This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/master by this push:
new ad894eba6e Updated examples using old match() syntax
ad894eba6e is described below
commit ad894eba6e7f2d94a5265d0e0369b0f079a7a9bc
Author: Stephen Mallette <[email protected]>
AuthorDate: Mon Jun 15 14:31:12 2026 -0400
Updated examples using old match() syntax
Left website modifications in comments since we release the webstie from
master branch right now. CTR
---
docs/site/home/gremlin.html | 51 +++++++++++++++++++++++++++++++
docs/site/home/index.html | 9 ++++++
docs/src/recipes/duplicate-edge.asciidoc | 12 +++-----
docs/src/reference/the-traversal.asciidoc | 47 +++-------------------------
4 files changed, 69 insertions(+), 50 deletions(-)
diff --git a/docs/site/home/gremlin.html b/docs/site/home/gremlin.html
index d078a556ea..da77b3c24d 100644
--- a/docs/site/home/gremlin.html
+++ b/docs/site/home/gremlin.html
@@ -349,6 +349,28 @@ g.V().has("name","gremlin").
</div>
<div class="carousel-item">
+ <!-- When TinkerPop 4.0 is released update with
this example
+ <div class="row">
+ <div class="col-md-6 mb-4 mb-md-0">
+ <div class="code-box h-100">
+ <pre
style="padding-left:10px;height:148px;overflow:hidden;"><code
class="language-groovy">g.match("MATCH (a)-[:knows]->(b), " +
+ "(a)-[:created]->(c), " +
+ "(b)-[:created]->(c)").
+ select("c").by("name")</code></pre>
+ </div>
+ </div>
+ <div class="col-md-6">
+ <p class="bold mb-2 text-white">What are
the names of the projects created by friends?</p>
+ <ul class="list-unstyled text-white op-7">
+ <li class="mb-1">1. ...there exists
some "a" who knows "b".</li>
+ <li class="mb-1">2. ...there exists
some "a" who created "c".</li>
+ <li class="mb-1">3. ...there exists
some "b" who created "c".</li>
+ <li class="mb-1">4. Get the name of
all matching "c" projects.</li>
+ </ul>
+ </div>
+ </div>
+ -->
+
<div class="row">
<div class="col-md-6 mb-4 mb-md-0">
<div class="code-box h-100">
@@ -500,6 +522,35 @@ g.V().has("name","gremlin").as("a").
</div>
+ <!-- When TinkerPop 4.0 is released update with this text
+
+ <div class="row">
+ <div class="col-md-12">
+ <p class="text-lg-end text-start">A declarative
Gremlin traversal does not tell the traversers the order in which to execute
their walk, but instead, allows each traverser to select a pattern to execute
from a collection of (potentially nested) patterns. The declarative traversal
in the second box yields the same result as the imperative traversal above.
However, the declarative traversal has the added benefit that it leverages not
only a compile-time query planne [...]
+ </div>
+ </div>
+
+ <div class="row mb-3 mb-md-5">
+
+ <div class="col-md-12 col-lg-6 order-1 order-md-2">
+ <p class="text-lg-end text-start">Gremlin achieves
this hybrid approach to querying by way of <code>match()</code> step which can
take a declarative query string as an input and pass this to an underlying
graph database (which must support that language) for processing. TinkerPop
itself ships with a subset of the <a href="">GQL</a> query language called
TinkerGQL and is enabled by default for TinkerGraph. Check with your graph
database provider to determine what f [...]
+ </div>
+ <div class="col-md-12 col-lg-6 mb-4 mb-lg-0 order-1
order-md-2">
+ <div class="code-box h-100">
+ <code>
+ <span
class="text-purpal">g</span><span class="text-blue">.match</span><span
class="text-success">("MATCH
(a:person{name:'gremlin'})-[r:created]->(b:software)<-[:created]-(d)").</span>
+
+
<br> <span class="text-blue">select</span><span
class="text-success">("d").</span>
+
+
<br> <span class="text-blue">groupCount</span><span
class="text-success">().</span><span class="text-blue">by</span><span
class="text-success">("name")</span>
+
+ </code>
+ </div>
+ </div>
+
+ </div>
+ -->
+
<div class="row mb-3 mb-md-5">
<div class="col-md-12 col-lg-6 order-2 order-md-1">
diff --git a/docs/site/home/index.html b/docs/site/home/index.html
index 18df657fff..a4b84a44ca 100644
--- a/docs/site/home/index.html
+++ b/docs/site/home/index.html
@@ -465,6 +465,15 @@ g.V().has("name","gremlin").
<div class="row">
<div class="col-md-12">
<div class="code-box h-100">
+ <!-- When TinkerPop 4.0 releases
replace with this example
+
+ <pre><code class="language-groovy">//
What are the names of projects that were created by friends?
+ g.match("MATCH (a)-[:knows]->(b), " +
+ "(a)-[:created]->(c), " +
+ "(b)-[:created]->(c)").
+ select("c").by("name")
+ </code></pre>
+ -->
<pre><code class="language-groovy">//
What are the names of projects that were created by two friends?
g.V().
match(as("a").out("knows").as("b"),
diff --git a/docs/src/recipes/duplicate-edge.asciidoc
b/docs/src/recipes/duplicate-edge.asciidoc
index b7196a187f..ca0ddc13a5 100644
--- a/docs/src/recipes/duplicate-edge.asciidoc
+++ b/docs/src/recipes/duplicate-edge.asciidoc
@@ -87,17 +87,13 @@ the outgoing vertex, the edge label, and the incoming
vertex as the key, with th
value.
<4> The rest of the traversal is the same as the previous one.
-Note that the above traversal could also be written using `match` step:
+Note that the above traversal could also be written using `match` step and
TinkerGQL:
[gremlin-groovy,existing]
----
-g.V().match(
- __.as("ov").outE().as("e"),
- __.as("e").inV().as("iv"),
- __.as("iv").inE().as("ie"),
- __.as("ie").outV().as("ov")).
- where("ie",neq("e")).
- where("ie",eq("e")).by(label).
+g.match("MATCH (ov)-[e]->(iv)<-[ie]-(ov)").
+ where("ie",neq("e")).
+ where("ie",eq("e")).by(label).
select("ie").
group().
by(select("ov","e","iv").by().by(label)).
diff --git a/docs/src/reference/the-traversal.asciidoc
b/docs/src/reference/the-traversal.asciidoc
index a2bc194fb6..46c53047a9 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -553,29 +553,20 @@
g.V().as('a').out('created').addE('createdBy').to('a').property('acl','public')
g.V(1).as('a').out('knows').
addE('livesNear').from('a').property('year',2009).
inV().inE('livesNear').values('year') <4>
-g.V().match(
- __.as('a').out('knows').as('b'),
- __.as('a').out('created').as('c'),
- __.as('b').out('created').as('c')).
- addE('friendlyCollaborator').from('a').to('b').
- property(id,23).property('project',select('c').values('name')) <5>
-g.E(23).valueMap()
vMarko = g.V().has('name','marko').next()
vPeter = g.V().has('name','peter').next()
-g.V(vMarko).addE('knows').to(vPeter) <6>
-g.addE('knows').from(vMarko).to(vPeter) <7>
-g.addE('knows').from(__.V(1)).to(__.constant(6)) <8>
+g.V(vMarko).addE('knows').to(vPeter) <5>
+g.addE('knows').from(vMarko).to(vPeter) <6>
+g.addE('knows').from(__.V(1)).to(__.constant(6)) <7>
----
<1> Add a co-developer edge with a year-property between marko and his
collaborators.
<2> Add incoming createdBy edges from the josh-vertex to the lop- and
ripple-vertices.
<3> Add an inverse createdBy edge for all created edges.
<4> The newly created edge is a traversable object.
-<5> Two arbitrary bindings in a traversal can be joined ``from()``->``to()``,
where `id` can be provided for graphs that
-supports user provided ids.
+<5> Add an edge between marko and peter given the directed (detached) vertex
references.
<6> Add an edge between marko and peter given the directed (detached) vertex
references.
-<7> Add an edge between marko and peter given the directed (detached) vertex
references.
-<8> Use child traversals producing either a vertex, or vertex id to add an
edge between marko and peter.
+<7> Use child traversals producing either a vertex, or vertex id to add an
edge between marko and peter.
*Additional References*
@@ -6114,34 +6105,6 @@ steps and implement `OptimizationStrategy`, then other
TinkerPop optimizations m
mis-understand the graph system specific step behaviors (e.g.
`ProviderVertexStep extends VertexStep`) and yield
incorrect semantics.
-Finally, here is a complicated traversal that has various components that are
optimized by the default TinkerPop strategies.
-
-[gremlin-groovy,modern]
-----
-g.V().hasLabel('person'). <1>
- and(has('name'), <2>
- has('name','marko'),
- filter(has('age',gt(20)))). <3>
- match(__.as('a').has('age',lt(32)), <4>
- __.as('a').repeat(outE().inV()).times(2).as('b')). <5>
- where('a',neq('b')). <6>
- where(__.as('b').both().count().is(gt(1))). <7>
- select('b'). <8>
- groupCount().
- by(out().count()). <9>
- explain()
-----
-
-<1> `TinkerGraphStepStrategy` pulls in `has()`-step predicates for global,
graph-centric index lookups.
-<2> `FilterRankStrategy` sorts filter steps by their time/space execution
costs.
-<3> `InlineFilterStrategy` de-nests filters to increase the likelihood of
filter concatenation and aggregation.
-<4> `InlineFilterStrategy` pulls out named predicates from `match()`-step to
more easily allow provider strategies to use indices.
-<5> `RepeatUnrollStrategy` will unroll loops and `IncidentToAdjacentStrategy`
will turn `outE().inV()`-patterns into `out()`.
-<6> `MatchPredicateStrategy` will pull in `where()`-steps so that they can be
subjected to `match()`-steps runtime query optimizer.
-<7> `CountStrategy` will limit the traversal to only the number of traversers
required for the `count().is(x)`-check.
-<8> `PathRetractionStrategy` will remove paths from the traversers and
increase the likelihood of bulking as path data is not required after
`select('b')`.
-<9> `AdjacentToIncidentStrategy` will turn `out()` into `outE()` to increase
data access locality.
-
==== A note on Traversal Parameters
Certain gremlin steps are able to accept parameterized arguments in the form
of one of more `GValue` objects. Please see