3
votes

as I am relatively new to Neo4J and I was wondering if it is possible to impose user defined data integrity constraints on the stored data.

The manual says that it is possible to impose UNIQUE constraints and here Michael Hunger pointed out that in the current RC NOT NULL constraints have been added.

I was wondering if it is possible, in some way, to define constraints like "every node with label X has to have a relationship with Label Y" or to impose, in some way, a type system, possibly with a type hierarchy and everything. Such constraints should automatically be checked by the DBMS, like in many of the old school (relational) database systems.

Cheers!

1
Take a look at @stefan-armbruster UUID extension which registers a TransactionEventHandler that does som "enforcing", in this case that each node gets a UUID. It's a few years old but it's a very nice example to look at and learn from. - jjaderberg
I will, many thanks :) - Alberto

1 Answers

1
votes

No, it's not possible to have same functionality like traditional RDBMS has, at least not out of the box.

You can write your own Unmanaged Extensions which could handle that for you. You can find basic information how to do that in this article.

I'm not aware of any existing "plugin". In the future GraphAware Enterprise should bring "schema enforcement".