You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2025/08/06 13:11:03 UTC

(tinkerpop) branch master updated (16bc514f03 -> aa15e39449)

This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


    from 16bc514f03 Merge branch '3.8-dev'
     add df775b0c78 TINKERPOP-3178 choose semantics consistency improvements
     new aa15e39449 Merge branch '3.8-dev'

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGELOG.asciidoc                                 |   5 +
 docs/src/dev/provider/gremlin-semantics.asciidoc   | 122 +++--
 docs/src/reference/the-traversal.asciidoc          | 114 ++++-
 docs/src/upgrade/release-3.8.x.asciidoc            | 118 +++++
 .../tinkerpop/gremlin/process/traversal/Pick.java  |  15 +-
 .../traversal/dsl/graph/GraphTraversal.java        |  55 +++
 .../gremlin/process/traversal/dsl/graph/__.java    |  21 +
 .../traversal/lambda/PredicateTraversal.java       |   4 +
 .../process/traversal/step/branch/BranchStep.java  |  34 +-
 .../process/traversal/step/branch/ChooseStep.java  |  94 +++-
 .../grammar/TraversalMethodVisitorTest.java        |   8 +-
 .../src/Gremlin.Net/Process/Traversal/Pick.cs      |   3 +
 gremlin-go/driver/traversal.go                     |  10 +-
 .../gremlin-javascript/lib/process/traversal.ts    |   2 +-
 .../gremlin-javascript/test/cucumber/gremlin.js    |  31 +-
 gremlin-language/src/main/antlr4/Gremlin.g4        |   3 +
 .../python/gremlin_python/process/traversal.py     |   3 +-
 gremlin-python/src/main/python/radish/gremlin.py   |  31 +-
 .../process/traversal/step/branch/ChooseTest.java  |  10 +-
 .../gremlin/test/features/branch/Choose.feature    | 520 ++++++++++++++++++++-
 20 files changed, 1127 insertions(+), 76 deletions(-)


(tinkerpop) 01/01: Merge branch '3.8-dev'

Posted by sp...@apache.org.
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

commit aa15e3944900c6ab4eb60a4be711d64bc63a63df
Merge: 16bc514f03 df775b0c78
Author: Stephen Mallette <st...@amazon.com>
AuthorDate: Wed Aug 6 09:10:53 2025 -0400

    Merge branch '3.8-dev'

 CHANGELOG.asciidoc                                 |   5 +
 docs/src/dev/provider/gremlin-semantics.asciidoc   | 122 +++--
 docs/src/reference/the-traversal.asciidoc          | 114 ++++-
 docs/src/upgrade/release-3.8.x.asciidoc            | 118 +++++
 .../tinkerpop/gremlin/process/traversal/Pick.java  |  15 +-
 .../traversal/dsl/graph/GraphTraversal.java        |  55 +++
 .../gremlin/process/traversal/dsl/graph/__.java    |  21 +
 .../traversal/lambda/PredicateTraversal.java       |   4 +
 .../process/traversal/step/branch/BranchStep.java  |  34 +-
 .../process/traversal/step/branch/ChooseStep.java  |  94 +++-
 .../grammar/TraversalMethodVisitorTest.java        |   8 +-
 .../src/Gremlin.Net/Process/Traversal/Pick.cs      |   3 +
 gremlin-go/driver/traversal.go                     |  10 +-
 .../gremlin-javascript/lib/process/traversal.ts    |   2 +-
 .../gremlin-javascript/test/cucumber/gremlin.js    |  31 +-
 gremlin-language/src/main/antlr4/Gremlin.g4        |   3 +
 .../python/gremlin_python/process/traversal.py     |   3 +-
 gremlin-python/src/main/python/radish/gremlin.py   |  31 +-
 .../process/traversal/step/branch/ChooseTest.java  |  10 +-
 .../gremlin/test/features/branch/Choose.feature    | 520 ++++++++++++++++++++-
 20 files changed, 1127 insertions(+), 76 deletions(-)

diff --cc gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
index 0347579b5c,7ee5d77b48..174842eb9f
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
@@@ -4044,6 -3353,21 +4045,21 @@@ public interface GraphTraversal<S, E> e
          return this.asAdmin().addStep(new ChooseStep<E, E2, Boolean>(this.asAdmin(), (Traversal.Admin<E, ?>) traversalPredicate, (Traversal.Admin<E, E2>) trueChoice, (Traversal.Admin<E, E2>) __.identity()));
      }
  
