You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by pl...@apache.org on 2015/10/16 16:57:55 UTC

[11/17] incubator-tinkerpop git commit: Update match()-step documentation with domain-related as() step labels

Update match()-step documentation with domain-related as() step labels


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

Branch: refs/heads/TINKERPOP3-858
Commit: 961537090f2441f2faf091d5ac7c3da5fec2b77d
Parents: a28a1a8
Author: jbmusso <jb...@gmail.com>
Authored: Fri Oct 16 00:09:48 2015 +0200
Committer: jbmusso <jb...@gmail.com>
Committed: Fri Oct 16 00:09:48 2015 +0200

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


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/96153709/docs/src/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/the-traversal.asciidoc b/docs/src/the-traversal.asciidoc
index adf65d3..b492800 100644
--- a/docs/src/the-traversal.asciidoc
+++ b/docs/src/the-traversal.asciidoc
@@ -779,6 +779,20 @@ g.V().match(
       select('a','c').by('name')
 ----
 
+In order to improve readability, `as()`-steps can be given meaningful labels which better reflect your domain. The previous query can thus be written in a more expressive way as shown below.
+
+[gremlin-groovy,modern]
+----
+g.V().match(
+        __.as('creators').out('created').has('name', 'lop').as('projects'), <1>
+        __.as('projects').in('created').has('age', 29).as('cocreators')). <2>
+      select('creators','cocreators').by('name') <3>
+----
+
+<1> Find vertices that created something and match them as 'creators', then find out what they created which is named 'lop' and match these vertices as 'projects'.
+<2> Using these 'projects' vertices, find out their creators aged 29 and remember these as 'cocreators'.
+<3> Return the name of both 'creators' and 'cocreators'.
+
 [[grateful-dead]]
 .Grateful Dead
 image::grateful-dead-schema.png[width=475]