You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2017/05/09 17:58:42 UTC
[4/7] tinkerpop git commit: TINKERPOP-786 Improved the
TraversalSource definition in the archetype
TINKERPOP-786 Improved the TraversalSource definition in the archetype
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b8f47fa9
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b8f47fa9
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b8f47fa9
Branch: refs/heads/TINKERPOP-786
Commit: b8f47fa91053355ea4915a5f5f107fc942cb6d81
Parents: 58f8c38
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue May 9 13:47:31 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue May 9 13:47:31 2017 -0400
----------------------------------------------------------------------
.../src/main/java/SocialTraversalSourceDsl.java | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b8f47fa9/gremlin-archetype/gremlin-archetype-dsl/src/main/resources/archetype-resources/src/main/java/SocialTraversalSourceDsl.java
----------------------------------------------------------------------
diff --git a/gremlin-archetype/gremlin-archetype-dsl/src/main/resources/archetype-resources/src/main/java/SocialTraversalSourceDsl.java b/gremlin-archetype/gremlin-archetype-dsl/src/main/resources/archetype-resources/src/main/java/SocialTraversalSourceDsl.java
index 3bd8297..d14b843 100644
--- a/gremlin-archetype/gremlin-archetype-dsl/src/main/resources/archetype-resources/src/main/java/SocialTraversalSourceDsl.java
+++ b/gremlin-archetype/gremlin-archetype-dsl/src/main/resources/archetype-resources/src/main/java/SocialTraversalSourceDsl.java
@@ -52,17 +52,15 @@ public class SocialTraversalSourceDsl extends GraphTraversalSource {
*/
public GraphTraversal<Vertex, Vertex> persons(String... names) {
GraphTraversalSource clone = this.clone();
- clone.getBytecode().addStep(GraphTraversal.Symbols.V);
- clone.getBytecode().addStep(GraphTraversal.Symbols.hasLabel, "person");
- GraphTraversal.Admin<Vertex, Vertex> traversal = new DefaultGraphTraversal<>(clone);
- traversal.addStep(new GraphStep<>(traversal, Vertex.class, true));
- TraversalHelper.addHasContainer(traversal, new HasContainer(T.label.getAccessor(), P.eq("person")));
+ // Manually add a "start" step for the traversal in this case the equivalent of V(). GraphStep is marked
+ // as a "start" step by passing "true" in the constructor.
+ clone.getBytecode().addStep(GraphTraversal.Symbols.V);
+ GraphTraversal<Vertex, Vertex> traversal = new DefaultGraphTraversal<>(clone);
+ traversal.asAdmin().addStep(new GraphStep<>(traversal.asAdmin(), Vertex.class, true));
- if (names.length > 0) {
- clone.getBytecode().addStep(GraphTraversal.Symbols.has, P.within(names));
- TraversalHelper.addHasContainer(traversal, new HasContainer("name", P.within(names)));
- }
+ traversal = traversal.hasLabel("person");
+ if (names.length > 0) traversal = traversal.has("name", P.within(names));
return traversal;
}