【发布时间】:2016-02-22 15:09:29
【问题描述】:
我对 neo4j 比较陌生,在合并节点时遇到了一些麻烦。也许我的概念错了,但这是问题陈述和我试图做的事情..
问题陈述:通过根据属性值为每个用户找到匹配项来创建图表。
Person-> id: user1, movie: lord of the rings
Person-> id: user1, movie: alice in wonderland
Person-> id: user2, movie: star wars
Movie-> name: lord of the rings, genre: Fantasy
Movie-> name: alice in wonderland, genre: Fantasy
Movie-> name: star wars, genre: Fantasy
我想要的输出是:
user1 -> lord of the rings
-> alice in wonderland
user2 -> star wars
我得到的是:
user1 -> lord of the rings
user1 -> alice in wonderland
user2 -> star wars
这是我迄今为止尝试过的:
MATCH (a:user),(b:movie)
where a.movieName = b.name
MERGE (a)-[r:matches]->(b)
RETURN r
理想情况下,我希望能够创建一个图表,在其中我可以将用户与不同电影的所有连接视为一对多连接。我希望这很清楚!关于我做错了什么的任何想法。
【问题讨论】:
标签: graph neo4j graph-databases bigdata