Specifying end node labels in relationship uniqueness constraint

Hello,

I noticed that in the syntax of creating uniqueness constraint on a relationship property, there is no way to specify the end nodes of the relationship. This impacts modelling the same names for connections with different end node labels, unless the same uniqueness property is available/ used in the different relationships.

Is there possibly a way to specify the end-nodes in the below syntax? (considering that there are graph models with multiple relationships with different pairs of end node labels but same type name?)

CREATE CONSTRAINT has_unique_id IF NOT EXISTS FOR () -[r:has]-> () REQUIRE r.unique_id IS UNIQUE;

perhaps more like:

CREATE CONSTRAINT has_unique_id IF NOT EXISTS FOR (a:endnode1) -[r:has]-> (b:endnode2) REQUIRE r.unique_id IS UNIQUE;

That capability does not exists.

is the capability in the roadmap? Thanks

Hi Lavanya, I am afraid this capability is not in the roadmap.
We have considered this in the past, but implementing such a constraint efficiently would be problematic. We are working on richer schema features, but this is not part of them.

We will undoubtedly look at this again, but it is not on my horizon, at least for 2025.