Skip to content

Commit d3a6421

Browse files
committed
Minor text changes after merge of discard/none backport to 3.8 CTR
1 parent f57584b commit d3a6421

5 files changed

Lines changed: 38 additions & 13 deletions

File tree

CHANGELOG.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
9595
This release also includes changes from <<release-3-7-XXX, 3.7.XXX>>.
9696
9797
* Removed Vertex/ReferenceVertex from grammar. Use vertex id in traversals now instead.
98+
* Renamed `none()` step to `discard()`.
99+
* Repurposed `none()` step as a list filtering step with the signature `none(P)`.
98100
* Modified mathematical operators to prevent overflows in steps such as `sum()` and 'sack()' to prefer promotion to the next highest number type.
99101
* Added `DateTime` ontop of the existing 'datetime' grammar.
100102
* Added `UUID()` and `UUID(value)` to grammar.

docs/src/dev/provider/gremlin-semantics.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,7 +1835,7 @@ link:https://tinkerpop.apache.org/docs/x.y.z/reference/#mergev-step[reference]
18351835
[[none-step]]
18361836
=== none()
18371837
1838-
*Description:* Filters array data from the Traversal Stream if none of the array's items match the supplied predicate.
1838+
*Description:* Filters array data from the traversal stream if none of the array's items match the supplied predicate.
18391839
18401840
*Syntax:* `none(P predicate)`
18411841
@@ -1847,7 +1847,7 @@ link:https://tinkerpop.apache.org/docs/x.y.z/reference/#mergev-step[reference]
18471847
18481848
*Arguments:*
18491849
1850-
* `predicate` - The predicate to use to test each value in the array data.
1850+
* `predicate` - The predicate used to test each value in the array data.
18511851
18521852
*Modulation:*
18531853
@@ -1856,7 +1856,7 @@ None
18561856
*Considerations:*
18571857
18581858
Each value will be tested using the supplied predicate. Empty lists always pass through and null/non-list traversers
1859-
will be filtered out of the Traversal Stream.
1859+
will be filtered out of the traversal stream.
18601860
18611861
*Exceptions*
18621862

docs/src/reference/the-traversal.asciidoc

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,12 +1515,23 @@ link:++https://tinkerpop.apache.org/docs/x.y.z/dev/provider/#difference-step++[`
15151515
[[discard-step]]
15161516
=== Discard Step
15171517
1518-
The `discard()`-step (*filter*) filters all objects from a traversal stream. It is especially useful for traversals
1519-
that are executed remotely where returning results is not useful and the traversal is only meant to generate
1520-
side-effects. Choosing not to return results saves in serialization and network costs as the objects are filtered on
1521-
the remote end and not returned to the client side. Typically, this step does not need to be used directly and is
1522-
quietly used by the `iterate()` terminal step which appends `discard()` to the traversal before actually cycling through
1523-
results.
1518+
The `discard()`-step (*filter*) filters all objects from a traversal stream. It is helpful with <<branch-step>> types
1519+
of steps where a particular branch of code should "throw away" traversers. In the following example, traversers that
1520+
don't match are filtered out of the traversal stream.
1521+
1522+
[gremlin-groovy,modern]
1523+
----
1524+
g.V().choose(T.label).
1525+
option("person", __.out("knows").values("name")).
1526+
option("bleep", __.out("created").values("name")).
1527+
option(none, discard())
1528+
----
1529+
1530+
It is also useful for traversals that are executed remotely where returning results is not useful and the traversal is
1531+
only meant to generate side-effects. Choosing not to return results saves in serialization and network costs as the
1532+
objects are filtered on the remote end and not returned to the client side. Typically, this step does not need to be
1533+
used directly and is quietly used by the `iterate()` terminal step which appends `discard()` to the traversal before
1534+
actually cycling through results.
15241535
15251536
*Additional References*
15261537
@@ -3242,9 +3253,8 @@ the supplied predicate and if none of the items pass then the traverser is passe
32423253
filtered. Empty lists are passed along but null or non-iterable traversers are filtered out.
32433254
32443255
3245-
NOTE: Prior to release 4.0.0, `none()` was a traversal discarding step primarily used by <<iterate-step,`iterate()`>>. This step has
3246-
since been renamed to <<discard-step,`discard()`>>
3247-
3256+
NOTE: Prior to release 3.8.0, `none()` was a traversal discarding step primarily used by <<iterate-step,`iterate()`>>.
3257+
This step has since been renamed to <<discard-step,`discard()`>>
32483258
32493259
[gremlin-groovy,modern]
32503260
----

docs/src/upgrade/release-3.8.x.asciidoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ gremlin> g.V().sack(assign).by(__.hasLabel('person').count().asBool()).sack(and)
5858
See: link:https://tinkerpop.apache.org/docs/3.8.0/reference/#asBool-step[asBool()-step]
5959
See: link:https://issues.apache.org/jira/browse/TINKERPOP-3175[TINKERPOP-3175]
6060
61+
==== none() and discard()
62+
63+
There is a complicated relationship with the `none()` and `discard()` steps that begs some discussion. Prior to this
64+
version, the `none()` step was used to "throw away" all traversers that passed into it. In 3.8.0, that step has been
65+
renamed to `discard()`. The `discard()` step with its verb tone arguably makes for a better name for that feature, but
66+
it also helped make room for `none()` to be repurposed as `none(P)` which is a complement to `any(P)` and `all(P) steps.
67+
6168
==== Set minimum Java version to 11
6269
6370
TinkerPop 3.8 requires a minimum of Java 11 for building and running. Support for Java 1.8 has been dropped.
@@ -438,6 +445,12 @@ link:https://issues.apache.org/jira/browse/TINKERPOP-2974[TINKERPOP-2974]
438445
439446
==== Graph System Providers
440447
448+
===== NoneStep Renaming
449+
450+
The `DiscardStep` is now renamed to `DiscardStep`. Providers who developed strategies or other optimizations around
451+
`DiscardStep` should switch to `DiscardStep`. Note that `DiscardStep` has been repurposed as `none(P)` for filtering
452+
collections as a complement to `any(P)` and `all(P)`.
453+
441454
==== Set minimum Java version to 11
442455
443456
TinkerPop 3.8 requires a minimum of Java 11 for building and running. Support for Java 1.8 has been dropped.

gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3581,7 +3581,7 @@ public default <S2> GraphTraversal<S, E> any(final P<S2> predicate) {
35813581
* @param predicate the filter to apply
35823582
* @return the traversal with an appended {@link NoneStep}
35833583
* @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#none-step" target="_blank">Reference Documentation - None Step</a>
3584-
* @since 4.0.0
3584+
* @since 3.8.0
35853585
*/
35863586
public default <S2> GraphTraversal<S, E> none(final P<S2> predicate) {
35873587
this.asAdmin().getGremlinLang().addStep(Symbols.none, predicate);

0 commit comments

Comments
 (0)