Database Reference
In-Depth Information
Note
The resulting nodes will have to match all comma-separated patterns, acting effectively as
a big AND clause.
The interesting bit here is that you use the same nodes as anchors in both patterns (both
patterns start with the same john node, and both patterns match the same node named
movie ).
If you run this query, you'll get a single result, Fargo :
| Node[4]{name->"Fargo",type->"Movie"} |
Obviously, this isn't the result you wanted. You matched all movies John's friends have
seen (resulting in all three movies), and then matched those to the movies John has seen,
resulting in all movies that both John and some of John's friends have seen.
While this can be a useful query (if you want an answer to “What movies do John and his
friends have in common?”), this isn't the answer you want here.
You need to replace the second pattern with a pattern that matches the nonexistence of the
relationship: movies that John has not seen. The following snippet illustrates how you can
use the NOT clause syntax to find all movies that John's friends have seen, but John hasn't:
The first pattern is exactly the same as before—matching movies John's friends have seen
. The second pattern, part of the where clause, filters out the movies returned by the
first pattern, optionally connected via a HAS_SEEN relationship
.
Search WWH ::




Custom Search