I am using Neo4J browser version - Neo4j is 3.5.
I am learning Cypher by ":play intro-neo4j-exercises" command in Neo4j browser.
My question is one of the exercise below, I am not able to understand this query :
Exercise 4.11: Retrieve the movies and their actors where one of the actors also directed the movie (Solution)
Retrieve the movies and their actors where one of the actors also directed the movie, returning the actors names, the director’s name, and the movie title.
Solution is:
MATCH (a1:Person)-[:ACTED_IN]->(m:Movie)<-[:ACTED_IN]-(a2:Person)
WHERE exists( (a2)-[:DIRECTED]->(m) )
RETURN a1.name as Actor, a2.name as Actor/Director
, m.title as Movie
Questions:
-
I am not able to understand first line in the above code.
-
Any difference if we reference node by variable or by node type , like if I refer WHERE clause with (m) or (:Movie)