Constraint -- unique property required when node has no incoming relationships


(Amoebae) #1

Hi there, is it possible to specify a constraint that applies ONLY when a node has no incoming relationships?

In this case, I use graphs to represent a taxonomy. All nodes in a taxonomy have label Taxon, including the root node. The root node in a taxonomy is only distinguished by the fact that it has no incoming relationships. I want the property name to be unique for these root nodes. But I don't want that uniqueness constraint to apply to nodes that are further down the taxonomy tree.


(Andrew Bowman) #2

If you add a :Root label to these nodes, then you can create a unique constraint on :Root(name).