Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
08-17-2021 08:21 PM
I'm wondering if it's possible to include something like apoc.create.setProperty or apoc.refactor.invert inside an iterate statement. Something like:
CALL apoc.periodic.iterate("MATCH ()-[rel:RELATED]->() RETURN rel",
"CALL apoc.refactor.invert(rel) YIELD input, output RETURN input, output",
{batchSize:1000, parallel: true})
YIELD batches, total RETURN batches, total
Yield doesn't mesh well with the way iterate works so I can't think of a way to make this work. Anyone have any thoughts?
08-19-2021 01:23 PM
Sure, you just have to yield one of the result columns and return a count(*)
to make it a valid statement.
changing rels in parallel might get you a lot of locking esp. before 4.3
CALL apoc.periodic.iterate("MATCH ()-[rel:RELATED]->() RETURN id(rel) as id",
"MATCH ()-[rel:RELATED]->() WHERE id(rel) = id WITH *
CALL apoc.refactor.invert(rel) YIELD output RETURN count(*)",
{batchSize:1000, parallel: true})
YIELD batches, total RETURN batches, total
All the sessions of the conference are now available online