Enhanced Entity-Relationship Model (EER)

Enhanced Entity-Relationship Model
(EER)
1
Enhanced-ER (EER) Model Concepts
 Includes all modeling concepts of basic ER
 Additional concepts: subclasses/superclasses,
specialization/generalization, categories, attribute
inheritance
 The resulting model is called the enhanced-ER or Extended
ER (E2R or EER) model
 It is used to model applications more completely and
accurately if needed
 It includes some object-oriented concepts, such as
inheritance
2
Enhanced Entity-Relationship Model
(EER)
EER is an ER model supported with additional semantic
concepts.
Semantic concepts supported:
- Specialization
- Generalization
- Aggregation
3
Specialization
 Top-down design process; we designate sub-groupings
within an entity type that are distinctive from other entities
in the set.
 These sub-groupings (subclasses) become lower-level
entity types that have attributes or participate in
relationships that do not apply to the higher-level entity set
(superclass).
4
Specialization/Generalization
Superclass
STAFF
IS_A relationship
1:1
Subclass
5
MANAGER
SECRETARY
SALES
PERSONNEL
Generalization
 A bottom-up design process – combine a number of entity
types that share the same features into a higher-level
(superclass) entity type.
 Specialization and generalization are simple inversions of
each other; they are represented in an EER diagram in the
same way.
6
Inheritance
A subclass entity type inherits all the attributes and
relationship participation of the superclass entity
type to which it is linked.
7
Inheritance
shared
attributes
Superclass
Subclass
Unshared
attributes
8
name
DOB
address
STAFF
SALES
PERSONNEL
Car
allowance
Sales
area
Shared
relationship
contract
COMPANY
require
CAR
Unshared
relationship
Subclasses and Superclasses (1)
 An entity type may have additional meaningful subgroupings of its






9
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
Subclasses and Superclasses (2)
 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 realworld
entity as some member of the superclass
– The Subclass member is the same entity in a distinct specific role
– An entity cannot exist in the database merely by being a member of a
subclass; it must also be a member of the superclass
– A member of the superclass can be optionally included as a member of any
number of its subclasses
 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
10
Constraints on
Specialization/Generalization
Participation constraint determines whether every member
in the superclass must participate as a member of a subclass.
Two types of participation constraints:
- Mandatory (total)
- Optional (partial)
11
Attribute Inheritance in Superclass /
Subclass Relationships
 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
12
Participation Constraints
Mandatory (total) participation where every member in the
superclass must also be a member of a subclass.
STAFF
salary
13
FULL-TIME
STAFF
PART-TIME
STAFF
Hourly-rate
Participation Constraints
Optional (partial) participation where a member in the
superclass need not belong to any of its subclasses.
STAFF
MANAGER
14
SECRETARY
SALES
PERSONNEL
Constraints on
Specialization/Generalization
Disjoint constraint describes the relationship between
members of the subclasses & indicates whether it is possible
for a member of a subclass to be a member of one or more
subclasses.
Two types of disjoint constraints:
- Disjoint
- Non-Disjoint
15
Disjoint Constraints
Disjoint constraint when an entity can be a member of only
one of the subclasses of the specialization.
STAFF
d
salary
16
FULL-TIME
STAFF
PART-TIME
STAFF
Hourly-rate
Disjoint Constraints
Non-disjoint constraints: a subclass is a member of more
than one subclass of specialization. Entity types may overlap.
STAFF
o
MANAGER
17
SECRETARY
SALES
PERSONNEL
Specialization Again
 Is the process of defining a set of subclasses of a superclass
 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
Example: Another specialization of EMPLOYEE based in method of pay is
{SALARIED_EMPLOYEE, HOURLY_EMPLOYEE}.
– Superclass/subclass relationships and specialization can be diagrammatically
represented in EER diagrams
– Attributes of a subclass are called specific attributes. For example,TypingSpeed
of SECRETARY
 – The subclass can participate in specific relationship types. For
 example, BELONGS_TO of HOURLY_EMPLOYEE
18
19
Generalization Again
 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
20
21
Aggregation
 Represents a “part-of” relationship between entity types,
where one represents the ‘whole’ and the other the ‘part’.
 No inherited attributes; each entity has its own unique set of
attributes.
22
Aggregation
TEAM
MEMBER
23
Summary of ERD notations (1)
ENTITY
ATTRIBUTE
KEY ATTRIBUTE
WEAK ENTITY
MULTI-VALUED
RELATIONSHIP
COMPOSITE
IDENTIFYING
RELATIONSHIP
24
DERIVED
Summary of ERD notations (2)
1
(min,max)
25
M
CARDINALITY
RATION
PARTICIPATION
CONSTRAINTS
Summary of EERD notations (3)
d
Disjoint constraint
o
Non-Disjoint constraint
Total Participation
Optional Participation
26