本文介绍了Neo4j - 按多种关系类型匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to match between entities by multiple relationship types.

是否可以说以下查询:

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

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

I need "and" between all the relation types; Yova liked and watched and .. a movie.

推荐答案

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

Yes, you can do something like:

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

查看文档:匹配多种关系类型

来自评论:

我需要关系类型之间的和"..你给了我一个或"

在这种情况下,您可以:

In this case, you can do:

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

这篇关于Neo4j - 按多种关系类型匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-19 14:25