Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query consult #286

Open
TCGOGOGO opened this issue Apr 10, 2019 · 5 comments
Open

Query consult #286

TCGOGOGO opened this issue Apr 10, 2019 · 5 comments

Comments

@TCGOGOGO
Copy link

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?

@yatli
Copy link
Contributor

yatli commented Apr 22, 2019

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)

@TCGOGOGO
Copy link
Author

Hi yatao,I am not clearly that the second outV comes after node C?but D is directly connected to A.

@yatli
Copy link
Contributor

yatli commented Apr 22, 2019

I'm mistaken. In this case you'd better traverse back to the parent vertex in the path

@yatli
Copy link
Contributor

yatli commented Apr 22, 2019

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.

@TCGOGOGO
Copy link
Author

but D is still followed by C in such query?I think we have to do a backtrack here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants