Lets say I have 2 anonymous traversals A and B. The result for traversal A is V[1], V[2], V[3] and the result for traversal B is V[3], V[4] and V[5].
Both A and B are searching for properties both of which will not be in any single vertex.
"A" traversal searches for property (x == y) which is in V[1] and V[1] is connected to V[2] and V[3] which are part of the traversal result.
"B" traversal searches for property (u == w) which is in V[5] and V[5] is connected to V[3] and V[4] which are part of the traversal result.
How do I find the intersection of these results?
I tried doing :
__.and(A, B)
But the result of this is not intersection.
For E.g:
A = __.has('name', 'marko').out()
B = __.has('name', 'josh').out()
__.and(A, B) is not correct.
Note: Took the above example for simplicity. In actual query A & B is quite big with multiple unions in each of them.
I went through the following links:
https://groups.google.com/forum/#!msg/gremlin-users/6_MRJxBnivo/wT_71IAzCwAJ
gremlin intersection operation
All the suggestions here have provided a way to do intersection provided the vertex satisfies all the conditions which is not the case here.