This is an automated email from the ASF dual-hosted git repository. spmallette pushed a commit to branch backport-discard in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 8e26f77d551deafdedc6220752adbaffe9464d73 Author: Stephen Mallette <[email protected]> AuthorDate: Sat Aug 2 12:51:02 2025 -0400 Backported more discard() steps from 4.x --- .../Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs | 3 +++ gremlin-go/driver/cucumber/gremlin.go | 3 +++ .../gremlin-javascript/test/cucumber/gremlin.js | 3 +++ gremlin-python/src/main/python/radish/gremlin.py | 3 +++ .../gremlin/test/features/filter/Discard.feature | 30 +++++++++++++++++++++- 5 files changed, 41 insertions(+), 1 deletion(-) diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs index 1549d3ae0d..c08b66053c 100644 --- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs +++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs @@ -203,6 +203,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin {"g_V_properties_dedup_count", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.AddV("person").Property("name", "josh").AddV("person").Property("name", "josh").AddV("person").Property("name", "josh"), (g,p) =>g.V().Properties<object>("name").Dedup().Count()}}, {"g_V_properties_dedup_byXvalueX_count", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.AddV("person").Property("name", "josh").AddV("person").Property("name", "josh").AddV("person").Property("name", "josh"), (g,p) =>g.V().Properties<object>("name").Dedup().By(T.Value).Count()}}, {"g_V_both_hasXlabel_softwareX_dedup_byXlangX_byXnameX_name", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Both().Has(T.Label, "software").Dedup().By("lang").By("name").Values<object>("name")}}, + {"g_V_count_discard", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Count().Discard()}}, + {"g_V_hasLabelXpersonX_discard", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().HasLabel("person").Discard()}}, + {"g_VX1X_outXcreatedX_discard", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V(p["vid1"]).Out("created").Discard()}}, {"g_V_discard", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Discard()}}, {"g_V_discard_discard", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Discard().Discard()}}, {"g_V_discard_fold", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Discard().Fold()}}, diff --git a/gremlin-go/driver/cucumber/gremlin.go b/gremlin-go/driver/cucumber/gremlin.go index 79fecd7d60..1c21117aae 100644 --- a/gremlin-go/driver/cucumber/gremlin.go +++ b/gremlin-go/driver/cucumber/gremlin.go @@ -173,6 +173,9 @@ var translationMap = map[string][]func(g *gremlingo.GraphTraversalSource, p map[ "g_V_properties_dedup_count": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.AddV("person").Property("name", "josh").AddV("person").Property("name", "josh").AddV("person").Property("name", "josh")}, func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Properties("name").Dedup().Count()}}, "g_V_properties_dedup_byXvalueX_count": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.AddV("person").Property("name", "josh").AddV("person").Property("name", "josh").AddV("person").Property("name", "josh")}, func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Properties("name").Dedup().By(gremlingo.T.Value).Count()}}, "g_V_both_hasXlabel_softwareX_dedup_byXlangX_byXnameX_name": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Both().Has(gremlingo.T.Label, "software").Dedup().By("lang").By("name").Values("name")}}, + "g_V_count_discard": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Count().Discard()}}, + "g_V_hasLabelXpersonX_discard": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().HasLabel("person").Discard()}}, + "g_VX1X_outXcreatedX_discard": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V(p["vid1"]).Out("created").Discard()}}, "g_V_discard": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Discard()}}, "g_V_discard_discard": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Discard().Discard()}}, "g_V_discard_fold": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Discard().Fold()}}, 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 5c23d7a430..1815521452 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 @@ -203,6 +203,9 @@ const gremlins = { g_V_properties_dedup_count: [function({g}) { return g.addV("person").property("name", "josh").addV("person").property("name", "josh").addV("person").property("name", "josh") }, function({g}) { return g.V().properties("name").dedup().count() }], g_V_properties_dedup_byXvalueX_count: [function({g}) { return g.addV("person").property("name", "josh").addV("person").property("name", "josh").addV("person").property("name", "josh") }, function({g}) { return g.V().properties("name").dedup().by(T.value).count() }], g_V_both_hasXlabel_softwareX_dedup_byXlangX_byXnameX_name: [function({g}) { return g.V().both().has(T.label, "software").dedup().by("lang").by("name").values("name") }], + g_V_count_discard: [function({g}) { return g.V().count().discard() }], + g_V_hasLabelXpersonX_discard: [function({g}) { return g.V().hasLabel("person").discard() }], + g_VX1X_outXcreatedX_discard: [function({g, vid1}) { return g.V(vid1).out("created").discard() }], g_V_discard: [function({g}) { return g.V().discard() }], g_V_discard_discard: [function({g}) { return g.V().discard().discard() }], g_V_discard_fold: [function({g}) { return g.V().discard().fold() }], diff --git a/gremlin-python/src/main/python/radish/gremlin.py b/gremlin-python/src/main/python/radish/gremlin.py index 64d5257aa9..8e61ccaf51 100644 --- a/gremlin-python/src/main/python/radish/gremlin.py +++ b/gremlin-python/src/main/python/radish/gremlin.py @@ -176,6 +176,9 @@ world.gremlins = { 'g_V_properties_dedup_count': [(lambda g:g.add_v('person').property('name', 'josh').add_v('person').property('name', 'josh').add_v('person').property('name', 'josh')), (lambda g:g.V().properties('name').dedup().count())], 'g_V_properties_dedup_byXvalueX_count': [(lambda g:g.add_v('person').property('name', 'josh').add_v('person').property('name', 'josh').add_v('person').property('name', 'josh')), (lambda g:g.V().properties('name').dedup().by(T.value).count())], 'g_V_both_hasXlabel_softwareX_dedup_byXlangX_byXnameX_name': [(lambda g:g.V().both().has(T.label, 'software').dedup().by('lang').by('name').values('name'))], + 'g_V_count_discard': [(lambda g:g.V().count().discard())], + 'g_V_hasLabelXpersonX_discard': [(lambda g:g.V().has_label('person').discard())], + 'g_VX1X_outXcreatedX_discard': [(lambda g, vid1=None:g.V(vid1).out('created').discard())], 'g_V_discard': [(lambda g:g.V().discard())], 'g_V_discard_discard': [(lambda g:g.V().discard().discard())], 'g_V_discard_fold': [(lambda g:g.V().discard().fold())], diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/filter/Discard.feature b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/filter/Discard.feature index 25e0dadff0..985437847c 100644 --- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/filter/Discard.feature +++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/filter/Discard.feature @@ -15,9 +15,37 @@ # specific language governing permissions and limitations # under the License. -@StepClassFilter @StepDiscard +@StepClassMap @StepDiscard Feature: Step - discard() + Scenario: g_V_count_discard + Given the modern graph + And the traversal of + """ + g.V().count().discard() + """ + When iterated to list + Then the result should be empty + + Scenario: g_V_hasLabelXpersonX_discard + Given the modern graph + And the traversal of + """ + g.V().hasLabel("person").discard() + """ + When iterated to list + Then the result should be empty + + Scenario: g_VX1X_outXcreatedX_discard + Given the modern graph + And using the parameter vid1 defined as "v[marko].id" + And the traversal of + """ + g.V(vid1).out("created").discard() + """ + When iterated to list + Then the result should be empty + Scenario: g_V_discard Given the modern graph And the traversal of
