This is an automated email from the ASF dual-hosted git repository. dkuppitz pushed a commit to branch TINKERPOP-2051 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit e91ea53ed1af14ff33de4ea1639fb276173b8c4d Author: Daniel Kuppitz <daniel_kupp...@hotmail.com> AuthorDate: Sat Nov 10 16:32:52 2018 -0700 TINERKPOP-2051 Uniqueness of property ids --- CHANGELOG.asciidoc | 1 + .../gremlin/structure/util/ElementHelper.java | 6 +++++- .../util/detached/DetachedVertexProperty.java | 23 ++++++++++++++++++++- gremlin-test/features/map/Properties.feature | 16 +++++++++++++- .../process/traversal/step/branch/ChooseTest.java | 6 ++++-- .../process/traversal/step/map/PropertiesTest.java | 20 +++++++++++++++++- .../io/graphson/tinkerpop-sink-typed-v1d0.json | 2 ++ .../io/graphson/tinkerpop-sink-typed-v2d0.json | 2 ++ .../structure/io/graphson/tinkerpop-sink-v1d0.json | 2 ++ .../structure/io/graphson/tinkerpop-sink-v2d0.json | 2 ++ .../structure/io/graphson/tinkerpop-sink-v3d0.json | 2 ++ .../structure/io/gryo/tinkerpop-sink-v1d0.kryo | Bin 240 -> 410 bytes .../structure/io/gryo/tinkerpop-sink-v3d0.kryo | Bin 240 -> 410 bytes .../tinkergraph/structure/TinkerFactory.java | 7 +++++++ 14 files changed, 83 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 39c5aaf..1c1b934 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -25,6 +25,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima This release also includes changes from <<release-3-3-3, 3.3.3>>. +* `VertexProperty` comparisons are now based on their id and their parent element's id. This makes local uniqueness (unique to the vertex) sufficient. * Made `valueMap()` aware of `by` and `with` modulators and deprecated `valueMap(boolean)` overloads. * Use `Compare.eq` in `Contains` predicates to ensure the same filter behavior for numeric values. * Added `OptionsStrategy` to allow traversals to take arbitrary traversal-wide configurations. diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java index 829880b..ae3c912 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java @@ -438,7 +438,11 @@ public final class ElementHelper { * @return true if ids are equal and false otherwise */ public static boolean haveEqualIds(final Element a, final Element b) { - return a.id().equals(b.id()); + return a.id().equals(b.id()) && (!(a instanceof Property) || haveEqualParentIds((Property) a, (Property) b)); + } + + private static boolean haveEqualParentIds(final Property a, final Property b) { + return a.element() == null || b.element() == null || haveEqualIds(a.element(), b.element()); } /** diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedVertexProperty.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedVertexProperty.java index d9b917c..837fdc5 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedVertexProperty.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedVertexProperty.java @@ -25,9 +25,11 @@ import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; import org.apache.tinkerpop.gremlin.structure.util.Host; import org.apache.tinkerpop.gremlin.structure.util.StringFactory; +import java.io.IOException; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; /** @@ -37,10 +39,29 @@ import java.util.Map; public class DetachedVertexProperty<V> extends DetachedElement<VertexProperty<V>> implements VertexProperty<V> { protected V value; - protected transient DetachedVertex vertex; + protected DetachedVertex vertex; private DetachedVertexProperty() {} + private void writeObject(final java.io.ObjectOutputStream out) throws IOException { + out.writeObject(this.id); + out.writeObject(this.label); + out.writeObject(this.value); + out.writeObject(this.properties); + out.writeObject(this.vertex != null ? vertex.id : null); + } + + private void readObject(final java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { + this.id = in.readObject(); + this.label = (String) in.readObject(); + this.value = (V) in.readObject(); + this.properties = (Map) in.readObject(); + final Object vertexId = in.readObject(); + if (vertexId != null) { + vertex = DetachedVertex.build().setId(vertexId).create(); + } + } + protected DetachedVertexProperty(final VertexProperty<V> vertexProperty, final boolean withProperties) { super(vertexProperty); this.value = vertexProperty.value(); diff --git a/gremlin-test/features/map/Properties.feature b/gremlin-test/features/map/Properties.feature index 58daa6a..9ddbf4d 100644 --- a/gremlin-test/features/map/Properties.feature +++ b/gremlin-test/features/map/Properties.feature @@ -86,4 +86,18 @@ Feature: Step - properties() Then nothing should happen because """ GLV suite doesn't support property identifiers and related assertions - """ \ No newline at end of file + """ + + Scenario: g_V_hasLabelXpersonX_properties_dedup_value + Given the sink graph + And the traversal of + """ + g.V().hasLabel("person").properties().dedup().value() + """ + When iterated to list + Then the result should be unordered + | result | + | alice | + | d[30].i | + | bob | + | d[30].i | diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/ChooseTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/ChooseTest.java index dd82f56..e83514f 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/ChooseTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/ChooseTest.java @@ -36,6 +36,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN; import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.hasLabel; @@ -85,13 +86,14 @@ public abstract class ChooseTest extends AbstractGremlinProcessTest { final Map<String, Long> counts = new HashMap<>(); int counter = 0; while (traversal.hasNext()) { - MapHelper.incr(counts, traversal.next().toString(), 1l); + MapHelper.incr(counts, traversal.next().toString(), 1L); counter++; } assertFalse(traversal.hasNext()); assertEquals(2, counter); assertEquals(2, counts.size()); - assertEquals(Long.valueOf(1), counts.get("{name=[marko], age=[29]}")); + assertEquals(Long.valueOf(1), Optional.ofNullable(counts.get("{name=[marko], age=[29]}")) + .orElse(counts.get("{age=[29], name=[marko]}"))); assertEquals(Long.valueOf(1), counts.get("josh")); } diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PropertiesTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PropertiesTest.java index 2b665dc..8b56689 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PropertiesTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PropertiesTest.java @@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest; import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; +import org.apache.tinkerpop.gremlin.structure.Property; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.VertexProperty; @@ -32,11 +33,14 @@ import org.junit.runner.RunWith; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; +import java.util.List; import java.util.Set; import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN; +import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.SINK; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; /** * @author Marko A. Rodriguez (http://markorodriguez.com) @@ -54,6 +58,8 @@ public abstract class PropertiesTest extends AbstractGremlinProcessTest { public abstract Traversal<VertexProperty<String>, String> get_g_injectXg_VX1X_propertiesXnameX_nextX_value(final Object v1Id); + public abstract Traversal<Vertex, Object> get_g_V_hasLabelXpersonX_properties_dedup_value(); + @Test @LoadGraphWith(MODERN) public void g_V_hasXageX_propertiesXname_ageX_value() { @@ -129,6 +135,14 @@ public abstract class PropertiesTest extends AbstractGremlinProcessTest { checkResults(Collections.singletonList("marko"), traversal); } + @Test + @LoadGraphWith(SINK) + public void g_V_hasLabelXpersonX_properties_dedup_value() { + final Traversal<Vertex, Object> traversal = get_g_V_hasLabelXpersonX_properties_dedup_value(); + printTraversalForm(traversal); + checkResults(Arrays.asList("alice", 30, "bob", 30), traversal); + } + public static class Traversals extends PropertiesTest { @Override public Traversal<Vertex, Object> get_g_V_hasXageX_propertiesXname_ageX_value() { @@ -154,6 +168,10 @@ public abstract class PropertiesTest extends AbstractGremlinProcessTest { public Traversal<VertexProperty<String>, String> get_g_injectXg_VX1X_propertiesXnameX_nextX_value(final Object v1Id) { return g.<VertexProperty<String>>inject((VertexProperty) g.V(v1Id).properties("name").next()).value(); } + + @Override + public Traversal<Vertex, Object> get_g_V_hasLabelXpersonX_properties_dedup_value() { + return g.V().hasLabel("person").properties().dedup().value(); + } } } - diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-typed-v1d0.json b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-typed-v1d0.json index 9f16788..2e39b20 100644 --- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-typed-v1d0.json +++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-typed-v1d0.json @@ -1,3 +1,5 @@ {"@class":"java.util.HashMap","id":2000,"label":"message","inE":{"@class":"java.util.HashMap","link":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":2003,"outV":2000}]]},"outE":{"@class":"java.util.HashMap","link":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":2002,"inV":2001},{"@class":"java.util.HashMap","id":2003,"inV":2000}]]},"properties":{"@class":"java.util.HashMap","name":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",1],"value [...] {"@class":"java.util.HashMap","id":2001,"label":"message","inE":{"@class":"java.util.HashMap","link":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":2002,"outV":2000}]]},"properties":{"@class":"java.util.HashMap","name":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",2],"value":"b"}]]}} {"@class":"java.util.HashMap","id":1000,"label":"loops","inE":{"@class":"java.util.HashMap","self":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":1001,"outV":1000}]]},"outE":{"@class":"java.util.HashMap","self":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":1001,"inV":1000}]]},"properties":{"@class":"java.util.HashMap","name":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",0],"value":"loop"}]]}} +{"@class":"java.util.HashMap","id":3000,"label":"person","outE":{"@class":"java.util.HashMap","knows":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":3002,"inV":3001}]]},"properties":{"@class":"java.util.HashMap","name":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",3010],"value":"alice"}]],"age":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",3011],"value":30}]]}} +{"@class":"java.util.HashMap","id":3001,"label":"person","inE":{"@class":"java.util.HashMap","knows":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":3002,"outV":3000}]]},"properties":{"@class":"java.util.HashMap","name":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",3010],"value":"bob"}]],"age":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",3011],"value":30}]]}} diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-typed-v2d0.json b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-typed-v2d0.json index 906d74a..de5c5c1 100644 --- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-typed-v2d0.json +++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-typed-v2d0.json @@ -1,3 +1,5 @@ {"id":{"@type":"g:Int32","@value":2000},"label":"message","inE":{"link":[{"id":{"@type":"g:Int32","@value":2003},"outV":{"@type":"g:Int32","@value":2000}}]},"outE":{"link":[{"id":{"@type":"g:Int32","@value":2002},"inV":{"@type":"g:Int32","@value":2001}},{"id":{"@type":"g:Int32","@value":2003},"inV":{"@type":"g:Int32","@value":2000}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":1},"value":"a"}]}} {"id":{"@type":"g:Int32","@value":2001},"label":"message","inE":{"link":[{"id":{"@type":"g:Int32","@value":2002},"outV":{"@type":"g:Int32","@value":2000}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":2},"value":"b"}]}} {"id":{"@type":"g:Int32","@value":1000},"label":"loops","inE":{"self":[{"id":{"@type":"g:Int32","@value":1001},"outV":{"@type":"g:Int32","@value":1000}}]},"outE":{"self":[{"id":{"@type":"g:Int32","@value":1001},"inV":{"@type":"g:Int32","@value":1000}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":0},"value":"loop"}]}} +{"id":{"@type":"g:Int32","@value":3000},"label":"person","outE":{"knows":[{"id":{"@type":"g:Int32","@value":3002},"inV":{"@type":"g:Int32","@value":3001}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":3010},"value":"alice"}],"age":[{"id":{"@type":"g:Int64","@value":3011},"value":{"@type":"g:Int32","@value":30}}]}} +{"id":{"@type":"g:Int32","@value":3001},"label":"person","inE":{"knows":[{"id":{"@type":"g:Int32","@value":3002},"outV":{"@type":"g:Int32","@value":3000}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":3010},"value":"bob"}],"age":[{"id":{"@type":"g:Int64","@value":3011},"value":{"@type":"g:Int32","@value":30}}]}} diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-v1d0.json b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-v1d0.json index 4d4811f..dfc2ca4 100644 --- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-v1d0.json +++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-v1d0.json @@ -1,3 +1,5 @@ {"id":2000,"label":"message","inE":{"link":[{"id":2003,"outV":2000}]},"outE":{"link":[{"id":2002,"inV":2001},{"id":2003,"inV":2000}]},"properties":{"name":[{"id":1,"value":"a"}]}} {"id":2001,"label":"message","inE":{"link":[{"id":2002,"outV":2000}]},"properties":{"name":[{"id":2,"value":"b"}]}} {"id":1000,"label":"loops","inE":{"self":[{"id":1001,"outV":1000}]},"outE":{"self":[{"id":1001,"inV":1000}]},"properties":{"name":[{"id":0,"value":"loop"}]}} +{"id":3000,"label":"person","outE":{"knows":[{"id":3002,"inV":3001}]},"properties":{"name":[{"id":3010,"value":"alice"}],"age":[{"id":3011,"value":30}]}} +{"id":3001,"label":"person","inE":{"knows":[{"id":3002,"outV":3000}]},"properties":{"name":[{"id":3010,"value":"bob"}],"age":[{"id":3011,"value":30}]}} diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-v2d0.json b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-v2d0.json index 4d4811f..dfc2ca4 100644 --- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-v2d0.json +++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-v2d0.json @@ -1,3 +1,5 @@ {"id":2000,"label":"message","inE":{"link":[{"id":2003,"outV":2000}]},"outE":{"link":[{"id":2002,"inV":2001},{"id":2003,"inV":2000}]},"properties":{"name":[{"id":1,"value":"a"}]}} {"id":2001,"label":"message","inE":{"link":[{"id":2002,"outV":2000}]},"properties":{"name":[{"id":2,"value":"b"}]}} {"id":1000,"label":"loops","inE":{"self":[{"id":1001,"outV":1000}]},"outE":{"self":[{"id":1001,"inV":1000}]},"properties":{"name":[{"id":0,"value":"loop"}]}} +{"id":3000,"label":"person","outE":{"knows":[{"id":3002,"inV":3001}]},"properties":{"name":[{"id":3010,"value":"alice"}],"age":[{"id":3011,"value":30}]}} +{"id":3001,"label":"person","inE":{"knows":[{"id":3002,"outV":3000}]},"properties":{"name":[{"id":3010,"value":"bob"}],"age":[{"id":3011,"value":30}]}} diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-v3d0.json b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-v3d0.json index 906d74a..de5c5c1 100644 --- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-v3d0.json +++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-sink-v3d0.json @@ -1,3 +1,5 @@ {"id":{"@type":"g:Int32","@value":2000},"label":"message","inE":{"link":[{"id":{"@type":"g:Int32","@value":2003},"outV":{"@type":"g:Int32","@value":2000}}]},"outE":{"link":[{"id":{"@type":"g:Int32","@value":2002},"inV":{"@type":"g:Int32","@value":2001}},{"id":{"@type":"g:Int32","@value":2003},"inV":{"@type":"g:Int32","@value":2000}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":1},"value":"a"}]}} {"id":{"@type":"g:Int32","@value":2001},"label":"message","inE":{"link":[{"id":{"@type":"g:Int32","@value":2002},"outV":{"@type":"g:Int32","@value":2000}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":2},"value":"b"}]}} {"id":{"@type":"g:Int32","@value":1000},"label":"loops","inE":{"self":[{"id":{"@type":"g:Int32","@value":1001},"outV":{"@type":"g:Int32","@value":1000}}]},"outE":{"self":[{"id":{"@type":"g:Int32","@value":1001},"inV":{"@type":"g:Int32","@value":1000}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":0},"value":"loop"}]}} +{"id":{"@type":"g:Int32","@value":3000},"label":"person","outE":{"knows":[{"id":{"@type":"g:Int32","@value":3002},"inV":{"@type":"g:Int32","@value":3001}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":3010},"value":"alice"}],"age":[{"id":{"@type":"g:Int64","@value":3011},"value":{"@type":"g:Int32","@value":30}}]}} +{"id":{"@type":"g:Int32","@value":3001},"label":"person","inE":{"knows":[{"id":{"@type":"g:Int32","@value":3002},"outV":{"@type":"g:Int32","@value":3000}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":3010},"value":"bob"}],"age":[{"id":{"@type":"g:Int64","@value":3011},"value":{"@type":"g:Int32","@value":30}}]}} diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-sink-v1d0.kryo b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-sink-v1d0.kryo index 8db5f4f..025bd98 100644 Binary files a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-sink-v1d0.kryo and b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-sink-v1d0.kryo differ diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-sink-v3d0.kryo b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-sink-v3d0.kryo index 8db5f4f..025bd98 100644 Binary files a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-sink-v3d0.kryo and b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-sink-v3d0.kryo differ diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java index 6c0f1b2..6e1c22e 100644 --- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java +++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java @@ -188,6 +188,13 @@ public final class TinkerFactory { addV("message").property(T.id, 2001).property("name", "b").as("b"). addE("link").from("a").to("b").property(T.id, 2002). addE("link").from("a").to("a").property(T.id, 2003).iterate(); + g.addV("person").property(T.id, 3000). + property("name", "alice", T.id, 3010). + property("age", 30, T.id, 3011).as("a"). + addV("person").property(T.id, 3001). + property("name", "bob", T.id, 3010). + property("age", 30, T.id, 3011). + addE("knows").from("a").property(T.id, 3002).iterate(); } /**