Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-11-2022 01:44 AM - edited 11-11-2022 01:48 AM
I am using the cloneNodes procedure for cloning a node with relationships:
This procedure accept properties that can be skipped while cloning. I am wondering if there is a way to skip relations.
In my schema (x:Person)-[:FRIEND]->(y:Person)-[:FRIEND]->(z:Person), I am trying to clone the node "y" with only outgoing FRIEND relations. For now, I have taken the inefficient path of cloning all relations and then deleting the incoming ones. I have a limited number of outgoing relations but incoming ones are higher by multiples, so this approach has a significant performance hit. My last resort is to copy desired properties/relations with regular cypher (without apoc).
I am using Enterprise Edition 5.1.0 with APOC v5.1.0. APOC docs for 5.1 are not published yet, so the linked one may be outdated.
PS: Sorry about the formatting. None of the markdown tags are working - I have tried manually and through the visual editor.
11-11-2022 02:37 AM
The documentation states you can choose to skip relationships, by setting the second parameter to true. It’s false by defaul. How about you take the opposite approach and skip all relationships and add back the ones you want.
11-11-2022 03:20 AM
There are a bunch of other outgoing relations that I need to copy as well. Perhaps thats why I was looking into the apoc library, cloning just the node properties is fairly straightforward and can be done without apoc.
11-11-2022 04:50 AM
Very true. When why not use cypher and roll your own?
11-11-2022 07:46 AM
copying relations is not so straightforward and somewhat error prone, especially copying multiple types
All the sessions of the conference are now available online