You are on page 1of 47

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Faculty of Computer Science


.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
University of Indonesia

IKI2024 - Database 1
Term 1 - 2011/2012
Lecturer:
Satrio Baskoro Yudhoatmojo, S.Kom., M.T.I.

1
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Faculty of Computer Science


.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
.

.
University of Indonesia

The Enhanced Entity-


Relationship (EER)
Model

2
Acknowledgement

• All materials in these slides are from:


• Elmasri, et al. Database Systems, 6th
Edition, Addison-Wesley, 2011
• Do not reproduce these slides for
commercial use and / or other purpose
outside Database 1 course.

3
Outline

• Subclasses, Superclasses, and Inheritance


• Specialization and Generalization
• Constraints and Characteristics of
Specialization and Generalization
Hierarchies
• Modeling of UNION Types Using
Categories

4
Why We Need an Enhanced ER?
• So far, ER has been useful to model a
‘traditional’ database (database processing
application for business and other common
industries)
• Since the late 70’s, the necessity for designing
schema for representing a more accurate
data properties and constraints, especially for
emerging application in several fields (CAD,
CAM, GIS, etc), is considered necessary.
• This necessity cause for a new development
semantic data modeling concepts to be
added to the existing ER model.
5
The Enhanced Entity- Relationship (EER) Model

• Enhanced ER (EER) model


✤ Created to design more accurate database
schemas
✴ Reflect the data properties and constraints more
precisely
✤ More complex requirements than traditional
applications

6
EER Model Concepts
• EER model includes all modeling concepts of
the ER model
• In addition, EER includes:
✤ Subclasses and superclasses
✤ Specialization and generalization
✤ Category or union type
✤ Attribute and relationship inheritance

• Enhanced ER or EER diagrams


✤ Diagrammatic technique for displaying these
concepts in an EER schema
7
Subclasses and Superclasses

• Subtype or subclass of an entity type


✤ Sub-groupings of entities that are meaningful
✤ Represented explicitly because of their
significance to the database application

• An entity in a subclass is a member of its


superclass, but it is not the other way
around
8
Superclasses/Subclasses Relationship
• Terms for relationship between a superclass
and any one of its subclasses
✤ Superclass / subclass
✤ Super-type / subtype
✤ Class / subclass relationship
✤ For example: Employee/Secretary, Employee/
Technician

• It is also called IS-A relationship


✤ SECRETARY IS AN EMPLOYEE
✤ TECHNICIAN IS AN EMPLOYEE
9
Type Inheritance

• Type inheritance
✤ Subclass entity inherits all attributes and
relationships of superclass

10
Specialization
• Specialization
✤ Process of defining a set of subclasses of an entity type
✤ Defined on the basis of some distinguishing
characteristic of the entities in the superclass

• Subclass can define:


✤ Specific attributes
✴ SECRETARY, ENGINEERS, TECHNICIAN are
specializations of EMPLOYEE based on the job_type
attribute
✤ Specific relationship types
✴ SALARIED_EMPLOYEE and HOURLY_EMPLOYEE are
specializations of EMPLOYEE based on the payment
methods
11
12
Specialization Notation in EER
Partial
Total
Participation
Participation

Disjoint Subclass
symbol

13
Specialization

• Certain attributes may apply to some but


not all entities of the superclass
• Some relationship types may be
participated in only by members of the
subclass

14
Benefits of Specialization

• Defines set of subclasses of a specific entity


type.
• Modeled specific attributes for each of the
subclass.
• Modeled specific relationship between a
subclass with other entity type or other
subclass.

15
Generalization

• Reverse process of abstraction


• Generalize into a single superclass
✤ Original entity types are special subclasses

• Generalization
✤ Process of defining a generalized entity type
from the given entity types
✤ By identifying entity types that have similar
attributes
✤ For example: TRUCK & CAR could be
generalized into VEHICLE
16
Example of Generalization

17
Constraints and Characteristics of Specialization and
Generalization

• A specialization based on attributes


✤ Specialization which formed based on the
attribute from its superclass (defining
attribute)
✤ For example: job_type

• A subclass defined by the user


✤ The membership of an entity in a subclass is
defined by the user

18
19
Constraints on Specialization and Generalization

The disjoint symbol (d) states


that an entity can only be a
member of its subclass.
The overlap symbol (o) states
that an entity can be a member of
more than one subclass.

Total (=): each entity of the


superclass becomes a member
of the subclass.
Partial (-): there exist an entity of
the superclass which are not
belong to any of the subclasses.
20
Constraints on Specialization and Generalization

• Based on those constraints, there are 4


forms of specialization/generalization:
✤ Disjoint, Total
✤ Disjoint, Partial
✤ Overlap, Total
✤ Overlap, Partial

• Generalization, commonly, has a total


constraint because the superclass is derived
from its subclasses.
21
An Example of Overlap and Total Specialization

22
Hierarchies and Lattices
• Specialization hierarchy
✤ Every subclass participates as a subclass in only one
class/subclass relationship
✤ Results in a tree structure or strict hierarchy
✴ For example:VEHICLE with TRUCK and CAR

