I'm just starting with Neo4J and got straight into v2.0 so my first models already use labels. I just got into a case where I expected labels be of help but not sure if what I want to do is possible. Let me explain:
THE DOMAIN
Let's imagine we modelled a food chain: (in pseudo-cypher)
(grass:Vegetable)-[:EATS]-(marie:Cow) (marie)-[:EATS]-(ferocious:Velociraptor) (marie)-[:EATS]-(joseph:Human)
DETECTING CANNIBALISM
Turns out the solution was right in my face... that is, in the docs.
MATCH (n)--(p)
WHERE labels(n) = labels(p)
RETURN n, p
Now, this works because I only added a label to each of my nodes but if I were to use labels aggressively this query would not solve my cannibalism detection.
Cap comentari:
Publica un comentari a l'entrada