Calmcode - neo4j: delete

Delete

1 2 3 4 5 6 7 8 9 10

Let's replace the data so that we have a property for the edges that indicates if the dependency is optional. The first thing we need to do is delete all the data. The simplest way to do this is to delete all the nodes. This will also delete all the edges. We'll use a MATCH for this.

MATCH (n)
DETACH DELETE n

Next we attach the nodes again.

LOAD CSV WITH HEADERS FROM 'file:///nodes.csv' AS line
CREATE (:Project {name: line.project})

Now we can attach the edges. This time with the property.

LOAD CSV WITH HEADERS FROM 'file:///dependencies.csv' AS line
MERGE (p:Project {name: line.project})
MERGE (d:Project {name: line.dep})
CREATE (p)<-[:Dependency {required: line.required}]-(d)