Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
08-26-2022 02:51 AM
I have graph with relationships that have type and some of that relations have property
I want to delete only relationships without property but relation with same type and with property must be untouched
Solved! Go to Solution.
08-26-2022 07:39 AM
The following will find all relationships of type ':REL' and delete those that have zero properties. You can add restrictions to the type of nodes it relates as well, if that is needed by adding node labels to the match pattern.
match()-[r:REL]->()
where size(keys(properties(r)))=0
delete r
You should test it first because it can't be undone. maybe execute it with 'return' instead of 'delete' so you can review the relationships it will delete.
08-26-2022 07:39 AM
The following will find all relationships of type ':REL' and delete those that have zero properties. You can add restrictions to the type of nodes it relates as well, if that is needed by adding node labels to the match pattern.
match()-[r:REL]->()
where size(keys(properties(r)))=0
delete r
You should test it first because it can't be undone. maybe execute it with 'return' instead of 'delete' so you can review the relationships it will delete.
08-27-2022 11:38 AM
Thank you, everything works as it should 😊
All the sessions of the conference are now available online