2012-11-22 34 views
3

在shell控制檯中執行此命令時出現此錯誤(我只想從圖中解散超級節點,因爲它們偏見我的建議):使用cypher shell控制檯刪除neo4j中的節點/關係時出現「TransactionFailureException:無法提交事務」錯誤

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。 我怎麼能正確和容易地刪除/解僱超級節點,所以他們不會偏見整個圖表?刪除他們的關係也是足夠的。

+0

即使當我嘗試刪除單個節點的所有關係時,我得到以下錯誤:start n = node(9)match n - r delete r; TransactionFailureException:無法提交事務 – ulkas

回答

4

沒關係,我的錯誤。

匹配子句n-r給出了雙方的節點,因此當仍然有rels時不能刪除節點。改爲MATCH n- [r] - ()的作品。

相關問題