https://github.com/famousdraw

Neo4j Fundamentals-The Movie Graph

VIDEO

The Movie Graph

VideoTranscript
 

The Movie graph

Throughout the courses of GraphAcademy, you will use some version of the Movie database to gain experience with Neo4j. In this lesson you will learn about the data in the "starter" Movie database that is used when you are learning Cypher for the first time.

Nodes

The nodes in the Movie database represent people, movies, and in some versions of the Movie database, genres for the movies.

Nodes in the Movie database

The "starter" version of the Movie database contains 171 nodes:

  • 38 Movie nodes (nodes with the label Movie)

  • 133 Person nodes (nodes with the label Person)

This is the database you use to first learn Cypher.

Node properties

Properties of Movie nodes

All Movie nodes have a property, title that is used to uniquely identify a movie. This property exists for all Movie nodes.

Other properties that a Movie node may have are:

  • released, the year that the movie was released.

  • tagline, a phrase to describe the movie.

So for example, we see in these two Movie nodes, they both have a title and released property, but only one of them has a tagline property.

Properties of Person nodes

All Person nodes have a property, name that is used to uniquely identify a person. Some Person nodes have a property, born, but not all of them.

Relationships

As you have learned, the most important element of a graph database is its relationships. A relationship has a type and a direction and represents the relationship between two specific nodes.

Some of the relationships in the "starter" Movie graph include:

Relationship typeDescriptionNumber in graph

ACTED_IN

A Person acted in a Movie

172

DIRECTED

A Person directed a Movie

44

WROTE

A Person wrote a Movie

10

PRODUCED

A Person produced a Movie

15

A person can have multiple relationships to a movie. For example, a person can be both an actor and a director for a particular movie. In the Movie graph, people are either actors, directors, writers and/or producers given these relationships.

hoffa

So, for example, the movie "Hoffa" in the Movie graph has these relationships. It has four actors and one director. Danny DeVito directed and acted in this movie. In our "starter" Movie graph, this movie has no writers or producers defined.

Other relationships in the graph include:

Relationship typeDescriptionNumber in graph

REVIEWED

A Person reviewed a Movie

9

FOLLOWS

A Person follows another Person

3

Using these relationships, people can be reviewers, followers, or followees. In the Movie graph, people who review movies or follow other people are not actors, directors, writers, or producers.

Here are the reviewers in our "starter" Movie graph:

Some movie reviewers

We have three Person nodes here for people who reviewed movies. All three of these reviewers reviewed the movie, The Replacements. Two people here are following Jessica Thompson.

Relationship properties

The ACTED_IN relationship may have the roles property that represents the roles that an actor had when s/he acted in a specific movie.

For example, in the "starter" Movie database, the actor, Hugo Weaving, has these properties defined for each of his ACTED_IN relationships to these movies:

Hugo Weaving roles

For movie reviewers, the REVIEWED relationship has the rating and summary properties:

Reviewed properties

Check your understanding

1. Nodes in the Movies graph

What node labels are used in the Movies graph?

  • Reviewer

  • Person

  • Director

  • Movie

2. Relationships in the Movie graph

What are some of the relationships in the Movie graph?

  • IS_ACTOR

  • ACTED_IN

  • KNOWS

  • FOLLOWS

posted on 2022-05-04 14:03  红色MINI  阅读(58)  评论(0编辑  收藏  举报

导航