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/03/15 17:54:48 UTC
tinkerpop git commit: Added some additional notes on local() vs
flatMap()
Repository: tinkerpop
Updated Branches:
refs/heads/tp32 99ad76d0b -> 7b234b468
Added some additional notes on local() vs flatMap()
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/7b234b46
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/7b234b46
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/7b234b46
Branch: refs/heads/tp32
Commit: 7b234b468149d729ad9367029499fdf155cd5d46
Parents: 99ad76d
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Mar 15 13:54:09 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 15 13:54:09 2017 -0400
----------------------------------------------------------------------
docs/src/reference/the-traversal.asciidoc | 11 +++++++++++
1 file changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7b234b46/docs/src/reference/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc
index eb93950..84887bc 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -949,6 +949,17 @@ The two traversals above look nearly identical save the inclusion of `local()` w
in a object-local traversal. As such, the `order().by()` and the `limit()` refer to a particular object, not to the
stream as a whole.
+Local Step is quite similar in functionality to <<general-steps,Flat Map Step>> where it can often be confused.
+`local()` propagates the traverser through the internal traversal as is without splitting/cloning it. Thus, its
+a \u201cglobal traversal\u201d with local processing. Its use is subtle and primarily finds application in compilation
+optimizations (i.e. when writing `TraversalStrategy` implementations. As another example consider:
+
+[gremlin-groovy,modern]
+----
+g.V().both().barrier().flatMap(groupCount().by("name"))
+g.V().both().barrier().local(groupCount().by("name"))
+----
+
WARNING: The anonymous traversal of `local()` processes the current object "locally." In OLAP, where the atomic unit
of computing is the vertex and its local "star graph," it is important that the anonymous traversal does not leave
the confines of the vertex's star graph. In other words, it can not traverse to an adjacent vertex's properties or edges.