In this Challenge, you will working with the data you previously imported with the Data Importer and did some transformations already.
This challenge has 4 steps:
-
Create the constraint for the Genre nodes.
-
Create the Genre nodes.
-
Remove the genres property.
-
Verify your final schema for the data model
As a reminder, here is the data model we are moving toward where you see that we want to add the Genre nodes to the graph.

Step 1: Create the constraint
Execute this code in the sandbox on the right to add the uniqueness constraint for the Genre nodes to the graph:
Unresolved directive in lesson.adoc - include::{repository-raw}/main/modules/3-refactoring-imported-data/lessons/7-nodes-from-properties/create-genre-constraint.cypher[]
After you have added this constraint, try running SHOW CONSTRAINTS
.
Step 2: Create the Genre nodes
Execute this code in the sandbox on the right to create the Genre nodes in the graph, and the IN_GENRE relationships:
Unresolved directive in lesson.adoc - include::{repository-raw}/main/modules/3-refactoring-imported-data/lessons/7-nodes-from-properties/merge-genre-nodes.cypher[]
Your execution should create 17 Genre nodes and 212 IN_GENRE relationships.
Step 3: Remove the genres property
Now that we have the Genre nodes, we no longer need the genres property in the Movie nodes.
Run code into the sandbox on the right to remove the genres property.
Unresolved directive in lesson.adoc - include::{repository-raw}/main/modules/3-refactoring-imported-data/lessons/7-nodes-from-properties/remove-genres-property.cypher[]
Your execution should set 93 properties.
Step 4: View the final schema
Your post-import refactoring of the graph should now be complete. View the schema.
Unresolved directive in lesson.adoc - include::{repository-raw}/main/shared/db-schema-visualization.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
Did you execute the three code blocks shown in this Challenge?
Solution
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, and language properties to lists
-
Add the Actor and Director labels
-
Execute the three code blocks of this Challenge
Summary
In this challenge, you performed the final steps to refactor the graph to match the target data model. In the next module, you learn about importing larger datasets.