以下工作正常。它创建节点和关系:
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
但是,如果我使用创建新的关系并使用相同的数据集添加一个额外的节点,则会出现以下错误:
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
您知道第二个查询而不是第一个查询的原因吗?
答案 0 :(得分:1)
这是您第二次合并中的这一部分:
topLevelDomain: row.Url.Tld
它期望row.Url
是具有Tld
键的地图。如果该字段实际上被命名为Url.Tld
(包括点),那么您可能需要使用反引号对字段名称进行转义:
topLevelDomain: row.`Url.Tld`