Create relationship from a relationship CSV

Hi, I am new to Neo4j and I couldn't find the answer directly by looking for it in this forum.

I want to create relationships from a csv on already existing nodes.

These are the CSV's I have with the following data:
object.csv
unid,name

object-link.csv
unid,parentid,childid

The parentid/childid's from the object-link.csv are matching the unids from object.csv. How can I connect the parents to the childs from the object-link.csv?

Thanks!

Assuming you created a Person node with unid, name as properties from object.csv

From object-link.csv

MATCH (p:Person) WHERE p.unid = line.parentid
MATCH (p1:Person) WHERE p1.unid = line.childid

WITH p, p1, line

MERGE (p)-[:PARENT_OF]->(p1)

1 Like