Traversing Relationships

Now for a challenge, use what you have learnt to answer the following question.

Who directed the movie Cloud Atlas?

Complete the Cypher query to find who directed the movie Cloud Atlas.

Replace the ????? with the correct Cypher to:

  1. MATCH using the DIRECTED relationship between (:Person) and (:Movie) nodes.

  2. RETURN the name property of the (:Person) nodes.

cypher
MATCH (m:Movie {title: "Cloud Atlas"})<-[:?????]-(p:?????)
RETURN p.?????

Select all the directors that apply:

  • ✓ Tom Tykwer

  • ❏ Robert Zemeckis

  • ✓ Lana Wachowski

  • ✓ Lilly Wachowski

Hint

You need to find the Person nodes that have a [:DIRECTED] relationship to the Cloud Atlas Movie node.

You can find the director names using the name property of the Person node.

There is more than one director for the movie Cloud Atlas. Select all that apply.

Solution

You can use the following query to find who directed Cloud Atlas:

cypher
MATCH (m:Movie {title: "Cloud Atlas"} )<-[:DIRECTED]-(p:Person)
RETURN p.name

The directors of Cloud Atlas are:

  • Tom Tykwer

  • Lana Wachowski

  • Lilly Wachowski

Summary

In this challenge, you demonstrated your skills in traversing the graph. Next you will demonstrate more skills in traversing the graph.