apoc.refactor.cloneNodes
Syntax |
|
||
Description |
Clones the given |
||
Input arguments |
Name |
Type |
Description |
|
|
The nodes to be cloned. |
|
|
|
Whether or not the connected relationships should also be cloned. The default is: |
|
|
|
Whether or not to skip the node properties when cloning. The default is: |
|
Return arguments |
Name |
Type |
Description |
|
|
The internal id of the original entity. |
|
|
|
The copied entity. |
|
|
|
Any error that occurred during the copy process. |
Usage Examples
The examples in this section are based on the following sample graph:
CREATE (mark:Person {name: "Mark", city: "London"})
CREATE (jennifer:Person {name: "Jennifer", city: "St Louis"});
The following creates copies of all Person
nodes:
MATCH (p:Person)
WITH collect(p) AS people
CALL apoc.refactor.cloneNodes(people)
YIELD input, output
RETURN input, output;
input | output |
---|---|
4 |
(:Person {name: "Mark", city: "London"}) |
5 |
(:Person {name: "Jennifer", city: "St Louis"}) |
We can list all the Person
nodes by running the following query:
MATCH (p:Person)
RETURN p;
p |
---|
(:Person {name: "Mark", city: "London"}) |
(:Person {name: "Jennifer", city: "St Louis"}) |
(:Person {name: "Mark", city: "London"}) |
(:Person {name: "Jennifer", city: "St Louis"}) |