关于neo4j:neo4j-查询根节点

match (root:MENUCATALOG)
where not (:MENUCATALOG)–>(root)
return root

match (root:MENUCATALOG)
optional match (root)<-[]-(n1:MENUCATALOG)
with root, n1
where n1 is null
return root

match (:MENUCATALOG)-[]->(n0:MENUCATALOG)
with collect(distinct id(n0)) as id0
match (root:MENUCATALOG)
where not id(root) in id0
return root

match p=(root:MENUCATALOG)-[*]->(:MENUCATALOG)
return root
order by length(p) desc
limit 1

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理