Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-02-2019 04:00 PM
The query below -
MATCH (p:Person)-[:WROTE]->(m:Movie)
WHERE NOT exists( (p)-[:DIRECTED]->() )
RETURN p.name, m.title
reads as such, correct?
"Match all people who wrote a movie who did not direct ANY movie"
It does not read as the following:
"Match all people who wrote a movie who did not direct THAT movie"
for it to be "that" movie, the query would have to include the following:
NOT exists( (p)-[:DIRECTED]->(m) )
Additionally, the following:
MATCH (gene:Person)-[:ACTED_IN]->(m:Movie)<-[:ACTED_IN]-(other:Person)
WHERE gene.name= 'Gene Hackman'
AND exists( (other)-[:DIRECTED]->() )
RETURN gene, other, m
Reads as -
"find Gene Hackman and ANY movie that he acted in
with another person who also directed ANY movie"
And NOT as -
"find Gene Hackman and THE movies that he acted in
with another person who also directed THE movie"
correct?
02-02-2019 04:40 PM
Yes, all your assumptions here are correct. Note that in your WHERE clause the exists()
function isn't really needed, it's enough to do WHERE <pattern>
or WHERE NOT <pattern>
All the sessions of the conference are now available online