Hey @dana_canzano
Thanks. It works for nodes, but not for relationships. Since apoc.merge.relationship needs both source and destination nodes as input, so I'm looking for a way to match on source and destination nodes. I want something to be able to match on source/dest nodes like:
with event.sourceLabel as sourceLabel, event.destLabel as destLabel, event
MATCH (n:sourceLabel {id: event.sourceNodeId})
MATCH (m:destLabel {id: event.destNodeId})
CALL apoc.merge.relationship (
n,
event.label,
event.props,
m
)
Using @dana_canzano’s suggestion, you can do the following:
WITH event.sourceLabel as sourceLabel, event.destLabel as destLabel, event
CALL apoc.merge.node([sourceLabel], {id: event.sourceNodeId}, {}, {}) yield node
WITH node as n, destLabel, event
CALL apoc.merge.node([destLabel], {id: event.destNodeId}, {}, {}) yield node
WITH node as m, n, event
CALL apoc.merge.relationship (
n,
event.label,
event.props,
m
)