0% found this document useful (0 votes)
138 views

EER Model Handout

The document describes an introduction to database systems course. It covers the enhanced entity-relationship (EER) data model, which incorporates concepts like subclasses, specialization, generalization, and attribute inheritance. It provides examples of how specialization allows subclasses to define additional attributes and relationships. Specialization can be predicate-defined or user-defined, and subclasses can be disjoint, overlapping, total, or partial. Hierarchies only allow single inheritance while lattices allow multiple inheritance. The document also gives examples of using the EER model to represent railway and airline reservation systems.

Uploaded by

Maimur Hasan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
138 views

EER Model Handout

The document describes an introduction to database systems course. It covers the enhanced entity-relationship (EER) data model, which incorporates concepts like subclasses, specialization, generalization, and attribute inheritance. It provides examples of how specialization allows subclasses to define additional attributes and relationships. Specialization can be predicate-defined or user-defined, and subclasses can be disjoint, overlapping, total, or partial. Hierarchies only allow single inheritance while lattices allow multiple inheritance. The document also gives examples of using the EER model to represent railway and airline reservation systems.

Uploaded by

Maimur Hasan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

CS4710 Introduction to Database Systems

Enhanced-ER Data Model

Instructor: Yi-Shin Chen


Office: EECS 3201
Email: [email protected]
Office Hour: Tu. 1-2PM, Th. 3-4pm

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

2007/3/13 Introduction to Database Systems 2

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

2007/3/13 Introduction to Database Systems 3

Key Ideas of EER


ƒ Generalization
} Compute the union of two or more entity sets (or subclasses)
⇒ Produce a higher-level entity set (or superclass)
⇒ Containment relationship between the superclass and subclass(es)
ƒ Specialization
} Construct the subclasses that are a subset of superclasses
} Reverse of generalization
ƒ Example

We focus on specialization afterward


2007/3/13 Introduction to Database Systems 4

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

2007/3/13 Introduction to Database Systems 5

Subclass
ƒ Subclass entities inherit attributes from the superclass
ƒ An entity can be a member of a number of subclasses

Sex Name ID Address DoB

Person

Employee Alumnus Student

Salary Class Major

ƒ An entity cannot just being a member of a subclass but not superclass


} It is not essential that every entity in a superclass be a member of some
subclass

2007/3/13 Introduction to Database Systems 6

3
Different Types of Specialization
ƒ Predicate-defined (or condition-defined)
} Determine subclass membership by examining the value of a
specific attribute (termed “defining attribute”)

Sex Name ID Address DoB

Employee

Secretary Faculty Technician

Typing Speed Research Interest Specialty

ƒ User-defined
} The user specifies subclass membership individually
2007/3/13 Introduction to Database Systems 7

Different Types of Specialization


ƒ Disjoint: an entity can be a member of at most one subclass
ƒ Overlap: when the subclasses are not disjoint

ƒ Total: each entity must be a member of some subclass


ƒ Partial: An entity might belong to no subclass

ƒ Disjointness and completeness constraints are independent


} Hence, four combinations are possible
2007/3/13 Introduction to Database Systems 8

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

2007/3/13 Introduction to Database Systems 9

Lattice Example

2007/3/13 Introduction to Database Systems 10

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: Database for vehicle registration, vehicle


owner can be a person, a bank (holding a lien on a
vehicle) or a company.
} Category (subclass) OWNER is a subset of the union of the
three superclasses COMPANY, BANK, and PERSON
2007/3/13 Introduction to Database Systems 11

Example of Categories

2007/3/13 Introduction to Database Systems 12

6
Category Member vs. Shared Subclass

ƒ A category member must exist in at least one of


its superclasses
ƒ Note: The difference from shared subclass,
which is subset of the intersection of its
superclasses (shared subclass member must
exist in all of its superclasses).

2007/3/13 Introduction to Database Systems 13

Example: Railway System


ƒ Each line has a unique line code
} Lines may run via mountain or sea
} Each line is associated with origin, destination, intermediate stops, and
all scheduled departure time, and scheduled arrival time
} Not every line runs every day
} Every time the line runs must be recorded.
ƒ There are four types of trains: each has fixed cars
} TzeChiang, ChuKuang,
} TzeChiang: the fastest one
} ChuKuang: the second fastest
} FuHsing: the slowest one
} EMU: where customers can sit anywhere
ƒ Tickets
} The types of tickets are classified into normal, half-fare, and platform
tickets

