Lectures 2014 Handout4 DataModeling EER
Lectures 2014 Handout4 DataModeling EER
• These are also called IS-A relationships (SECRETARY IS-A EMPLOYEE, TECHNICIAN IS-A
EMPLOYEE, . . . ).
• Note: An entity that is member of a subclass represents the same real-world entity as some member
of the superclass
• Example: A salaried employee who is also an engineer belongs to the two subclasses ENGINEER
and SALARIED EMPLOYEE
– It is not necessary that every entity in a superclass be a member of some subclass
• An entity that is member of a subclass inherits all attributes of the entity as a member of the
superclass
• It also inherits all relationships
22
Specialization
23
Figure 12: EER diagram notation to represent subclasses and specialization
Generalization
• Example: CAR, TRUCK generalized into VEHICLE; both CAR, TRUCK become subclasses of
the superclass VEHICLE.
– We can view CAR, TRUCK as a specialization of VEHICLE
– Alternatively, we can view VEHICLE as a generalization of CAR and TRUCK
• Completeness Constraint
24
Figure 13: Examples of generalization
– Total specifies that every entity in the superclass must be a member of some subclass in the
specialization/ generalization
– Shown in EER diagrams by a double line
– Partial allows an entity not to belong to any of the subclasses
– Shown in EER diagrams by a single line
• All of the superclass/subclass relationships we have seen thus far have a single superclass
• A shared subclass is subclass in more than one distinct superclass/subclass relationships, where
each relationships has a single superclass (multiple inheritance)
• In some cases, need to model a single superclass/subclass relationship with more than one superclass
25
Figure 14: Example of disjoint partial specialization
• Example: Database for vehicle registration, vehicle owner can be a person, a bank (holding a lien
on a vehicle) or a company.
– Category (subclass) OWNER is a subset of the union of the three superclasses COMPANY,
BANK, and PERSON
– A category member must exist in at least one of its superclasses
• Note: The difference from shared subclass, which is subset of the intersection of its superclasses(shared
subclass member must exist in all of its superclasses).
File: Lectures 2014.tex Date: Thursday 13th February, 2014 8:57am Revision: 0.3
26
Figure 15: Example of overlapping specialization
27
Figure 17: An EER conceptual schema for a UNIVERSITY database. Refer section 4.5 (8.5.1 in 6th
edition) of the text book for more information.
28