Usually I can find everything I need already on SO but not this time. I'm looking for a very simple way to exclude labels, for example (pseudo code)
:
match (n) where n not in (Label1, Label2) return n
Sorry about crappy query. In short I have labels x,y,z and I want to return all of them apart from z.
Thnx!
Label is a name or identifier to a Node or a Relationship in Neo4j Database. We can say this Label name to a Relationship as "Relationship Type". We can use CQL CREATE command to create a single label to a Node or a Relationship and multiple labels to a Node.
Create a node with multiple labels. To add labels when creating a node, use the syntax below. In this case, we add two labels.
If you want to get the labels of a specify node, then use labels(node) ; If you only want to get all node labels in neo4j, then use this function instead: call db. labels; , never ever use this query: MATCH n RETURN DISTINCT LABELS(n) . It will do a full table scan, which is very very slow..
This should do it:
MATCH (n) WHERE NOT n:Label1 AND NOT n:Label2 RETURN n;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With