apoc.refactor.setType

Procedure APOC Core

apoc.refactor.setType(rel, 'NEW-TYPE') change relationship-type

Signature

apoc.refactor.setType(relationship :: RELATIONSHIP?, newType :: STRING?) :: (input :: INTEGER?, output :: RELATIONSHIP?, error :: STRING?)

Input parameters

Name Type Default

relationship

RELATIONSHIP?

null

newType

STRING?

null

Output parameters

Name Type

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:

Table 1. Results
input output

30

[:`NEW-TYPE`]

And the graph now looks like this:

apoc.refactor.setType2