I have a usecase in which certain actions should only be triggered for 
specific nodetypes. a nodetype is defined by a *combination* of labels.

The nodetypes for which an "action" should take place is given by a nested 
collection of label combinations by something like  [["a", 
"b"],["a","d","e"]]  . There has to be a exact match, so a node with only 
label "a" or " b", or a node with  :a:b:x  should not match.

Now the problem arises when I want to compare the  labels(n) with this 
collection, because ["a", "b"] is different from  ["a", "b"] , and there 
seems to be not a specific order in which labels are returned.

The only way I got this working is this

match (n) 
WHERE
(ALL (l in labels(n) WHERE l in ['a','b']) AND LENGTH(labels(n))=2)
OR
(ALL (l in labels(n) WHERE l in ['a','d','e']) AND LENGTH(labels(n))=3)
return n.name


If there was a way to predict the order of the labels , i would do this


match (n) 
WHERE 
         REDUCE(acc = '', p IN labels(n)| acc + p + ' ') IN ['a b ','a d e 
'] 
return n.name


Or is there another way?

Best, 

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to