The ACTED_IN relationship
In this lesson, you will learn how to create relationships between nodes.
The ACTED_IN relationship connects a Person node to a Movie node. This relationship indicates that the person acted in the movie.
The relationship has a property called role that stores the name of the character a person played in the movie.
Creating Relationships
The process for creating relationships is similar to creating nodes:
-
Upload the data
-
Create the relationship in the model
-
Map the fields
-
Run the import
Upload the data
The acted_in.csv file contains the data to match the Person nodes to the Movie nodes.
The file contains the following columns:
-
movieId- The unique identifier of the movie -
person_tmdbId- the unique identifier of the person -
role- the role the person played
Download the acted_in.csv file and upload it to Data Importer.
Create the relationship
To create a relationship between nodes, hover over the edge of the start node, click, and drag the relationship to the end node.
Create the relationship
To create the ACTED_IN relationship, you need to:
-
Create a relationship between the
PersonandMovienodes -
Set the relationship type to
ACTED_IN -
Select the
acted_in.csvfile -
Set the Node ID mapping for the
PersonandMovienodes:Node
ID
ID column
From
PersontmdbIdperson_tmdbIdTo
MoviemovieIdmovieId -
Map the
roleproperty from the file to the relationship
Deleting relationships
You can remove an unwanted relationship by selecting the relationship and pressing the delete key.
Once you have set up the relationship, you can run the import.
View the data
You can check that the ACTED_IN relationships have been created by running the following query to find the actors in the movie "Toy Story":
MATCH (p:Person)-[r:ACTED_IN]->(m:Movie)
WHERE m.title = 'Toy Story'
RETURN p,r,mNeed to download a working solution?
This Data Importer model, person-movie-acted_in-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.
Continue
Summary
In this lesson, you learned how to create relationships between nodes.
In the next challenge, you will use what you have learned to import the DIRECTED relationship between Person and Movie nodes.