apoc.refactor.setType
Procedure
apoc.refactor.setType(rel RELATIONSHIP, newType STRING)
- changes the type of the given RELATIONSHIP
.
Signature
apoc.refactor.setType(relationship :: RELATIONSHIP, newType :: STRING) :: (input :: INTEGER, output :: RELATIONSHIP, error :: STRING)
Usage Examples
The examples in this section are based on the following graph:
CREATE (f:Foo)-[rel:FOOBAR]->(b:Bar);
The following changes the relationship type from FOOBAR
to NEW-TYPE
:
MATCH (f:Foo)-[rel:FOOBAR]->(b:Bar)
CALL apoc.refactor.setType(rel, 'NEW-TYPE')
YIELD input, output
RETURN input, output;
If we execute this query, it will result in the following output:
input | output |
---|---|
30 |
[:`NEW-TYPE`] |
And the graph now looks like this: