MATCH (u:User)-[r:PLAY]->(g:Game)
WHERE r.rating = 5
RETURN g, u
평가 점수가 5점인 게임 : “The Forest”, “Don’t Starve”, “Stardew Valley”, “Battle Ground”, “Day by Daylight”
5점을 준 사람 : “Skunk”, “Frog”, “Giraffe”, “Pig”, “Dog”, “Fox”, “Turtle”
MATCH (s:Streamer)-[:STREAMING]->(g:Game)-[:HAS_GENRE]->(ge:Genre)
WHERE ge.name = “Survival”
RETURN s, g
장르가 “Survival”인 게임 : “Don’t Starve”, “The Forest”, “Day by Daylight”, “Battle Ground”
이를 스트리밍한 스트리머 : “Sky”, “Wind”, “Stone”, “Moon”, “Flower”, “Star”, “Sand”, “Sun”
MATCH (u:User)-[:PLAY]->(g:Game), (s:Streamer{stagename:”Ocean”})
WHERE (s)-[:STREAMING]->(g)
RETURN u, g
“Ocean”이 스트리밍한 게임 : “iRacing”, “Football Manager”
이를 플레이한 유저 : “Elephant”, “Skunk”, “Duck”
MATCH (u:User)-[r:PLAY]->(g:Game)
WHERE g.title=”Battle Ground”
RETURN u.name AS Users, r.playtime AS `Playtime of Battle Ground`
ORDER BY r.playtime DESC
MATCH (u:User)-[r:PLAY]->(g:Game)-[:HAS_GENRE]->(ge:Genre{name:"Adventure"})
WITH avg(r.rating) AS rate_average, g
RETURN g.title AS Game, rate_average
ORDER BY rate_average DESC
LIMIT 1
“Don’t Starve”, 4.5
MATCH (u1:User{name:"Turtle"})-[x:PLAY]->(g:Game)<-[y:PLAY]-(u2:User)
WITH SUM(x.rating*y.rating) AS xyDotProduct,
SQRT(REDUCE(xDot=0.0, a IN COLLECT(x.rating)|xDot + a^2)) AS xLength,
SQRT(REDUCE(yDot=0.0, b IN COLLECT(y.rating)|yDot + b^2)) AS yLength,
u1, u2
MERGE (u1)-[s:SIMILARITY]-(u2)
SET s.similarity = xyDotProduct / (xLength * yLength)
RETURN s.similarity
MATCH (u1:User{name:"Turtle"})-[s:SIMILARITY]-(u2:User)
WITH u2, s.similarity AS sim
ORDER BY sim DESC
LIMIT 5
RETURN u2.name AS Neighbor, sim AS Similarity
“Squirrel”, “Fox”, “Giraffe”, “Skunk”, “Cat” 순으로 “Turtle”과 유사성이 높음.
MATCH (u:User)-[r:PLAY]->(g:Game), (u)-[s:SIMILARITY]-(fox:User{name:"Fox"})
WHERE NOT ((fox)-[:PLAY]->(g))
WITH g, s.similarity AS similarity, r.rating AS rating
ORDER BY g.title, similarity DESC
WITH g.title AS game, COLLECT(rating)[0..3] AS ratings
WITH game, REDUCE(s = 0, i IN ratings | s + i) AS reco
ORDER BY reco DESC
RETURN game AS Game, reco AS Recommandation
Turtle에게 “Battle Ground”, “Super Animal Royale”, “Stardew Valley”, “Football Manager”=”Rusty Lake”, “To The. Moon” 순으로 게임을 추천
MATCH (fox:User{name:"Fox"})-[r1:SUBSCRIBE]->(s:Streamer)-[r2:STREAMING]->(g:Game)
WHERE NOT ((fox)-[:PLAY]->(g))
WITH g, count(g) AS game_count
ORDER BY game_count DESC
RETURN g.title AS Game, game_count AS `Recommendation by Streamer`
“Fox”에게 “Battle Ground”, “Don’t Starve”, “Stardew Valley” 순으로 게임을 추천
MATCH (u1:User)-[r:PLAY]->(g:Game), (frog:User{name:"Frog"})
WHERE NOT (frog)-[:PLAY]->(g)
RETURN g.title AS Game, avg(r.playtime) AS `Recommendation by Playtime`
ORDER BY avg(r.playtime) DESC
“Frog”에게 “Border Land”, “Football Manager”, “Stardew Valley”, “Super Animal Royale”, “To The Moon”, “Asphalt”, “iRacing”, “Rusty Lake” 순으로 게임을 추천