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 1CBAE200CEC for ; Mon, 10 Jul 2017 20:18:38 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1A751165268; Mon, 10 Jul 2017 18:18:38 +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 D099D16526D for ; Mon, 10 Jul 2017 20:18:34 +0200 (CEST) Received: (qmail 24868 invoked by uid 500); 10 Jul 2017 18:18:34 -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 24716 invoked by uid 99); 10 Jul 2017 18:18:34 -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; Mon, 10 Jul 2017 18:18:34 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id CD68BF552B; Mon, 10 Jul 2017 18:18:30 +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: Mon, 10 Jul 2017 18:18:31 -0000 Message-Id: In-Reply-To: <4a30827b16024643b089a70b856cfba2@git.apache.org> References: <4a30827b16024643b089a70b856cfba2@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [02/50] [abbrv] tinkerpop git commit: added A Note on Scopes to the-traversal docs. archived-at: Mon, 10 Jul 2017 18:18:38 -0000 added A Note on Scopes to the-traversal docs. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/6579b017 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/6579b017 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/6579b017 Branch: refs/heads/TINKERPOP-1698 Commit: 6579b017ee0d377d7428c1c182d8009a4153d859 Parents: c8cc0e5 Author: Marko A. Rodriguez Authored: Fri Jun 30 12:33:07 2017 -0600 Committer: Marko A. Rodriguez Committed: Fri Jun 30 12:33:07 2017 -0600 ---------------------------------------------------------------------- docs/src/reference/the-traversal.asciidoc | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6579b017/docs/src/reference/the-traversal.asciidoc ---------------------------------------------------------------------- diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc index f39fe11..8af40df 100644 --- a/docs/src/reference/the-traversal.asciidoc +++ b/docs/src/reference/the-traversal.asciidoc @@ -2574,6 +2574,49 @@ possible at the current, local vertex. What it can't compute without referencing into a barrier collection. When there are no more traversers at the local vertex, the barriered traversers are the messages that are propagated to remote vertices for further processing. +[[a-note-on-scopes]] +A Note on Scopes +---------------- + +The `Scope` enum has two constants: `Scope.local` and `Scope.global`. Scope determines whether the particular step +being scoped is with respects to the current object (`local`) at that step or to the entire stream of objects up to that +step ('global'). + +[gremlin-groovy,modern] +---- +g.V().has('name','marko').out('knows').count() <1> +g.V().has('name','marko').out('knows').fold().count() <2> +g.V().has('name','marko').out('knows').fold().count(local) <3> +g.V().has('name','marko').out('knows').fold().count(global) <4> +---- + +<1> Marko knows 2 people. +<2> A list of Marko's friends is created and thus, one object is counted (the single list). +<3> A list of Marko's fiends is created and a `local`-count yields the number of objects in that list. +<4> `count(global)` is the same as `count()` as the default behavior for most scoped steps is `global`. + +The steps that support scoping are: + +* <>: count the local collection or global stream. +* <>: dedup the local collection of global stream. +* <>: get the max value in the local collection or global stream. +* <>: get the mean value in the local collection or global stream. +* <>: get the min value in the local collection or global stream. +* <>: order the objects in the local collection or global stream. +* <>: clip the local collection or global stream. +* <>: sample objects from the local collection or global stream. +* <>: get the tail of the objects in the local collection or global stream. + +A few more examples of the use of `Scope` are provided below: + +[gremlin-groovy,modern] +---- +g.V().both().group().by(label).select('software').dedup(local) +g.V().groupCount().by(label).select(values).min(local) +g.V().groupCount().by(label).order(local).by(values,decr) +g.V().fold().sample(local,2) +---- + [[a-note-on-lambdas]] A Note On Lambdas -----------------