You have refactored the graph to add the Actor label to the appropriate nodes. You must now retest your use cases against the refactored graph.
Note that if you had a fully-scaled graph, you would see differences in the queries that use the Person label vs. the Actor label. You can profile the queries to compare the rows retrieved before an after.
Use case #1: What people acted in a movie?
Run this Cypher code to test this use case using the movie, Sleepless in Seattle.
MATCH (p:Actor)-[:ACTED_IN]-(m:Movie)
WHERE m.title = 'Sleepless in Seattle'
RETURN p.name AS Actor
It should return two names of actors, Tom Hanks, and Meg Ryan.
Use case #3: What movies did a person act in?
Run this Cypher code to test this use case using the person, Tom Hanks.
MATCH (p:Actor)-[:ACTED_IN]-(m:Movie)
WHERE p.name = 'Tom Hanks'
RETURN m.title AS Movie
It should return the movies Apollo 13 and Sleepless in Seattle.
Use case #5: Who was the youngest person to act in a movie?
Run this Cypher code to test this use case with the movie, Hoffa.
MATCH (p:Actor)-[:ACTED_IN]-(m:Movie)
WHERE m.title = 'Hoffa'
RETURN p.name AS Actor, p.born as `Year Born` ORDER BY p.born DESC LIMIT 1
It should return Danny DeVito with his birth year.
Use case #6: What role did a person play in a movie?
Run this Cypher code to test this use case with the movie, Sleepless in Seattle and the person, Meg Ryan.
MATCH (p:Actor)-[r:ACTED_IN]-(m:Movie)
WHERE m.title = 'Sleepless in Seattle' AND
p.name = 'Meg Ryan'
RETURN r.role AS Role
It should return Annie Reed.
Use case #8: What drama movies did an actor act in?
Run this Cypher code to test this use case with the person, Tom Hanks.
MATCH (p:Actor)-[:ACTED_IN]-(m:Movie)
WHERE p.name = 'Tom Hanks' AND
'Drama' IN m.genres
RETURN m.title AS Movie
If you were to change 'Drama' to 'Comedy' in this query, it would return a different result.
Use case #10: What actors were born before 1950?
Run this Cypher code to test this use case with the year 1950.
MATCH (p:Actor)
WHERE p.born < '1950'
RETURN p.name
It should return the actors, Danny DeVito and Jack Nicholson
Run this Cypher code to return everything in the graph and answer the next question.
MATCH (n)
RETURN n
Actor nodes
How many Actor nodes are now in the graph?
-
✓ 4
Hint
As with the previous lessons, you can either write a Cypher statement to return all :Actor
nodes and count them manually or use the following query to return a count of :Actor nodes
:
MATCH (:Actor) RETURN count(*)
Solution
There should now be 4 Actor nodes in your graph.
Summary
In this challenge, you tested the use cases affected by the refactoring to add the Actor label.
In the next Challenge, you will add the Director label to the graph.