0
votes

Query to find all the title of movies that an actor in Cloud Atlast acted in, for each movie title , also return the name of these actors

MATCH (m:Movie {title:"Cloud Atlast"})<-[:ACTED_IN]-(p:Person)
RETURN p.name, m.title

Kindly tell me what did I missed

2
You have a typo in the title - the movie's name is Cloud Atlas.Gabor Szarnyas

2 Answers

0
votes

Sounds like you just need to extend your pattern out and aggregate the actors per movie:

MATCH (:Movie {title:"Cloud Atlas"})<-[:ACTED_IN]-(p)-[:ACTED_IN]->(m)
RETURN m.title as title, collect(p.name) as actors

As you're using the movies graph, we can assume that :ACTED_IN relationships only connect :Person nodes to :Movie nodes, so we can remove the labels from the later parts of the path.

0
votes

I think this is what you want :

    MATCH (:Movie {title:"Cloud Atlas"})<-[:ACTED_IN]-(p)-[:ACTED_IN]->(m)<-[:ACTED_IN]-(others)
    RETURN m.title as title, collect(others.name) as actors