Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 4F6BA200CFC for ; Wed, 13 Sep 2017 17:17:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4E30B1609C9; Wed, 13 Sep 2017 15:17:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9797E1609CA for ; Wed, 13 Sep 2017 17:17:06 +0200 (CEST) Received: (qmail 87393 invoked by uid 500); 13 Sep 2017 15:17:05 -0000 Mailing-List: contact commits-help@tinkerpop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tinkerpop.apache.org Delivered-To: mailing list commits@tinkerpop.apache.org Received: (qmail 87382 invoked by uid 99); 13 Sep 2017 15:17:05 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Sep 2017 15:17:05 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 08B0DF5642; Wed, 13 Sep 2017 15:17:05 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: spmallette@apache.org To: commits@tinkerpop.apache.org Date: Wed, 13 Sep 2017 15:17:05 -0000 Message-Id: <06913328f26a4bfc8b602130b5a8b9ad@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] tinkerpop git commit: Add sum coefficients appendix item to recipes CTR archived-at: Wed, 13 Sep 2017 15:17:07 -0000 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 Authored: Wed Sep 13 11:12:15 2017 -0400 Committer: Stephen Mallette 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()) +---- +