I habe found how to query for nodes without labels, but how do I have to write a query for all the nodes in the database that do not have any property and/or any relationship?
The background of my question: I have imported a CSV but due to misspelling in the Cypher-statement, I have created 20.000 „empty“ nodes without a label and without properties. I know how to find the ones without label, but Before deleting them I want to make sure that these are also the ones without properties and relationships.
MATCH (n) WHERE size((n--())) = 0 AND properties(n) = {} AND labels(n) =
RETURN n
Explanation:
As the function properties will always return the properties map of a node or relation, you will get an empty map for those who don't have any properties. Same for labels except that the return object is an empty list.
WARNING:
This query is not looking for the nodes without labels: