The following use case has been bugging me from time to time and it always annoyed me that I don't really know a solution for this. Recently I came across it once more:
- An
object
has 0 or moreobjectProperties
;- an
object
is used in 1 or moreoperations
;- some of the
operations
use 1 or moreobjectProperties
of theobject
they are operating on (0 or more relation);- an
objectProperty
will be used in 1 or moreoperations
.
This leads me to the following database design:
Note: the table names are made up to illustrate the problem
My questions are:
- Is this db design correct for the stated use case?
- Is there any method to force referential integrity for the use case as described within the database engine*?
*) I can enforce this rule in my application code, but that strikes me as rather fragile, so I would rather see the integrity enforced by constraints in my data model, if at all possible.