+     /**
+      * Routes the current traverser to a particular traversal branch option which allows the creation of if-then-else
+      * like semantics within a traversal. A {@code choose} is modified by {@link #option} which provides the various
+      * branch choices.
+      *
+      * @param t extracts this value from an incoming element to match against an option
+      * @return the traversal with the appended {@link ChooseStep}
+      * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#choose-step" target="_blank">Reference Documentation - Choose Step</a>
+      * @since 3.8.0
+      */
+     public default <E2> GraphTraversal<S, E2> choose(final T t) {
 -        this.asAdmin().getBytecode().addStep(Symbols.choose, t);
++        this.asAdmin().getGremlinLang().addStep(Symbols.choose, t);
+         return this.asAdmin().addStep(new ChooseStep<>(this.asAdmin(), new TokenTraversal<>(t)));
+     }
+ 
      /**
       * Routes the current traverser to a particular traversal branch option which allows the creation of if-then-else
       * like semantics within a traversal. A {@code choose} is modified by {@link #option} which provides the various
@@@ -4055,7 -3379,9 +4071,9 @@@
       * @since 3.0.0-incubating
       */
      public default <M, E2> GraphTraversal<S, E2> choose(final Function<E, M> choiceFunction) {
+         if (choiceFunction instanceof T) return choose((T) choiceFunction);
+ 
 -        this.asAdmin().getBytecode().addStep(Symbols.choose, choiceFunction);
 +        this.asAdmin().getGremlinLang().addStep(Symbols.choose, choiceFunction);
          return this.asAdmin().addStep(new ChooseStep<>(this.asAdmin(), (Traversal.Admin<E, M>) __.map(new FunctionTraverser<>(choiceFunction))));
      }
  
@@@ -4072,10 -3398,29 +4090,29 @@@
       */
      public default <E2> GraphTraversal<S, E2> choose(final Predicate<E> choosePredicate,
                                                       final Traversal<?, E2> trueChoice, final Traversal<?, E2> falseChoice) {
+         if (choosePredicate instanceof P) return choose((P) choosePredicate, trueChoice, falseChoice);
+ 
 -        this.asAdmin().getBytecode().addStep(Symbols.choose, choosePredicate, trueChoice, falseChoice);
 +        this.asAdmin().getGremlinLang().addStep(Symbols.choose, choosePredicate, trueChoice, falseChoice);
          return this.asAdmin().addStep(new ChooseStep<E, E2, Boolean>(this.asAdmin(), (Traversal.Admin<E, ?>) __.filter(new PredicateTraverser<>(choosePredicate)), (Traversal.Admin<E, E2>) trueChoice, (Traversal.Admin<E, E2>) falseChoice));
      }
  
+     /**
+      * Routes the current traverser to a particular traversal branch option which allows the creation of if-then-else
+      * like semantics within a traversal.
+      *
+      * @param choosePredicate the {@link P} used to determine the "if" portion of the if-then-else
+      * @param trueChoice      the traversal to execute in the event the {@code traversalPredicate} returns true
+      * @param falseChoice     the traversal to execute in the event the {@code traversalPredicate} returns false
+      * @return the traversal with the appended {@link ChooseStep}
+      * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#choose-step" target="_blank">Reference Documentation - Choose Step</a>
+      * @since 3.8.0
+      */
+     public default <E2> GraphTraversal<S, E2> choose(final P<E> choosePredicate,
+                                                      final Traversal<?, E2> trueChoice, final Traversal<?, E2> falseChoice) {
 -        this.asAdmin().getBytecode().addStep(Symbols.choose, choosePredicate, trueChoice, falseChoice);
++        this.asAdmin().getGremlinLang().addStep(Symbols.choose, choosePredicate, trueChoice, falseChoice);
+         return this.asAdmin().addStep(new ChooseStep<E, E2, Boolean>(this.asAdmin(), (Traversal.Admin<E, ?>) __.is(choosePredicate), (Traversal.Admin<E, E2>) trueChoice, (Traversal.Admin<E, E2>) falseChoice));
+     }
+ 
      /**
       * Routes the current traverser to a particular traversal branch option which allows the creation of if-then
       * like semantics within a traversal.
@@@ -4088,10 -3433,28 +4125,28 @@@
       */
      public default <E2> GraphTraversal<S, E2> choose(final Predicate<E> choosePredicate,
                                                       final Traversal<?, E2> trueChoice) {
+         if (choosePredicate instanceof P) return choose((P) choosePredicate, trueChoice);
+ 
 -        this.asAdmin().getBytecode().addStep(Symbols.choose, choosePredicate, trueChoice);
 +        this.asAdmin().getGremlinLang().addStep(Symbols.choose, choosePredicate, trueChoice);
          return this.asAdmin().addStep(new ChooseStep<E, E2, Boolean>(this.asAdmin(), (Traversal.Admin<E, ?>) __.filter(new PredicateTraverser<>(choosePredicate)), (Traversal.Admin<E, E2>) trueChoice, (Traversal.Admin<E, E2>) __.identity()));
      }
  
