apoc.refactor.setType

Details

Syntax

apoc.refactor.setType(rel, newType) :: (input, output, error)

Description

Changes the type of the given RELATIONSHIP.

Input arguments

Name

Type

Description

rel

RELATIONSHIP

The relationship to change the type of.

newType

STRING

The new type for the relationship.

Return arguments

Name

Type

Description

input

INTEGER

The id of the given relationship.

output

RELATIONSHIP

The id of the new relationship with the updated type.

error

STRING

The message if an error occurred.

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:

Results
input output

30

[:`NEW-TYPE`]

And the graph now looks like this:

apoc.refactor.setType2