tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [1/2] tinkerpop git commit: Add sum coefficients appendix item to recipes CTR
Date Wed, 13 Sep 2017 15:17:05 GMT
Repository: tinkerpop
Updated Branches:
  refs/heads/tp32 214fb073b -> 736cb261c


Add sum coefficients appendix item to recipes CTR


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

Branch: refs/heads/tp32
Commit: e9b364af5d1c9c6c3bcfcacee59b1af06d47865d
Parents: 214fb07
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Wed Sep 13 11:12:15 2017 -0400
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Wed Sep 13 11:12:15 2017 -0400

----------------------------------------------------------------------
 docs/src/recipes/appendix.asciidoc | 34 +++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e9b364af/docs/src/recipes/appendix.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/recipes/appendix.asciidoc b/docs/src/recipes/appendix.asciidoc
index eccb6df..22ce1a7 100644
--- a/docs/src/recipes/appendix.asciidoc
+++ b/docs/src/recipes/appendix.asciidoc
@@ -260,3 +260,37 @@ g.V().as("a").
       by(select(keys).unfold()).
       by(select(values).unfold().unfold().fold()))
 ----
+
+[[appendix-j]]
+_Sum edge weight with a coefficient._
+
+[gremlin-groovy]
+----
+g.addV('person').property('name','alice').as('alice').
+  addV('person').property('name','bobby').as('bobby').
+  addV('person').property('name','cindy').as('cindy').
+  addV('person').property('name','david').as('david').
+  addV('person').property('name','eliza').as('eliza').
+  addE('rates').from('alice').to('bobby').property('tag','ruby').property('value',9).
+  addE('rates').from('bobby').to('cindy').property('tag','ruby').property('value',8).
+  addE('rates').from('cindy').to('david').property('tag','ruby').property('value',7).
+  addE('rates').from('david').to('eliza').property('tag','ruby').property('value',6).
+  addE('rates').from('alice').to('eliza').property('tag','java').property('value',9).iterate()
+ g.withSack(1.0).V().has("name","alice").
+   repeat(outE("rates").has("tag","ruby").
+          project("a","b","c").
+            by(inV()).
+            by(sack()).
+            by("value").as("x").
+          select("a").
+          sack(mult).by(constant(0.5))).
+      times(3).emit().
+    select(all, "x").
+    project("name","score").
+      by(tail(local, 1).select("a").values("name")).
+      by(unfold().
+         sack(assign).by(select("b")).
+         sack(mult).by(select("c")).
+         sack().sum())
+----
+


Mime
View raw message