Reputation: 522
In Tinkerpop Gremlin, I have two select query
g.V().has("id","foo").out().values("x").toList();
g.V().has("bar","foo").out().values("id").toList();
Now Can we club these query into one batched tinkerpop gremlin?
I tried
g.V().has("id","foo").out().values("x").union(__.V().has("bar","foo").out().values("id")).toList()
but this leads to a single list instead of two separate list. I want to extract the response of these two queries separately.
Upvotes: 0
Views: 410
Reputation: 46206
You could start your traversal with some dummy value and then union()
the two traversals together:
gremlin> g.inject(0).union(V(1).out().fold(),V(2).in().fold())
==>[v[3],v[2],v[4]]
==>[v[1]]
Upvotes: 1