In this lesson, you will learn how to create relationships between nodes.
To complete this activity, you will need the acted_in.csv file that contains the data to match the Person nodes to the Movie nodes.
The ACTED_IN relationship
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.
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.
You then give the relationship a type, choose which IDs to use to match the nodes in the relationship, and set up any properties.
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.
Check Your Understanding
Relationship Properties
True or False - Relationships can only have the start and end node IDs as properties.
- 
❏ True
 - 
✓ False
 
Hint
Relationships in Neo4j are first-class citizens and can have properties just like nodes.
Solution
The statement is False - Relationships can have properties, and you can map them from source files.
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.