Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple way to delete a relationship by ID in Neo4j Cypher?

Using Match and Where can delete a relationship by ID.

Match ()-[r]-() Where ID(r)=1 Delete r

Is there a simpler way?

like image 637
Rm558 Avatar asked Jan 28 '15 05:01

Rm558


People also ask

How do I delete a particular relationship in neo4j?

In Neo4j to delete a node or relations between nodes you have to use DELETE clause. To delete any node you need DELETE clause with the MATCH statement, the MATCH statement data will find the specific node and whichever node is matched with the statement that node will be vanished.

How do you remove a Cypher relationship?

Deleting Nodes with Relationships Attached One option is to delete all relationships, then delete the node. Another option is to use the DETACH DELETE clause. The DETACH DELETE clause lets you delete a node and all relationships connected to it.

How delete all nodes and relationships in neo4j give example?

There is a method to delete a node and all relationships related to that node. Use the DETACH DELETE statement: Example: MATCH (Kohli:player{name: "Virat Kohli"}) DETACH DELETE Kohli.

How do I remove a property from neo4j?

Remove a property Neo4j doesn't allow storing null in properties. Instead, if no value exists, the property is just not there. So, REMOVE is used to remove a property value from a node or a relationship. The node is returned, and no property age exists on it.


1 Answers

You can delete by simple modified chyper for delete some Relations.

This is my code:

MATCH ()-[r]->() WHERE id(r)=43 OR id(r)=44 OR id(r)=45 DELETE r
like image 67
ardan7779 Avatar answered Oct 26 '22 06:10

ardan7779