Add Users Ratings

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.

A graph showing the User node with userId and name properties

The process is the same as importing from a single file as it is from multiple files:

  1. Upload the ratings.csv.

  2. Create the model for the data, in this case, a User node and a RATED relationship to the Movie node.

  3. Map the columns to the model. The node and the relationship will use the same ratings.csv file.

  4. Import the data.

You can check you have imported the data by running the following query to return User nodes and the RATED relationship:

cypher
MATCH (u:User)-[r:RATED]->(m:Movie)
RETURN u,r,m
LIMIT 25
A graph showing User nodes with RATED relationships to Movie nodes

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:

A screenshot of Data Importer showing a model with `User` nodes and `RATED` relationships to `Movie` nodes.

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.

The Open model (with data) button highlighted 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.