tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject tinkerpop git commit: wip
Date Thu, 31 May 2018 18:53:20 GMT
Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1975-x 251fe79f5 -> 8ced62095


wip


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/8ced6209
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/8ced6209
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/8ced6209

Branch: refs/heads/TINKERPOP-1975-x
Commit: 8ced62095809c0c64f4939f8d2d8ec191e67c3c1
Parents: 251fe79
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Thu May 31 14:53:07 2018 -0400
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Thu May 31 14:53:07 2018 -0400

----------------------------------------------------------------------
 docs/src/reference/the-traversal.asciidoc        | 19 +++++++++++++++----
 .../tinkerpop/gremlin/jsr223/CoreImports.java    |  2 ++
 .../step/map/PageRankVertexProgramStep.java      | 15 +++++++++++++++
 3 files changed, 32 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ced6209/docs/src/reference/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc
index e28090a..56384f7 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -1705,11 +1705,15 @@ g = graph.traversal().withComputer()
 g.V().pageRank().by('pageRank').values('pageRank')
 g.V().hasLabel('person').
   pageRank().
-    by(outE('knows')).
-    by('friendRank').
+    with(PageRank.EDGES, __.outE('knows')).
+    with(PageRank.PROPERTY_NAME, 'friendRank').
   order().by('friendRank',desc).valueMap('name','friendRank')
 ----
 
+Note the use of the `with()` modulating step which provides configuration options to the
algorithm. It takes
+configuration keys from the static `PageRank` inner class on `PageRankVertexProgramStep`
and is automatically
+imported to the Gremlin Console.
+
 The <<explain-step,`explain()`>>-step can be used to understand how the traversal
is compiled into multiple `GraphComputer` jobs.
 
 [gremlin-groovy,modern]
@@ -1717,8 +1721,8 @@ The <<explain-step,`explain()`>>-step can be used to understand
how the traversa
 g = graph.traversal().withComputer()
 g.V().hasLabel('person').
   pageRank().
-    by(outE('knows')).
-    by('friendRank').
+    with(PageRank.EDGES, __.outE('knows')).
+    with(PageRank.PROPERTY_NAME, 'friendRank').
   order().by('friendRank',desc).valueMap('name','friendRank').explain()
 ----
 
@@ -2970,6 +2974,13 @@ link:++http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/grem
 link:++http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#where-org.apache.tinkerpop.gremlin.process.traversal.Traversal-++[`where(Traversal)`],
 link:++http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/P.html++[`P`]
 
+[[with-step]]
+=== With Step
+
+The `with()`-step is not an actual step, but is instead a "step modulator" which modifies
the behavior of the step
+prior to it. The `with()`-step provides additional "configuration" information to steps that
implement the `Configuring`
+interface. Steps that allow for this type of modulation will explicitly state so in their
documentation.
+
 [[a-note-on-predicates]]
 == A Note on Predicates
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ced6209/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
index 8839dcd..368b92d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
@@ -48,6 +48,7 @@ import org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankMa
 import org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankVertexProgram;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.MemoryTraversalSideEffects;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.PageRankVertexProgramStep;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.optimization.GraphFilterStrategy;
 import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection;
@@ -260,6 +261,7 @@ public final class CoreImports {
         CLASS_IMPORTS.add(PeerPressureVertexProgram.class);
         CLASS_IMPORTS.add(PageRankMapReduce.class);
         CLASS_IMPORTS.add(PageRankVertexProgram.class);
+        CLASS_IMPORTS.add(PageRankVertexProgramStep.PageRank.class);
         CLASS_IMPORTS.add(GraphFilterStrategy.class);
         CLASS_IMPORTS.add(TraversalVertexProgram.class);
         CLASS_IMPORTS.add(VertexProgramStrategy.class);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ced6209/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRankVertexProgramStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRankVertexProgramStep.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRankVertexProgramStep.java
index a3c6238..5c96a1e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRankVertexProgramStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRankVertexProgramStep.java
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.process.computer.GraphFilter;
 import org.apache.tinkerpop.gremlin.process.computer.Memory;
 import org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankVertexProgram;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.lambda.HaltedTraversersCountTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Parameterizing;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
@@ -161,9 +162,23 @@ public final class PageRankVertexProgramStep extends VertexProgramStep
         return super.hashCode() ^ this.edgeTraversal.hashCode() ^ this.pageRankProperty.hashCode()
^ this.times;
     }
 
+    /**
+     * Configuration options to be passed to the {@link GraphTraversal#with(String, Object)}
step.
+     */
     public static class PageRank {
+        /**
+         * Configures number of iterations that the algorithm should run.
+         */
         public static final String TIMES = Graph.Hidden.hide("tinkerpop.pageRank.times");
+
+        /**
+         * Configures the edge to traverse when calculating the pagerank.
+         */
         public static final String EDGES = Graph.Hidden.hide("tinkerpop.pageRank.edges");
+
+        /**
+         * Configures the name of the property within which to store the pagerank value.
+         */
         public static final String PROPERTY_NAME = Graph.Hidden.hide("tinkerpop.pageRank.propertyName");
     }
 }


Mime
View raw message