Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-22-2022 11:16 PM
1. I have an existing CSV file from which I have converted the details into nodes and relationships:
LOAD CSV WITH HEADERS FROM $path AS row
MERGE (f:food {food_name: row.food_name})
MERGE (m:material {material: row.material})
MERGE (f)-[:material]->(m)
2. Now, I have another CSV file with one column called material, with common elements as in (m:material {material: row.material}). With this CSV file I want to set the other columns and rows, and properties to "m" without creating a a new node for the nodes with the same indentities.
LOAD CSV WITH HEADERS FROM $path AS row
MERGE (mt:materials {materials: row.Material_name})
SET mt.English_name = row.English, mt.Grade = row.Grade, mt.Standard = row.Standard
#Neo4j #CSV #match #Merge
Solved! Go to Solution.
11-22-2022 11:27 PM
Hi Reuben,
from looking at your code, I think the only problem with that is a spelling mistake. In your second line of the second cypher block, it says
MERGE (mt:materials {materials: row.Material_name})
instead of
MERGE (mt:material {material: row.Material_name})
i.e. the "s" in the Label and the "s" in the property name are different to the nodes that you create in your first cypher block where these two s's are not present.
If you correct these, your aim should be achieved with exactly that code.
Regards,
Elena
11-22-2022 11:55 PM
Hi Reuben,
yes, I understood what you want to achieve. What I am saying is that the following the cypher queries that your wrote are almost perfect and you just need to delete the additional s's in your second line of your second block and then you get your desired result.
11-22-2022 11:27 PM
Hi Reuben,
from looking at your code, I think the only problem with that is a spelling mistake. In your second line of the second cypher block, it says
MERGE (mt:materials {materials: row.Material_name})
instead of
MERGE (mt:material {material: row.Material_name})
i.e. the "s" in the Label and the "s" in the property name are different to the nodes that you create in your first cypher block where these two s's are not present.
If you correct these, your aim should be achieved with exactly that code.
Regards,
Elena
11-22-2022 11:51 PM
Thanks, Elena,for the swift respose,please I hope this image makes my intentions clearer
11-22-2022 11:55 PM
Hi Reuben,
yes, I understood what you want to achieve. What I am saying is that the following the cypher queries that your wrote are almost perfect and you just need to delete the additional s's in your second line of your second block and then you get your desired result.
11-22-2022 11:59 PM - edited 11-23-2022 12:22 AM
Got it now.Thanks!
All the sessions of the conference are now available online