I'm new to Neo4j and have been going over some example and have had modest success importing data from csv files (from a relational database). I've managed to create nodes for Persons easily:
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:/home/xxx/Development/Database/exports/persons.csv" AS row
MERGE (:Person {id: toInt(row.id)});
I have a second csv file containing a row per relationship between 2 Persons and I'm trying to use the following Cypher query to create the relationships with no success (No data returned, and nothing was changed):
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:/home/xxxx/Development/Database/exports/person_relationship.csv" AS row
MATCH (f:Person {id: toInt(row.from_person_id)}), (t:Person {id: toInt(row.to_person_id)})
CREATE (f)-[:RELATED_TO]->(t);
Like I say, Persons are created fine but no amount of wangling or examples can lead me to the correct grammar to create the relationship RELATED_TO.
Any help appreciated.
from_person_id
andto_person_id
match theid
s in person.csv? – alanCREATE CONSTRAINT ON (p:Person) ASSERT p.id IS UNIQUE;
– Michael Hunger