Hi,
I'm trying to convert a gremlin query from tinkerpop2 to tinkerpop3 in java.
Gremlin (TP2):
g.V().has("subjectId", "uday").outE("isAssigned").has("receivedStatus", T.in, ["New", "In progress"]).order{it.b.assignedOn <=> it.a.assignedOn}[0..15].as("e_asg").inV().as("v_svc").ifThenElse{it.status == "New"}{it,m -> ["id":it.id, "instanceId":m.v_svc.instanceId, "receivedStatus":m.e_asg.receivedStatus]}{it,m -> it.as('x').outE().inV().loop('x'){it.loops % 2 == 1 || it.object.status == "Completed"}.transform{["id":it.id, "instanceId":m.v_svc.instanceId, "receivedStatus":m.e_asg.receivedStatus, "subFlowId":it.subFlowId, "status":it.status]}}
Java (TP3):
GraphTraversal<Vertex, Vertex> traversal = graph.traversal().V().
has("subjectId", "test").
outE("isAssigned").
has("receivedStatus", P.within(receivedStatuses)).
order().by("assignedOn", Order.decr).range(0, 15).as("e_asg").
inV().as("v_svc");
GraphTraversal<Vertex, Object> t = traversal.
choose((Predicate<Vertex>) it -> it.property("status").value().equals("New"),
traversal.identity().map(it -> it.get().value("status")),
traversal.identity().map(it -> it.get().value("previousStatus")));
Running the java code is throwing this exception:
Method threw 'java.lang.StackOverflowError' exception. Cannot evaluate org.apache.tinkerpop.gremlin.process.traversal.step.branch.ChooseStep.toString()
What am doing wrong? How can I use the identity _() step in TP3 java? Can I use identity in choose step? An example of choose step in Java 8 would be helpful.
Any help much appreciated.