Your challenge is to create a Cypher statement that adds the Director
label to all Person
nodes with a DIRECTED
relationship to a Movie
node.
Previously, you used the following Cypher to add the Actor
label to nodes with the ACTED_IN
relationship.
cypher
MATCH (p:Person)-[:ACTED_IN]->()
WITH DISTINCT p SET p:Actor
Actor and Director labels
Once you have added the Director
labels, click the Check Database button to verify that the task is complete.
Hint
Modify the previous query to add the Director
labels to Person
nodes with a DIRECTED
relationship to a Movie
node.
Solution
Run this Cypher statement to add Director
labels to the graph.
cypher
MATCH (p:Person)-[:DIRECTED]->()
WITH DISTINCT p SET p:Director;
Summary
In this challenge, you create a Cypher statement to add a label to an existing node.
Next, you will check your knowledge by taking a short quiz.