Call apoc procedure in subquery

I am trying to set labels dynamically with the `poc.create.setLabels function:

:auto MATCH (n:TempNode)
CALL {
    with n
    CALL apoc.create.setLabels( n, [ n.type ] ) YIELD node
} IN TRANSACTIONS;

I get a strange error that I never saw before:

Neo.ClientError.Statement.SyntaxError

Variable `n` not defined (line 3, column 10 (offset: 35))
"    with n"
          ^

Any ideas why this fairly simple query does not work?

Hi @martin2 !

Really interesting. This is mainly due to the parsing expecting a node Yield call function. I'll check this internally, meanwhile, considering you are changing into a label, removing also the type will make it work.

:auto MATCH (n:TempNode)
CALL {
    with n
    CALL apoc.create.setLabels( n, [ n.type ] ) YIELD node
    remove n.type
} IN TRANSACTIONS;

Try this:

:auto 
MATCH (n:TempNode)
CALL {
    with n
    CALL apoc.create.setLabels( n, [ n.type ] ) yield node
    return node
} IN TRANSACTIONS
return node

It didn't seem to like the yield without a return.