使用cypher shell控制台删除neo4j中的节点/关系时出现“TransactionFailureException:无法提交事务”错误

时间:2012-11-22 10:55:22

标签: neo4j cypher

我在shell控制台中执行此命令时遇到此错误(我只是想从图中删除超级节点,因为它们偏向于我的建议):

neo4j-sh (0)$ cypher 1.9 start n=node:node_auto_index('n_id_customer:*') match n--r with n,count(*) as cnt where cnt > 5000 with n match n--r2 with r2 delete r2;     
TransactionFailureException: Unable to commit transaction

直接删除节点时出现相同的错误(后来我意识到我必须首先删除它们的关系)。当执行相同的查询但用RETURN替换DELETE命令时,一切正常:

cypher 1.9 start n=node:node_auto_index('n_id_customer:*') match n--r with n,count(*) as cnt where cnt > 5000 with n match n--r2 with r2 return  count(r2); 
+-----------+
| count(r2) |
+-----------+
| 181294    |
+-----------+
1 row
20615 ms

neo4j版本是1.9。 我怎样才能正确,轻松地删除/关闭超级节点,这样他们就不会偏向整个图形?删除他们的关系也足够了。

1 个答案:

答案 0 :(得分:4)

没关系,我的错误。

match子句n-r给出了双方的节点,因此当仍然具有rel时不能删除节点。改为MATCH n- [r] - ()有效。

相关问题