Entity Relationship
Entity Relationship
Because they have several common attributes, they can be generalized into the entity type
VEHICLE, as shown in figure (b) above. Both CAR and TRUCK are now subclasses of the
generalized superclass VEHICLE.
The term generalization is used to refer to the process of defining a generalized entity type
from the given entity types. It can be viewed as the inverse of specialization process.
Constraints on Specialization & Generalization:
In general, we may have several specializations defined on the same entity
type. In such a case, entities may belong to subclasses in each of the
specializations.
However, a specialization may also consist of a single subclass only. In such
a case, we do not use the circle notation.
In some specializations, we can determine exactly the entities that will
become members of each subclass by placing a condition on the value of
some attribute of the superclass. Such subclasses are called predicate-
defined (or condition-defined) subclasses.
For example, if the EMPLOYEE entity type has an attribute job-type, we can
specify the condition of membership in the SECRETARY subclass by the
condition (job-type=’Secretary’), as shown in figure below:
Constraints on Specialization & Generalization:
The condition is called the defining predicate of the subclass. It is
a constraint specifying that exactly those entities of the
EMPLOYEE entity type whose attribute values for job-type is
‘Secretary’ belong to the subclass.
We display a predicate-defined subclass by writing the predicate
condition next to the line that connects the subclass to the
specialization circle.
If all subclasses in a specialization have their membership
condition on the same attribute of the superclass, the
specialization itself is called an attribute-defined specialization,
and the attribute is called the defining attribute of the
specialization.
When we do not have a condition for determining membership in
a subclass, the subclass is called user-defined.
Two other constraints that may apply to a specialization are
disjointness constraints and completeness constraints.
A specialization that is attribute-defined implies the disjointness
constraint if the attribute used to define the membership
predicate is single valued.
Figure above illustrates this case, where the d in the circle stands
for disjoint.
Constraints on Specialization & Generalization:
If the subclasses are not constrained to be disjoint, their sets of
entities may overlap, that is, the same entity may be a member of
more than one subclass of the specialization. This case is
displayed by placing an O in the circle as shown in figure below: