Architectural Principles Super / Sub Types
From PPDM Wiki
Contents |
When Does PPDM 3.8 Use Super Sub Types?
Super Sub type relationships are used in PPDM under certain conditions:
- The data model must manage a business object or entity that ocurrs in various forms. While each form may be described using different characteristics, the overall behavior of the business object is much the same as it relates to other business objects. For example, the LAND RIGHTS module is divided into land rights that are owned, leased or combined with others (pooled). Information that specifically describes a kind of land right is stored in each sub type table. Information that may describe any land right is stored in the super type table. The super type table manages all relationships to other parts of the data model; this reduces the number of foreign keys that might otherwise be in the model.
- An entity in the data model must take on the identity of a business object that is described and defined in another part of the data model. For example, the PRODUCTION ENTITIES module in PPDM 3.8 is used to capture information about production volumes. Production may be captured for many kinds of business object, including WELL, BUSINESS_ASSOCIATE, POOL, FIELD and more. In this case, the PDEN table takes on the identity of the necessary business object via the sub type tables, which contain a foreign key to the object that the PDEN is using.
Guidelines
- The relationship between the super and sub type table is always 1:1 (the PK in both tables contain the same columns)
- One of the PK columns is defined as varchar2(30), and is validated by a check constraint
- In the Super Type table, the Check Constraint requires the value of the column to equal the name of ANY of the sub type tables.
- In each Sub Type table, the Check Constraing requires the value of the column name to equal the name of the table the column is in. In all cases, this value must also exist in the check constraint for the super type table.
- Relationships to other business modules in PPDM should be given at the Super Type level
- Relationships to detail tables in the subject areas should be given at the Super Type level.
Using Super Sub type tables
It is important to be sure that you populate BOTH the super type table and the sub type table when creating data. If you do not, you may lose important information or relationships.
For example, if you populate PDEN and PDEN_TYPE = 'PDEN_WELL', you must also put a row of data into PDEN_WELL. The FK relationship to the well whose identity the PDEN is assuming is in PDEN_WELL.
