GraphEngine
GraphEngine copied to clipboard
Query consult
I was confused about one query type recently, wish some advises If my graph is like below root -> A, root -> A' A -> C, A -> D A' -> C', A' -> D' A and A' are nodes with same type but represent two entities (also C,C' and D,D') I want a property of D but need one property in C as filter In more detail, I want a property of D which connected to an A node, and this A node has a sub node C, and C has a given property How can i write LIKQ in such case?
how about:
g.V("A constraints").outV(C v => v.ContinueIf(v.member1 && v.member2)).outV(select: new[] {"member to extract"}, D v =>Action.Return)
Hi yatao,I am not clearly that the second outV comes after node C?but D is directly connected to A.
I'm mistaken. In this case you'd better traverse back to the parent vertex in the path
try this:
g.V("A constraints").outV(C v => v.ContinueIf(v.member1 && v.member2)).outV(select: new[] {"member to extract"}, D v =>v.ReturnIf(v.get_id_in_path(0) == v.CellId))
A bit awkward we have to first traverse to 2nd hop and then examine whether we're on the right track.
but D is still followed by C in such query?I think we have to do a backtrack here.