neo4j获取没有与其他节点建立关系的独立节点

193 阅读1分钟

neo4j数据库要删除所有独立的空节点,查询了很多文章提到的方法执行的时候都报错了,这里主要参考的是这里提到的方法,后来受不了了自己写了一个,目前看来能达到效果,记录一下。

match (n)-[r*0..1]- (m) where n.name is null with n, count(r) as c where c=1 return n

删除空节点

match (n)-[r*0..1]- (m) where n.name is null with n, count(r) as c where c=1 delete n

image.png