I've been trying to filter all nodes that are not connected to nodes of a given type, and discovered an odd behavior.
Specifically in my current small example, I had two actors connected to a single movie, and another movie with nothing connected to it.
This query worked fine:
MATCH (a:Actor) WHERE NOT (a)-->(:Movie) RETURN a
It returned no actors, as both actors starred in my one movie.
However, when I wrote it like this
MATCH (a:Actor),(m:Movie) WHERE NOT (a)-->(m) RETURN a
it returned both actors.
In reverse, the query
MATCH (m:Movie) WHERE NOT (m)<--(:Actor) RETURN m
worked as expected, returning the movie nobody starred in, but this time,
MATCH (m:Movie),(a:Actor) WHERE NOT (m)<--(a) RETURN m
also returned only the movie nobody starred in! What was odd, though, is that it returned 2 rows, both of them being the movie nobody starred in.
All in all, I'm completely confused.