Copy all relationships r that relate a to c in (a {uuid1})-[r]-(c), for use in (b {uuid2})-[r]-(c)


(Snellad1) #1

Hi,

I am trying to copy all r{} where (a {uuid1})-[r]-(c) for use in (b {uuid2})-[r]-(c), while maintaining the original (a)-[r]-(c). It's for versioning purposes - b is an updated node of a, and I want to copy over all relationships a had over to b.
I have uuid uniqueness constraints in place for both nodes and relationships.

I have read and tested how to move relationships from a to b with apoc.refactor.to and apoc.refactor.from. I've also tried apoc.refactor.cloneNodesWithRelationships.
But I've yet seen how to clone relationships without creating unwanted nodes.

Any suggestions?
Many thanks.

PS, Before posting, I've read the following:



https://neo4j-contrib.github.io/neo4j-apoc-procedures/