In this Challenge, you will be working with the data you previously imported with the Data Importer and did some transformations already.
This challenge has 3 steps:
-
Add the Actor label to the Person nodes.
-
Add the Director label to the Person nodes.
-
View the labels stored in the graph.
As a reminder, here is the data model we are moving toward where you see that we want Person nodes to have the Actor label and/or Director label, depending upon the type of relationship to a Movie node.

Step 1: Add the Actor labels
Execute this code in the sandbox on the right to add the Actor labels to the graph:
Unresolved directive in lesson.adoc - include::{repository-raw}/main/modules/3-refactoring-imported-data/lessons/6-c-add-labels/add-actor-label.cypher[]
This code should update 353 nodes in the graph.
Step 2: Add the Director labels
Modify and run the code you just executed to add the Director labels to the nodes.
Your execution should update 97 nodes in the graph.
Step 3: Examine the new labels in the graph
Run code into the sandbox on the right to view the node labels. Person nodes now have the additional labels of Actor and/or Director.
Unresolved directive in lesson.adoc - include::{repository-raw}/main/shared/apoc-meta-nodetypeproperties.cypher[]
Validate Results
Once you completed the steps of this Challenge, click the Check Database button and we will check the database for you.
Hint
-
Find all Person nodes that have a :DIRECTED relationship.
-
Use
SET
to set the label to DIRECTED
Solution
Here is the code to set the Director label:
Unresolved directive in questions/verify.adoc - include::{repository-raw}/main/modules/3-refactoring-imported-data/lessons/6-c-add-labels/solution.cypher[]
If your graph does not verify, you may need to:
-
Clear the graph with:
Unresolved directive in questions/verify.adoc - include::{repository-raw}/main/shared/detach-delete-all-nodes.cypher[]
-
Re-import the data once again with the Data Importer
-
Transform the genres, countries, languages properties to lists
-
Add the Director labels
Summary
In this challenge, you added the Actor and Director labels to the Person nodes. In the next lesson, you learn how to refactor the graph to create nodes from properties.