Example dataset: movie¶
The built-in movie sample dataset contains movies, actors, directors, users, genres, and their relationships.
Data model¶
The dataset uses graph type movie_type and graph movie. In the diagram below, boxes represent node types, and arrows show edge types and their directions:
graph LR
Actor["Actor"] -->|"Act (acts in)"| Movie["Movie"]
Director["Director"] -->|"Direct (directs)"| Movie
User["User"] -->|"Watch (watches)"| Movie
Movie -->|"WithGenre (has genre)"| Genre["Genre"]
Node types¶
Each Movie node represents one movie, and each Actor node represents one actor. The dataset contains five node types:
| Node type | Represents | Label | Properties |
|---|---|---|---|
Actor |
Actor | Person |
id, name, birthDate |
Director |
Director | Person |
id, name, birthDate |
User |
User | Person |
id |
Movie |
Movie | Movie |
id, name |
Genre |
Movie genre | Genre |
id, name |
Actor, Director, and User share the Person label. In a query, @Actor matches actors by type, while :Person matches nodes of all three types by label. See Types and labels for details.
Node properties¶
Properties describe individual nodes. The dataset uses these node properties:
| Property | Data type | Meaning |
|---|---|---|
id |
INT (integer) |
The node's ID and the primary key for its node type. |
name |
STRING (string) |
An actor's or director's name, a movie title, or a genre name. |
birthDate |
DATE (date) |
An actor's or director's date of birth; some records have a NULL value. |
Nodes of the same type must have different id values. Different types can reuse an id. For example, these two nodes both have ID 11, but one represents a movie and the other a genre:
| Node type | id |
name |
|---|---|---|
Movie |
11 | Star Wars: A New Hope |
Genre |
11 | Space Opera |
Nodes with the Person label do not all have the same properties. User has only id, with no name or birthDate.
Edge types and properties¶
An edge connects two nodes and represents their relationship. Edge types distinguish different relationships. Arrows in the table point from the start node to the end node:
| Edge type | Start → end | Meaning | Properties |
|---|---|---|---|
Act |
Actor → Movie |
Actor acts in a movie | None |
Direct |
Director → Movie |
Director directs a movie | None |
Watch |
User → Movie |
User watches a movie | rate: a FLOAT (floating-point) rating |
WithGenre |
Movie → Genre |
Movie belongs to a genre | None |
Each Watch edge stores one user's rating for one movie in its rate property. Ratings for different movies are stored on separate Watch edges.
Each edge type in this dataset has a label with the same name. For example, the Act edge type has the Act label.
Data loading¶
Loading through NebulaGraph Studio or ngql creates graph type movie_type, then graph movie, and then inserts the nodes and edges in the selected Schema. For the complete steps, see Connect and run your first query.
Repeated or interrupted loads
If movie_type or movie already exists, another load can fail because of a name conflict.
If loading is interrupted or fails, check the error and any objects already created before retrying. The existence of graph movie does not mean all the data was loaded. Deleting only the graph may still leave a conflict with movie_type.