Reputation: 11216
I am going to experiment with creating a uniqueness constraint on objects in my graph with two labels and am wondering if I can expect it to work.
I want to do something like this...
CREATE CONSTRAINT ON (n:Object:Sub_graph_A) ASSERT n.name is unique;
CREATE CONSTRAINT ON (n:Object:Sub_graph_B) ASSERT n.name is unique;
The same object can exist with the same name in the overall graph but must be unique in a particular sub-graph.
Any thoughts on whether this is a good idea or not? I should know whether I am technically successful soon enough. I am just not sure if the approach is sound (i.e. am I operating within the design capabilities of Neo4j).
Upvotes: 1
Views: 142
Reputation: 41706
No unfortunately currently there is only one label and one property, we plan to extend that later.
If you want it to be unique for both labels, you might create two constraints one for each label. But that's not addressing your use-case. I'd remove :Object
from your constraint and instead add an index on :Object(name)
Upvotes: 1