Compliance to a schema in neo4j

889 views Asked by At

I am thinking of using a graph DB to store IFC data. Ideally, the DB should provide a way to define all the rule types defined in the IFC schema. However, I don't think there are any such databases because some of the rule types in IFC are very complex and requires querying the DB. Others are simple, like uniqueness of GUID, existence of mandatory attributes, or data validation. Neo4j seem to have a few constraint enforcing methods:

Neo4j helps enforce data integrity with the use of constraints. Constraints can be applied to either nodes or relationships. Unique node property constraints can be created, as well as node and relationship property existence constraints.

Are there other methods that can ensure compliance of entered data with a predefined schema?

Or are there other graph DBs that are more suitable for this job?

2

There are 2 answers

1
Christophe Willemsen On BEST ANSWER

You can achieve pretty much everything you want by creating Transaction Event handlers.

http://neo4j.com/docs/java-reference/current/javadocs/org/neo4j/graphdb/event/TransactionEventHandler.html

You can also take a look at the GraphAware Framework and all its submodules for use-cases and also the ease of creating and deploying neo4j extensions.

4
James Fleming On

Depends on whether you need the schema enforced by the database itself, or whether you're OK with that being done at the application layer.

I've just gotten Restagraph to the "working prototype" level, and my next trick is Dockerising it. It's a framework of sorts, that enables you to define a schema by creating nodes and relationships in Neo4J with specific labels, and which dynamically creates a REST API to enforce it.

It's also written in Common Lisp, so I'll understand if you wait for the Docker image :)