Skip to content

Commit

Permalink
Minor adjustment to test semantics for select() CTR
Browse files Browse the repository at this point in the history
  • Loading branch information
spmallette committed Nov 12, 2024
1 parent 0ebd920 commit 04fc394
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ private static IDictionary<string, List<Func<GraphTraversalSource, IDictionary<s
{"g_V_asXa_nX_selectXa_nX_byXageX_byXnameX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().As("a","n").Select<object>("a","n").By("age").By("name")}},
{"g_withStrategiesXProductiveByStrategyX_V_asXaX_selectXaX_byXageX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.WithStrategies(new ProductiveByStrategy(productiveKeys: new List<object> {})).V().As("a").Select<object>("a").By("age")}},
{"g_withSideEffectXk_nullX_injectXxX_selectXkX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.WithSideEffect("k",null).Inject("x").Select<object>("k")}},
{"g_V_out_in_selectXall_a_a_aX_byXunfold_name_foldX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.AddV("A").Property("name","a1").As("a1").AddV("A").Property("name","a2").As("a2").AddV("A").Property("name","a3").As("a3").AddV("B").Property("name","b1").As("b1").AddV("B").Property("name","b2").As("b2").AddV("B").Property("name","b3").As("b3").AddE("ab").From("a1").To("b1").AddE("ab").From("a2").To("b2").AddE("ab").From("a3").To("b3"), (g,p) =>g.V().As("a").Out().As("a").In().As("a").Select<object>(Pop.All,"a","a","a").By(__.Unfold<object>().Values<object>("name").Fold())}},
{"g_V_out_in_selectXall_a_a_aX_byXunfold_name_foldX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.AddV("A").Property("name","a1").As("a1").AddV("B").Property("name","b1").As("b1").AddE("ab").From("a1").To("b1"), (g,p) =>g.V().As("a").Out().As("a").In().As("a").Select<object>(Pop.All,"a","a","a").By(__.Unfold<object>().Values<object>("name").Fold())}},
{"g_V_asXlabelX_aggregateXlocal_xX_selectXxX_selectXlabelX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().As("label").Aggregate(Scope.Local,"x").Barrier().Select<object>("x").Select<object>("label")}},
{"g_V_name_asXaX_selectXfirst_aX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Values<object>("name").As("a").Select<object>(Pop.First,"a")}},
{"g_V_name_asXaX_selectXlast_aX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Values<object>("name").As("a").Select<object>(Pop.Last,"a")}},
Expand Down
2 changes: 1 addition & 1 deletion gremlin-go/driver/cucumber/gremlin.go
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ var translationMap = map[string][]func(g *gremlingo.GraphTraversalSource, p map[
"g_V_asXa_nX_selectXa_nX_byXageX_byXnameX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().As("a", "n").Select("a", "n").By("age").By("name")}},
"g_withStrategiesXProductiveByStrategyX_V_asXaX_selectXaX_byXageX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.WithStrategies(gremlingo.ProductiveByStrategy(gremlingo.ProductiveByStrategyConfig{ProductiveKeys: []string{}})).V().As("a").Select("a").By("age")}},
"g_withSideEffectXk_nullX_injectXxX_selectXkX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.WithSideEffect("k", nil).Inject("x").Select("k")}},
"g_V_out_in_selectXall_a_a_aX_byXunfold_name_foldX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.AddV("A").Property("name", "a1").As("a1").AddV("A").Property("name", "a2").As("a2").AddV("A").Property("name", "a3").As("a3").AddV("B").Property("name", "b1").As("b1").AddV("B").Property("name", "b2").As("b2").AddV("B").Property("name", "b3").As("b3").AddE("ab").From("a1").To("b1").AddE("ab").From("a2").To("b2").AddE("ab").From("a3").To("b3")}, func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().As("a").Out().As("a").In().As("a").Select(gremlingo.Pop.All, "a", "a", "a").By(gremlingo.T__.Unfold().Values("name").Fold())}},
"g_V_out_in_selectXall_a_a_aX_byXunfold_name_foldX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.AddV("A").Property("name", "a1").As("a1").AddV("B").Property("name", "b1").As("b1").AddE("ab").From("a1").To("b1")}, func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().As("a").Out().As("a").In().As("a").Select(gremlingo.Pop.All, "a", "a", "a").By(gremlingo.T__.Unfold().Values("name").Fold())}},
"g_V_asXlabelX_aggregateXlocal_xX_selectXxX_selectXlabelX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().As("label").Aggregate(gremlingo.Scope.Local, "x").Barrier().Select("x").Select("label")}},
"g_V_name_asXaX_selectXfirst_aX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Values("name").As("a").Select(gremlingo.Pop.First, "a")}},
"g_V_name_asXaX_selectXlast_aX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Values("name").As("a").Select(gremlingo.Pop.Last, "a")}},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gremlin-python/src/main/python/radish/gremlin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@
'g_V_asXa_nX_selectXa_nX_byXageX_byXnameX': [(lambda g:g.V().as_('a','n').select('a','n').by('age').by('name'))],
'g_withStrategiesXProductiveByStrategyX_V_asXaX_selectXaX_byXageX': [(lambda g:g.withStrategies(*[TraversalStrategy('ProductiveByStrategy',{'productiveKeys':[],'strategy':'org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.ProductiveByStrategy'}, 'org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.ProductiveByStrategy')]).V().as_('a').select('a').by('age'))],
'g_withSideEffectXk_nullX_injectXxX_selectXkX': [(lambda g:g.withSideEffect('k',None).inject('x').select('k'))],
'g_V_out_in_selectXall_a_a_aX_byXunfold_name_foldX': [(lambda g:g.addV('A').property('name','a1').as_('a1').addV('A').property('name','a2').as_('a2').addV('A').property('name','a3').as_('a3').addV('B').property('name','b1').as_('b1').addV('B').property('name','b2').as_('b2').addV('B').property('name','b3').as_('b3').addE('ab').from_('a1').to('b1').addE('ab').from_('a2').to('b2').addE('ab').from_('a3').to('b3')), (lambda g:g.V().as_('a').out().as_('a').in_().as_('a').select(Pop.all_,'a','a','a').by(__.unfold().name.fold()))],
'g_V_out_in_selectXall_a_a_aX_byXunfold_name_foldX': [(lambda g:g.addV('A').property('name','a1').as_('a1').addV('B').property('name','b1').as_('b1').addE('ab').from_('a1').to('b1')), (lambda g:g.V().as_('a').out().as_('a').in_().as_('a').select(Pop.all_,'a','a','a').by(__.unfold().name.fold()))],
'g_V_asXlabelX_aggregateXlocal_xX_selectXxX_selectXlabelX': [(lambda g:g.V().as_('label').aggregate(Scope.local,'x').barrier().select('x').select('label'))],
'g_V_name_asXaX_selectXfirst_aX': [(lambda g:g.V().name.as_('a').select(Pop.first,'a'))],
'g_V_name_asXaX_selectXlast_aX': [(lambda g:g.V().name.as_('a').select(Pop.last,'a'))],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -880,14 +880,8 @@ Feature: Step - select()
And the graph initializer of
"""
g.addV("A").property("name", "a1").as("a1").
addV("A").property("name", "a2").as("a2").
addV("A").property("name", "a3").as("a3").
addV("B").property("name", "b1").as("b1").
addV("B").property("name", "b2").as("b2").
addV("B").property("name", "b3").as("b3").
addE("ab").from("a1").to("b1").
addE("ab").from("a2").to("b2").
addE("ab").from("a3").to("b3")
addE("ab").from("a1").to("b1")
"""
And the traversal of
"""
Expand All @@ -896,11 +890,11 @@ Feature: Step - select()
by(unfold().values('name').fold())
"""
When iterated to list
Then the result should be unordered
Then the result should be of
| result |
| m[{"a":["a1","b1","a1"]}] |
| m[{"a":["a2","b2","a2"]}] |
| m[{"a":["a3","b3","a3"]}] |
| m[{"a":["a1","a1","b1"]}] |
| m[{"a":["b1","a1","a1"]}] |

Scenario: g_V_asXlabelX_aggregateXlocal_xX_selectXxX_selectXlabelX
Given the modern graph
Expand Down

0 comments on commit 04fc394

Please sign in to comment.