2007/3/13 Introduction to Database Systems 14

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

2007/3/13 Introduction to Database Systems 15

Example: Reservation System


ƒ Reservation System for airline companies
} Each company has many aircrafts
ƒ Each has a registration number, make, model, and the maximum
capacity of passengers
} Each company has many flights
ƒ Flights can be classified into domestic or international routes
ƒ Each flight departs from and arrives at registered airports
} An airport also has an airport code, description name, city and country
} Flight may stop at some intermediate stops
} Customers could take a transfer flight from intermediate stops
ƒ Each flight has three seat classes
} First Class, Business Class, and Economy class
ƒ For every flight, the system should store a list of available seats
ƒ The seat arrangements are associated with aircrafts
ƒ Each seat can only be reserved to one customer
ƒ Ticket prices are associated with classes and time
ƒ Customers can make reservation without reserving seats
ƒ Each flight allow 20% overbooking

2007/3/13 Introduction to Database Systems 16

8
Example: Reservation System (Contd.)

ƒ The reservation system should keep


} A unique identifier for each customer
ƒ This identifier is assigned automatically once customers make a
new reservation in the system
} Customer information
} Flight information
} The time that reservation was made
} A credit-card number associated with the reservation
} A flag which indicates whether this particular reservation is paid
or not
ƒ When a reservation is paid it is transformed automatically to a ticket
ƒ The reservation can be canceled before flight departure, however
the ticket is still valid (to exchange some products)
ƒ Each reservation might be associated with many flights
2007/3/13 Introduction to Database Systems 17

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

2007/3/13 Introduction to Database Systems 18

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

2007/3/13 Introduction to Database Systems 19

Example: Movie On Demand System


ƒ The movie-on-demand (MoD) provider operates several
video servers in different geographical locations that let
customers view movies at home via a special set-top box
that interfaces with their TV and that further connects to
the video server network.
ƒ The database must represent the following information:
} Video Movie Information
ƒ A movie has a title, release date, rating, running time, director, and
one or more actors
ƒ Movies are split between domestic and foreign movies
} A foreign movie uses a language other than English and may provide
English subtitles
} Domestic movies are further categorized into comedy, drama, action,
and horror movies
ƒ A comedy movie has the degree of “funniness” which ranges
between 1 and 5
ƒ A drama movie has a short description such as “love story”,
“documentary”, “humanity”, etc.

2007/3/13 Introduction to Database Systems 20

10
Example: Movie On Demand System (Con.)

ƒ Each movie could be reviewed by one or more critics, each of whom


evaluates it as between zero and five stars
} A critic has a name and a phone number
} He or she might review one or more movies
ƒ A movie may have won one or more academy awards (i.e., “Oscars”)
} If that is the case, then the movie has a list of all the categories in which it won
} E.g., “best picture”, “best actor”, “best actress”, etc.
ƒ Each movie is stored on a number of different video servers
} Each video server has a unique ID and an address (location)
} If a customer requests a movie then that movie is delivered (streamed) from one
of the video servers to the customer’s home
} Each movie can be supplied by only one distributor
ƒ One distributor might provide several movies
} For each distributor, the MoD provider keeps track of information about its name,
address, and phone number
} A distributor’s address can be accessed as street address, city, state, and zip
code individually
} However, the entire address of a distributor can also be retrieved as a unit

2007/3/13 Introduction to Database Systems 21

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.

2007/3/13 Introduction to Database Systems 22

11
Example: Movie On Demand System (Con.)

ƒ Bill Statement Information


} Each customer receives one bill statement after each viewing
transaction
} Each statement has a billing date, a billing number, one or more
movie titles, and a total charge.
} A billing number is unique for a particular customer
ƒ It is not unique across different customers
ƒ Release Charge Information
} For each movie, a release type is defined
ƒ Arbitrarily recent movies are marked as “new release,” whereas
others are marked as “ordinary release.”
} The store keeps track of different charge information for different
release types
ƒ For newly released movies, the fee is $100 for the first viewing and
$30 for each additional viewing
ƒ For the other ones, the fee is $50 for the first viewing and $15 for
each additional viewing

2007/3/13 Introduction to Database Systems 23

12

You might also like