- Create two constraint on
Node(Identifier)
and on :Fiber Cable(Identifier)
so that the nodes are looked up quickly from that (or add a Node label to the first node you're creating)
- Only merge on the single identifier property and set the others
- forlarge files (50k+) you probably want to use USING PERIODIC COMMIT and three separate passess two for the nodes and one for the relationships
LOAD CSV WITH HEADERS FROM 'file:///Links.csv' as row
WITH row WHERE row.ObjectID IS NOT NULL
MERGE (f:Node {Identifier: row.Identifier})
ON CREATE SET f:`Fiber Cable`, f.ObjectId=row.ObjectID, f.Status=row.Status, f.RouteType=row.Type
with f, row
UNWIND split(row.Segments, ' ') AS node
MERGE (n:Node{Identifier:node})
MERGE (f)-[r:ATTACHED_TO]->(n)
return count(f)