You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by dkuppitz <gi...@git.apache.org> on 2017/07/03 11:17:00 UTC

[GitHub] tinkerpop pull request #647: TINKERPOP-1708: Add a "Note on Scopes" document

Github user dkuppitz commented on a diff in the pull request:

    https://github.com/apache/tinkerpop/pull/647#discussion_r125266019
  
    --- Diff: docs/src/reference/the-traversal.asciidoc ---
    @@ -2574,6 +2574,58 @@ 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-step,`count()`>>: count the local collection or global stream.
    +* <<dedup-step, `dedup()`>>: dedup the local collection of global stream.
    +* <<max-step, `max()`>>: get the max value in the local collection or global stream.
    +* <<mean-step, `mean()`>>: get the mean value in the local collection or global stream.
    +* <<min-step, `min()`>>: get the min value in the local collection or global stream.
    +* <<order-step,`order()`>>: order the objects in the local collection or global stream.
    +* <<range-step, `range()`>>: clip the local collection or global stream.
    +* <<sample-step, `sample()`>>: sample objects from the local collection or global stream.
    +* <<tail-step, `tail()`>>: get the tail of the objects in the local collection or global stream.
    --- End diff --
    
    `limit()` is missing. I know it's `RangeStep`, but in the user docs we describe `range()` and `limit()` as different steps.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---