Suvam Kumar Das
Suvam Kumar Das

Reputation: 13

How to add user defined constraints on a node/relationship in Neo4j using Java API

Consider I have a node having Label L1 in Neo4j database. I need to put a constraint on all nodes having label L1 such that there shall be no outgoing edge from these nodes. So whenever user tries to add an outgoing edge from these nodes, a constraint violation occurs. Is it possible to add user defined constraints on nodes and relationships?

If yes, how can I put such constraint(s) on nodes/relationships using Neo4j Java API's?

Upvotes: 1

Views: 138

Answers (1)

Bruno Peres
Bruno Peres

Reputation: 16375

According to the Neo4j constraints documentation there is no way to do this.

I think you should delegate this type of responsibility to the application layer. Alternatively, you can try achieve your goal writing your own user defined procedure.

Upvotes: 1

Related Questions