Skip to content

Latest commit

 

History

History
84 lines (56 loc) · 3.96 KB

File metadata and controls

84 lines (56 loc) · 3.96 KB

DEMO:Movie

This document mainly introduces the usage of the movie demo.

1.Modeling and Data Import

After logging in, click "Create Graph Project", select the movie dataset, fill in the graph project configuration, and the system will automatically complete the creation of the Movie scenario graph project.Other scenarios can also be created in the same manner.

Movie:

movie_schema

Label Type Description
movie Vertex Represents a specific movie, such as "Forrest Gump".
person Vertex Represents a person, who may be an actor, director, or screenwriter for a movie.
genre Vertex Represents the genre of a movie, such as drama, horror.
keyword Vertex Represents some keywords related to the movie, such as "save the world", "virtual reality", "subway".
user Vertex Represents a user who watches movies.
produce Edge Represents the relationship between the producer of a movie.
acted_in Edge Represents the relationship between actors and the movies they have appeared in.
direct Edge Represents the relationship between a movie and its director.
write Edge Represents the screenwriting relationship of a movie.
has_genre Edge Represents the genre classification of a movie.
has_keyword Edge Represents some keywords of a movie, which are more specific labels for classification.
rate Edge Represents the rating given by a user to a movie.

2.Query Examples

2.1.Example One

Query all actors of the movie 'Forrest Gump' and return the subgraph composed of the movie and the actors.

MATCH (m:movie {title: 'Forrest Gump'})<-[:acted_in]-(a:person) RETURN a, m

2.2.Example Two

Query all actors of the movie 'Forrest Gump' and list the roles they played in the movie.

MATCH (m:movie {title: 'Forrest Gump'})<-[r:acted_in]-(a:person) RETURN a.name,r.role

2.3.Example Three

Query all movies rated below 3 by Michael.

MATCH (u:user {login: 'Michael'})-[r:rate]->(m:movie) WHERE r.stars < 3 RETURN m.title, r.stars

2.4.Example Four

Query users who have the same dislike of movies as Michael, where the standard for dislike is a rating of less than three.

MATCH (u:user {login: 'Michael'})-[r:rate]->(m:movie)<-[s:rate]-(v) WHERE r.stars < 3 AND s.stars < 3 RETURN u, m, v

2.5.Example Five

Recommend movies to Michael by first finding users who dislike the same movies as Michael, and then filtering out the movies that these users like.

MATCH (u:user {login: 'Michael'})-[r:rate]->(m:movie)<-[s:rate]-(v)-[r2:rate]->(m2:movie) WHERE r.stars < 3 AND s.stars < 3 AND r2.stars > 3 RETURN u, m, v, m2

2.6.Example Six

Query the movies that Michael's friends like.

MATCH (u:user {login: 'Michael'})-[:is_friend]->(v:user)-[r:rate]->(m:movie) WHERE r.stars > 3 RETURN u, v, m

2.7.Example Seven

By querying the movies that people who gave 'Forrest Gump' a high rating also like, recommend similar movies to users who like 'Forrest Gump'.

MATCH (m:movie {title:'Forrest Gump'})<-[r:rate]-(u:user)-[r2:rate]->(m2:movie) WHERE r.stars>3 AND r2.stars>3 RETURN m, u,m2