Data Models
Extended or Enhanced ER Model
Asif Sohail
University of the Punjab
Punjab University College of Information Technology (PUCIT)
Database Systems Slide 1
Extended or Enhanced ER Model
• The model that has resulted from extending the original E-R
model with new modeling constructs.
• Used to cope with the dynamic and complex business
environment.
• It uses the representations for supertypes and subtypes.
Database Systems Slide 2
E-R Model
Super Types, Subtypes - Example
EMPLOYEE TYPE ATTRIBUTES
1. Hourly ENo, EName, Address, Hire_Date, Hourly_Rate
2. Salaried ENo, EName, Address, Hire_Date, Salary
3. Contract ENo, EName, Address, Hire_Date, Rate
• We have three choices for ER diagram:
1. Define a single entity type Employee with all the possible attributes in it.
2. Define a separate entity type for each employee type.
3. Define a supertype with all the common attributes and introduce its
subtypes having only the applicable attributes.
ER Diagram
Database Systems Slide 3
E-R Model
Super Types, Subtypes
• A Super type is a generic entity type that is subdivided into subtypes.
• A Subtype is a subset of a super type that shares the common attributes of
the super type plus it has some of its own attributes that distinguish it from
other subtypes.
• The super type and subtypes employ the concept of Generalization and
Categorization.
• Generalization is the concept that some entities are subtypes of other more
general entities. E.g. Bird, Vehicle etc.
• Categorization is the concept that an entity comes in various subtypes.
• Super type & Subtype representation is used to represent the entities that
are very much similar.
• Attribute Inheritance:
– Subtype entities inherit values of all attributes of the supertype
– Subtype entities inherit their primary key from their supertype
– An instance of a subtype is also an instance of the supertype
Database Systems Slide 4
Database Systems Slide 5
Basic Notations for Super Type/Subtype
Different modeling tools may have different notation for the same
modeling constructs
Database Systems Slide 6
Figure 4-2 – Employee supertype with three subtypes
All employee subtypes
will have emp nbr, name,
address, and date-hired
Each employee subtype
will also have its own
attributes
Database Systems Slide 7
E-R Model
Super Types, Subtypes
• The relationship between each subtype and its super type is
called ISA relationship.
• The relationship is read from the subtype to the super type.
• The cardinality of the relationship from subtype to super type is
always mandatory one and from super type to subtype is
optionally one. Henceforth, cardinality may be omitted in
diagram.
Database Systems Slide 8
Supertype/subtype relationships in a hospital
Both outpatients and
resident patients are
cared for by a
responsible physician
Only resident patients are
assigned to a bed
Database Systems Slide 9
Example of generalization
Three entity types: CAR, TRUCK, and MOTORCYCLE
All these types
of vehicles
have common
attributes
Database Systems Slide 10
Generalization to VEHICLE supertype
So we put
the shared
attributes in
a supertype
Note: no subtype for motorcycle, since it has no unique attributes
Database Systems Slide 11
Example of specialization
Entity type PART
Applies only to purchased parts
Only applies to
manufactured
parts
Database Systems Slide 12
Specialization to MANUFACTURED PART and PURCHASED PART
Created 2 subtypes
Note: multivalued attribute was replaced by a relationship to another entity
Database Systems Slide 13
E-R Model
Types of Subtypes
• There are the following types of subtypes:
a) Exhaustive & Non-Exhaustive subtypes (Completeness
Constraint)
b) Exclusive & Non-Exclusive subtypes.
• Exhaustive subtypes mean that all the subtypes have been
defined and there can’t be any further subtypes.
• Exclusive subtypes mean that each instance of a super type is
categorized as exactly one subtype.
Database Systems Slide 14
E-R Model
Types of Subtypes
a) Exhaustive & Non-Exhaustive subtypes
• Exhaustive subtypes mean that all the subtypes have been
defined and there can’t be any further subtypes.
• It is used for enforcing completeness constraint, which
determines, Whether an instance of a super type must also be
a member of at least one subtype
– Total Specialization Rule: Yes (double line)
– Partial Specialization Rule: No (single line)
Database Systems Slide 15
Total Specialization Rule
A patient must be either
an outpatient or a
resident patient
Database Systems Slide 16
Partial Specialization Rule
A vehicle could be a car,
a truck, or neither
Database Systems Slide 17
E-R Model
Types of Subtypes
b) Exclusive & Non-Exclusive subtypes
• Exclusive subtypes mean that each instance of a super type is
categorized as exactly one subtype.
• It is used for enforcing Disjointness Constraints, which
determines, Whether an instance of a super type may
simultaneously be a member of two (or more) subtypes
– Disjoint Rule: An instance of the super type can be only
ONE of the subtypes
– Overlap Rule: An instance of the super type could be more
than one of the subtypes
Database Systems Slide 18
Disjoint Rule
A patient can either be outpatient
or resident, but not both
Database Systems Slide 19
Overlap Rule
A part may be both
purchased and
manufactured
Database Systems Slide 20
Subtype Discriminators
• An attribute of the super type whose values determine the
target subtype(s)
– Disjoint – a simple attribute with alternative values to
indicate the possible subtypes
– Overlapping – a composite attribute whose subparts
pertain to different subtypes. Each subpart contains a
Boolean value to indicate whether or not the instance
belongs to the associated subtype
Database Systems Slide 21
Subtype Discriminator (disjoint Rule)
A simple attribute with
different possible values
indicating the subtype
Database Systems Slide 22
Subtype discriminator (Overlap Rule)
A composite attribute
with sub-attributes
indicating “yes” or “no”
to determine whether it
is of each subtype
Database Systems Slide 23
Database Systems Slide 24
Database Systems Slide 25
Entity Clustering
• Entity clustering is a useful way to present a data model a
large and complex systems involving hundreds of entities.
• An entity cluster is a virtual entity type formed by combining
multiple related entities.
• Referring to the examples discussed, the entities related
employee, patient, part can be clustered together.
• The cardinalities of the relationships of the clustered entities
with the other entities remain the same.
Database Systems Slide 26
Reading Material
Book Chapter Sections / Pages
Text Book 5 Sections 5.1, 5.2
Ref. Book A 3 Pages 114-134
Ref. Book B 12 Sections 12.1 to 12.3
Database Systems Slide 27
Thank you for your attention.
Asif Sohail
Assistant Professor
University of the Punjab
Punjab University College of Information Technology (PUCIT)
Allama Iqbal (Old) Campus, Anarkali
Lahore, Pakistan
Tel: +92-(0)42-111-923-923 Ext. 154
E-mail: [email protected]
Database Systems Slide 28