如何匹配CSV加载中的节点并将每个匹配中的值推入关系的array属性中?
LOAD CSV WITH HEADERS FROM 'http://example.com/horse_races.csv' AS line
MATCH (j:Jockey { name: line.JOCKEY_NAME})
MATCH (h:Horse { name: line.HORSE_NAME})
MERGE (j)-[r:JOCKEYED]->(h)
ON MATCH SET r.date = r.date + date(line.RACE_DATE)
答案 0 :(得分:1)
当前在merge
上,您仅在关系已经存在的情况下为该关系设置日期。您可以设置on create
来初始化尚不存在的列表:
LOAD CSV WITH HEADERS FROM 'file:///jockeys.csv' AS line
with distinct line MATCH (j:Jockey { name: line.JOCKEY_NAME}), (h:Horse { name: line.HORSE_NAME})
MERGE (j)-[r:JOCKEYED]->(h) ON CREATE SET r.date = [line.RACE_DATE]
ON MATCH SET r.date = r.date + date(line.RACE_DATE)