Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1708 [created] 6579b017e


added A Note on Scopes to the-traversal docs.


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

Branch: refs/heads/TINKERPOP-1708
Commit: 6579b017ee0d377d7428c1c182d8009a4153d859
Parents: c8cc0e5
Author: Marko A. Rodriguez <okramma...@gmail.com>
Authored: Fri Jun 30 12:33:07 2017 -0600
Committer: Marko A. Rodriguez <okramma...@gmail.com>
Committed: Fri Jun 30 12:33:07 2017 -0600

----------------------------------------------------------------------
 docs/src/reference/the-traversal.asciidoc | 43 ++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6579b017/docs/src/reference/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-traversal.asciidoc 
b/docs/src/reference/the-traversal.asciidoc
index f39fe11..8af40df 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -2574,6 +2574,49 @@ possible at the current, local vertex. What it can't 
compute without referencing
 into a barrier collection. When there are no more traversers at the local 
vertex, the barriered traversers are the
 messages that are propagated to remote vertices for further processing.
 
+[[a-note-on-scopes]]
+A Note on Scopes
+----------------
+
+The `Scope` enum has two constants: `Scope.local` and `Scope.global`. Scope 
determines whether the particular step
+being scoped is with respects to the current object (`local`) at that step or 
to the entire stream of objects up to that
+step ('global').
+
+[gremlin-groovy,modern]
+----
+g.V().has('name','marko').out('knows').count() <1>
+g.V().has('name','marko').out('knows').fold().count() <2>
+g.V().has('name','marko').out('knows').fold().count(local) <3>
+g.V().has('name','marko').out('knows').fold().count(global) <4>
+----
+
+<1> Marko knows 2 people.
+<2> A list of Marko's friends is created and thus, one object is counted (the 
single list).
+<3> A list of Marko's fiends is created and a `local`-count yields the number 
of objects in that list.
+<4> `count(global)` is the same as `count()` as the default behavior for most 
scoped steps is `global`.
+
+The steps that support scoping are:
+
+* <<count-step,`count()`>>: count the local collection or global stream.
+* <<dedup-step, `dedup()`>>: dedup the local collection of global stream.
+* <<max-step, `max()`>>: get the max value in the local collection or global 
stream.
+* <<mean-step, `mean()`>>: get the mean value in the local collection or 
global stream.
+* <<min-step, `min()`>>: get the min value in the local collection or global 
stream.
+* <<order-step,`order()`>>: order the objects in the local collection or 
global stream.
+* <<range-step, `range()`>>: clip the local collection or global stream.
+* <<sample-step, `sample()`>>: sample objects from the local collection or 
global stream.
+* <<tail-step, `tail()`>>: get the tail of the objects in the local collection 
or global stream.
+
+A few more examples of the use of `Scope` are provided below:
+
+[gremlin-groovy,modern]
+----
+g.V().both().group().by(label).select('software').dedup(local)
+g.V().groupCount().by(label).select(values).min(local)
+g.V().groupCount().by(label).order(local).by(values,decr)
+g.V().fold().sample(local,2)
+----
+
 [[a-note-on-lambdas]]
 A Note On Lambdas
 -----------------

Reply via email to