cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site maintenance this Wednesday, February 1. Disruptions expected as we migrate the forums.

Angela Thompson interacts with Braveheart movie. Recommend her a Movie based on other users who ...

miklov
Node Link

Angela Thompson interacts with Braveheart movie. Recommend her a Movie based on other users who have also seen Braveheart.

Hello, 

I've been trying to code the above from the MovieLens database but i dont get it right. This is what i did so far, can someone help please?

MATCH (u1:User{name:"Angela Thompson"})

MATCH(m1:Movie {title: "Braveheart"})

MATCH (u1:User{name:"Angela Thompson"})-[:RATED]->(m1:Movie)-[:IN_GENRE]->(g:Genre)<-[:IN_GENRE]-(m2:Movie)<-[:RATED]-(m1:Movie {title: "Braveheart"})

WITH  COUNT(*) AS usersWhoAlsoWatched

RETURN *;

8 REPLIES 8

glilienfield
Ninja
Ninja

What is your database model? 

Hello glilienfield,

I am using the MovieLens database

Execute this command in Neo4j Browser:

CALL db.schema.visualization();

 and upload the result here.

 

This is what i got

This query should do what you want:

MATCH (u:User {name: "Angela Thompson"})-[:RATED]->(:Movie {title: "Braveheart"})<-[:RATED]-(:User)-[:RATED]->(m:Movie)
RETURN m.title AS movie, count(*) AS count

It only gives me a table, how do i get the graph?

What graph do you want? If you want to see Movie nodes, just do:

RETURN m, count(*) AS count

i want to see this graph

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online