This is an automated email from the ASF dual-hosted git repository. xiazcy pushed a commit to branch asbool-step in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 2a3701c0a5811b8cb77a33e5220720fb0d742ae4 Author: xiazcy <[email protected]> AuthorDate: Tue Jul 8 17:20:50 2025 -0400 Minor updates and fixes to implementation and docs --- docs/src/dev/provider/gremlin-semantics.asciidoc | 35 +++++++------- docs/src/reference/the-traversal.asciidoc | 41 ++++++++-------- docs/src/upgrade/release-3.8.x.asciidoc | 29 ++++++++++++ .../grammar/DefaultGremlinBaseVisitor.java | 18 +++---- .../process/traversal/step/map/AsBoolStep.java | 7 +-- .../process/traversal/util/BytecodeHelper.java | 2 + .../language/translator/GremlinTranslatorTest.java | 9 ++++ .../process/traversal/step/map/AsBoolStepTest.java | 15 ++++-- .../Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs | 22 +++++---- gremlin-go/driver/cucumber/gremlin.go | 16 ++++--- gremlin-go/driver/graphTraversal.go | 12 ++--- .../gremlin-javascript/test/cucumber/gremlin.js | 16 ++++--- gremlin-language/src/main/antlr4/Gremlin.g4 | 11 +++-- .../gremlin_python/process/graph_traversal.py | 26 +++++----- gremlin-python/src/main/python/radish/gremlin.py | 16 ++++--- .../gremlin/test/features/map/AsBool.feature | 55 ++++++++++++++++++++-- 16 files changed, 224 insertions(+), 106 deletions(-) diff --git a/docs/src/dev/provider/gremlin-semantics.asciidoc b/docs/src/dev/provider/gremlin-semantics.asciidoc index 5966360fb5..403389f0c3 100644 --- a/docs/src/dev/provider/gremlin-semantics.asciidoc +++ b/docs/src/dev/provider/gremlin-semantics.asciidoc @@ -776,37 +776,38 @@ None See: link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java[source], link:https://tinkerpop.apache.org/docs/x.y.z/reference/#as-step[reference] -[[asDate-step]] -=== asDate() +[[asBool-step]] +=== asBool() -*Description:* Parse the value of incoming traverser as date. Supported ISO-8601 strings and Unix time numbers. +*Description:* Parse the value of the incoming traverser as boolean. -*Syntax:* `asDate()` +*Syntax:* `asBool()` [width="100%",options="header"] |========================================================= |Start Step |Mid Step |Modulated |Domain |Range -|N |Y |N |`any` |`any` +|N |Y |N |`Number`/`String`/`null` |`boolean` |========================================================= *Arguments:* None -Incoming date remains unchanged. +`null` values return `null`, numbers evaluate to `true` if non-zero. Strings only accept "true" or "false", any other strings will return `null`. *Exceptions* -* If the incoming traverser is a non-String/Number/Date value then an `IllegalArgumentException` will be thrown. -See: link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AsDateStep.java[source], -link:https://tinkerpop.apache.org/docs/x.y.z/reference/#asDate-step[reference] +If the incoming traverser type is unsupported or a string other than "true" or "false" then an `IllegalArgumentException` is thrown. -[[asBool-step]] -=== asBool() +See: link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AsBoolStep.java[source], +link:https://tinkerpop.apache.org/docs/x.y.z/reference/#asBool-step[reference] -*Description:* Parse the value of the incoming traverser as boolean. +[[asDate-step]] +=== asDate() -*Syntax:* `asBool()` +*Description:* Parse the value of incoming traverser as date. Supported ISO-8601 strings and Unix time numbers. + +*Syntax:* `asDate()` [width="100%",options="header"] |========================================================= @@ -818,13 +819,13 @@ link:https://tinkerpop.apache.org/docs/x.y.z/reference/#asDate-step[reference] None -`null` values return `false`, numbers evaluate to `true` if non-zero and strings only accept "true" or "false". +Incoming date remains unchanged. *Exceptions* -* If the incoming traverser type is unsupported or a string other than "true" or "false" then an `IllegalArgumentException` is thrown. +* If the incoming traverser is a non-String/Number/Date value then an `IllegalArgumentException` will be thrown. -See: link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AsBoolStep.java[source], -link:https://tinkerpop.apache.org/docs/x.y.z/reference/#asBool-step[reference] +See: link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AsDateStep.java[source], +link:https://tinkerpop.apache.org/docs/x.y.z/reference/#asDate-step[reference] [[barrier-step]] === barrier() diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc index f27adaea14..5a9cd2489f 100644 --- a/docs/src/reference/the-traversal.asciidoc +++ b/docs/src/reference/the-traversal.asciidoc @@ -804,6 +804,27 @@ g.V().hasLabel('person').values('age').fold().asString(local) <3> link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#asString()++[`asString()`] link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#asString(org.apache.tinkerpop.gremlin.process.traversal.Scope)++[`asString(Scope)`] +[[asBool-step]] +=== AsBool Step + +The `asBool()`-step (*map*) converts the incoming traverser to a boolean value. Numbers evaluate to +`true` when non-zero (and not `NaN`), `null` evaluates to `null`. Strings are only accepted when +equal to `"true"` or `"false"` (case-insensitive), otherwise `null` will be returned. +All other types will throw an `IllegalArgumentException`. + +[gremlin-groovy,modern] +---- +g.inject(1).asBool() <1> +g.inject("false").asBool() <2> +---- + +<1> Convert number to boolean +<2> Convert string to boolean + +*Additional References* + +link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#asBool()++[`asBool()`] + [[asDate-step]] === AsDate Step @@ -829,26 +850,6 @@ g.inject(datetime("2023-08-24T00:00:00Z")).asDate() <3> link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#asDate()++[`asDate()`] -[[asBool-step]] -=== AsBool Step - -The `asBool()`-step (*map*) converts the incoming traverser to a boolean value. Numbers evaluate to -`true` when non-zero (and not `NaN`), `null` evaluates to `false` and strings are only accepted when -equal to `"true"` or `"false"` (case-insensitive). All other types will throw an `IllegalArgumentException`. - -[gremlin-groovy,modern] ----- -g.inject(1).asBool() <1> -g.inject("false").asBool() <2> ----- - -<1> Convert number to boolean -<2> Convert string to boolean - -*Additional References* - -link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#asBool()++[`asBool()`] - [[barrier-step]] === Barrier Step diff --git a/docs/src/upgrade/release-3.8.x.asciidoc b/docs/src/upgrade/release-3.8.x.asciidoc index e8ed68dee1..e730b76263 100644 --- a/docs/src/upgrade/release-3.8.x.asciidoc +++ b/docs/src/upgrade/release-3.8.x.asciidoc @@ -30,6 +30,35 @@ complete list of all the modifications that are part of this release. === Upgrading for Users +==== Boolean Conversion Step + +We have introduced a boolean conversion step, `asBool()`, which converts the incoming traverser to a boolean value. +Numbers evaluate to `true` when non-zero (and not `NaN`), `null` evaluates to `null`. Strings are only accepted when +equal to `"true"` or `"false"` (case-insensitive), otherwise `null` will be returned. +All other types will throw an `IllegalArgumentException`. + +[source,text] +---- +gremlin> g.inject(5).asBool() +==> true +gremlin> g.inject(5.0).asBool() +==> true +gremlin> g.inject(0).asBool() +==> false +gremlin> g.inject(0.0).asBool() +==> false +gremlin> g.inject("true").asBool() +==> true +gremlin> g.inject("123hello").asBool() +==> null +gremlin> g.inject(null).asBool() +==> null +gremlin> g.inject([1, 2, 3, 4]).asBool() +==> IllegalArgumentException +---- + +See: link:https://tinkerpop.apache.org/docs/3.8.0/reference/#asBool-step[asBool()-step] + ==== Removal of Vertex/ReferenceVertex from grammar `StructureVertex`, previously used to construct new vertices in the grammar, now been removed. The `V()` step, as well diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/DefaultGremlinBaseVisitor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/DefaultGremlinBaseVisitor.java index 09d1b97a4f..4b64161115 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/DefaultGremlinBaseVisitor.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/DefaultGremlinBaseVisitor.java @@ -1050,15 +1050,15 @@ public class DefaultGremlinBaseVisitor<T> extends AbstractParseTreeVisitor<T> im /** * {@inheritDoc} */ - @Override public T visitTraversalMethod_substring_Scope_int_int(final GremlinParser.TraversalMethod_substring_Scope_int_intContext ctx) { notImplemented(ctx); return null; } - /** - * {@inheritDoc} - */ - @Override public T visitTraversalMethod_asBool(final GremlinParser.TraversalMethod_asBoolContext ctx) { notImplemented(ctx); return null; } - /** - * {@inheritDoc} - */ - @Override public T visitTraversalMethod_asDate(final GremlinParser.TraversalMethod_asDateContext ctx) { notImplemented(ctx); return null; } + @Override public T visitTraversalMethod_substring_Scope_int_int(final GremlinParser.TraversalMethod_substring_Scope_int_intContext ctx) { notImplemented(ctx); return null; } + /** + * {@inheritDoc} + */ + @Override public T visitTraversalMethod_asBool(final GremlinParser.TraversalMethod_asBoolContext ctx) { notImplemented(ctx); return null; } + /** + * {@inheritDoc} + */ + @Override public T visitTraversalMethod_asDate(final GremlinParser.TraversalMethod_asDateContext ctx) { notImplemented(ctx); return null; } /** * {@inheritDoc} */ diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AsBoolStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AsBoolStep.java index 299fc6c993..89dbdeedb0 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AsBoolStep.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AsBoolStep.java @@ -37,17 +37,18 @@ public final class AsBoolStep<S> extends ScalarMapStep<S, Boolean> { @Override protected Boolean map(final Traverser.Admin<S> traverser) { final Object object = traverser.get(); - if (object == null) return false; + if (object == null) return null; if (object instanceof Boolean) return (Boolean) object; if (object instanceof Number) { final double d = ((Number) object).doubleValue(); - return !Double.isNaN(d) && d != 0d; + if (Double.isNaN(d)) return null; + return d != 0d; } if (object instanceof String) { final String str = (String) object; if (str.equalsIgnoreCase("true")) return true; if (str.equalsIgnoreCase("false")) return false; - throw new IllegalArgumentException("Can't parse " + object + " as Boolean."); + return null; } throw new IllegalArgumentException("Can't parse " + object.getClass().getName() + " as Boolean."); } diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/BytecodeHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/BytecodeHelper.java index 9a508be6d5..0ad7c53764 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/BytecodeHelper.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/BytecodeHelper.java @@ -64,6 +64,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.filter.WherePredicate import org.apache.tinkerpop.gremlin.process.traversal.step.filter.WhereTraversalStep; import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddEdgeStep; import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexStep; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.AsBoolStep; import org.apache.tinkerpop.gremlin.process.traversal.step.map.AsDateStep; import org.apache.tinkerpop.gremlin.process.traversal.step.map.AsStringGlobalStep; import org.apache.tinkerpop.gremlin.process.traversal.step.map.AsStringLocalStep; @@ -244,6 +245,7 @@ public final class BytecodeHelper { put(GraphTraversal.Symbols.replace, Arrays.asList(ReplaceGlobalStep.class, ReplaceLocalStep.class)); put(GraphTraversal.Symbols.substring, Arrays.asList(SubstringGlobalStep.class, ReplaceLocalStep.class)); put(GraphTraversal.Symbols.split, Arrays.asList(SplitGlobalStep.class, SplitLocalStep.class)); + put(GraphTraversal.Symbols.asBool, Collections.singletonList(AsBoolStep.class)); put(GraphTraversal.Symbols.asDate, Collections.singletonList(AsDateStep.class)); put(GraphTraversal.Symbols.dateAdd, Collections.singletonList(DateAddStep.class)); put(GraphTraversal.Symbols.dateDiff, Collections.singletonList(DateDiffStep.class)); diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/language/translator/GremlinTranslatorTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/language/translator/GremlinTranslatorTest.java index 746a0cd711..c35f4c253e 100644 --- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/language/translator/GremlinTranslatorTest.java +++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/language/translator/GremlinTranslatorTest.java @@ -731,6 +731,15 @@ public class GremlinTranslatorTest { "Java does not support range literals", "Javascript does not support range literals", "Python does not support range literals"}, + {"g.inject(1).asBool()", + null, + "g.inject(number0).asBool()", + "g.Inject<object>(1).AsBool()", + "g.Inject(1).AsBool()", + null, + null, + null, + "g.inject(1).as_bool()"}, {"g.inject(1694017707000).asDate()", null, "g.inject(number0).asDate()", diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AsBoolStepTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AsBoolStepTest.java index a09dfdc199..461f5c519e 100644 --- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AsBoolStepTest.java +++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AsBoolStepTest.java @@ -23,10 +23,13 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; import org.apache.tinkerpop.gremlin.process.traversal.step.StepTest; import org.junit.Test; +import java.math.BigInteger; +import java.util.Arrays; import java.util.Collections; import java.util.List; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; public class AsBoolStepTest extends StepTest { @@ -37,17 +40,21 @@ public class AsBoolStepTest extends StepTest { @Test public void shouldParseBoolean() { - assertEquals(true, __.__(1).asBool().next()); + assertEquals(true, __.__(-1).asBool().next()); assertEquals(false, __.__(0).asBool().next()); + assertEquals(true, __.__(1).asBool().next()); assertEquals(true, __.__(3.14).asBool().next()); - assertEquals(false, __.__(Double.NaN).asBool().next()); - assertEquals(false, __.__(null).asBool().next()); + assertEquals(true, __.__(new BigInteger("1000000000000000000000")).asBool().next()); assertEquals(true, __.__("TRUE").asBool().next()); assertEquals(false, __.__("false").asBool().next()); + assertNull(__.__(Double.NaN).asBool().next()); + assertNull(__.__((Object) null).asBool().next()); + assertNull(__.__("hello world").asBool().next()); + assertNull(__.__("1").asBool().next()); } @Test(expected = IllegalArgumentException.class) public void shouldThrowOnInvalidString() { - __.__("hello").asBool().next(); + __.__(Arrays.asList(1, 2)).asBool().next(); } } diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs index 557b6d48bc..325889ffa1 100644 --- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs +++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs @@ -614,19 +614,23 @@ namespace Gremlin.Net.IntegrationTest.Gherkin {"g_addVXpersonX_propertyXname_markoX_propertyXfriendWeight_null_acl_nullX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.AddV("person").Property("name", "marko").Property("friendWeight", null, "acl", null), (g,p) =>g.V().Has("person", "name", "marko").Has("friendWeight", (object) null), (g,p) =>g.V().Has("person", "name", "marko").Properties<object>("friendWeight").Has("acl", (object) null), (g,p) =>g.V().Has("person", "name", " [...] {"g_V_hasXperson_name_aliceX_propertyXsingle_age_unionXage_constantX1XX_sumX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.AddV("person").Property("name", "alice").Property(Cardinality.Single, "age", 50), (g,p) =>g.V().Has("person", "name", "alice").Property("age", __.Union<object>(__.Values<object>("age"), __.Constant<object>(1)).Sum<object>()), (g,p) =>g.V().Has("person", "age", 50), (g,p) =>g.V().Has("person", "age", 51)}}, {"g_V_limitX3X_addVXsoftwareX_aggregateXa1X_byXlabelX_aggregateXa2X_byXlabelX_capXa1_a2X_selectXa_bX_byXunfoldX_foldX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.AddV("person").Property("name", "marko").Property("age", 29).As("marko").AddV("person").Property("name", "vadas").Property("age", 27).As("vadas").AddV("software").Property("name", "lop").Property("lang", "java").As("lop").AddV("person").Property("name", "josh").Proper [...] + {"g_injectX1X_asBool", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(1).AsBool()}}, + {"g_injectXneg_1X_asBool", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(-1).AsBool()}}, + {"g_injectX0X_asBool", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(0).AsBool()}}, + {"g_injectXneg_0X_asBool", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(-0.0).AsBool()}}, + {"g_injectXtrueX_asBool", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>("true").AsBool()}}, + {"g_injectXnullX_asBool", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(null).AsBool()}}, + {"g_injectXhelloX_asBool", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>("hello").AsBool()}}, + {"g_injectX1_2X_asBool", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(p["xx1"]).AsBool()}}, {"g_injectXstrX_asDate", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>("2023-08-02T00:00:00Z").AsDate()}}, {"g_injectXstr_offsetX_asDate", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>("2023-08-02T00:00:00-07:00").AsDate()}}, {"g_injectX1694017707000X_asDate", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(1694017707000).AsDate()}}, {"g_injectX1694017708000LX_asDate", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(p["xx1"]).AsDate()}}, - {"g_injectX1694017709000dX_asDate", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(p["xx1"]).AsDate()}}, - {"g_injectX1_2X_asDate", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(p["xx1"]).AsDate()}}, - {"g_injectXnullX_asDate", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(null).AsDate()}}, - {"g_injectXinvalidstrX_asDate", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>("This String is not an ISO 8601 Date").AsDate()}}, - {"g_injectX1X_asBool", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(1).AsBool()}}, - {"g_injectX0X_asBool", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(0).AsBool()}}, - {"g_injectXstr_trueX_asBool", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>("true").AsBool()}}, - {"g_injectXinvalidstrX_asBool", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>("hello").AsBool()}}, - {"g_injectX1_2X_asString", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(p["xx1"], p["xx2"]).AsString()}}, + {"g_injectX1694017709000dX_asDate", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(p["xx1"]).AsDate()}}, + {"g_injectX1_2X_asDate", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(p["xx1"]).AsDate()}}, + {"g_injectXnullX_asDate", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(null).AsDate()}}, + {"g_injectXinvalidstrX_asDate", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>("This String is not an ISO 8601 Date").AsDate()}}, + {"g_injectX1_2X_asString", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(p["xx1"], p["xx2"]).AsString()}}, {"g_injectX1_2X_asStringXlocalX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(p["xx1"], p["xx2"]).AsString<object>(Scope.Local)}}, {"g_injectXlist_1_2X_asStringXlocalX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(p["xx1"]).AsString<object>(Scope.Local)}}, {"g_injectX1_nullX_asString", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(null, p["xx1"]).AsString()}}, diff --git a/gremlin-go/driver/cucumber/gremlin.go b/gremlin-go/driver/cucumber/gremlin.go index 48f8833d28..6d11f6ef64 100644 --- a/gremlin-go/driver/cucumber/gremlin.go +++ b/gremlin-go/driver/cucumber/gremlin.go @@ -584,6 +584,14 @@ var translationMap = map[string][]func(g *gremlingo.GraphTraversalSource, p map[ "g_addVXpersonX_propertyXname_markoX_propertyXfriendWeight_null_acl_nullX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.AddV("person").Property("name", "marko").Property("friendWeight", nil, "acl", nil)}, func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Has("person", "name", "marko").Has("friendWeight", nil)}, func(g *gremlingo.GraphTraversalSource, p map[string]interfa [...] "g_V_hasXperson_name_aliceX_propertyXsingle_age_unionXage_constantX1XX_sumX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.AddV("person").Property("name", "alice").Property(gremlingo.Cardinality.Single, "age", 50)}, func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Has("person", "name", "alice").Property("age", gremlingo.T__.Union(gremlingo.T__.Values("age"), gremlingo.T_ [...] "g_V_limitX3X_addVXsoftwareX_aggregateXa1X_byXlabelX_aggregateXa2X_byXlabelX_capXa1_a2X_selectXa_bX_byXunfoldX_foldX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.AddV("person").Property("name", "marko").Property("age", 29).As("marko").AddV("person").Property("name", "vadas").Property("age", 27).As("vadas").AddV("software").Property("name", "lop").Property("lang", "java").As("lop").AddV("person").Property("name", "josh").Prop [...] + "g_injectX1X_asBool": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1).AsBool()}}, + "g_injectXneg_1X_asBool": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(-1).AsBool()}}, + "g_injectX0X_asBool": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(0).AsBool()}}, + "g_injectXneg_0X_asBool": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(-0.0).AsBool()}}, + "g_injectXtrueX_asBool": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject("true").AsBool()}}, + "g_injectXnullX_asBool": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(nil).AsBool()}}, + "g_injectXhelloX_asBool": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject("hello").AsBool()}}, + "g_injectX1_2X_asBool": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).AsBool()}}, "g_injectXstrX_asDate": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject("2023-08-02T00:00:00Z").AsDate()}}, "g_injectXstr_offsetX_asDate": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject("2023-08-02T00:00:00-07:00").AsDate()}}, "g_injectX1694017707000X_asDate": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1694017707000).AsDate()}}, @@ -591,12 +599,8 @@ var translationMap = map[string][]func(g *gremlingo.GraphTraversalSource, p map[ "g_injectX1694017709000dX_asDate": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).AsDate()}}, "g_injectX1_2X_asDate": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).AsDate()}}, "g_injectXnullX_asDate": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(nil).AsDate()}}, - "g_injectXinvalidstrX_asDate": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject("This String is not an ISO 8601 Date").AsDate()}}, - "g_injectX1X_asBool": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1).AsBool()}}, - "g_injectX0X_asBool": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(0).AsBool()}}, - "g_injectXstr_trueX_asBool": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject("true").AsBool()}}, - "g_injectXinvalidstrX_asBool": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject("hello").AsBool()}}, - "g_injectX1_2X_asString": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"], p["xx2"]).AsString()}}, + "g_injectXinvalidstrX_asDate": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject("This String is not an ISO 8601 Date").AsDate()}}, + "g_injectX1_2X_asString": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"], p["xx2"]).AsString()}}, "g_injectX1_2X_asStringXlocalX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"], p["xx2"]).AsString(gremlingo.Scope.Local)}}, "g_injectXlist_1_2X_asStringXlocalX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).AsString(gremlingo.Scope.Local)}}, "g_injectX1_nullX_asString": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(nil, p["xx1"]).AsString()}}, diff --git a/gremlin-go/driver/graphTraversal.go b/gremlin-go/driver/graphTraversal.go index c9096d5d59..ae9aa7f262 100644 --- a/gremlin-go/driver/graphTraversal.go +++ b/gremlin-go/driver/graphTraversal.go @@ -106,18 +106,18 @@ func (g *GraphTraversal) As(args ...interface{}) *GraphTraversal { return g } +// AsBool adds the asBool step to the GraphTraversal. +func (g *GraphTraversal) AsBool(args ...interface{}) *GraphTraversal { + g.Bytecode.AddStep("asBool", args...) + return g +} + // AsDate adds the asDate step to the GraphTraversal. func (g *GraphTraversal) AsDate(args ...interface{}) *GraphTraversal { g.Bytecode.AddStep("asDate", args...) return g } -// AsBool adds the asBool step to the GraphTraversal. -func (g *GraphTraversal) AsBool(args ...interface{}) *GraphTraversal { - g.Bytecode.AddStep("asBool", args...) - return g -} - // AsString adds the asString step to the GraphTraversal. func (g *GraphTraversal) AsString(args ...interface{}) *GraphTraversal { g.Bytecode.AddStep("asString", args...) diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js index 490e9da972..1b65f0640b 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js @@ -614,6 +614,14 @@ const gremlins = { g_addVXpersonX_propertyXname_markoX_propertyXfriendWeight_null_acl_nullX: [function({g}) { return g.addV("person").property("name", "marko").property("friendWeight", null, "acl", null) }, function({g}) { return g.V().has("person", "name", "marko").has("friendWeight", null) }, function({g}) { return g.V().has("person", "name", "marko").properties("friendWeight").has("acl", null) }, function({g}) { return g.V().has("person", "name", "marko").properties("friendWeight").count() }], g_V_hasXperson_name_aliceX_propertyXsingle_age_unionXage_constantX1XX_sumX: [function({g}) { return g.addV("person").property("name", "alice").property(Cardinality.single, "age", 50) }, function({g}) { return g.V().has("person", "name", "alice").property("age", __.union(__.values("age"), __.constant(1)).sum()) }, function({g}) { return g.V().has("person", "age", 50) }, function({g}) { return g.V().has("person", "age", 51) }], g_V_limitX3X_addVXsoftwareX_aggregateXa1X_byXlabelX_aggregateXa2X_byXlabelX_capXa1_a2X_selectXa_bX_byXunfoldX_foldX: [function({g}) { return g.addV("person").property("name", "marko").property("age", 29).as("marko").addV("person").property("name", "vadas").property("age", 27).as("vadas").addV("software").property("name", "lop").property("lang", "java").as("lop").addV("person").property("name", "josh").property("age", 32).as("josh").addV("software").property("name", "ripple").property [...] + g_injectX1X_asBool: [function({g}) { return g.inject(1).asBool() }], + g_injectXneg_1X_asBool: [function({g}) { return g.inject(-1).asBool() }], + g_injectX0X_asBool: [function({g}) { return g.inject(0).asBool() }], + g_injectXneg_0X_asBool: [function({g}) { return g.inject(-0.0).asBool() }], + g_injectXtrueX_asBool: [function({g}) { return g.inject("true").asBool() }], + g_injectXnullX_asBool: [function({g}) { return g.inject(null).asBool() }], + g_injectXhelloX_asBool: [function({g}) { return g.inject("hello").asBool() }], + g_injectX1_2X_asBool: [function({g, xx1}) { return g.inject(xx1).asBool() }], g_injectXstrX_asDate: [function({g}) { return g.inject("2023-08-02T00:00:00Z").asDate() }], g_injectXstr_offsetX_asDate: [function({g}) { return g.inject("2023-08-02T00:00:00-07:00").asDate() }], g_injectX1694017707000X_asDate: [function({g}) { return g.inject(1694017707000).asDate() }], @@ -621,12 +629,8 @@ const gremlins = { g_injectX1694017709000dX_asDate: [function({g, xx1}) { return g.inject(xx1).asDate() }], g_injectX1_2X_asDate: [function({g, xx1}) { return g.inject(xx1).asDate() }], g_injectXnullX_asDate: [function({g}) { return g.inject(null).asDate() }], - g_injectXinvalidstrX_asDate: [function({g}) { return g.inject("This String is not an ISO 8601 Date").asDate() }], - g_injectX1X_asBool: [function({g}) { return g.inject(1).asBool() }], - g_injectX0X_asBool: [function({g}) { return g.inject(0).asBool() }], - g_injectXstr_trueX_asBool: [function({g}) { return g.inject("true").asBool() }], - g_injectXinvalidstrX_asBool: [function({g}) { return g.inject("hello").asBool() }], - g_injectX1_2X_asString: [function({g, xx1, xx2}) { return g.inject(xx1, xx2).asString() }], + g_injectXinvalidstrX_asDate: [function({g}) { return g.inject("This String is not an ISO 8601 Date").asDate() }], + g_injectX1_2X_asString: [function({g, xx1, xx2}) { return g.inject(xx1, xx2).asString() }], g_injectX1_2X_asStringXlocalX: [function({g, xx1, xx2}) { return g.inject(xx1, xx2).asString(Scope.local) }], g_injectXlist_1_2X_asStringXlocalX: [function({g, xx1}) { return g.inject(xx1).asString(Scope.local) }], g_injectX1_nullX_asString: [function({g, xx1}) { return g.inject(null, xx1).asString() }], diff --git a/gremlin-language/src/main/antlr4/Gremlin.g4 b/gremlin-language/src/main/antlr4/Gremlin.g4 index 6f4ee05b57..0b60761f35 100644 --- a/gremlin-language/src/main/antlr4/Gremlin.g4 +++ b/gremlin-language/src/main/antlr4/Gremlin.g4 @@ -350,6 +350,10 @@ traversalMethod_as : K_AS LPAREN stringLiteral (COMMA stringNullableLiteralVarargs)? RPAREN ; +traversalMethod_asBool + : K_ASBOOL LPAREN RPAREN + ; + traversalMethod_asDate : K_ASDATE LPAREN RPAREN ; @@ -359,10 +363,6 @@ traversalMethod_asString | K_ASSTRING LPAREN traversalScope RPAREN #traversalMethod_asString_Scope ; -traversalMethod_asBool - : K_ASBOOL LPAREN RPAREN - ; - traversalMethod_barrier : K_BARRIER LPAREN traversalSackMethod RPAREN #traversalMethod_barrier_Consumer | K_BARRIER LPAREN RPAREN #traversalMethod_barrier_Empty @@ -1672,6 +1672,7 @@ keyword | K_AND | K_ANY | K_AS + | K_ASBOOL | K_ASC | K_ASDATE | K_ASSTRING @@ -1931,9 +1932,9 @@ K_ALL: 'all'; K_AND: 'and'; K_ANY: 'any'; K_AS: 'as'; +K_ASBOOL: 'asBool'; K_ASC: 'asc'; K_ASDATE: 'asDate'; -K_ASBOOL: 'asBool'; K_ASSTRING: 'asString'; K_ASSIGN: 'assign'; K_BARRIER: 'barrier'; diff --git a/gremlin-python/src/main/python/gremlin_python/process/graph_traversal.py b/gremlin-python/src/main/python/gremlin_python/process/graph_traversal.py index 5ded8b3f53..9a33d899fd 100644 --- a/gremlin-python/src/main/python/gremlin_python/process/graph_traversal.py +++ b/gremlin-python/src/main/python/gremlin_python/process/graph_traversal.py @@ -314,12 +314,12 @@ class GraphTraversal(Traversal): self.bytecode.add_step("as", *args) return self - def as_date(self, *args): - self.bytecode.add_step("asDate", *args) + def as_bool(self, *args): + self.bytecode.add_step("asBool", *args) return self - def as_bool(self, *args): - self.gremlin_lang.add_step("asBool", *args) + def as_date(self, *args): + self.bytecode.add_step("asDate", *args) return self def as_string(self, *args): @@ -1100,12 +1100,12 @@ class __(object, metaclass=MagicType): return cls.graph_traversal(None, None, Bytecode()).as_(*args) @classmethod - def as_date(cls, *args): - return cls.graph_traversal(None, None, Bytecode()).as_date(*args) + def as_bool(cls, *args): + return cls.graph_traversal(None, None, Bytecode()).as_bool(*args) @classmethod - def as_bool(cls, *args): - return cls.graph_traversal(None, None, GremlinLang()).as_bool(*args) + def as_date(cls, *args): + return cls.graph_traversal(None, None, Bytecode()).as_date(*args) @classmethod def as_string(cls, *args): @@ -1875,11 +1875,13 @@ def as_(*args): return __.as_(*args) +def as_bool(*args): + return __.as_bool(*args) + + def as_date(*args): return __.as_date(*args) -def as_bool(*args): - return __.as_bool(*args) def as_string(*args): return __.as_string(*args) @@ -2423,10 +2425,10 @@ statics.add_static('and_', and_) statics.add_static('as_', as_) -statics.add_static('as_date', as_date) - statics.add_static('as_bool', as_bool) +statics.add_static('as_date', as_date) + statics.add_static('as_string', as_string) statics.add_static('barrier', barrier) diff --git a/gremlin-python/src/main/python/radish/gremlin.py b/gremlin-python/src/main/python/radish/gremlin.py index c61a66f7b0..a72e659255 100644 --- a/gremlin-python/src/main/python/radish/gremlin.py +++ b/gremlin-python/src/main/python/radish/gremlin.py @@ -587,6 +587,14 @@ world.gremlins = { 'g_addVXpersonX_propertyXname_markoX_propertyXfriendWeight_null_acl_nullX': [(lambda g:g.add_v('person').property('name', 'marko').property('friendWeight', None, 'acl', None)), (lambda g:g.V().has('person', 'name', 'marko').has('friendWeight', None)), (lambda g:g.V().has('person', 'name', 'marko').properties('friendWeight').has('acl', None)), (lambda g:g.V().has('person', 'name', 'marko').properties('friendWeight').count())], 'g_V_hasXperson_name_aliceX_propertyXsingle_age_unionXage_constantX1XX_sumX': [(lambda g:g.add_v('person').property('name', 'alice').property(Cardinality.single, 'age', 50)), (lambda g:g.V().has('person', 'name', 'alice').property('age', __.union(__.values('age'), __.constant(1)).sum_())), (lambda g:g.V().has('person', 'age', 50)), (lambda g:g.V().has('person', 'age', 51))], 'g_V_limitX3X_addVXsoftwareX_aggregateXa1X_byXlabelX_aggregateXa2X_byXlabelX_capXa1_a2X_selectXa_bX_byXunfoldX_foldX': [(lambda g:g.add_v('person').property('name', 'marko').property('age', 29).as_('marko').add_v('person').property('name', 'vadas').property('age', 27).as_('vadas').add_v('software').property('name', 'lop').property('lang', 'java').as_('lop').add_v('person').property('name', 'josh').property('age', 32).as_('josh').add_v('software').property('name', 'ripple').property(' [...] + 'g_injectX1X_asBool': [(lambda g:g.inject(1).as_bool())], + 'g_injectXneg_1X_asBool': [(lambda g:g.inject(-1).as_bool())], + 'g_injectX0X_asBool': [(lambda g:g.inject(0).as_bool())], + 'g_injectXneg_0X_asBool': [(lambda g:g.inject(-0.0).as_bool())], + 'g_injectXtrueX_asBool': [(lambda g:g.inject('true').as_bool())], + 'g_injectXnullX_asBool': [(lambda g:g.inject(None).as_bool())], + 'g_injectXhelloX_asBool': [(lambda g:g.inject('hello').as_bool())], + 'g_injectX1_2X_asBool': [(lambda g, xx1=None:g.inject(xx1).as_bool())], 'g_injectXstrX_asDate': [(lambda g:g.inject('2023-08-02T00:00:00Z').as_date())], 'g_injectXstr_offsetX_asDate': [(lambda g:g.inject('2023-08-02T00:00:00-07:00').as_date())], 'g_injectX1694017707000X_asDate': [(lambda g:g.inject(long(1694017707000)).as_date())], @@ -594,12 +602,8 @@ world.gremlins = { 'g_injectX1694017709000dX_asDate': [(lambda g, xx1=None:g.inject(xx1).as_date())], 'g_injectX1_2X_asDate': [(lambda g, xx1=None:g.inject(xx1).as_date())], 'g_injectXnullX_asDate': [(lambda g:g.inject(None).as_date())], - 'g_injectXinvalidstrX_asDate': [(lambda g:g.inject('This String is not an ISO 8601 Date').as_date())], - 'g_injectX1X_asBool': [(lambda g:g.inject(1).as_bool())], - 'g_injectX0X_asBool': [(lambda g:g.inject(0).as_bool())], - 'g_injectXstr_trueX_asBool': [(lambda g:g.inject('true').as_bool())], - 'g_injectXinvalidstrX_asBool': [(lambda g:g.inject('hello').as_bool())], - 'g_injectX1_2X_asString': [(lambda g, xx1=None,xx2=None:g.inject(xx1, xx2).as_string())], + 'g_injectXinvalidstrX_asDate': [(lambda g:g.inject('This String is not an ISO 8601 Date').as_date())], + 'g_injectX1_2X_asString': [(lambda g, xx1=None,xx2=None:g.inject(xx1, xx2).as_string())], 'g_injectX1_2X_asStringXlocalX': [(lambda g, xx1=None,xx2=None:g.inject(xx1, xx2).as_string(Scope.local))], 'g_injectXlist_1_2X_asStringXlocalX': [(lambda g, xx1=None:g.inject(xx1).as_string(Scope.local))], 'g_injectX1_nullX_asString': [(lambda g, xx1=None:g.inject(None, xx1).as_string())], diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/AsBool.feature b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/AsBool.feature index 93f9381464..28892e5941 100644 --- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/AsBool.feature +++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/AsBool.feature @@ -30,6 +30,18 @@ Feature: Step - asBool() | result | | true | + @GraphComputerVerificationInjectionNotSupported + Scenario: g_injectXneg_1X_asBool + Given the empty graph + And the traversal of + """ + g.inject(-1).asBool() + """ + When iterated to list + Then the result should be unordered + | result | + | true | + @GraphComputerVerificationInjectionNotSupported Scenario: g_injectX0X_asBool Given the empty graph @@ -43,7 +55,19 @@ Feature: Step - asBool() | false | @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectXstr_trueX_asBool + Scenario: g_injectXneg_0X_asBool + Given the empty graph + And the traversal of + """ + g.inject(-0.0).asBool() + """ + When iterated to list + Then the result should be unordered + | result | + | false | + + @GraphComputerVerificationInjectionNotSupported + Scenario: g_injectXtrueX_asBool Given the empty graph And the traversal of """ @@ -55,11 +79,36 @@ Feature: Step - asBool() | true | @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectXinvalidstrX_asBool + Scenario: g_injectXnullX_asBool + Given the empty graph + And the traversal of + """ + g.inject(null).asBool() + """ + When iterated to list + Then the result should be unordered + | result | + | null | + + @GraphComputerVerificationInjectionNotSupported + Scenario: g_injectXhelloX_asBool Given the empty graph And the traversal of """ g.inject('hello').asBool() """ When iterated to list - Then the traversal will raise an error with message containing text of "Can't parse" + Then the result should be unordered + | result | + | null | + + @GraphComputerVerificationInjectionNotSupported + Scenario: g_injectX1_2X_asBool + Given the empty graph + And using the parameter xx1 defined as "l[1,2]" + And the traversal of + """ + g.inject(xx1).asBool() + """ + When iterated to list + Then the traversal will raise an error with message containing text of "Can't parse" \ No newline at end of file
