Repository: tinkerpop Updated Branches: refs/heads/tp33 ebee26c47 -> 421839d27
Added GLV specific warnings in the step docs to point out step naming differences CTR Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/f56a3e72 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/f56a3e72 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/f56a3e72 Branch: refs/heads/tp33 Commit: f56a3e724e08c33b55b0d131438db66b95c4e54d Parents: 9986493 Author: Stephen Mallette <sp...@genoprime.com> Authored: Wed Jul 25 08:58:41 2018 -0400 Committer: Stephen Mallette <sp...@genoprime.com> Committed: Wed Jul 25 08:58:41 2018 -0400 ---------------------------------------------------------------------- docs/src/reference/gremlin-variants.asciidoc | 2 +- docs/src/reference/the-traversal.asciidoc | 63 +++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f56a3e72/docs/src/reference/gremlin-variants.asciidoc ---------------------------------------------------------------------- diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc index 04090b5..e8b4c21 100644 --- a/docs/src/reference/gremlin-variants.asciidoc +++ b/docs/src/reference/gremlin-variants.asciidoc @@ -88,7 +88,7 @@ link:https://en.wikipedia.org/wiki/CPython[CPython] machine. Python's syntax has namespaces (`a(b())` vs `a(__.b())`). As such, anyone familiar with Gremlin-Java will immediately be able to work with Gremlin-Python. Moreover, there are a few added constructs to Gremlin-Python that make traversals a bit more succinct. -WARNING: In Python, `as`, `in`, `and`, `or`, `is`, `not`, `from`, and `global` are reserved words. Gremlin-Python simply +WARNING: In Python, `and`, `as`, `from`, `global`, `in`, `is`, `not`, and `or` are reserved words. Gremlin-Python simply postfixes `_` to the end of these terms for their use with graph traversal. For instance: `g.V().as_('a').in_().as_('b').select('a','b')`. To install Gremlin-Python, use Python's link:https://en.wikipedia.org/wiki/Pip_(package_manager)[pip] package manager. http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f56a3e72/docs/src/reference/the-traversal.asciidoc ---------------------------------------------------------------------- diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc index 8cc6ac0..057ec6a 100644 --- a/docs/src/reference/the-traversal.asciidoc +++ b/docs/src/reference/the-traversal.asciidoc @@ -315,6 +315,11 @@ link:++http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/grem The `and()`-step ensures that all provided traversals yield a result (*filter*). Please see <<or-step,`or()`>> for or-semantics. +[NOTE, caption=Python] +==== +The term `and` is a reserved word in Python, and therefore must be referred to in Gremlin with `and_()`. +==== + [gremlin-groovy,modern] ---- g.V().and( @@ -345,6 +350,17 @@ The `as()`-step is not a real step, but a "step modulator" similar to <<by-step, With `as()`, it is possible to provide a label to the step that can later be accessed by steps and data structures that make use of such labels -- e.g., <<select-step,`select()`>>, <<match-step,`match()`>>, and path. +[NOTE, caption=Groovy] +==== +The term `as` is a reserved word in Groovy, and when therefore used as part of an anonymous traversal must be referred +to in Gremlin with the double underscore `__.as()`. +==== + +[NOTE, caption=Python] +==== +The term `as` is a reserved word in Python, and therefore must be referred to in Gremlin with `as_()`. +==== + [gremlin-groovy,modern] ---- g.V().as('a').out('created').as('b').select('a','b') <1> @@ -809,6 +825,16 @@ means by which they are added. The general pattern is `step().from()`. See <<to- The list of steps that support `from()`-modulation are: <<simplepath-step,`simplePath()`>>, <<cyclicpath-step,`cyclicPath()`>>, <<path-step,`path()`>>, and <<addedge-step,`addE()`>>. +[NOTE, caption=Javasacript] +==== +The term `from` is a reserved word in Javascript, and therefore must be referred to in Gremlin with `from_()`. +==== + +[NOTE, caption=Python] +==== +The term `from` is a reserved word in Python, and therefore must be referred to in Gremlin with `from_()`. +==== + *Additional References* link:++http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#from-java.lang.String-++[`from(String)`], @@ -1045,6 +1071,11 @@ link:++http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/grem It is possible to filter scalar values using `is()`-step (*filter*). +[NOTE, caption=Python] +==== +The term `is` is a reserved word in Python, and therefore must be referred to in Gremlin with `is_()`. +==== + [gremlin-groovy,modern] ---- g.V().values('age').is(32) @@ -1482,6 +1513,17 @@ link:++http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/grem The `not()`-step (*filter*) removes objects from the traversal stream when the traversal provided as an argument returns an object. +[NOTE, caption=Groovy] +==== +The term `not` is a reserved word in Groovy, and when therefore used as part of an anonymous traversal must be referred +to in Gremlin with the double underscore `__.not()`. +==== + +[NOTE, caption=Python] +==== +The term `not` is a reserved word in Python, and therefore must be referred to in Gremlin with `not_()`. +==== + [gremlin-groovy,modern] ---- g.V().not(hasLabel('person')).valueMap(true) @@ -1539,6 +1581,11 @@ link:++http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/grem The `or()`-step ensures that at least one of the provided traversals yield a result (*filter*). Please see <<and-step,`and()`>> for and-semantics. +[NOTE, caption=Python] +==== +The term `or` is a reserved word in Python, and therefore must be referred to in Gremlin with `or_()`. +==== + [gremlin-groovy,modern] ---- g.V().or( @@ -2773,6 +2820,22 @@ graph -- i.e. traverse. * `bothV()`: Move to both vertices. * `otherV()` : Move to the vertex that was not the vertex that was moved from. +[NOTE, caption=Groovy] +==== +The term `in` is a reserved word in Groovy, and when therefore used as part of an anonymous traversal must be referred +to in Gremlin with the double underscore `__.in()`. +==== + +[NOTE, caption=Javascript] +==== +The term `in` is a reserved word in Python, and therefore must be referred to in Gremlin with `in_()`. +==== + +[NOTE, caption=Python] +==== +The term `in` is a reserved word in Python, and therefore must be referred to in Gremlin with `in_()`. +==== + [gremlin-groovy,modern] ---- g.V(4)