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 0e9f184139 Expand To Step reference docs with argument forms and a
live example
0e9f184139 is described below
commit 0e9f18413944fdba18cc1ba91c390fb92a12ebb1
Author: Stephen Mallette <[email protected]>
AuthorDate: Thu Aug 13 15:51:57 2026 +0000
Expand To Step reference docs with argument forms and a live example
The To Step reference section was a bare stub: it described to()'s
arguments only as 'traversals or strings', gave no runnable example,
and its Additional References block had two mislabeled anchors.
- Describe the three argument forms: to(String) takes a step-label
previously set by as(); to(Traversal) takes a child traversal that
resolves to a vertex; to(Vertex) takes an explicit Vertex.
- Add a runnable modern-graph example showing addE().to() with both an
as()-label and a child traversal, so its output renders at doc-build.
- Fix the Additional References links so to(Direction,String...) and
to(String) point to their own javadoc anchors instead of the
to(Traversal) anchor.
Assisted-by: Kiro:claude-opus-4.8
---
docs/src/reference/the-traversal.asciidoc | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/docs/src/reference/the-traversal.asciidoc
b/docs/src/reference/the-traversal.asciidoc
index 321221939c..9c545aa3a4 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -5676,13 +5676,33 @@ The `to()`-step is not an actual step, but instead is a
"step-modulator" similar
<<by-step,`by()`>>. If a step is able to accept traversals or strings then
`to()` is the
means by which they are added. The general pattern is `step().to()`. See
<<from-step,`from()`>>-step.
+When used to modulate <<addedge-step,`addE()`>>, `to()` identifies the
incoming (head) vertex of the new edge
+and accepts one of three argument forms:
+
+* `to(String)` -- a step-label previously set by <<as-step,`as()`>>, referring
to a vertex encountered earlier
+in the traversal.
+* `to(Traversal)` -- a child traversal that resolves to a vertex (or a vertex
id).
+* `to(Vertex)` -- an explicit `Vertex` object. This is a convenience exposed
by the language variant (e.g.
+Gremlin-Java), which resolves the `Vertex` down to its id, rather than a
canonical Gremlin argument form.
+
The list of steps that support `to()`-modulation are:
<<simplepath-step,`simplePath()`>>, <<cyclicpath-step,`cyclicPath()`>>,
<<path-step,`path()`>>, and <<addedge-step,`addE()`>>.
+[gremlin-groovy,modern]
+----
+g.V().has('name','marko').as('a').out('knows').addE('friend').to('a') <1>
+g.V().has('name','peter').addE('created').to(V().has('name','lop')) <2>
+----
+
+<1> `to(String)` uses the `as()`-labeled step `'a'` (the marko-vertex) as the
incoming vertex, while each
+incoming traverser (marko's `knows`-neighbors) supplies the outgoing vertex.
+<2> `to(Traversal)` supplies a child traversal that resolves to a vertex --
here the lop-vertex -- as the
+incoming vertex, while the incoming traverser (the peter-vertex) supplies the
outgoing vertex.
+
*Additional References*
-link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#to(org.apache.tinkerpop.gremlin.process.traversal.Traversal)++[`to(Direction,String...)`],
-link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#to(org.apache.tinkerpop.gremlin.process.traversal.Traversal)++[`to(String)`],
+link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#to(org.apache.tinkerpop.gremlin.structure.Direction,java.lang.String...)++[`to(Direction,String...)`],
+link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#to(java.lang.String)++[`to(String)`],
link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#to(org.apache.tinkerpop.gremlin.process.traversal.Traversal)++[`to(Traversal)`],
link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#to(org.apache.tinkerpop.gremlin.structure.Vertex)++[`to(Vertex)`],
link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#toE(org.apache.tinkerpop.gremlin.structure.Direction,java.lang.String...)++[`toE(Direction,String)`],