Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-06-2019 12:28 PM
Please provide a working example of renaming existing node labels with apoc.refactor.rename.label procedure. I could not find any in the APOC guides.
Thanks
Solved! Go to Solution.
10-06-2019 02:59 PM
10-06-2019 02:38 PM
an example to create 10,000 nodes with label 'Label123' then display count of said nodes, rename the nodes to label 'Label456' using apoc.refactor.rename.label, display there counts
neo4j> foreach (x in range (1,10000) | create (n:Label123 {id:x}));
0 rows available after 921 ms, consumed after another 1 ms
Added 10000 nodes, Set 10000 properties, Added 10000 labels
neo4j> match (n:Label123) return count(n);
+----------+
| count(n) |
+----------+
| 10000 |
+----------+
neo4j> match (n:Label123) with collect(n) as nodes CALL apoc.refactor.rename.label('Label123','Label456',nodes) yield errorMessages as eMessages return eMessages;
+-----------+
| eMessages |
+-----------+
| {} |
+-----------+
neo4j> match (n:Label123) return count(n);
+----------+
| count(n) |
+----------+
| 0 |
+----------+
1 row available after 27 ms, consumed after another 0 ms
neo4j> match (n:Label456) return count(n);
+----------+
| count(n) |
+----------+
| 10000 |
+----------+
1 row available after 23 ms, consumed after another 0 ms
```
10-06-2019 02:59 PM
Thanks, it worked and could apply the change to 186555 nodes.
All the sessions of the conference are now available online