Reputation: 2117
The following works fine. It creates nodes and relationships:
LOAD CSV WITH HEADERS FROM ("file:///sessions/parsed_message_amp_v2.csv") AS row
MERGE (a:Sender { name: row.From, domain: row.Sender_Sub_Fld})
MERGE (c:Recipient { name: row.To})
WITH a,c,row
WHERE row.Url_Sub_Fld = "false" AND row.FileHash = "false"
CALL apoc.merge.relationship(a, row.Outcome2, {}, {}, c) YIELD rel as rel1
RETURN a,c
But if I create new relationships with the and add one additional node using the same dataset I get the following error:
Neo.ClientError.Statement.TypeError: Type mismatch: expected a map but was String("false")
LOAD CSV WITH HEADERS FROM ("file:///sessions/parsed_message_amp_v2.csv") AS row
MERGE (a:Sender { name: row.From, domain: row.Sender_Sub_Fld})
MERGE (b:Link { name: row.Url_Sub_Fld, topLevelDomain: row.Url.Tld})
MERGE (c:Recipient { name: row.To})
WITH a,b,c,row
WHERE row.FileHash = "false"
CALL apoc.merge.relationship(a, row.Outcome, {}, {}, b) YIELD rel as rel1
CALL apoc.merge.relationship(b, row.Outcome2, {}, {}, c) YIELD rel as rel2
RETURN a,b,c
Do you know what is causing this in the second query and not the first?
Upvotes: 1
Views: 6107
Reputation: 30397
This part in your second MERGE:
topLevelDomain: row.Url.Tld
It expects row.Url
to be a map, with a Tld
key. If the field is actually named Url.Tld
including the dot, then you may need to escape the field name with backticks:
topLevelDomain: row.`Url.Tld`
Upvotes: 3