memgraph / mage

MAGE - Memgraph Advanced Graph Extensions :crystal_ball:
Apache License 2.0
240 stars 23 forks source link

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

Closed david-cabillic closed 7 months ago

david-cabillic commented 7 months ago

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
katarinasupe commented 7 months ago

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

antepusic commented 7 months ago

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:

antepusic commented 7 months ago

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!