Cypher:不匹配模式

问题描述 投票:0回答:1

对于 (A)-[LinkedTo]->(B) 类型的模型<-[Knows]-(C) I'm looking how to get back all B's linked to A's, but not knowing C's. Can't use the 'where not exists' construction as this would require C's know B's. Also optional match does not seem to work. Any suggestions?

graph neo4j cypher
1个回答
0
投票

您可以使用几个路径模式表达式来测试是否存在/不存在至少一个与特定模式匹配的关系:

MATCH (b:B)
WHERE (:A)-[:LinkedTo]->(b) AND NOT (b)<-[:Knows]-(:C)
RETURN b
© www.soinside.com 2019 - 2024. All rights reserved.