How to merge sets of nodes

Hi All,

I want to merge nodes with different labels but are connected by a relationship and also share the same property value e.g.

(A)-[:SHARES_NAME]->(B)

and I want to merge all B nodes onto A and move all properties and relationships.

Is there any easy way to achieve this?

Thanks

Stuart

Merge Nodes - APOC Documentation provides examples

The examples in here talks about merging nodes with the same label. If I try and manipulate the example it throws a IndexEntryConflictException - there's unique constraints on the name properties for both of these nodes.

Well that's a warning sign that you are going to potentially lose information, which may or may not be what you want...

What you can do, is delete the unique constraints, do the merge, and then recreate the constraints.