tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [2/2] incubator-tinkerpop git commit: Did some more indent work on the recipes - formatting only CTR
Date Thu, 19 May 2016 20:50:24 GMT
Did some more indent work on the recipes - formatting only CTR


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

Branch: refs/heads/master
Commit: 3c613d9f8777c30b73f6c5aed687a4642d7d0a75
Parents: 62f0e2d
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Thu May 19 16:49:47 2016 -0400
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Thu May 19 16:49:47 2016 -0400

----------------------------------------------------------------------
 docs/src/recipes/between-vertices.asciidoc       | 14 +++++++++-----
 docs/src/recipes/if-then-based-grouping.asciidoc | 13 +++++++------
 docs/src/recipes/index.asciidoc                  |  6 ++++--
 docs/src/recipes/shortest-path.asciidoc          | 19 ++++++++++++-------
 4 files changed, 32 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3c613d9f/docs/src/recipes/between-vertices.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/recipes/between-vertices.asciidoc b/docs/src/recipes/between-vertices.asciidoc
index e8f9845..03a4b3c 100644
--- a/docs/src/recipes/between-vertices.asciidoc
+++ b/docs/src/recipes/between-vertices.asciidoc
@@ -47,7 +47,7 @@ two vertices.
 The basic pattern of using `where()` step to find the "other" known vertex can be applied
in far more complex
 scenarios. Consider the following schema:
 
-image:recipe-job-schema.png[width=500]
+image:recipe-job-schema.png[width=750]
 
 Assume that the goal is to find information about a known job and a known person. Specifically,
the idea would be
 to extract the known job, the company that created the job, the date it was created by the
company and whether or not
@@ -83,14 +83,18 @@ g.V(vRexsterJob1).as('job').
   inE('created').as('created').
   outV().as('company').
   select('job').
-  coalesce(__.in('appliesTo').where(__.in('completes').is(vStephen)), constant(false)).as('application').
-  select('job', 'company', 'created', 'application').by().by().by('creationDate').by()
+  coalesce(__.in('appliesTo').where(__.in('completes').is(vStephen)),
+           constant(false)).as('application').
+  select('job', 'company', 'created', 'application').
+    by().by().by('creationDate').by()
 g.V(vRexsterJob1, vBlueprintsJob1).as('job').
   inE('created').as('created').
   outV().as('company').
   select('job').
-  coalesce(__.in('appliesTo').where(__.in('completes').is(vBob)), constant(false)).as('application').
-  select('job', 'company', 'created', 'application').by().by().by('creationDate').by()
+  coalesce(__.in('appliesTo').where(__.in('completes').is(vBob)),
+           constant(false)).as('application').
+  select('job', 'company', 'created', 'application').
+    by().by().by('creationDate').by()
 ----
 
 While the traversals above are more complex, the pattern for finding "things" between two
vertices is largely the same.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3c613d9f/docs/src/recipes/if-then-based-grouping.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/recipes/if-then-based-grouping.asciidoc b/docs/src/recipes/if-then-based-grouping.asciidoc
index fc319b7..dc0025f 100644
--- a/docs/src/recipes/if-then-based-grouping.asciidoc
+++ b/docs/src/recipes/if-then-based-grouping.asciidoc
@@ -35,8 +35,8 @@ a domain concept such as "young", "old" and "very old".
 g.V().hasLabel("person").groupCount().by(values("age").choose(
   is(lt(28)),constant("young"),
   choose(is(lt(30)),
-    constant("old"),
-    constant("very old"))))
+         constant("old"),
+         constant("very old"))))
 ----
 
 Note that the `by` modulator has been altered from simply taking a string key of "age" to
take a `Traversal`. That
@@ -61,10 +61,11 @@ there is another option to consider with `coalesce`:
 
 [gremlin-groovy,modern]
 ----
