Reputation: 2611
I am using Bolt Driver to load the csv data into Graph. The Create and Delete operations are done very well but I am stuck with the update operations.
Since, each node contains different set of properties. How can I write the Cypher Query using SET property.
Approach 1:
My CSV Data:
2,attribute1,0.8,attribute2,0.1
5,attribute1,0.5,attribute2,0.2,attribute3,0.7
4,....
Approach 2:
My CSV Data:
id,attribute1,attribute2,attribute3
2, 0.8, 0.1, Null
5, Null, 0.2, ,0.7
4,....
If the first approach is impossible. Then I wish to opt for the second approach. In this approach how can Iterate over each attribute and make if else kind of execution using cypher.
Upvotes: 1
Views: 102
Reputation: 41706
for the 2nd approach:
LOAD CSV WITH HEADERS FROM "URL" AS row
MATCH (n:Label) WHERE n.id = row.id
SET n += row
This adds / overrides properties.
If you want to replace all properties use SET n = row
Upvotes: 1