lets say, I have two nodes with the same label and same attribute values:
Create (n:A {foo: 'bar'});
Create (m:A {foo: 'bar'});
I have also some other nodes:
Create(o:B {test: 'test'});
Create(p:C {other: 'other'});
And I have relationships from the first nodes to the other nodes:
Match (n:A {foo: 'bar'}), (o:B {test: 'test'}) MERGE (n)-[:r]-(o);
Match (m:A {foo: 'bar'}), (p:C {other: 'other'}) MERGE (m)-[:s]-(p);
So I get a graph shown in the picture:
Now I want to combine the two nodes of type A to one node and keep both relationships. So I want to get a graph similar as shown in the picture:
Is there a cypher query to do this? Especially to do this with all nodes of one type which have the same attribute properties?