Given edgeId I want to get in & out vertex with edge properties.
I tried the following:
final String edgeId = "edge-nk1-to-nk2";
g.addV("nk_node").property(T.id, "nk1").property("name", "name-nk1").as("n1")
.addV("nk_node").property(T.id, "nk2").property("name", "name-nk2").as("n2")
.addE("friend").property(T.id, edgeId).property("name", "edge-name-prop-value").from("n1").to("n2")
.next();
System.out.println("---------------------------------------------------------------------------------");
final Object usingBothVOutput = g.E(edgeId).as("edge")
.bothV().as("nodes")
.select("edge", "nodes").by(valueMap(true))
.toList();
System.out.println(usingBothVOutput);
System.out.println("--------------------------------------------------------------------------------");
final Path path = g.E(edgeId).as("edge").bothV().path().next();
System.out.println(path);
With output:
---------------------------------------------------------------------------------
[{edge={id=edge-nk1-to-nk2, label=friend, name=edge-name-prop-value}, nodes={id=nk1, label=nk_node, name=[name-nk1]}}, {edge={id=edge-nk1-to-nk2, label=friend, name=edge-name-prop-value}, nodes={id=nk2, label=nk_node, name=[name-nk2]}}]
--------------------------------------------------------------------------------
path[e[edge-nk1-to-nk2][nk1-friend->nk2], v[nk1]]
The first query output has both nodes but has no indication which one is IN and which one is OUT. The path query has the IN and OUT vertex explicitly stated, however, it doesn't have the property of the edge.