EER Model Handout
EER Model Handout
Motivation
ER data model is useful to describe “traditional”
applications
Newer types of applications were difficult to model, for
example:
} Design and manufacturing (CAD/CAM)
} Geographic Information Systems (GIS)
These applications had more complex requirements
Semantic data modeling concepts needed to be
incorporated
} Result⇒ Enhanced (or Extended) ER data model
1
EER Model Concepts
Includes all modeling concepts of basic ER
Additional concepts: subclasses/superclasses,
specialization/generalization, categories,
attribute inheritance
It is used to model applications more completely
and accurately if needed
It includes some object-oriented concepts, such
as inheritance
2
Why Specialization
The process allows us to
} Define a set of subclasses of an entity type
} Establish additional specific attributes with each
subclass
} Establish additional specific relationship sets between
each subclass and other entity sets
Subclass
Subclass entities inherit attributes from the superclass
An entity can be a member of a number of subclasses
Person
3
Different Types of Specialization
Predicate-defined (or condition-defined)
} Determine subclass membership by examining the value of a
specific attribute (termed “defining attribute”)
Employee
User-defined
} The user specifies subclass membership individually
2007/3/13 Introduction to Database Systems 7
4
Hierarchies vs. Lattices
Hierarchy has a constraint that every subclass has only
one superclass (called single inheritance)
In a lattice, a subclass can be subclass of more than one
superclass (called multiple inheritance)
} A subclass with more than one superclass is called a shared
subclass
In a lattice or hierarchy, a subclass inherits attributes not
only of its direct superclass, but also of all its
predecessor superclasses
Lattice Example
5
Categories (UNION TYPES)
In some cases, need to model a single
superclass/subclass relationship with more than one
superclass
} Superclasses represent different entity types
} Such a subclass is called a category or UNION TYPE
Example of Categories
6
Category Member vs. Shared Subclass
7
Example: Railway System (Contd.)
Information of normal and half-fare tickets includes
} The origin
} The destination
} Price
} The line he takes
} The date he takes
} Car number and seat number should also be recorded except for EMU
} If all seats were sold out, passengers will get tickets without seats
} If a customer bought a round trip ticket, he could get 10% discount
Customers can book tickets by the Internet or by telephone
} One customer can book up to four tickets at one time
Booking information includes
} Personal ID of the customer
} The date he booked the tickets
} The information of the tickets
} Booked tickets are only reserved for 5 days
If a customer didn’t pay for the booked tickets in time, the booking is invalid
and the seats are released for other customers
8
Example: Reservation System (Contd.)
Example: Registration-System
For University System of Taiwan (UST)
Each school has many departments
Each department will offer many courses
} Some courses are specially designed for students majoring in
some subjects
} Some courses will be offered regularly
} For some courses, there will be many classes in one semester
taught by different instructors
} Some courses will have prerequisite subjects
} Some classes will control the number of seats
} The system should avoid time conflicts when students schedule
their courses
9
Example: Registration-System
(Cond.)
} Some courses are specially designed for graduate students
} Graduate students can become TAs of certain classes
However, he/she has to take this course before
} A full-time student should enroll in at least
8-units/semester for graduate students
6-units/semester for graduate students who have TA/RAships
12-units/semester for undergraduate students
} The instructors of classes can be
Faculty
PhD students (who can only teach undergraduate-level classes)
} Students receiving RAships should work with some faculty
10
Example: Movie On Demand System (Con.)
Employee Information
} An employee has a name, a social security number, date of birth, salary,
and a phone number
} He or she may have a supervisor
} Employees are either permanent or temporary, but not both
} Each permanent employee has an employee number
} All supervisors are permanent employees
} An employee works at the location of one of the video servers
Customer Information
} A customer has a social security number, a name, a phone number, and
an address
} Each customer must have one or more credit cards
Each credit card includes a type of credit card (Visa/MasterCard/…), a card
number, and an expiration date.
Viewing Transaction Information
} Each customer can view movies from a video server
} For each viewing transaction, the viewing date and time is recorded.
11
Example: Movie On Demand System (Con.)
12