Description
Not yet tested in older versions.
What follows are two queries that only differ in where as("p2").select("p1","p2") is done. p1 is a person and p2 is (supposed to be) either a person known by p1 or - if p1 doesn't know anybody - the same as p1.
OLTP (all good):
gremlin> g = TinkerFactory.createModern().traversal() ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard] gremlin> g.V().hasLabel("person").as("p1").choose(outE("knows"), out("knows"), identity()).as("p2").select("p1","p2") ==>[p1:v[1],p2:v[2]] ==>[p1:v[1],p2:v[4]] ==>[p1:v[2],p2:v[2]] ==>[p1:v[4],p2:v[4]] ==>[p1:v[6],p2:v[6]] gremlin> g.V().hasLabel("person").as("p1").choose(outE("knows"), out("knows").as("p2").select("p1","p2"), __.as("p2").select("p1","p2")) ==>[p1:v[1],p2:v[2]] ==>[p1:v[1],p2:v[4]] ==>[p1:v[2],p2:v[2]] ==>[p1:v[4],p2:v[4]] ==>[p1:v[6],p2:v[6]]
OLAP (only works when select() is done twice - once for each branch):
gremlin> g = g.withComputer() ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], graphcomputer] gremlin> g.V().hasLabel("person").as("p1").choose(outE("knows"), out("knows"), identity()).as("p2").select("p1","p2") ==>[p1:v[1],p2:v[1]] ==>[p1:v[1],p2:v[1]] gremlin> g.V().hasLabel("person").as("p1").choose(outE("knows"), out("knows").as("p2").select("p1","p2"), __.as("p2").select("p1","p2")) ==>[p1:v[2],p2:v[2]] ==>[p1:v[4],p2:v[4]] ==>[p1:v[6],p2:v[6]] ==>[p1:v[1],p2:v[2]] ==>[p1:v[1],p2:v[4]]
Attachments
Issue Links
- links to