-g.V().hasLabel("person").groupCount().by(values("age").coalesce(
-  is(lt(28)).constant("young"),
-  is(lt(30)).constant("old"),
-             constant("very old")))
+g.V().hasLabel("person").
+  groupCount().by(values("age").
+  coalesce(is(lt(28)).constant("young"),
+           is(lt(30)).constant("old"),
+           constant("very old")))
 ----
 
 The answer is the same, but this traversal removes the nested `choose`, which makes it easier
to read.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3c613d9f/docs/src/recipes/index.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/recipes/index.asciidoc b/docs/src/recipes/index.asciidoc
index 8a64818..89d4660 100644
--- a/docs/src/recipes/index.asciidoc
+++ b/docs/src/recipes/index.asciidoc
@@ -36,17 +36,19 @@ link:http://tinkerpop.apache.org/docs/x.y.z/tutorials/the-gremlin-console/[The
G
 Traversal Recipes
 =================
 
-include::style-guide.asciidoc[]
-
 include::between-vertices.asciidoc[]
 
 include::shortest-path.asciidoc[]
 
 include::if-then-based-grouping.asciidoc[]
 
+include::cycle-detection.asciidoc[]
+
 Implementation Recipes
 ======================
 
+include::style-guide.asciidoc[]
+
 include::traversal-component-reuse.asciidoc[]
 
 [[contributing]]

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3c613d9f/docs/src/recipes/shortest-path.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/recipes/shortest-path.asciidoc b/docs/src/recipes/shortest-path.asciidoc
index 161646a..3f380f1 100644
--- a/docs/src/recipes/shortest-path.asciidoc
+++ b/docs/src/recipes/shortest-path.asciidoc
@@ -40,7 +40,8 @@ v3.addEdge("knows", v4)
 g = graph.traversal()
 g.V(1).repeat(out().simplePath()).until(hasId(5)).path().limit(1)     <1>
 g.V(1).repeat(out().simplePath()).until(hasId(5)).path().count(local) <2>
-g.V(1).repeat(out().simplePath()).until(hasId(5)).path().group().by(count(local)).next()
 <3>
+g.V(1).repeat(out().simplePath()).until(hasId(5)).path().
+  group().by(count(local)).next()                                     <3>
 ----
 
 <1> The traversal starts at vertex with the identifier of "1" and repeatedly traverses
on out edges "until" it finds a
@@ -69,15 +70,19 @@ v4.addEdge("knows", v5, "weight", 0.25)
 v2.addEdge("knows", v3, "weight", 0.25)
 v3.addEdge("knows", v4, "weight", 0.25)
 g = graph.traversal()
-g.V(1).repeat(out().simplePath()).until(hasId(5)).path().group().by(count(local)).next()
 <1>
-g.V(1).repeat(outE().inV().simplePath()).until(hasId(5)).                               
 <2>
-  path().by(coalesce(values('weight'), constant(0.0))).map(unfold().sum())
+g.V(1).repeat(out().simplePath()).until(hasId(5)).path().
+  group().by(count(local)).next()                                                       
 <1>
+g.V(1).repeat(outE().inV().simplePath()).until(hasId(5)).
+  path().by(coalesce(values('weight'),
+                     constant(0.0))).
+  map(unfold().sum())                                                                   
 <2>
 g.V(1).repeat(outE().inV().simplePath()).until(hasId(5)).
   path().by(constant(0.0)).by('weight').map(unfold().sum())                             
 <3>
-g.V(1).repeat(outE().inV().simplePath()).until(hasId(5)).                               
 <4>
+g.V(1).repeat(outE().inV().simplePath()).until(hasId(5)).
   path().as('p').
-  map(unfold().coalesce(values('weight'),constant(0.0)).sum()).as('cost').
-  select('cost','p')
+  map(unfold().coalesce(values('weight'),
+                        constant(0.0)).sum()).as('cost').
+  select('cost','p')                                                                    
 <4>
 ----
 
 <1> Note that the shortest path as determined by the structure of the graph is the
same.


Mime
View raw message