How to write a CYPHER query that returns only those nodes that do not have labels attached to them? I tried:
match (n:) return n
Invalid input ')': expected whitespace or a label name (line 1, column 10)
"match (n:) return n"
^
Introduction. The MATCH clause allows you to specify the patterns Neo4j will search for in the database. This is the primary way of getting data into the current set of bindings. It is worth reading up more on the specification of the patterns themselves in Patterns.
When you want to return all nodes, relationships and paths found in a query, you can use the * symbol. This returns the two nodes, the relationship and the path used in the query.
To create a relationship between two nodes, we first get the two nodes. Once the nodes are loaded, we simply create a relationship between them. The created relationship is returned by the query.
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) .
In Neo4j < 2.3:
MATCH n
WHERE length(labels(n)) = 0
RETURN n
In Neo4j >= 2.3:
MATCH (n)
WHERE size(labels(n)) = 0
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