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 b4298e5eee Clarify Gremlin-Groovy __. prefix guidance and datetime()
return type
b4298e5eee is described below
commit b4298e5eee799b04f03e50ff63157a778a8c1ab4
Author: Stephen Mallette <[email protected]>
AuthorDate: Thu Aug 6 17:24:15 2026 +0000
Clarify Gremlin-Groovy __. prefix guidance and datetime() return type
Reframe the as/in/not guidance in the Gremlin-Groovy differences section:
still recommend the __. prefix, but justify it as the way to get
deterministic, portable resolution rather than a hard reserved-word rule.
Clarify that a bare not(...) resolves to P.not(P) (predicate negation)
whereas __.not(traversal) is the filter step, and advise being explicit
(__.not(...) for the step, P.not(...) for the predicate). Note that
datetime() returns a java.time.OffsetDateTime, and record in the canonical
Gremlin literal types table that the all-lowercase 'datetime' form is also
accepted alongside 'DateTime'.
Assisted-by: Kiro:claude-opus-4.8
---
docs/src/reference/gremlin-variants.asciidoc | 13 ++++++++++---
docs/src/reference/the-traversal.asciidoc | 2 +-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/docs/src/reference/gremlin-variants.asciidoc
b/docs/src/reference/gremlin-variants.asciidoc
index 8d34d3ce7c..4f435c35b3 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -864,9 +864,14 @@ compile group: 'org.apache.tinkerpop', name:
'gremlin-driver', version: 'x.y.z'
[[gremlin-groovy-differences]]
=== Differences
-In Groovy, `as`, `in`, and `not` are reserved words. Gremlin-Groovy does not
allow these steps to be called
-statically from the anonymous traversal `+__+` and therefore, must always be
prefixed with `+__.+` For instance:
-`+g.V().as('a').in().as('b').where(__.not(__.as('a').out().as('b')))+`
+In Groovy, `as`, `in`, and `not` overlap with reserved words and predicate
functions, so calling them as bare
+functions is not guaranteed to resolve to the anonymous traversal step you
intend. For deterministic, portable
+results, be explicit: prefix an anonymous traversal step with `+__.+` and use
`P.` when you actually want a
+predicate. For instance:
`+g.V().as('a').in().as('b').where(__.not(__.as('a').out().as('b')))+`
+
+This is especially important for `not`: a bare `+not(...)+` resolves to
`+P.not(P)+` (predicate negation), whereas
+`+__.not(traversal)+` is the filter step. Prefer `+__.not(...)+` for the step
and `+P.not(...)+` for the predicate to
+avoid the ambiguity.
Care needs to be taken when using the `any(P)` step as you may accidentally
invoke Groovy's `any(Closure)` method. This
typically happens when calling `any()` without arguments. You can tell if
Groovy's `any` has been called if the return
@@ -884,6 +889,8 @@ time zone offset of UTC(+00:00):
* `2018-03-22T00:35:44.741Z`
* `2018-03-22T00:35:44.741+1600`
+The `datetime()` function returns a `java.time.OffsetDateTime`.
+
anchor:connecting-via-remotegraph[]
anchor:connecting-via-java[]
[[gremlin-java]]
diff --git a/docs/src/reference/the-traversal.asciidoc
b/docs/src/reference/the-traversal.asciidoc
index 9d8ad42a10..39b2612516 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -6391,7 +6391,7 @@ script requests.
|Float |`1.0F` |A floating-point number with an `F` suffix and a value within
the bounds of `Float`.
|Double |`1.0`, `1.0D` |A floating-point number with an optional `D` suffix.
|BigDecimal |`1.0M` |A floating-point number with an `M` suffix.
-|DateTime |`DateTime("2018-03-22T00:35:44Z")`, `DateTime()` |An ISO-8601 date
or date-time string. `DateTime()` evaluates to the current time.
+|DateTime |`DateTime("2018-03-22T00:35:44Z")`, `DateTime()` |An ISO-8601 date
or date-time string. `DateTime()` evaluates to the current time. The
all-lowercase form `datetime` is also accepted (for example
`datetime("2018-03-22T00:35:44Z")`).
|UUID |`UUID("f47af10b-58cc-4372-a567-0f02b2f3d479")`, `UUID()` |A UUID string
in the textual form written as 8-4-4-4-12 hexadecimal digit groups. `UUID()`
generates a random UUID.
|Duration |`Duration(3600,0)`, `Duration(30,0,false)` |The first argument is
non-negative seconds. The second is nanoseconds from `0` to `999999999`. The
optional third argument is a boolean sign flag with `false` negating the
duration.
|Binary |`Binary("AQID")` |A Base64-encoded string.