this construct can cause considerable difficulty to the business
because it allows only one hierarchy to be represented. This
does not reflect the real world, and as a result, it can cause
unnecessary and inappropriate restrictions on the business. In
fact, it is the combination of entity-type partitioning and restric-
tive cardinalities.
Consequences
Imposing restrictions through the data structure means
• Arbitrary or inappropriate restrictions are placed on the data that
can be held.
• Fudge or false data may be introduced to overcome the restrictions
in the data structure. This may have to be programmed around.
• Data may be replicated to overcome the restrictions in the data
structure. The different versions must be reconciled.
• The entity type will only work within the context defined. A change
in business rules may require a change in the database structure.
• The resultant system is harder to share.
Failing to correctly recognize entity types means
• The same data structures may be replicated.
• The same functionality may be replicated.
An example is given in Figure 9-8.
Each stock_item must belong to one and only o ne
stock_item_group, which must belong to one and only one
stock_item_group_type. An example of the kind of restriction
this can place is that y ou might have Naphtha as a stock_item,
and you might have Feedstock, Intermediate, and Finished
Prod u c t as stock_item_groups. This model restricts you to
allowing Naphtha to be only classed a s one of those, even
though it can be all three.
The first step is to check that the entity types are of the same
type. By comparing each of the entity types, you can see that all
the entity types are classes of stock or material, so the entity
type class is a supertype to them all, as shown in Figure 9-9.
The next thing is to check that all the relationship types are
the same. In our case, the three relationship types indicated in
Figure 9-9 are of the same type, indicating that an instance of
the entity type at the one end is a generalization of an instance
of the entity type at the many end. On the other hand, the
relationship type between stock_item and sales_product
is indicating that one is sold as the other, which is a dif-
ferent type of relationship type. This being the case, we can
simplify the model and add flexibility at the same time by
stock_item_
group_type
stock_item_
group
sales_product
stock_item
Figure 9-8 A fixed hierarchy.
Chapter 9 GENERAL PRINCIPLES FOR ENTITY TYPES 101