2

I am using call apoc.refactor.invert(rel) to invert relationship directions. When I try this on already created graph with relationship type instead of rel it gives error

Type mismatch: expected Relationship but was String/float

and when I try to invert relationships upon creating them with the following query

CALL apoc.create.relationship(a, graphName.connectionName, {}, b) yield rel1
call apoc.refactor.invert(rel1)

it gives error

Neo.ClientError.Statement.SyntaxError: Unknown procedure output: rel1 (line 7, column 67 (offset: 232)) "call apoc.refactor.invert(rel1)

if someone knows the proper use of it please help me.

Bruno Peres
  • 15,845
  • 5
  • 53
  • 89
Raza Ul Haq
  • 342
  • 3
  • 15

1 Answers1

2

You cannot use a relationship type as parameter to apoc.refactor.invert(rel) procedure. This procedure accepts a relationship instead.

Your second attempt if falling because apoc.create.relationship does not produce a rel1 output (you can see it running call apoc.help("apoc.create.relationship")). This procedure produces rel output instead.

So change your code to:

call apoc.create.relationship(a, graphName.connectionName, {}, b) yield rel
call apoc.refactor.invert(rel) yield input, output
Bruno Peres
  • 15,845
  • 5
  • 53
  • 89