Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-28-2022 04:51 AM
I'm using the Community edition v4.6
I have some nodes with multiple labels, say ["Asset", "M", "M10", "M20"]
So, I can have a (:Asset:M:M10) or a (:Asset:M:M20) but also I can have (:Asset:M) nodes
How can I query neo4j to return all nodes which are (:Asset:M) but not M10 or M20?
I tried with
MATCH (n:Miura)
WHERE NOT any(word IN labels(n) WHERE any(word1 in ["M10","M20"] CONTAINS word))
RETURN n, labels(n) LIMIT 25
But it returns an error:
any(...) requires a WHERE predicate (line 2, column 39 (offset: 54))
"WHERE NOT any(word IN labels(n) WHERE any(word1 in ["M10","M20"] CONTAINS word))"
^
Any suggestion will be appreciated. TIA
Solved! Go to Solution.
04-28-2022 05:14 AM
The syntax is little off.
MATCH (n:Miura)
WHERE NOT any(word IN labels(n) WHERE any(word1 in ["M10","M20"] WHERE word1 = word))
RETURN n, labels(n) LIMIT 25
Or, a simplified version:
MATCH (n:Miura)
WHERE none(word IN labels(n) WHERE word in ["M10","M20"])
RETURN n, labels(n) LIMIT 25
Based on your requirement, I would think the following would work.
Match (n:Asset:M)
Where not n:M10 and not n:M20
Return n
04-28-2022 05:14 AM
The syntax is little off.
MATCH (n:Miura)
WHERE NOT any(word IN labels(n) WHERE any(word1 in ["M10","M20"] WHERE word1 = word))
RETURN n, labels(n) LIMIT 25
Or, a simplified version:
MATCH (n:Miura)
WHERE none(word IN labels(n) WHERE word in ["M10","M20"])
RETURN n, labels(n) LIMIT 25
Based on your requirement, I would think the following would work.
Match (n:Asset:M)
Where not n:M10 and not n:M20
Return n
04-28-2022 01:58 PM
Try this:
MATCH (n) where labels(n) = ['M']
RETURN n
04-29-2022 03:39 AM
All the sessions of the conference are now available online