Added docs for not()-step Re-arranged some steps that were out of order CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/28e1d93f Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/28e1d93f Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/28e1d93f Branch: refs/heads/TINKERPOP-1602 Commit: 28e1d93fe84fa35439ad81493daa270299461cfa Parents: e80a4cd Author: Stephen Mallette <sp...@genoprime.com> Authored: Wed Jan 18 11:31:59 2017 -0500 Committer: Stephen Mallette <sp...@genoprime.com> Committed: Wed Jan 18 11:31:59 2017 -0500 ---------------------------------------------------------------------- docs/src/reference/the-traversal.asciidoc | 90 +++++++++++++++----------- 1 file changed, 53 insertions(+), 37 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28e1d93f/docs/src/reference/the-traversal.asciidoc ---------------------------------------------------------------------- diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc index 6380efc..861adce 100644 --- a/docs/src/reference/the-traversal.asciidoc +++ b/docs/src/reference/the-traversal.asciidoc @@ -438,43 +438,6 @@ g.V().groupCount('a').by(label).groupCount('b').by(outE().count()).cap('a','b') <1> Group and count verticies by their label. Emit the side effect labeled 'a', which is the group count by label. <2> Same as statement 1, but also emit the side effect labeled 'b' which groups vertices by the number of out edges. -[[coalesce-step]] -Coalesce Step -~~~~~~~~~~~~~ - -The `coalesce()`-step evaluates the provided traversals in order and returns the first traversal that emits at -least one element. - -[gremlin-groovy,modern] ----- -g.V(1).coalesce(outE('knows'), outE('created')).inV().path().by('name').by(label) -g.V(1).coalesce(outE('created'), outE('knows')).inV().path().by('name').by(label) -g.V(1).property('nickname', 'okram') -g.V().hasLabel('person').coalesce(values('nickname'), values('name')) ----- - -[[count-step]] -Count Step -~~~~~~~~~~ - -image::count-step.png[width=195] - -The `count()`-step (*map*) counts the total number of represented traversers in the streams (i.e. the bulk count). - -[gremlin-groovy,modern] ----- -g.V().count() -g.V().hasLabel('person').count() -g.V().hasLabel('person').outE('created').count().path() <1> -g.V().hasLabel('person').outE('created').count().map {it.get() * 10}.path() <2> ----- - -<1> `count()`-step is a <<a-note-on-barrier-steps,reducing barrier step>> meaning that all of the previous traversers are folded into a new traverser. -<2> The path of the traverser emanating from `count()` starts at `count()`. - -IMPORTANT: `count(local)` counts the current, local object (not the objects in the traversal stream). This works for -`Collection`- and `Map`-type objects. For any other object, a count of 1 is returned. - [[choose-step]] Choose Step ~~~~~~~~~~~ @@ -532,6 +495,21 @@ g.V().hasLabel('person'). option(none, values('name')) ---- +[[coalesce-step]] +Coalesce Step +~~~~~~~~~~~~~ + +The `coalesce()`-step evaluates the provided traversals in order and returns the first traversal that emits at +least one element. + +[gremlin-groovy,modern] +---- +g.V(1).coalesce(outE('knows'), outE('created')).inV().path().by('name').by(label) +g.V(1).coalesce(outE('created'), outE('knows')).inV().path().by('name').by(label) +g.V(1).property('nickname', 'okram') +g.V().hasLabel('person').coalesce(values('nickname'), values('name')) +---- + [[coin-step]] Coin Step ~~~~~~~~~ @@ -565,6 +543,28 @@ g.V().coalesce( <1> Show the names of people, but show "inhuman" for other vertices. <2> Same as statement 1 (unless there is a person vertex with no name). +[[count-step]] +Count Step +~~~~~~~~~~ + +image::count-step.png[width=195] + +The `count()`-step (*map*) counts the total number of represented traversers in the streams (i.e. the bulk count). + +[gremlin-groovy,modern] +---- +g.V().count() +g.V().hasLabel('person').count() +g.V().hasLabel('person').outE('created').count().path() <1> +g.V().hasLabel('person').outE('created').count().map {it.get() * 10}.path() <2> +---- + +<1> `count()`-step is a <<a-note-on-barrier-steps,reducing barrier step>> meaning that all of the previous traversers are folded into a new traverser. +<2> The path of the traverser emanating from `count()` starts at `count()`. + +IMPORTANT: `count(local)` counts the current, local object (not the objects in the traversal stream). This works for +`Collection`- and `Map`-type objects. For any other object, a count of 1 is returned. + [[cyclicpath-step]] CyclicPath Step ~~~~~~~~~~~~~~~ @@ -1184,6 +1184,22 @@ g.V().repeat(both()).times(3).values('age').min() IMPORTANT: `min(local)` determines the min of the current, local object (not the objects in the traversal stream). This works for `Collection` and `Number`-type objects. For any other object, a min of `Double.NaN` is returned. +[[not-step]] +Not Step +~~~~~~~~ + +The `not()`-step (*filter*) removes objects from the traversal stream when the traversal provided as an argument does +not return any objects. + +[gremlin-groovy,modern] +---- +g.V().not(hasLabel('person')).valueMap(true) +g.V().hasLabel('person'). + not(out('created').count().is(gt(1))).values('name') <1> +---- + +<1> josh created two projects and vadas none + [[option-step]] Option Step ~~~~~~~~~~~