You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2015/04/07 23:13:30 UTC
incubator-tinkerpop git commit: work on a 'micro' version of
TinkerGraph called StarGraph for reducing the on heap size of the star graph
for OLAP systems like SparkGraphComptuer and GiraphGraphComputer.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/star_graph [created] d0d578132
work on a 'micro' version of TinkerGraph called StarGraph for reducing the on heap size of the star graph for OLAP systems like SparkGraphComptuer and GiraphGraphComputer.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/d0d57813
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/d0d57813
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/d0d57813
Branch: refs/heads/star_graph
Commit: d0d5781325187f33afe0855bf11edd0c44b94574
Parents: 21c304d
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Apr 7 15:13:22 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Apr 7 15:13:22 2015 -0600
----------------------------------------------------------------------
.../computer/util/star/StarAdjacentVertex.java | 98 ++++++++++++
.../process/computer/util/star/StarEdge.java | 67 +++++++++
.../process/computer/util/star/StarElement.java | 66 +++++++++
.../process/computer/util/star/StarGraph.java | 148 +++++++++++++++++++
.../process/computer/util/star/StarInEdge.java | 64 ++++++++
.../computer/util/star/StarInVertex.java | 51 +++++++
.../process/computer/util/star/StarOutEdge.java | 63 ++++++++
.../computer/util/star/StarOutVertex.java | 51 +++++++
.../computer/util/star/StarProperty.java | 68 +++++++++
.../process/computer/util/star/StarVertex.java | 130 ++++++++++++++++
.../computer/util/star/StarVertexProperty.java | 111 ++++++++++++++
.../hadoop/structure/io/VertexWritable.java | 7 +-
.../io/graphson/GraphSONRecordReader.java | 7 +-
.../structure/io/gryo/GryoRecordReader.java | 7 +-
.../tinkergraph/structure/TinkerGraphTest.java | 13 +-
15 files changed, 934 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d0d57813/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarAdjacentVertex.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarAdjacentVertex.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarAdjacentVertex.java
new file mode 100644
index 0000000..6716762
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarAdjacentVertex.java
@@ -0,0 +1,98 @@
+/*
+ *
+ * * Licensed to the Apache Software Foundation (ASF) under one
+ * * or more contributor license agreements. See the NOTICE file
+ * * distributed with this work for additional information
+ * * regarding copyright ownership. The ASF licenses this file
+ * * to you under the Apache License, Version 2.0 (the
+ * * "License"); you may not use this file except in compliance
+ * * with the License. You may obtain a copy of the License at
+ * *
+ * * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * * Unless required by applicable law or agreed to in writing,
+ * * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * * KIND, either express or implied. See the License for the
+ * * specific language governing permissions and limitations
+ * * under the License.
+ *
+ */
+
+package org.apache.tinkerpop.gremlin.process.computer.util.star;
+
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
+import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
+
+import java.util.Collections;
+import java.util.Iterator;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public abstract class StarAdjacentVertex implements Vertex {
+
+ private final Object id;
+ protected final StarVertex starVertex;
+
+ protected StarAdjacentVertex(final Object id, final StarVertex starVertex) {
+ this.id = id;
+ this.starVertex = starVertex;
+ }
+
+ @Override
+ public <V> VertexProperty<V> property(final VertexProperty.Cardinality cardinality, final String key, final V value, final Object... keyValues) {
+ throw Element.Exceptions.propertyAdditionNotSupported();
+ }
+
+ @Override
+ public Iterator<Edge> edges(final Direction direction, final String... edgeLabels) {
+ return Collections.emptyIterator();
+ }
+
+ @Override
+ public Iterator<Vertex> vertices(final Direction direction, final String... edgeLabels) {
+ return Collections.emptyIterator();
+ }
+
+ @Override
+ public Object id() {
+ return this.id;
+ }
+
+ @Override
+ public String label() {
+ return Vertex.DEFAULT_LABEL;
+ }
+
+ @Override
+ public Graph graph() {
+ return EmptyGraph.instance();
+ }
+
+ @Override
+ public void remove() {
+ throw Vertex.Exceptions.vertexRemovalNotSupported();
+ }
+
+ @Override
+ public <V> Iterator<VertexProperty<V>> properties(final String... propertyKeys) {
+ return Collections.emptyIterator();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ return ElementHelper.areEqual(this, other);
+ }
+
+ @Override
+ public int hashCode() {
+ return ElementHelper.hashCode(this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d0d57813/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarEdge.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarEdge.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarEdge.java
new file mode 100644
index 0000000..28fa36d
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarEdge.java
@@ -0,0 +1,67 @@
+/*
+ *
+ * * Licensed to the Apache Software Foundation (ASF) under one
+ * * or more contributor license agreements. See the NOTICE file
+ * * distributed with this work for additional information
+ * * regarding copyright ownership. The ASF licenses this file
+ * * to you under the Apache License, Version 2.0 (the
+ * * "License"); you may not use this file except in compliance
+ * * with the License. You may obtain a copy of the License at
+ * *
+ * * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * * Unless required by applicable law or agreed to in writing,
+ * * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * * KIND, either express or implied. See the License for the
+ * * specific language governing permissions and limitations
+ * * under the License.
+ *
+ */
+
+package org.apache.tinkerpop.gremlin.process.computer.util.star;
+
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public abstract class StarEdge extends StarElement implements Edge {
+
+ private Map<String, Object> properties = null;
+
+ public StarEdge(final Object id, final String label) {
+ super(id, label);
+ }
+
+ @Override
+ public <V> Property<V> property(final String key, final V value) {
+ if (null == this.properties)
+ this.properties = new HashMap<>();
+ this.properties.put(key, value);
+ return new StarProperty<>(key, value,this);
+ }
+
+ @Override
+ public <V> Iterator<Property<V>> properties(final String... propertyKeys) {
+ return null == this.properties ?
+ Collections.emptyIterator() :
+ (Iterator) this.properties.entrySet()
+ .stream()
+ .filter(entry -> ElementHelper.keyExists(entry.getKey(), propertyKeys))
+ .map(entry -> new StarProperty<>(entry.getKey(), (V) entry.getValue(),this))
+ .iterator();
+ }
+
+ @Override
+ public void remove() {
+ //TODO: throw Edge.Exceptions.edgeRemovalNotSupported();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d0d57813/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarElement.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarElement.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarElement.java
new file mode 100644
index 0000000..2904c92
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarElement.java
@@ -0,0 +1,66 @@
+/*
+ *
+ * * Licensed to the Apache Software Foundation (ASF) under one
+ * * or more contributor license agreements. See the NOTICE file
+ * * distributed with this work for additional information
+ * * regarding copyright ownership. The ASF licenses this file
+ * * to you under the Apache License, Version 2.0 (the
+ * * "License"); you may not use this file except in compliance
+ * * with the License. You may obtain a copy of the License at
+ * *
+ * * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * * Unless required by applicable law or agreed to in writing,
+ * * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * * KIND, either express or implied. See the License for the
+ * * specific language governing permissions and limitations
+ * * under the License.
+ *
+ */
+
+package org.apache.tinkerpop.gremlin.process.computer.util.star;
+
+import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
+import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public abstract class StarElement implements Element {
+
+ private final Object id;
+ private final String label;
+
+ protected StarElement(final Object id, final String label) {
+ this.id = null == id ? StarGraph.randomId() : id;
+ this.label = label;
+ }
+
+ @Override
+ public Object id() {
+ return this.id;
+ }
+
+ @Override
+ public String label() {
+ return this.label;
+ }
+
+ @Override
+ public Graph graph() {
+ return EmptyGraph.instance();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ return ElementHelper.areEqual(this, other);
+ }
+
+ @Override
+ public int hashCode() {
+ return ElementHelper.hashCode(this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d0d57813/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarGraph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarGraph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarGraph.java
new file mode 100644
index 0000000..7482290
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarGraph.java
@@ -0,0 +1,148 @@
+/*
+ *
+ * * Licensed to the Apache Software Foundation (ASF) under one
+ * * or more contributor license agreements. See the NOTICE file
+ * * distributed with this work for additional information
+ * * regarding copyright ownership. The ASF licenses this file
+ * * to you under the Apache License, Version 2.0 (the
+ * * "License"); you may not use this file except in compliance
+ * * with the License. You may obtain a copy of the License at
+ * *
+ * * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * * Unless required by applicable law or agreed to in writing,
+ * * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * * KIND, either express or implied. See the License for the
+ * * specific language governing permissions and limitations
+ * * under the License.
+ *
+ */
+
+package org.apache.tinkerpop.gremlin.process.computer.util.star;
+
+import org.apache.commons.configuration.BaseConfiguration;
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
+import org.apache.tinkerpop.gremlin.process.traversal.T;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Transaction;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+import java.util.stream.Stream;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class StarGraph implements Graph {
+
+ private static final Configuration EMPTY_CONFIGURATION = new BaseConfiguration();
+
+ private StarVertex starVertex;
+
+ @Override
+ public Vertex addVertex(final Object... keyValues) {
+ throw Graph.Exceptions.vertexAdditionsNotSupported();
+ }
+
+ @Override
+ public <C extends GraphComputer> C compute(final Class<C> graphComputerClass) throws IllegalArgumentException {
+ throw Graph.Exceptions.graphComputerNotSupported();
+ }
+
+ @Override
+ public GraphComputer compute() throws IllegalArgumentException {
+ throw Graph.Exceptions.graphComputerNotSupported();
+ }
+
+ @Override
+ public Iterator<Vertex> vertices(final Object... vertexIds) {
+ return null == this.starVertex ?
+ Collections.emptyIterator() :
+ Stream.concat(
+ Stream.of(this.starVertex),
+ this.starVertex.outEdges.values()
+ .stream()
+ .flatMap(List::stream)
+ .map(Edge::inVertex))
+ .filter(vertex -> ElementHelper.idExists(vertex.id(), vertexIds)).iterator();
+ }
+
+ @Override
+ public Iterator<Edge> edges(final Object... edgeIds) {
+ return null == this.starVertex ?
+ Collections.emptyIterator() :
+ Stream.concat(
+ this.starVertex.inEdges.values().stream(),
+ this.starVertex.outEdges.values().stream())
+ .flatMap(List::stream)
+ .filter(edge -> ElementHelper.idExists(edge.id(), edgeIds))
+ .iterator();
+ }
+
+ @Override
+ public Transaction tx() {
+ throw Graph.Exceptions.transactionsNotSupported();
+ }
+
+ @Override
+ public Variables variables() {
+ throw Graph.Exceptions.variablesNotSupported();
+ }
+
+ @Override
+ public Configuration configuration() {
+ return EMPTY_CONFIGURATION;
+ }
+
+ @Override
+ public void close() throws Exception {
+
+ }
+
+ public static StarGraph open() {
+ return new StarGraph();
+ }
+
+ public static Vertex addTo(final StarGraph graph, final DetachedVertex detachedVertex) {
+ if (null != graph.starVertex)
+ return null;
+
+ graph.starVertex = new StarVertex(detachedVertex.id(), detachedVertex.label());
+ detachedVertex.properties().forEachRemaining(detachedVertexProperty -> {
+ final VertexProperty<?> vertexProperty = graph.starVertex.property(VertexProperty.Cardinality.list, detachedVertexProperty.key(), detachedVertexProperty.value());
+ detachedVertexProperty.properties().forEachRemaining(detachedVertexPropertyProperty -> {
+ vertexProperty.property(detachedVertexPropertyProperty.key(), detachedVertexPropertyProperty.value());
+ });
+ });
+ return graph.starVertex;
+ }
+
+ public static Edge addTo(final StarGraph graph, final DetachedEdge edge) {
+ final Object id = edge.inVertex().id();
+ if(graph.starVertex.id().equals(id)) {
+ final Edge outEdge = graph.starVertex.addEdge(edge.label(),new StarInVertex(edge.inVertex().id(),graph.starVertex),new Object[]{T.id,edge.id()});
+ edge.properties().forEachRemaining(property -> outEdge.property(property.key(),property.value()));
+ return outEdge;
+ } else {
+ final Edge inEdge = new StarOutVertex(edge.outVertex().id(),graph.starVertex).addEdge(edge.label(),graph.starVertex,new Object[]{T.id,edge.id()});
+ edge.properties().forEachRemaining(property -> inEdge.property(property.key(),property.value()));
+ return inEdge;
+ }
+ }
+
+ protected static Long randomId() {
+ return new Random().nextLong();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d0d57813/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarInEdge.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarInEdge.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarInEdge.java
new file mode 100644
index 0000000..82da76e
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarInEdge.java
@@ -0,0 +1,64 @@
+/*
+ *
+ * * Licensed to the Apache Software Foundation (ASF) under one
+ * * or more contributor license agreements. See the NOTICE file
+ * * distributed with this work for additional information
+ * * regarding copyright ownership. The ASF licenses this file
+ * * to you under the Apache License, Version 2.0 (the
+ * * "License"); you may not use this file except in compliance
+ * * with the License. You may obtain a copy of the License at
+ * *
+ * * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * * Unless required by applicable law or agreed to in writing,
+ * * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * * KIND, either express or implied. See the License for the
+ * * specific language governing permissions and limitations
+ * * under the License.
+ *
+ */
+
+package org.apache.tinkerpop.gremlin.process.computer.util.star;
+
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+
+import java.util.Iterator;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class StarInEdge extends StarEdge {
+
+ private final StarOutVertex starOutVertex;
+ private final StarVertex starVertex;
+
+ public StarInEdge(final Object id, final StarOutVertex starOutVertex, final String label, final StarVertex starVertex) {
+ super(id, label);
+ this.starOutVertex = starOutVertex;
+ this.starVertex = starVertex;
+
+ }
+
+ @Override
+ public Iterator<Vertex> vertices(final Direction direction) {
+ if (direction.equals(Direction.OUT))
+ return IteratorUtils.of(this.starOutVertex);
+ else if (direction.equals(Direction.IN))
+ return IteratorUtils.of(this.starVertex);
+ else
+ return IteratorUtils.of(this.starOutVertex, this.starVertex);
+ }
+
+ @Override
+ public Vertex outVertex() {
+ return this.starOutVertex;
+ }
+
+ @Override
+ public Vertex inVertex() {
+ return this.starVertex;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d0d57813/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarInVertex.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarInVertex.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarInVertex.java
new file mode 100644
index 0000000..cbdef7e
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarInVertex.java
@@ -0,0 +1,51 @@
+/*
+ *
+ * * Licensed to the Apache Software Foundation (ASF) under one
+ * * or more contributor license agreements. See the NOTICE file
+ * * distributed with this work for additional information
+ * * regarding copyright ownership. The ASF licenses this file
+ * * to you under the Apache License, Version 2.0 (the
+ * * "License"); you may not use this file except in compliance
+ * * with the License. You may obtain a copy of the License at
+ * *
+ * * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * * Unless required by applicable law or agreed to in writing,
+ * * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * * KIND, either express or implied. See the License for the
+ * * specific language governing permissions and limitations
+ * * under the License.
+ *
+ */
+
+package org.apache.tinkerpop.gremlin.process.computer.util.star;
+
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class StarInVertex extends StarAdjacentVertex {
+
+ public StarInVertex(final Object id, final StarVertex starVertex) {
+ super(id, starVertex);
+ }
+
+ @Override
+ public Edge addEdge(final String label, final Vertex inVertex, final Object... keyValues) {
+ List<Edge> outE = this.starVertex.outEdges.get(label);
+ if (null == outE) {
+ outE = new ArrayList<>();
+ this.starVertex.outEdges.put(label, outE);
+ }
+ final StarOutEdge outEdge = new StarOutEdge(ElementHelper.getIdValue(keyValues).orElse(null), (StarVertex) inVertex, label, this);
+ outE.add(outEdge);
+ return outEdge;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d0d57813/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarOutEdge.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarOutEdge.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarOutEdge.java
new file mode 100644
index 0000000..4a1e795
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarOutEdge.java
@@ -0,0 +1,63 @@
+/*
+ *
+ * * Licensed to the Apache Software Foundation (ASF) under one
+ * * or more contributor license agreements. See the NOTICE file
+ * * distributed with this work for additional information
+ * * regarding copyright ownership. The ASF licenses this file
+ * * to you under the Apache License, Version 2.0 (the
+ * * "License"); you may not use this file except in compliance
+ * * with the License. You may obtain a copy of the License at
+ * *
+ * * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * * Unless required by applicable law or agreed to in writing,
+ * * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * * KIND, either express or implied. See the License for the
+ * * specific language governing permissions and limitations
+ * * under the License.
+ *
+ */
+
+package org.apache.tinkerpop.gremlin.process.computer.util.star;
+
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+
+import java.util.Iterator;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class StarOutEdge extends StarEdge {
+
+ private final StarVertex starVertex;
+ private final StarInVertex starInVertex;
+
+ public StarOutEdge(final Object id, final StarVertex starVertex, final String label, final StarInVertex starInVertex) {
+ super(id, label);
+ this.starVertex = starVertex;
+ this.starInVertex = starInVertex;
+ }
+
+ @Override
+ public Iterator<Vertex> vertices(final Direction direction) {
+ if (direction.equals(Direction.OUT))
+ return IteratorUtils.of(this.starVertex);
+ else if (direction.equals(Direction.IN))
+ return IteratorUtils.of(this.starInVertex);
+ else
+ return IteratorUtils.of(this.starVertex, this.starInVertex);
+ }
+
+ @Override
+ public Vertex outVertex() {
+ return this.starVertex;
+ }
+
+ @Override
+ public Vertex inVertex() {
+ return this.starInVertex;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d0d57813/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarOutVertex.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarOutVertex.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarOutVertex.java
new file mode 100644
index 0000000..82fdc3a
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarOutVertex.java
@@ -0,0 +1,51 @@
+/*
+ *
+ * * Licensed to the Apache Software Foundation (ASF) under one
+ * * or more contributor license agreements. See the NOTICE file
+ * * distributed with this work for additional information
+ * * regarding copyright ownership. The ASF licenses this file
+ * * to you under the Apache License, Version 2.0 (the
+ * * "License"); you may not use this file except in compliance
+ * * with the License. You may obtain a copy of the License at
+ * *
+ * * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * * Unless required by applicable law or agreed to in writing,
+ * * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * * KIND, either express or implied. See the License for the
+ * * specific language governing permissions and limitations
+ * * under the License.
+ *
+ */
+
+package org.apache.tinkerpop.gremlin.process.computer.util.star;
+
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class StarOutVertex extends StarAdjacentVertex {
+
+ public StarOutVertex(final Object id, final StarVertex starVertex) {
+ super(id, starVertex);
+ }
+
+ @Override
+ public Edge addEdge(final String label, final Vertex inVertex, final Object... keyValues) {
+ List<Edge> inE = this.starVertex.inEdges.get(label);
+ if (null == inE) {
+ inE = new ArrayList<>();
+ this.starVertex.inEdges.put(label, inE);
+ }
+ final StarInEdge inEdge = new StarInEdge(ElementHelper.getIdValue(keyValues).orElse(null), this, label, (StarVertex) inVertex);
+ inE.add(inEdge);
+ return inEdge;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d0d57813/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarProperty.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarProperty.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarProperty.java
new file mode 100644
index 0000000..407ed3e
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarProperty.java
@@ -0,0 +1,68 @@
+/*
+ *
+ * * Licensed to the Apache Software Foundation (ASF) under one
+ * * or more contributor license agreements. See the NOTICE file
+ * * distributed with this work for additional information
+ * * regarding copyright ownership. The ASF licenses this file
+ * * to you under the Apache License, Version 2.0 (the
+ * * "License"); you may not use this file except in compliance
+ * * with the License. You may obtain a copy of the License at
+ * *
+ * * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * * Unless required by applicable law or agreed to in writing,
+ * * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * * KIND, either express or implied. See the License for the
+ * * specific language governing permissions and limitations
+ * * under the License.
+ *
+ */
+
+package org.apache.tinkerpop.gremlin.process.computer.util.star;
+
+import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.tinkerpop.gremlin.structure.Property;
+
+import java.util.NoSuchElementException;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class StarProperty<V> implements Property<V> {
+
+ private final String key;
+ private final V value;
+ private final Element element;
+
+ public StarProperty(final String key, final V value, final Element element) {
+ this.key = key;
+ this.value =value;
+ this.element = element;
+ }
+
+ @Override
+ public String key() {
+ return this.key;
+ }
+
+ @Override
+ public V value() throws NoSuchElementException {
+ return this.value;
+ }
+
+ @Override
+ public boolean isPresent() {
+ return true;
+ }
+
+ @Override
+ public Element element() {
+ return this.element;
+ }
+
+ @Override
+ public void remove() {
+ throw Element.Exceptions.propertyRemovalNotSupported();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d0d57813/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarVertex.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarVertex.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarVertex.java
new file mode 100644
index 0000000..f883809
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarVertex.java
@@ -0,0 +1,130 @@
+/*
+ *
+ * * Licensed to the Apache Software Foundation (ASF) under one
+ * * or more contributor license agreements. See the NOTICE file
+ * * distributed with this work for additional information
+ * * regarding copyright ownership. The ASF licenses this file
+ * * to you under the Apache License, Version 2.0 (the
+ * * "License"); you may not use this file except in compliance
+ * * with the License. You may obtain a copy of the License at
+ * *
+ * * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * * Unless required by applicable law or agreed to in writing,
+ * * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * * KIND, either express or implied. See the License for the
+ * * specific language governing permissions and limitations
+ * * under the License.
+ *
+ */
+
+package org.apache.tinkerpop.gremlin.process.computer.util.star;
+
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Stream;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class StarVertex extends StarElement implements Vertex {
+
+ protected Map<String, List<VertexProperty<?>>> properties = null;
+ protected Map<String, List<Edge>> outEdges = new HashMap<>();
+ protected Map<String, List<Edge>> inEdges = new HashMap<>();
+
+ public StarVertex(final Object id, final String label) {
+ super(id, label);
+ }
+
+ @Override
+ public Edge addEdge(final String label, final Vertex inVertex, final Object... keyValues) {
+ List<Edge> outE = this.outEdges.get(label);
+ if (null == outE) {
+ outE = new ArrayList<>();
+ this.outEdges.put(label, outE);
+ }
+ final StarOutEdge outEdge = new StarOutEdge(ElementHelper.getIdValue(keyValues).orElse(null), this, label, (StarInVertex) inVertex);
+ outE.add(outEdge);
+ return outEdge;
+ }
+
+ @Override
+ public <V> VertexProperty<V> property(final VertexProperty.Cardinality cardinality, final String key, V value, final Object... keyValues) {
+ if (null == this.properties)
+ this.properties = new HashMap<>();
+
+ final List<VertexProperty<?>> list = cardinality.equals(VertexProperty.Cardinality.single) ? new ArrayList<>(1) : this.properties.getOrDefault(key, new ArrayList<>());
+ final VertexProperty<V> vertexProperty = new StarVertexProperty<>(ElementHelper.getIdValue(keyValues).orElse(null), key, value, this);
+ list.add(vertexProperty);
+ this.properties.put(key, list);
+ return vertexProperty;
+ }
+
+ @Override
+ public Iterator<Edge> edges(final Direction direction, final String... edgeLabels) {
+ if (direction.equals(Direction.OUT)) {
+ return this.outEdges.entrySet().stream()
+ .filter(entry -> ElementHelper.keyExists(entry.getKey(), edgeLabels))
+ .map(Map.Entry::getValue)
+ .flatMap(List::stream)
+ .iterator();
+ } else if (direction.equals(Direction.IN)) {
+ return this.inEdges.entrySet().stream()
+ .filter(entry -> ElementHelper.keyExists(entry.getKey(), edgeLabels))
+ .map(Map.Entry::getValue)
+ .flatMap(List::stream)
+ .iterator();
+ } else {
+ return Stream.concat(this.inEdges.entrySet().stream(), this.outEdges.entrySet().stream())
+ .filter(entry -> ElementHelper.keyExists(entry.getKey(), edgeLabels))
+ .map(Map.Entry::getValue)
+ .flatMap(List::stream)
+ .iterator();
+ }
+ }
+
+ @Override
+ public Iterator<Vertex> vertices(final Direction direction, final String... edgeLabels) {
+ if (direction.equals(Direction.OUT)) {
+ return this.outEdges.entrySet().stream()
+ .filter(entry -> ElementHelper.keyExists(entry.getKey(), edgeLabels))
+ .map(Map.Entry::getValue)
+ .flatMap(List::stream)
+ .map(Edge::inVertex)
+ .iterator();
+ } else if (direction.equals(Direction.IN)) {
+ return this.inEdges.entrySet().stream()
+ .filter(entry -> ElementHelper.keyExists(entry.getKey(), edgeLabels))
+ .map(Map.Entry::getValue)
+ .flatMap(List::stream)
+ .map(Edge::outVertex)
+ .iterator();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public void remove() {
+
+ }
+
+ @Override
+ public <V> Iterator<VertexProperty<V>> properties(final String... propertyKeys) {
+ return null == this.properties ?
+ Collections.emptyIterator() :
+ (Iterator) this.properties.entrySet().stream().filter(entry -> ElementHelper.keyExists(entry.getKey(), propertyKeys)).flatMap(entry -> entry.getValue().stream()).iterator();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d0d57813/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarVertexProperty.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarVertexProperty.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarVertexProperty.java
new file mode 100644
index 0000000..f06aeee
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/star/StarVertexProperty.java
@@ -0,0 +1,111 @@
+/*
+ *
+ * * Licensed to the Apache Software Foundation (ASF) under one
+ * * or more contributor license agreements. See the NOTICE file
+ * * distributed with this work for additional information
+ * * regarding copyright ownership. The ASF licenses this file
+ * * to you under the Apache License, Version 2.0 (the
+ * * "License"); you may not use this file except in compliance
+ * * with the License. You may obtain a copy of the License at
+ * *
+ * * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * * Unless required by applicable law or agreed to in writing,
+ * * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * * KIND, either express or implied. See the License for the
+ * * specific language governing permissions and limitations
+ * * under the License.
+ *
+ */
+
+package org.apache.tinkerpop.gremlin.process.computer.util.star;
+
+import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class StarVertexProperty<V> implements VertexProperty<V> {
+
+ private final Object id;
+ private final String key;
+ private final V value;
+ private Map<String, Object> properties = null;
+ private final StarVertex starVertex;
+
+ public StarVertexProperty(final Object id, final String key, final V value, final StarVertex starVertex) {
+ this.id = null == id ? StarGraph.randomId() : id;
+ this.key = key;
+ this.value = value;
+ this.starVertex = starVertex;
+ }
+
+ @Override
+ public String key() {
+ return this.key;
+ }
+
+ @Override
+ public V value() throws NoSuchElementException {
+ return this.value;
+ }
+
+ @Override
+ public boolean isPresent() {
+ return true;
+ }
+
+ @Override
+ public Vertex element() {
+ return this.starVertex;
+ }
+
+ @Override
+ public void remove() {
+ this.starVertex.properties.get(this.key).remove(this);
+ }
+
+ @Override
+ public <U> Iterator<Property<U>> properties(final String... propertyKeys) {
+ return null == this.properties ?
+ Collections.emptyIterator() :
+ (Iterator) this.properties.entrySet().stream()
+ .filter(entry -> ElementHelper.keyExists(entry.getKey(), propertyKeys))
+ .map(entry -> new StarProperty<>(entry.getKey(), entry.getValue(), this))
+ .iterator();
+ }
+
+ @Override
+ public Object id() {
+ return this.id;
+ }
+
+ @Override
+ public <U> Property<U> property(final String key, final U value) {
+ if (null == this.properties)
+ this.properties = new HashMap<>();
+ this.properties.put(key, value);
+ return new StarProperty<>(key, value, this);
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ return ElementHelper.areEqual(this, other);
+ }
+
+ @Override
+ public int hashCode() {
+ return ElementHelper.hashCode((Element)this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d0d57813/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/VertexWritable.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/VertexWritable.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/VertexWritable.java
index 2afe369..af3ceb1 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/VertexWritable.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/VertexWritable.java
@@ -20,6 +20,7 @@ package org.apache.tinkerpop.gremlin.hadoop.structure.io;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableUtils;
+import org.apache.tinkerpop.gremlin.process.computer.util.star.StarGraph;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -67,10 +68,10 @@ public final class VertexWritable implements Writable, Serializable {
this.vertex = HadoopPools.GRYO_POOL.doWithReader(gryoReader -> {
try {
final ByteArrayInputStream inputStream = new ByteArrayInputStream(WritableUtils.readCompressedByteArray(input));
- final Graph gLocal = TinkerGraph.open();
+ final StarGraph gLocal = StarGraph.open();
return gryoReader.readVertex(inputStream, Direction.BOTH,
- detachedVertex -> DetachedVertex.addTo(gLocal, detachedVertex),
- detachedEdge -> DetachedEdge.addTo(gLocal, detachedEdge));
+ detachedVertex -> StarGraph.addTo(gLocal, detachedVertex),
+ detachedEdge -> StarGraph.addTo(gLocal, detachedEdge));
} catch (final IOException e) {
throw new IllegalStateException(e.getMessage(), e);
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d0d57813/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/GraphSONRecordReader.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/GraphSONRecordReader.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/GraphSONRecordReader.java
index ec7649c..e77e60f 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/GraphSONRecordReader.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/GraphSONRecordReader.java
@@ -25,6 +25,7 @@ import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.input.LineRecordReader;
import org.apache.tinkerpop.gremlin.hadoop.Constants;
import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
+import org.apache.tinkerpop.gremlin.process.computer.util.star.StarGraph;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -63,9 +64,9 @@ public class GraphSONRecordReader extends RecordReader<NullWritable, VertexWrita
if (!this.lineRecordReader.nextKeyValue())
return false;
- final TinkerGraph gLocal = TinkerGraph.open();
- final Function<DetachedVertex, Vertex> vertexMaker = detachedVertex -> DetachedVertex.addTo(gLocal, detachedVertex);
- final Function<DetachedEdge, Edge> edgeMaker = detachedEdge -> DetachedEdge.addTo(gLocal, detachedEdge);
+ final StarGraph gLocal = StarGraph.open();
+ final Function<DetachedVertex, Vertex> vertexMaker = detachedVertex -> StarGraph.addTo(gLocal, detachedVertex);
+ final Function<DetachedEdge, Edge> edgeMaker = detachedEdge -> StarGraph.addTo(gLocal, detachedEdge);
try (InputStream in = new ByteArrayInputStream(this.lineRecordReader.getCurrentValue().getBytes())) {
this.vertexWritable.set(this.hasEdges ?
this.graphsonReader.readVertex(in, Direction.BOTH, vertexMaker, edgeMaker) :
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d0d57813/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReader.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReader.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReader.java
index 6422104..4862959 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReader.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReader.java
@@ -29,6 +29,7 @@ import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;
import org.apache.tinkerpop.gremlin.hadoop.Constants;
import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
+import org.apache.tinkerpop.gremlin.process.computer.util.star.StarGraph;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -130,9 +131,9 @@ public class GryoRecordReader extends RecordReader<NullWritable, VertexWritable>
terminatorLocation = 0;
if (terminatorLocation >= TERMINATOR.length) {
- final Graph gLocal = TinkerGraph.open();
- final Function<DetachedVertex, Vertex> vertexMaker = detachedVertex -> DetachedVertex.addTo(gLocal, detachedVertex);
- final Function<DetachedEdge, Edge> edgeMaker = detachedEdge -> DetachedEdge.addTo(gLocal, detachedEdge);
+ final StarGraph gLocal = StarGraph.open();
+ final Function<DetachedVertex, Vertex> vertexMaker = detachedVertex -> StarGraph.addTo(gLocal, detachedVertex);
+ final Function<DetachedEdge, Edge> edgeMaker = detachedEdge -> StarGraph.addTo(gLocal, detachedEdge);
try (InputStream in = new ByteArrayInputStream(output.toByteArray())) {
this.vertexWritable.set(this.hasEdges ?
this.gryoReader.readVertex(in, Direction.BOTH, vertexMaker, edgeMaker) :
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d0d57813/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
index 51d1b51..59a0bf4 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
@@ -21,6 +21,7 @@ package org.apache.tinkerpop.gremlin.tinkergraph.structure;
import org.apache.commons.io.FileUtils;
import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
import org.apache.tinkerpop.gremlin.TestHelper;
+import org.apache.tinkerpop.gremlin.process.computer.util.star.StarGraph;
import org.apache.tinkerpop.gremlin.process.traversal.T;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
@@ -141,14 +142,10 @@ public class TinkerGraphTest {
@Test
@Ignore
public void testPlay3() throws Exception {
- Graph graph = TinkerGraph.open();
- GraphTraversalSource g = graph.traversal(GraphTraversalSource.standard());
- final Vertex marko = graph.addVertex("name", "marko", "name", "marko a. rodriguez");
- marko.property(VertexProperty.Cardinality.list, "location", "san diego", "startTime", 1997, "endTime", 2001);
- marko.property(VertexProperty.Cardinality.list, "location", "santa cruz", "startTime", 2001, "endTime", 2004);
- marko.property(VertexProperty.Cardinality.list, "location", "brussels", "startTime", 2004, "endTime", 2005);
- marko.property(VertexProperty.Cardinality.list, "location", "santa fe", "startTime", 2005);
- g.V().valueMap().forEachRemaining(System.out::println);
+ StarGraph graph = StarGraph.open();
+ Vertex a = graph.addVertex(T.id,1,"name","marko");
+ Vertex b = graph.addVertex(T.id,2,"firstname","stephen");
+ graph.vertices().forEachRemaining(System.out::println);
}
@Test