apoc.refactor.from
Syntax |
|
||
Description |
Redirects the given |
||
Input arguments |
Name |
Type |
Description |
|
|
The relationship to redirect. |
|
|
|
The node to redirect the given relationship to. |
|
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"})
CREATE (michael:Person {name: "Michael", city: "Dresden"})
CREATE (mark)-[:FOLLOWS]->(jennifer);
The following makes Michael the start node in the FOLLOWS
relationship:
MATCH (michael:Person {name: "Michael"})
MATCH ()-[rel:FOLLOWS]->()
CALL apoc.refactor.from(rel, michael)
YIELD input, output
RETURN input, output;
input | output |
---|---|
14 |
[:FOLLOWS] |
We can list all the Person
nodes by running the following query:
MATCH path = ()-[rel:FOLLOWS]->()
RETURN path;
path |
---|
(:Person {name: "Michael", city: "Dresden"})-[:FOLLOWS]→(:Person {name: "Jennifer", city: "St Louis"}) |