You are on page 1of 27

Enhanced Entity

Relationship (EER) Model

.
What is an EER Model?
 Enhanced Entity Relationship (EER) –
Data Modeling
 EER shows complex relationships
between objects in a database
(multimedia, geographical).
 Concepts of subclasses and superclasses,
specializations and generalizations.
 Put concepts in diagram to form EER
model
.
 Enhanced ER (EER) (model con’t)
 Created to design more accurate database
schemas
 Reflectthe data properties and constraints more
precisely
 More complex requirements than traditional
applications

.
Supertypes and Subtypes
 Subtype: A subgrouping of the entities in an entity
type which has attributes that are distinct from those
in other subgroupings
 Supertype: An generic entity type that has a
relationship with one or more subtypes
 Inheritance:
 Subtype entities inherit values of all attributes of
the supertype
 An instance of a subtype is also an instance of the
supertype

.
Subclasses and Superclasses
 Supertype/superclass (entity) can be
subdivided into Subtypes/subclass
 Example:

JOB
manager
clerk
sales
support

.
 An entity type may have additional meaningful
subgroupings of its entities
 Example: EMPLOYEE may be further grouped into
SECRETARY, ENGINEER, MANAGER, TECHNICIAN,
SALARIED_EMPLOYEE, HOURLY_EMPLOYEE,…
 Each of these groupings is a subset of EMPLOYEE entities
 Each is called a subclass of EMPLOYEE
 EMPLOYEE is the superclass for each of these subclasses
 These are called superclass/subclass relationships.
 Example: EMPLOYEE/SECRETARY,
EMPLOYEE/TECHNICIAN

.
.
Subtype
A subtype:
 inherits all attributes of the supertype
 inherits all relationships of the supertype
 usually has its own attributes or relationships
 is drawn within the supertype
 never exists alone
 may have subtypes of its own
 is also known as a "subentity“

.
Attributes
 Supertype can have attributes at
supertype level
 Attributes at supertype level are for all
subtypes
 Subtypes can have own attributes for only
that attribute

.
Relationships and Subtypes
 Relationships at the supertype level
indicate that all subtypes will participate in
the relationship
 The instances of a subtype may
participate in a relationship unique to that
subtype. In this situation, the relationship
is shown at the subtype level

.
P K
#P_id #k_id
* Xxx

A
Q #a_id
q_id

P B
p_id #b_id

L
#l_id
.
A

B C

 B can inherit from A


 A cannot inherit from B
 Every A is either a B or a C
 Every B is A //B inherits everything from A
 Every C is an A

.
Rules of the subtype
 Subtypes of the same entity must be:

 Exhaustive:
 Every instance of the supertype is also an instance of one
of the subtypes.
 Treating all parts or aspects without omissions.
 2 or more items
 Mutually exclusive:
 Every instance of the supertype is of one and only one
subtype(implemented using arc).
 A relationship that presents choices which are unable to
be true at the same time.
.
example2
EMPLOYEE

PARMANENT CONTRACT

EMPLOYEE

PARMANENT CONTRACT
.
Correctly identify subtypes
 When considering supertypes and
subtypes, you can use three questions to
see if the subtype is correctly identified:
1. Isthis subtype a kind of supertype?
2. Have I covered all possible cases?
(exhaustive)
3. Does the example fit into one and only one
subtype? (mutually exclusive)

.
Nested subtypes

.
Basic notation for
supertype/subtype
relationships

.
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

.
Specialization and
Generalization
 Specialization
 Identifying subclasses and their
distinguishing characteristics(attributes and
relationships)
 The process of defining one or more subtypes
of the supertype, and forming
supertype/subtype relationships. TOP-DOWN
 Classify a class of objects into more
specialized subclasses
 Defined on the basis of some distinguishing

.
characteristic of the entities in the superclass
Generalization and
Specialization (cont’d.)
 Generalization: The process of defining
a more general entity type from a set of
more specialized entity types.
 Generalize several classes into a higher-
level abstract class BOTTOM-UP
 Includes the objects in all these classes

.
 Inheritance-IS_A(instance) relation that
supports attribute inheritance and
relationship participation
 Single inheritance results in a hierarchy
 Multiple inheritance results in a lattice

.
Specialization (1)
 Specialization is the process of defining a
set of subclasses of a superclass
 Subgrouping into subclasses (top-down
approach)
 The set of subclasses is based upon some
distinguishing characteristics of the entities
in the superclass
 Example: {SECRETARY, ENGINEER,
TECHNICIAN} is a specialization of
EMPLOYEE based upon job type.
 May have several specializations of the same
superclass
Specialization (2)
 Example 2: EMPLOYEE -> SECRETARY
MANAGER, etc.
 Inheritance – Inherit attributes and relationships
from superclass (Name, Birthdate, etc.)
 Subclasses may have uniqe attributes
 SECRETARY has TypingSpeed attribute, MANAGER
has BusinessUnitManaged, etc.

.
Representing Specialization in EER
Diagrams
Generalization

 Generalization is the reverse of the specialization


process
 Several classes with common features are generalized
into a superclass;
 original classes become its subclasses
 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
Generalization (2)

These types of
vehicles have
common attributes

So we put the
shared attributes
in a supertype
GENERALIZATION AND
SPECIALIZATION

Student sid
student
name
Generalization is A Specialization

Undergraduate
Undergrad Graduate
graduate

You might also like