• Specialization lattice
✤ Subclass can be a subclass in more than one class/
subclass relationship
✤ For example: a Engineering Manager must be an
Engineer and also a Manager
✤ Has a multiple inheritance concept
23
24
25
Hierarchies and Lattices

• Multiple inheritance
✤ Subclass with more than one superclass
✤ If an attribute (or relationship) originating in
the same superclass inherited more than once
via different paths in a lattice
✴ Included only once in a shared subclass

• Single inheritance
✤ Some models and languages limited to single
inheritance

26
Utilizing Specialization and Generalization in Refining
Conceptual Schemas

• Specialization process
✤ Start with entity type then define subclasses
by a successive specialization
✤ Top-down conceptual refinement
process

• Bottom-up conceptual synthesis


✤ Involves generalization rather than
specialization

27
Modeling of UNION Types Using Categories

• Union type or a category


✤ Represents a single superclass/subclass
relationship with more than one superclass
✤ Subclass represents a collection of objects
that is a subset of the UNION of distinct
entity types
✤ Attribute inheritance works more selectively
✤ Category can be total or partial

• Some modeling methodologies do not have


union types
28
A Sample UNIVERSITY EER Schema, Design
Choices, and Formal Definitions

• The UNIVERSITY Database Example


✤ UNIVERSITY database
✴ Students and their majors
✴ Transcripts, and registration
✴ University’s course offerings

29
Set Union
Operation
INSTRUCTOR_RE
SEARCHER is a
union subclass of
FACULTY and
GRAD_STUDENT

Category

30
Differences between Category and Lattice

• Engineering_Manager must exist in all of


the superclasses: MANAGER, ENGINEER,
SALARIED_EMPLOYEE
• Instructor_Researcher must exist in one of
the superclasses: FACULTY or
GRAD_STUDENT
• Engineering_Manager inherits all of the
superclasses’ attributes
• Instructor_Researcher inherits only certain
attributes of its superclasses (depending
from which superclass)
31
Partial Category

• Partial Category: the ability to participate


or not to participate in a relationship

32
Total Category
• Holds all entities in
its superclass
• For example: A
building and a lot
must be a member of
PROPERTY
• It can be represent
by a generalization
(d), especially if
there were a lot of
similarities.
33
Design Choices for Specialization/Generalization

• Many specializations and subclasses can be


defined to make the conceptual model
accurate
• If subclass has few specific attributes and
no specific relationships
✤ Can be merged into the superclass

34
Design Choices for Specialization/Generalization

• If all the subclasses of a specialization/


generalization have few specific attributes
and no specific relationships
✤ Can be merged into the superclass
✤ Replace with one or more type attributes
that specify the subclass or subclasses that
each entity belongs to

35
Design Choices for Specialization/Generalization

• Union types and categories should


generally be avoided
• Choice of disjoint/overlapping and total/
partial constraints on specialization/
generalization
• Driven by rules in mini-world being
modeled

36
Formal Definitions for the EER Model Concepts

• Class
✤ Set or collection of entities
✤ Includes any of the EER schema constructs of
group entities

• Subclass
✤ Class whose entities must always be a subset
of the entities in another class

• Specialization
✤ Set of subclasses that have same superclass
37
Formal Definitions for the EER Model Concepts

• Generalization
✤ Generalized entity type or superclass

• Predicate-defined
✤ Predicate on the attributes of is used to
specify which entities in C are members of S

• User-defined
✤ Subclass that is not defined by a predicate

38
Higher Degree Relationship
These two schemas
have different
meanings!

Ternary relationship type:


connects 3 entity type

Three binary
relationship type:
CAN_SUPPLY,
USES, SUPPLIES

39
Higher Degree Relationship
• How to simplify this seemly complex higher
degree relationship?

Option #1: Higher Option #2: Higher


degree relationship as degree relationship as
a weak entity an identifying
• Represents the higher relationship type
degree relationship as • A ternary relationship
a weak entity type that type with a weak entity
relates to the owner type and two owner
entity types entity types
• Includes a binary
(identifying)
relationship

40
Ternary Relationship as a Weak Entity Type

41
Ternary Relationship as Identifying Relationship Type

42
Ternary Vs. Binary Relationship Type

43
When Do We Use the EER Model?
• Most of database projects do not need the
object-oriented model features provided by
EER.
• The objective of conceptual data modeling
is to provide a simple and understandable
model.
• Do not use the complex class/subclass
relationship if it is not needed.
• The use of EER model offers benefits
compare to ER model if it were used in a
proper condition.
44
When Do We Use the EER Model?
• EER model needs to be use if the domain which
we are trying to model is naturally an object-
oriented domain, thus inheritance would be able
to reduce the complexity of the design.
• Use EER model in these situations:
✤ If the use of attribute inheritance is able to reduce
the use of null value in a single entity relation (the
one which contains multiple subclasses)
✤ A subclass can be use to explicitly modeled and
named a subset of an entity which participated in
its own relationship (where other subclass in the
same superclass is not participated in that
relationship)
45
Alternative Diagrammatic Notations

46
Summary

• Enhanced ER or EER model


✤ Extensions to ER model that improve its
representational capabilities
✤ Subclass and its superclass
✤ Category or union type

47

You might also like