I am trying to build complex traversals using Java client to a remote JanusGraph server.
The following traversal returns the ReferenceVertex elements identified by the label "mylabel":
GraphTraversal<Vertex, Vertex> t = g.V().hasLabel("mylabel");
List<Vertex> r = t.toList();
For more complex queries I need to concatenate multiple traversals that form a part of the whole queries. The following code illustrates the concept:
GraphTraversal<Vertex, Vertex> addMe = __.hasLabel("mylabel");
GraphTraversal<Vertex, Vertex> t = g.V();
for (Step<?, ?> step : addMe.asAdmin().getSteps()) {
t.asAdmin().addStep(step);
}
List<Vertex> r = t.toList();
For local access this works. For remote access however, it returns all vertices available on the server, not the ones identified by the label.
In both cases, t.toString() returns
[GraphStep(vertex,[]), HasStep([~label.eq(mylabel)])]
What am I doing wrong?