Hello fellow Neo4jers/ians!
Going through the lessons under Querying with Cypher and a question -
Related note from the Cypher Manual page -
In the case of multiple
OPTIONAL MATCHclauses, the predicate in
WHEREis always a part of the patterns in the directly preceding
OPTIONAL MATCH. Both results and performance may be impacted if the
WHEREis put inside the wrong
WHERE valKilmer.name = 'Val Kilmer'
RETURN m.title as movie , actor.name
How is this block processed? I understand MATCH 1 produces a list of Person nodes who acted in a movie. At this point, the MATCH 2 produces a list of Person nodes who acted in the Movie nodes identified in MATCH 1.
Now when the WHERE is applied to MATCH 2, how is does the condition work on the nodes identified in MATCH 2? I do not see a clear connection between them.
In the OPTIONAL MATCH case, it is a little more intuitive since the WHERE is directly placed after the MATCH statement to which it applies. (at least in the examples I have come across).
Your help is appreciated!