如何删除neo4j中的多个节点

Shr*_*nsS 4 neo4j graph-databases cypher

如何在neo4j中删除多个节点(不是全部)?

我有这个问题
MATCH (n)
where n.name IS NULL
delete n

它返回多个节点,我想删除所有这些节点(所有节点,错误地创建,这就是为什么变为null).

我面临的错误是

javax.transaction.HeuristicRollbackException: Failed to commit transaction Transaction(11, owner:"qtp16626756-84")[STATUS_NO_TRANSACTION,Resources=1], transaction rolled back ---> javax.transaction.xa.XAException

情况2:在NOT NULL(属性)的情况下该怎么做但在一个或两个节点内没有任何关系; 表示一个orhpan类型的节点,不与其他节点连接.

我试过使用LIMIT/SKIP但不工作.有什么帮助吗?

Eve*_*man 12

您还需要删除与这些节点相关的任何关系,如下所示:

match (n)
where n.name IS NULL
optional match (n)-[r]-()
delete n, r
Run Code Online (Sandbox Code Playgroud)

第二种情况的更新(这只删除了孤儿):

match (n)
where NOT (n)--()
  and n.name IS NULL
delete n
Run Code Online (Sandbox Code Playgroud)