memgraph/mage

"CALL merge.relationship" should be used anywhere "MERGE" can be used

Closed this issue · 3 comments

It's a nonsense to have different rules for the same functionalities. So there should not be any difference. Currently "CALL merge.relationship" is not usable because it's limited. It should work anywhere (in FOREACH for example) and result should be usable too:

WITH value, c, relationship
WHERE relationship IS NOT NULL

MERGE (r:Contact {uuid: relationship.relatedContactExtNum})
SET r.iditId = relationship.id
SET r.updateVersion = relationship.updateVersion
WITH r, c, relationship
CALL apoc.merge.relationship(r, relationship.relationshipTypeVO.desc, {}, {uuid:relationship.id, iditId:relationship.id, updateVersion:relationship.updateVersion, effectiveDate:date(substring(relationship.effectiveDate, 0, 10))}, c, {uuid:relationship.id})
YIELD rel

RETURN r.uuid // Contact UUID to look for

To add, the current implementation of merge.relationship block @david-cabillic of migrating to Memgraph.

Hi! I’ve investigated the issue you raised and the reason why merge.relationship can’t be used in this query is due to the design decision that, when a write procedure is used in query, any graph modification has to be done as part of the write procedure.
You can work around this in one of these ways:

  • Split this query into two queries (one with the SET clauses, other calling merge.relationship)
  • Implement a custom query procedure that does all graph modifications from this query

Hello @david-cabillic! Because the behavior you described here is expected from Memgraph (see my above comment), I’m closing this issue for now.

I hope that you’ve found the suggestions helpful. If you have any further questions about making this work, don’t hesitate to ask us on Discord!