Data Model is as follows:
g.addV('A').property('property1',0).property('input','two').next()
g.addV('B').property('property2',0).next()
g.V().has('property1',0).as('fromV').V().has('property2',0).as('toV').addE('AB').from('fromV').to('toV').iterate()
First, need to check whether the node A and B are connected by AB relation. If yes, change the property value for node A according to the given input.
Condition for property value:
if input="one" then 1
else if input="two" then 2
else if input="three" then 3
else 0
Tried the following query:
g.V().has('property1',0).where(outE('AB').inV('B')).property('property1',choose(values('input').is(eq('one')),1,choose(values('input').is(eq('two')),2,choose(values('input').is(eq('three')),3,0))))
Error:
No signature of method: static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.choose() is applicable for argument types: (org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.DefaultGraphTraversal...) values: [[PropertiesStep([input_currency],value), IsStep(eq(Local))], ...]
Possible solutions: choose(java.util.function.Function), choose(org.apache.tinkerpop.gremlin.process.traversal.Traversal), choose(java.util.function.Predicate, org.apache.tinkerpop.gremlin.process.traversal.Traversal), choose(org.apache.tinkerpop.gremlin.process.traversal.Traversal, org.apache.tinkerpop.gremlin.process.traversal.Traversal), choose(java.util.function.Predicate, org.apache.tinkerpop.gremlin.process.traversal.Traversal, org.apache.tinkerpop.gremlin.process.traversal.Traversal), choose(org.apache.tinkerpop.gremlin.process.traversal.Traversal, org.apache.tinkerpop.gremlin.process.traversal.Traversal, org.apache.tinkerpop.gremlin.process.traversal.Traversal)
Type ':help' or ':h' for help.
Display stack trace? [yN]