In this challenge, you will add movie ratings to the graph.
You will create a new node for each User
and a RATED
relationship between the User
and the Movie
nodes.
The data for the node and relationship is stored in a single file, ratings.csv
, which contains the following columns:
-
movieId
: The ID of the movie that the user rated. -
userId
: The user’s ID. -
name
: The user’s name. -
rating
: The user’s rating of the movie. -
timestamp
: The timestamp when the user created the rating.
The User
node should have userId
and name
properties, and the RATED
relationship should have rating
and timestamp
properties.
The process is the same as importing from a single file as it is from multiple files:
-
Upload the
ratings.csv
. -
Create the model for the data, in this case, a
User
node and aRATED
relationship to theMovie
node. -
Map the columns to the model. The node and the relationship will use the same
ratings.csv
file. -
Import the data.
You can check you have imported the data by running the following query to return User
nodes and the RATED
relationship:
MATCH (u:User)-[r:RATED]->(m:Movie)
RETURN u,r,m
LIMIT 25
Validate Results
Once you have imported the User
nodes and RATED
relationship, click the Check Database button to verify that the task is complete.
Hint
Your Data Importer model should look similar to this:
The User
nodes and RATED
relationships should both use the rating.csv
file.
Solution
This Data Importer model, person-movie-user-import.zip, contains a working solution for this exercise.
Download the model and open it using the Open model (with data) button
in the …
menu.
Note that this will replace your existing model.
Review the model; the User
nodes and RATED
relationships are imported from the rating.csv
file.
Run the import to import the user ratings.
Summary
In this lesson, you learned how to import multiple nodes and relationships from a single file.
In the next lesson, you will explore the considerations for using Data Importer.