Total and Exclusive Subtype Pattern

Unofficial Content
Name: Total and Exclusive Subtype
The name is obvious. See Types of Inheritance for more info.

Intention
This patterns applies when there are a set of entities (Children) that are all a subtype of another entity (Father). Total means there must exist one of the children and exclusive means there cannot exist more than one Children. So each Father's record must have one and only one record in the Children.

The intention of this pattern is to create all the Transactions needed to Insert, Update or Delete these entities. Given the Father is usually an abstract entity, the data entry is done in the children and the father is automatically created/updated/deleted.

Example
The Party, Organization and Person transactions in People And Organizations Knowledge Base is of this kind. Each Party must be a Person or and Organization, and only one of them.

Implementation
The pattern asks for the name (and attributes) of each child, and creates the following transactions:

Father
FatherId*
FatherName
FatherType  //it's an enumerated type where each value represent a child

// also creates an user index for FatherName


Children (one for each child)
ChildXXId*
ChildXXName
... // child particular attributes

Subtype group ChildXX
ChildXXId subtype of FatherId
ChildXXName subtype of FatherName

// also creates an user index for ChildXXName


Each child transaction has rules to automatically create the corresponding father on insert.