Hi all,
I have a csv file containing:
"FromNode","RelationType","ToNode"
"Cybersecurity knowledge","CONNECTED","Vulnerabilities"
"Cybersecurity knowledge","RELATED","Mitigations"
Trying to load from csv I used this (wrong) statement:
LOAD CSV WITH HEADERS FROM "file:///relations.csv" AS row
MATCH (f:Node), (s:Node)
WHERE f.Name = row.FromNode
AND s.Name = row.ToNode
CREATE (f)-[:TOSTRING(row.RelationType)]->(s)
I found that the apoc procedure
"apoc.create.relationship(person1,'KNOWS',{key:value,...}, person2) create relationship with dynamic rel-type"
should do thework; but I was unable to find the correct syntax.
How can I create these differently labelled relationships from csv?
UPDATE:
Tryed this
LOAD CSV WITH HEADERS FROM "file:///relations.csv" AS row
MATCH (f:Node), (s:Node)
WHERE f.Name = row.FromNode
AND s.Name = row.ToNode
CALL apoc.create.relationship(f, row.RelationType,{}, s)
(taken from Can I use this CSV to load a neo4j graph with cypher? - Stack Overflow )
But obtained the error:
SyntaxError: Query cannot conclude with CALL (must be RETURN or an update clause) (line 5, column 1 (offset: 135))