我有一个非常简单的数据模型,包含source - [:link] - > target。我想找出所有没有传入链接的节点,例如我的数据模型的“根”。我如何在Cypher中做到这一点?
答案 0 :(得分:3)
您可以过滤 null 值
START target=node(*)
MATCH target<-[r?:link]-source
WHERE r is null
RETURN target
有关详细信息,请参阅Cypher where clause documentation
或者,您也可以
START target=node(*)
WHERE not(target<-[:link]-source)
RETURN target
*注意:未经测试
答案 1 :(得分:2)
start n=node(*)
match n<-[?]-m
with n, count(m) as c
where c=0
return n