(movie:M-6ren">
gpt4 book ai didi

Neo4j - 按多种关系类型匹配

转载 作者:行者123 更新时间:2023-12-03 10:57:56 24 4
gpt4 key购买 nike

我想通过多种关系类型在实体之间进行匹配。

是否可以说以下查询:

match (Yoav:Person{name:"Yoav"})-[:liked & watched & ... ]->(movie:Movie) return movie

我需要所有关系类型之间的“和”; Yova 喜欢并观看了......一部电影。

最佳答案

是的,您可以执行以下操作:

match (gal:Person{name:"Yoav"})-[:liked|:watched|:other]->(movie:Movie) 
return movie

查看文档: Match on multiple relationship types

编辑:

来自评论:

I need "and" between the relation types.. you gave me an "or"



在这种情况下,您可以执行以下操作:
match (Yoav:Person{name:"Yoav"})-[:liked]->(movie:Movie),
(Yoav)-[:watched]->(movie),
(Yoav)-[:other]->(movie)
return movie

关于Neo4j - 按多种关系类型匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46132345/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com