+     /**
+      * Routes the current traverser to a particular traversal branch option which allows the creation of if-then
+      * like semantics within a traversal.
+      *
+      * @param choosePredicate the {@link P} used to determine the "if" portion of the if-then-else
+      * @param trueChoice      the traversal to execute in the event the {@code traversalPredicate} returns true
+      * @return the traversal with the appended {@link ChooseStep}
+      * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#choose-step" target="_blank">Reference Documentation - Choose Step</a>
+      * @since 3.8.0
+      */
+     public default <E2> GraphTraversal<S, E2> choose(final P<E> choosePredicate,
+                                                      final Traversal<?, E2> trueChoice) {
 -        this.asAdmin().getBytecode().addStep(Symbols.choose, choosePredicate, trueChoice);
++        this.asAdmin().getGremlinLang().addStep(Symbols.choose, choosePredicate, trueChoice);
+         return this.asAdmin().addStep(new ChooseStep<E, E2, Boolean>(this.asAdmin(), (Traversal.Admin<E, ?>) __.is(choosePredicate), (Traversal.Admin<E, E2>) trueChoice, (Traversal.Admin<E, E2>) __.identity()));
+     }
+ 
      /**
       * Returns the result of the specified traversal if it yields a result, otherwise it returns the calling element.
       *
diff --cc gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.ts
index 5aefc1d472,06bc8dfd44..3a62e758f5
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.ts
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.ts
@@@ -502,17 -498,27 +502,17 @@@ export class EnumValue 
    }
  }
  
 -module.exports = {
 -  EnumValue,
 -  P,
 -  TextP,
 -  withOptions,
 -  IO,
 -  Traversal,
 -  TraversalSideEffects,
 -  Traverser,
 -  barrier: toEnum('Barrier', 'normSack'),
 -  cardinality: toEnum('Cardinality', 'list set single'),
 -  column: toEnum('Column', 'keys values'),
 -  direction: toDirectionEnum('Direction', 'BOTH IN OUT from_ to'),
 -  dt: toEnum('DT', 'second minute hour day'),
 -  graphSONVersion: toEnum('GraphSONVersion', 'V1_0 V2_0 V3_0'),
 -  gryoVersion: toEnum('GryoVersion', 'V1_0 V3_0'),
 -  merge: toEnum('Merge', 'onCreate onMatch outV inV'),
 -  operator: toEnum('Operator', 'addAll and assign div max min minus mult or sum sumLong'),
 -  order: toEnum('Order', 'asc desc shuffle'),
 -  pick: toEnum('Pick', 'any none unproductive'),
 -  pop: toEnum('Pop', 'all first last mixed'),
 -  scope: toEnum('Scope', 'global local'),
 -  t: toEnum('T', 'id key label value'),
 -};
 +export const barrier = toEnum('Barrier', 'normSack');
 +export const cardinality = toEnum('Cardinality', 'list set single');
 +export const column = toEnum('Column', 'keys values');
 +export const direction = toDirectionEnum('Direction', 'BOTH IN OUT from_ to');
 +export const dt = toEnum('DT', 'second minute hour day');
 +export const graphSONVersion = toEnum('GraphSONVersion', 'V1_0 V2_0 V3_0');
 +export const gryoVersion = toEnum('GryoVersion', 'V1_0 V3_0');
 +export const merge = toEnum('Merge', 'onCreate onMatch outV inV');
 +export const operator = toEnum('Operator', 'addAll and assign div max min minus mult or sum sumLong');
 +export const order = toEnum('Order', 'asc desc shuffle');
- export const pick = toEnum('Pick', 'any none');
++export const pick = toEnum('Pick', 'any none unproductive');
 +export const pop = toEnum('Pop', 'all first last mixed');
 +export const scope = toEnum('Scope', 'global local');
 +export const t = toEnum('T', 'id key label value');