i have a csv file containing activities (process graph) :
startActivityId,Name,endActivityId
1,A,2
2,B,3
3,C,4
4,D,5
so that it will look like this : A->B->C->D i imported the csv file successfully into neo4j server : using this Cypher query :
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:path/graph/activity.csv" AS row
CREATE (:Activity {startactivityId:row.startActivityId, Name: row.Name, endActivityId: row.endActivityId});
i then created an index on startactivityId :
CREATE INDEX ON :activity(startActivityId);
then i want to create the relationships between these nodes, so tried this cypher query :
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:path/graph/activity.csv" AS row
MATCH (startActivity:Activity {startActivityId: row.startActivityId})
MATCH (endActivity:Activity {startActivityId: row.endActivityId})
MERGE (startActivity)-[:LINKS_TO]->(endActivity);`
but no relationships created, nothing happens
i'm sure i missed something cause i'm new to cypher but i can't figure it out.
any ideas ?
startActivityId
in the csv butrow.startactivityId
in the query, and node propertystartactivityId
in the create query butstartActivityId
in the match. Does it work if you fix that? – jjaderbergstartActivityId
andendActivityId
. What doesMATCH (n:Activity) RETURN n
tell you? – jjaderberg