I have a traversal that I create two vertices and I connect them with an edge like that:
DseCluster dseCluster = null;
dseCluster = DseCluster.builder()
.addContactPoint(DbC.dseHost)
.build();
DseSession dseSession = dseCluster.connect();
GraphTraversalSource g = DseGraph.traversal(dseSession, new GraphOptions().setGraphName(DbC.graphName));
GraphTraversal traversal = g
.addV("aLabel").as("a")
.addV("aLabel").as("b")
.addE("edgeLabel").from("a").to("b")
GraphStatement graphStatement = DseGraph.statementFromTraversal(traversal);
GraphResultSet grs = dseSession.executeGraph(graphStatement.setGraphName(DbC.graphName));
//grs contains an edge only
How can I make the resultset contain only a specific vertex like "a" source vertex for example?
I know I could do instead:
GraphTraversal traversal = g
.addV("aLabel").as("a")
.addV("aLabel").as("b")
.addE("edgeLabel").from("a").to("b").outV() // this returns a
but I am looking in a solution like
GraphTraversal traversal = g
.addV("aLabel").as("a")
.addV("aLabel").as("b")
.addE("edgeLabel").from("a").to("b").emit("a") // this doesn't work
Thanks!
The answer that worked is using select:
or