eer model handout
Post on 08-Apr-2018
220 Views
Preview:
TRANSCRIPT
-
8/6/2019 EER Model Handout
1/12
1
Enhanced-ER Data Model
CS4710 Introduction to Database Systems
Instructor: Yi-Shin ChenOffice: EECS 3201Email: yishin@cs.nthu.edu.tw
Office Hour: Tu. 1-2PM, Th. 3-4pm
2007/3/13 Introduction to Database Systems 2
Motivation
ER data model is useful to describe traditionalapplicationsNewer types of applications were difficult to model, forexample:
Design and manufacturing (CAD/CAM)
Geographic Information Systems (GIS)These applications had more complex requirementsSemantic data modeling concepts needed to beincorporated
Result Enhanced (or Extended) ER data model
-
8/6/2019 EER Model Handout
2/12
2
2007/3/13 Introduction to Database Systems 3
EER Model ConceptsIncludes all modeling concepts of basic ERAdditional concepts: subclasses/superclasses,specialization/generalization, categories,attribute inheritanceIt is used to model applications more completelyand accurately if neededIt includes some object-oriented concepts, suchas inheritance
2007/3/13 Introduction to Database Systems 4
Key Ideas of EERGeneralization
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 superclassesReverse of generalization
Example
We focus on specialization afterward
-
8/6/2019 EER Model Handout
3/12
3
2007/3/13 Introduction to Database Systems 5
Why SpecializationThe process allows us to
Define a set of subclasses of an entity typeEstablish additional specific attributes with eachsubclassEstablish additional specific relationship sets betweeneach subclass and other entity sets
2007/3/13 Introduction to Database Systems 6
Subclass
Subclass entities inherit attributes from the superclassAn entity can be a member of a number of subclasses
An entity cannot just being a member of a subclass but not superclassIt is not essential that every entity in a superclass be a member of somesubclass
Person
Employee Alumnus Student
Sex Name ID Address DoB
Salary MajorClass
-
8/6/2019 EER Model Handout
4/12
4
2007/3/13 Introduction to Database Systems 7
Different Types of SpecializationPredicate-defined (or condition-defined)
Determine subclass membership by examining the value of aspecific attribute (termed defining attribute)
User-definedThe user specifies subclass membership individually
Secretary Faculty Technician
Sex Name ID Address DoB
Typing Speed SpecialtyResearch Interest
Employee
2007/3/13 Introduction to Database Systems 8
Different Types of SpecializationDisjoint: an entity can be a member of at most one subclassOverlap: when the subclasses are not disjoint
Total: each entity must be a member of some subclassPartial: An entity might belong to no subclass
Disjointness and completeness constraints are independentHence, four combinations are possible
-
8/6/2019 EER Model Handout
5/12
-
8/6/2019 EER Model Handout
6/12
6
2007/3/13 Introduction to Database Systems 11
Categories (UNION TYPES)In some cases, need to model a singlesuperclass/subclass relationship with more than onesuperclass
Superclasses represent different entity typesSuch a subclass is called a category or UNION TYPE
Example: Database for vehicle registration, vehicleowner can be a person, a bank (holding a lien on avehicle) or a company.
Category (subclass) OWNER is a subset of the union of thethree superclasses COMPANY, BANK, and PERSON
2007/3/13 Introduction to Database Systems 12
Example of Categories
-
8/6/2019 EER Model Handout
7/12
7
2007/3/13 Introduction to Database Systems 13
Category Member vs. Shared Subclass
A category member must exist in at least one ofits superclassesNote: The difference from shared subclass,which is subset of the intersection of itssuperclasses (shared subclass member mustexist in all of its superclasses).
2007/3/13 Introduction to Database Systems 14
Example: Railway System
Each line has a unique line codeLines may run via mountain or seaEach line is associated with origin, destination, intermediate stops, andall scheduled departure time, and scheduled arrival timeNot every line runs every dayEvery time the line runs must be recorded.
There are four types of trains: each has fixed carsTzeChiang, ChuKuang,TzeChiang: the fastest oneChuKuang: the second fastestFuHsing: the slowest oneEMU: where customers can sit anywhere
TicketsThe types of tickets are classified into normal, half-fare, and platformtickets
-
8/6/2019 EER Model Handout
8/12
8
2007/3/13 Introduction to Database Systems 15
Example: Railway System (Contd.)Information of normal and half-fare tickets includes
The originThe destinationPriceThe line he takesThe date he takesCar number and seat number should also be recorded except for EMUIf all seats were sold out, passengers will get tickets without seatsIf a customer bought a round trip ticket, he could get 10% discount
Customers can book tickets by the Internet or by telephoneOne customer can book up to four tickets at one time
Booking information includesPersonal ID of the customerThe date he booked the ticketsThe information of the ticketsBooked tickets are only reserved for 5 days
If a customer didnt pay for the booked tickets in time, the booking is invalidand the seats are released for other customers
2007/3/13 Introduction to Database Systems 16
Example: Reservation System
Reservation System for airline companiesEach company has many aircrafts
Each has a registration number, make, model, and the maximumcapacity of passengers
Each company has many flightsFlights can be classified into domestic or international routesEach flight departs from and arrives at registered airports
An airport also has an airport code, description name, city and countryFlight may stop at some intermediate stopsCustomers could take a transfer flight from intermediate stops
Each flight has three seat classesFirst Class, Business Class, and Economy class
For every flight, the system should store a list of available seatsThe seat arrangements are associated with aircraftsEach seat can only be reserved to one customerTicket prices are associated with classes and time
Customers can make reservation without reserving seatsEach flight allow 20% overbooking
-
8/6/2019 EER Model Handout
9/12
9
2007/3/13 Introduction to Database Systems 17
Example: Reservation System (Contd.)
The reservation system should keepA unique identifier for each customer
This identifier is assigned automatically once customers make anew reservation in the system
Customer informationFlight informationThe time that reservation was madeA credit-card number associated with the reservationA flag which indicates whether this particular reservation is paid
or notWhen a reservation is paid it is transformed automatically to a ticketThe reservation can be canceled before flight departure, howeverthe ticket is still valid (to exchange some products)
Each reservation might be associated with many flights
2007/3/13 Introduction to Database Systems 18
Example: Registration-SystemFor University System of Taiwan (UST)Each school has many departmentsEach department will offer many courses
Some courses are specially designed for students majoring insome subjects
Some courses will be offered regularlyFor some courses, there will be many classes in one semestertaught by different instructorsSome courses will have prerequisite subjectsSome classes will control the number of seatsThe system should avoid time conflicts when students scheduletheir courses
-
8/6/2019 EER Model Handout
10/12
10
2007/3/13 Introduction to Database Systems 19
Example: Registration-System(Cond.)
Some courses are specially designed for graduate studentsGraduate students can become TAs of certain classes
However, he/she has to take this course beforeA full-time student should enroll in at least
8-units/semester for graduate students6-units/semester for graduate students who have TA/RAships12-units/semester for undergraduate students
The instructors of classes can beFaculty
PhD students (who can only teach undergraduate-level classes)Students receiving RAships should work with some faculty
2007/3/13 Introduction to Database Systems 20
Example: Movie On Demand System
The movie-on-demand (MoD) provider operates severalvideo servers in different geographical locations that letcustomers view movies at home via a special set-top boxthat interfaces with their TV and that further connects tothe video server network.The database must represent the following information:
Video Movie InformationA movie has a title, release date, rating, running time, director, andone or more actorsMovies are split between domestic and foreign movies
A foreign movie uses a language other than English and may provideEnglish subtitlesDomestic movies are further categorized into comedy, drama, action,and horror movies
A comedy movie has the degree of funniness which rangesbetween 1 and 5A drama movie has a short description such as love story,documentary, humanity, etc.
-
8/6/2019 EER Model Handout
11/12
11
2007/3/13 Introduction to Database Systems 21
Example: Movie On Demand System (Con.)
Each movie could be reviewed by one or more critics, each of whomevaluates it as between zero and five stars
A critic has a name and a phone numberHe 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 wonE.g., best picture, best actor, best actress, etc.
Each movie is stored on a number of different video serversEach video server has a unique ID and an address (location)If a customer requests a movie then that movie is delivered (streamed) from oneof the video servers to the customers homeEach movie can be supplied by only one distributor
One distributor might provide several moviesFor each distributor, the MoD provider keeps track of information about its name,address, and phone numberA distributors address can be accessed as street address, city, state, and zipcode individuallyHowever, the entire address of a distributor can also be retrieved as a unit
2007/3/13 Introduction to Database Systems 22
Example: Movie On Demand System (Con.)
Employee InformationAn employee has a name, a social security number, date of birth, salary,and a phone numberHe or she may have a supervisorEmployees are either permanent or temporary, but not bothEach permanent employee has an employee numberAll supervisors are permanent employeesAn employee works at the location of one of the video servers
Customer InformationA customer has a social security number, a name, a phone number, andan addressEach customer must have one or more credit cards
Each credit card includes a type of credit card (Visa/MasterCard/), a cardnumber, and an expiration date.
Viewing Transaction InformationEach customer can view movies from a video serverFor each viewing transaction, the viewing date and time is recorded.
-
8/6/2019 EER Model Handout
12/12
12
2007/3/13 Introduction to Database Systems 23
Example: Movie On Demand System (Con.)
Bill Statement InformationEach customer receives one bill statement after each viewingtransactionEach statement has a billing date, a billing number, one or moremovie titles, and a total charge.A billing number is unique for a particular customer
It is not unique across different customersRelease Charge Information
For each movie, a release type is definedArbitrarily recent movies are marked as new release, whereasothers are marked as ordinary release.
The store keeps track of different charge information for differentrelease typesFor newly released movies, the fee is $100 for the first viewing and$30 for each additional viewingFor the other ones, the fee is $50 for the first viewing and $15 foreach additional viewing
top related