You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.asciidoc
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -129,6 +129,11 @@ This release also includes changes from <<release-3-7-XXX, 3.7.XXX>>.
129
129
* Added integer overflow checks.
130
130
* Added missing strategies to the `TraversalStrategies` global cache as well as `CoreImports` in `gremlin-groovy`.
131
131
* Added missing strategies to `strategies.py` in `gremlin-python`.
132
+
* Preferred use of `TokenTraversal` when using `T` with `choose` instead of `LambdaMapTraversal` which treats `T` more abstractly as a `Function`.
133
+
* Preferred use of `is()` when using `P` with `choose` instead of a `PredicateTraverser` which allows `P` to be used more concretely rather than as a `Function`.
134
+
* Changed `choose` to only use the first `option` matched.
135
+
* Added `Pick.unproductive` to allow for matches on unproductive predicates.
136
+
* Changed `choose` to pass through traversers of unproductive predicates and unmatched choices.
132
137
* Updated `OptionsStrategy` in `gremlin-python` to take options directly as keyword arguments.
133
138
* Added static `instance()` method to `ElementIdStrategy` to an instance with the default configuration.
134
139
* Updated `ElementIdStrategy.getConfiguration()` to help with serialization.
* `choice` - A `Traversal`, or `T` that produces a value used to determine which option to take. In the `if-then` forms, this value may be a `P` to determine `true` or `false`.
1165
+
* `trueChoice` - The traversal to take if the predicate traversal returns a value (has a next element).
1166
+
* `falseChoice` - The traversal to take if the predicate traversal returns no value (has no next element).
1167
+
1168
+
*Modulation:*
1169
+
1170
+
* `option(pickToken, traversalOption)` - Adds a traversal option to the `choose` step. The `pickToken` is matched
1171
+
against the result of the choice traversal. The `pickToken` may be a literal value, a predicate `P`, a `Traversal`
1172
+
(whose first returned value is used for matching) or a `Pick` enum value. If a match is found, the traverser is routed
1173
+
to the corresponding `traversalOption`.
1174
+
1175
+
*Considerations:*
1176
+
1177
+
The `choose()` step is a branch step that routes the traverser to different paths based on a choice criterion. There are
1178
+
two main forms of the `choose()` step:
1179
+
1180
+
1. *if-then form*: `choose(predicate, trueChoice, falseChoice)` - If the predicate traversal or `P` returns a value
1181
+
(has a next element), the traverser is routed to the trueChoice traversal. Otherwise, it is routed to the falseChoice
1182
+
traversal. If the predicate is unproductive or if the falseChoice is not specified, then the traverser passes through.
1183
+
1184
+
2. *switch form*: `choose(choice).option(pickValue, resultTraversal)` - The choice which may be a `Traversal` or
1185
+
`T` produces a value that is matched against the pickValue of each option. If a match is found, the traverser is routed
1186
+
to the corresponding resultTraversal and no further matches are attempted. If no match is found then the traverser
1187
+
passes through by default or can be matched on `Pick.none`. If the choiceTraversal is unproductive, then the traverser
1188
+
passes through by default or can be matched on `Pick.unproductive`.
1189
+
1190
+
`choose` does not allow more than one traversal to be assigned to a single `Pick`. The first `Pick` assigned via
1191
+
`option` is the one that will be used, similar to how the first pickValue match that is found is used.
1192
+
1193
+
The `choose()` step ensures that only one option is selected for each traverser, unlike other branch steps like
1194
+
`union()` that can route a traverser to multiple paths. As it is like `union()`, note that each `option` stream will
0 commit comments