Merge branch 'tp32'
Conflicts:
docs/src/reference/the-traversal.asciidoc
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/6c38c50b
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/6c38c50b
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/6c38c50b
Branch: refs/heads/master
Commit: 6c38c50b260e1efe8cb6489ff30cce8ab327cc9d
Parents: abfa44f 953bf48
Author: Stephen Mallette <[email protected]>
Authored: Fri Feb 2 14:31:53 2018 -0500
Committer: Stephen Mallette <[email protected]>
Committed: Fri Feb 2 14:31:53 2018 -0500
----------------------------------------------------------------------
docs/src/reference/the-traversal.asciidoc | 54 +++++++++++++-------------
1 file changed, 27 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6c38c50b/docs/src/reference/the-traversal.asciidoc
----------------------------------------------------------------------
diff --cc docs/src/reference/the-traversal.asciidoc
index 1139306,db658b7..9ffd953
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@@ -219,8 -213,7 +219,8 @@@ supports user provided ids
*Additional References*
-
link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#addE-java.lang.String-[`addEdge(String)`],
-
link:http://tinkerpop.apache.org/javadocs/3.3.2-SNAPSHOT/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#addE-org.apache.tinkerpop.gremlin.process.traversal.Traversal-[`addE(Traversal)`]
-link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#addE-java.lang.String-[`addE(String)`]
++link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#addE-java.lang.String-[`addE(String)`],
++link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#addE-org.apache.tinkerpop.gremlin.process.traversal.Traversal-[`addE(Traversal)`]
[[addvertex-step]]
=== AddVertex Step
@@@ -240,8 -233,7 +240,8 @@@ g.V().has('name','nothing').bothE(
*Additional References*
link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#addV--[`addV()`],
-link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#addV-java.lang.String-[`addV(String)`])
+link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#addV-java.lang.String-[`addV(String)`]),
-
link:http://tinkerpop.apache.org/javadocs/3.3.2-SNAPSHOT/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#addV-org.apache.tinkerpop.gremlin.process.traversal.Traversal-[`addV(Traversal)`]
++link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#addV-org.apache.tinkerpop.gremlin.process.traversal.Traversal-[`addV(Traversal)`]
[[addproperty-step]]
=== AddProperty Step
@@@ -803,6 -795,21 +803,22 @@@ g.V().values('age').sum() <6
link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#fold--[`fold()`],
link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#fold-E2-java.util.function.BiFunction-[`fold(Object,BiFunction)`]
+ [[from-step]]
+ === From Step
+
+ The `from()`-step is not an actual step, but instead is a "step-modulator"
similar to <<as-step,`as()`>> and
+ <<by-step,`by()`>>. If a step is able to accept traversals or strings then
`from()` is the
+ means by which they are added. The general pattern is `step().from()`. See
<<to-step,`to()`>>-step.
+
+ The list of steps that support `from()`-modulation are:
<<simplepath-step,`simplePath()`>>, <<cyclicpath-step,`cyclicPath()`>>,
+ <<path-step,`path()`>>, and <<addedge-step,`addE()`>>.
+
+ *Additional References*
+
+
link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#from-java.lang.String-[`from(String)`],
-link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#from-org.apache.tinkerpop.gremlin.process.traversal.Traversal-[`from(Traversal)`]
++link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#from-org.apache.tinkerpop.gremlin.process.traversal.Traversal-[`from(Traversal)`],
++link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#from-org.apache.tinkerpop.gremlin.structure.Vertex-[`from(Vertex)`]
+
[[graph-step]]
=== Graph Step
@@@ -1416,54 -1408,6 +1416,54 @@@ path of the traverser in `match()`. As
link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#match-org.apache.tinkerpop.gremlin.process.traversal.Traversal...-[`match(Traversal...)`]
+[[math-step]]
+=== Math Step
+
+The `math()`-step (*math*) enables scientific calculator functionality within
Gremlin. This step deviates from the common
+function composition and nesting formalisms to provide an easy to read
string-based math processor. Variables within the
+equation map to scopes in Gremlin -- e.g. path labels, side-effects, or
incoming map keys. This step supports
+`by()`-modulation where the `by()`-modulators are applied in the order in
which the variables are first referenced
+within the equation. Note that the reserved variable `_` refers to the
current numeric traverser object incoming to the
+`math()`-step.
+
+[gremlin-groovy,modern]
+----
+g.V().as('a').out('knows').as('b').math('a + b').by('age')
+g.V().as('a').out('created').as('b').
+ math('b + a').
+ by(both().count().math('_ + 100')).
+ by('age')
+g.withSideEffect('x',10).V().values('age').math('_ / x')
+g.withSack(1).V(1).repeat(sack(sum).by(constant(1))).times(10).emit().sack().math('sin
_')
+----
+
+The operators supported by the calculator include: `*`, `+`, `\`, `^`, and
`%`.
+Furthermore, the following built in functions are provided:
+
+* `abs`: absolute value
+* `acos`: arc cosine
+* `asin`: arc sine
+* `atan`: arc tangent
+* `cbrt`: cubic root
+* `ceil`: nearest upper integer
+* `cos`: cosine
+* `cosh`: hyperbolic cosine
+* `exp`: euler's number raised to the power (`e^x`)
+* `floor`: nearest lower integer
+* `log`: logarithmus naturalis (base e)
+* `log10`: logarithm (base 10)
+* `log2`: logarithm (base 2)
+* `sin`: sine
+* `sinh`: hyperbolic sine
+* `sqrt`: square root
+* `tan`: tangent
+* `tanh`: hyperbolic tangent
+* `signum`: signum function
+
+*Additional References*
+
-
link:http://tinkerpop.apache.org/javadocs/3.3.2-SNAPSHOT/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#math-java.lang.String-[`math(String)`]
++link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#math-java.lang.String-[`math(String)`]
+
[[max-step]]
=== Max Step
@@@ -2421,40 -2365,6 +2421,40 @@@ cross the vertices from the first path
link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#simplePath--[`simplePath()`]
+[[skip-step]]
+=== Skip Step
+
+The `skip()`-step is analogous to <<range-step,`range()`-step>> save that the
higher end range is set to -1.
+
+[gremlin-groovy,modern]
+----
+g.V().values('age').order()
+g.V().values('age').order().skip(2)
+g.V().values('age').order().range(2, -1)
+----
+
+The `skip()`-step can also be applied with `Scope.local`, in which case it
operates on the incoming collection.
+
+[gremlin-groovy,modern]
+----
+g.V().hasLabel('person').filter(outE('created')).as('p'). <1>
+ map(out('created').values('name').fold()).
+ project('person','primary','other').
+ by(select('p').by('name')).
+ by(limit(local, 1)). <2>
+ by(skip(local, 1)) <3>
+----
+
+<1> For each person who created something...
+<2> ...select the first project (random order) as `primary` and...
+<3> ...select all other projects as `other`.
+
+*Additional References*
+
-
link:http://tinkerpop.apache.org/javadocs/3.3.2-SNAPSHOT/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#skip-long-[`skip(long)`],
-
link:http://tinkerpop.apache.org/javadocs/3.3.2-SNAPSHOT/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#skip-org.apache.tinkerpop.gremlin.process.traversal.Scope-long-[`skip(Scope,long)`],
-
link:http://tinkerpop.apache.org/javadocs/3.3.2-SNAPSHOT/core/org/apache/tinkerpop/gremlin/process/traversal/Scope.html[`Scope`]
++link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#skip-long-[`skip(long)`],
++link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#skip-org.apache.tinkerpop.gremlin.process.traversal.Scope-long-[`skip(Scope,long)`],
++link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/Scope.html[`Scope`]
+
[[store-step]]
=== Store Step
@@@ -2641,10 -2551,9 +2641,10 @@@ The list of steps that support `to()`-m
link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#to-org.apache.tinkerpop.gremlin.process.traversal.Traversal-[`to(Direction,String...)`],
link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#to-org.apache.tinkerpop.gremlin.process.traversal.Traversal-[`to(String)`],
link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#to-org.apache.tinkerpop.gremlin.process.traversal.Traversal-[`to(Traversal)`],
-
link:http://tinkerpop.apache.org/javadocs/3.3.2-SNAPSHOT/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#to-org.apache.tinkerpop.gremlin.structure.Vertex-[`to(Vertex)`],
++link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#to-org.apache.tinkerpop.gremlin.structure.Vertex-[`to(Vertex)`],
link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#toE-org.apache.tinkerpop.gremlin.structure.Direction-java.lang.String...-[`toE(Direction,String)`],
link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#toV-org.apache.tinkerpop.gremlin.structure.Direction-[`toV(Direction)`],
-link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/structure/Direction.html[`Direction`]
+link:http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/structure/Direction.html[`Direction`]
[[tree-step]]
=== Tree Step