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/16 15:50:50 UTC
[23/43] tinkerpop git commit: TINKERPOP-786 Updated javadocs in dsl
archetype
TINKERPOP-786 Updated javadocs in dsl archetype
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/94fe5f51
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/94fe5f51
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/94fe5f51
Branch: refs/heads/TINKERPOP-786
Commit: 94fe5f51572c15083609e15fea08540b6740286c
Parents: 7e0d6d4
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue May 9 11:16:48 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue May 16 11:01:50 2017 -0400
----------------------------------------------------------------------
.../src/main/java/SocialTraversalDsl.java | 22 ++++++++++++++++++++
.../src/main/java/SocialTraversalSourceDsl.java | 9 ++++++++
2 files changed, 31 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/94fe5f51/gremlin-archetype/gremlin-archetype-dsl/src/main/resources/archetype-resources/src/main/java/SocialTraversalDsl.java
----------------------------------------------------------------------
diff --git a/gremlin-archetype/gremlin-archetype-dsl/src/main/resources/archetype-resources/src/main/java/SocialTraversalDsl.java b/gremlin-archetype/gremlin-archetype-dsl/src/main/resources/archetype-resources/src/main/java/SocialTraversalDsl.java
index e8a2ded..af1f039 100644
--- a/gremlin-archetype/gremlin-archetype-dsl/src/main/resources/archetype-resources/src/main/java/SocialTraversalDsl.java
+++ b/gremlin-archetype/gremlin-archetype-dsl/src/main/resources/archetype-resources/src/main/java/SocialTraversalDsl.java
@@ -23,12 +23,34 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Vertex;
+/**
+ * This Social DSL is meant to be used with the TinkerPop "modern" toy graph.
+ * <p/>
+ * All DSLs should extend {@code GraphTraversal.Admin} and be suffixed with "TraversalDsl". Simply add DSL traversal
+ * methods to this interface. Use Gremlin's steps to build the underlying traversal in these methods to ensure
+ * compatibility with the rest of the TinkerPop stack and provider implementations.
+ * <p/>
+ * Arguments provided to the {@code GremlinDsl} annotation are all optional. In this case, a {@code traversalSource} is
+ * specified which points to a specific implementation to use. Had that argument not been specified then a default
+ * {@code TraversalSource} would have been generated.
+ */
@GremlinDsl(traversalSource = "${package}.SocialTraversalSourceDsl")
public interface SocialTraversalDsl<S, E> extends GraphTraversal.Admin<S, E> {
+
+ /**
+ * From a {@code Vertex} traverse "knows" edges to adjacent "person" vertices and filter those vertices on the
+ * "name" property.
+ *
+ * @param personName the name of the person to filter on
+ */
public default GraphTraversal<S, Vertex> knows(String personName) {
return out("knows").hasLabel("person").has("name", personName);
}
+ /**
+ * From a {@code Vertex} traverse "knows" edges to adjacent "person" vertices and determine the youngest age of
+ * those persons.
+ */
public default <E2 extends Number> GraphTraversal<S, E2> youngestFriendsAge() {
return out("knows").hasLabel("person").values("age").min();
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/94fe5f51/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 9b5b136..3bd8297 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
@@ -31,6 +31,9 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
+/**
+ * See {@code SocialTraversalDsl} for more information about this DSL.
+ */
public class SocialTraversalSourceDsl extends GraphTraversalSource {
public SocialTraversalSourceDsl(final Graph graph, final TraversalStrategies traversalStrategies) {
@@ -41,6 +44,12 @@ public class SocialTraversalSourceDsl extends GraphTraversalSource {
super(graph);
}
+ /**
+ * Starts a traversal that finds all vertices with a "person" label and optionally allows filtering of those
+ * vertices on the "name" property.
+ *
+ * @param names list of person names to filter on
+ */
public GraphTraversal<Vertex, Vertex> persons(String... names) {
GraphTraversalSource clone = this.clone();
clone.getBytecode().addStep(GraphTraversal.Symbols.V);