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 2016/10/14 16:34:38 UTC

tinkerpop git commit: Cleaned up indenting on the tree recipe CTR

Repository: tinkerpop
Updated Branches:
  refs/heads/master 3245849ea -> 8c66d736d


Cleaned up indenting on the tree recipe CTR


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

Branch: refs/heads/master
Commit: 8c66d736de5c4b6f652c24aa0d2719af15b1cb9c
Parents: 3245849
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Oct 14 12:34:24 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Oct 14 12:34:24 2016 -0400

----------------------------------------------------------------------
 docs/src/recipes/tree.asciidoc | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8c66d736/docs/src/recipes/tree.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/recipes/tree.asciidoc b/docs/src/recipes/tree.asciidoc
index 5d73dc6..47560aa 100644
--- a/docs/src/recipes/tree.asciidoc
+++ b/docs/src/recipes/tree.asciidoc
@@ -71,9 +71,12 @@ g.V().has('name', input.head()).
   repeat(out('hasParent')).emit().as('x').                               <1>
   V().has('name', within(input.tail())).                                 <2>
   repeat(out('hasParent')).emit(where(eq('x'))).                         <3>
-  group().by(select('x')).by(path().count(local).fold()).                <4>
+  group().
+    by(select('x')).
+    by(path().count(local).fold()).                                      <4>
   unfold().filter(select(values).count(local).is(input.tail().size())).  <5>
-  order().by(select(values).unfold().sum()).                             <6>
+  order().by(select(values).
+  unfold().sum()).                                                       <6>
   select(keys).limit(1).valueMap(true)                                   <7>
 ----
 
@@ -91,16 +94,23 @@ As the above traversal utilizes a mid-traversal `V()`, it cannot be used for OLA
 
 [gremlin-groovy,existing]
 ----
-g.withComputer().V().has('name', within(input)).aggregate('input').
-  has('name', input.head()).repeat(out('hasParent')).emit().as('x').
+g.withComputer().
+  V().has('name', within(input)).
+  aggregate('input').has('name', input.head()).                          <1>
+  repeat(out('hasParent')).emit().as('x').
   select('input').unfold().has('name', within(input.tail())).
   repeat(out('hasParent')).emit(where(eq('x'))).
-  group().by(select('x')).by(path().count(local).fold()).
+  group().
+    by(select('x')).
+    by(path().count(local).fold()).
   unfold().filter(select(values).count(local).is(input.tail().size())).
-  order().by(select(values).unfold().sum()).
+  order().
+    by(select(values).unfold().sum()).
   select(keys).limit(1).valueMap(true)
 ----
 
+<1> The main difference for OLAP is the use of `aggregate()` over the mid-traversal`V()`.
+
 Maximum Depth
 ~~~~~~~~~~~~~
 
@@ -194,7 +204,8 @@ g.V().has('name','2016').out('may').out('day31').out('has').values()      <3>
 g.V().has('name','2016').out('may').out('day31').as('start').
   V().has('name','2016').out('june').out('day01').as('end').
   emit().repeat(__.in('next')).until(where(eq('start'))).
-  out('has').order().by('name').values('name')                            <4>
+  out('has').
+  order().by('name').values('name')                                       <4>
 ----
 
 <1> Find all the events in 2016.