I am very frustrated about very simple things when I try to do a single traversal and bring a lot of stuff from DSE Graph 5.0 at once using Gremlin..
In my simplifie
If Entity:Type
is a 1:n
relationship, then you won't even need optional()
.
g.V().has("Entity","uuid","6708ec6d-4518-4159-9005-9e9d642f157e").
project("entity","types").by().by(outE("IsOfType").fold())
The result will be of type List<Map<String, Object>>
.
UPDATE
Following the short toList()
discussion in the comments below, this is how you can work with a traversal result without storing the whole thing in a collection:
g.V().has("Entity","uuid","6708ec6d-4518-4159-9005-9e9d642f157e")
.project("entity","types").by().by(outE("IsOfType").fold())
.forEachRemaining(m -> {
final Vertex entityV = (Vertex) m.get("entity");
final List<Edge> typeE = (List<Edge>) m.get("types");
// whatever ...
})