October 2017
Beginner to intermediate
316 pages
8h
English
It is possible to merge several nodes together. Let's create some nodes:
CREATE (a:FIRST:MERGE {propF1: 'AF1',propF2: 'AF2'}), (b:SECOND:MERGE {propS1: 'BS1',propS2: 'BS2'}), (c:THIRD:MERGE {propT1: 'CT1',propT2: 'CT2',propT3: 'CT3'})
Now let's see them:
MATCH (n:MERGE)RETURN n
All right. Now, let's merge them onto the first node with this query:
MATCH (a:FIRST:MERGE), (b:SECOND:MERGE), (c:THIRD:MERGE)CALL apoc.refactor.mergeNodes([a,b,c]) YIELD node RETURN node
This results in a single node with four labels and the following properties (this is a copy/paste from the text view):
{"propF2":"AF2","propF1":"AF1","propS1":"BS1","propT2":"CT2","propT1":"CT1","propS2":"BS2","propT3":"CT3"}
This was the expected result. Now what if ...
Read now
Unlock full access