Reputation: 23322
I'm trying to learn Cypher.
In their online console, I am trying to write a query that will give me all the actors (label "Person") who have played in the same movie as Hugo Weaving.
Based on what I've read so far, this should work:
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)-[:ACTED_IN]->(hugo:Person{Name:"Hugo Weaving"})
RETURN p.Name
However, it is not.
I've also tried:
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
WHERE (:Person{Name:"Hugo Weaving"})-[:ACTED_IN]->(m)
RETURN p.Name
But again - no avail.
Does anyone know what I'm doing wrong?
Upvotes: 0
Views: 843
Reputation: 2583
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)<-[:ACTED_IN]-(hugo:Person{name:"Hugo Weaving"})
RETURN p.name
direction of the relation in your query (m:Movie)<-[:ACTED_IN]-(hugo:Person
is causing the problem
Upvotes: 4