cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

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

amoebae
Node Link

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.

1 REPLY 1

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