I am trying to determine a way to make the csv file the one stop shop for updating all elements in Neo4j. I am able to create a cypher expression that loads, creates, and updates nodes and relationships. What I am trying to do now is develop a cypher expression that would identify if an existing node/relationship in Neo4j is still in the new csv load file. If it is no longer in the file, delete it from Neo4j. Is this possible? I am working with a fairly large data set and want to avoid having to do one off deletes. Please let me know if there may be a different solution that may work for this as well.
0
votes
"Is this possible" questions are generally too vague for StackOverflow and you're more likely to get a better response if you post your question in a "Here's my data:" "Here's my attempted function to do what I want" "Here's my output that didn't work." --- if you don't know how to 'attempt', keep looking! :)
– Cody G
1 Answers
1
votes
One way you could do this is to add a :Processed label to all nodes used in your CSV, and a 'processed' property to relationships used in your CSV. Then, after your import/update has run and all included nodes and properties have been annotated like this, run a query to match on nodes without the :Processed label, and on relationships without the 'processed' property, and delete them. Then afterwards, cleanup by removing all the annotations.