I want to abstract a real world hierarchy in a strict DB model (as strict as possible).
My problem is to to create a structure with a this-or-this-but-not-both rules set.
I have two entity types,
Device, should be connectable to one other "device" as child and as parent.
Combiner, it can be connected with multiple "devices" as parents and one as child.
BUT(!) a device can only be connected to one of them at the same time. So like "device" as only one child and one parent.
I try to visualize it somehow:
Image may be NSFW.
Clik here to view.
All my ideas are not strict but I searching if there is a pattern to solve this without rules on application level. On a class model I would solve this with inheritance. Some ideas?