2
votes

i got this error when executing this command in the shell console (i just want to dismiss the super-nodes from the graph because they bias my recommendations) :

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

the same error appears when deleting nodes directly (later i realized i have to delete their relationships first). when executing the same query but replacing the DELETE command with RETURN everything works:

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 version is 1.9. how could i properly and easily delete/dismiss the super nodes so they will not bias the whole graph? deleting their relationships would be enough, too.

1
even when i try to delete all relationships of a single node i got this error: start n=node(9) match n--r delete r; TransactionFailureException: Unable to commit transactionulkas

1 Answers

4
votes

nevermind, my mistake.

the match clause n--r gives nodes on both sides and thus can't be deleted nodes when still have rels. changing to MATCH n-[r]-() works.