Top Banner
The Enhanced E-R (EER) The Enhanced E-R (EER) Model Model EER model is used to identify the model that has resulted form extending the original ER model with these new modeling constructs. These extensions make the EER model semantically similar to object- oriented data modeling.
45

The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Dec 22, 2015

Download

Documents

Claire Townsend
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

The Enhanced E-R (EER) ModelThe Enhanced E-R (EER) Model

EER model is used to identify the model that has resulted form extending the original ER model with these new modeling constructs. These extensions make the EER model semantically similar to object-oriented data modeling.

Page 2: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Why EER Model?

• Business environment has changed dramatically– Business relationships become more complex, so

is business data– Business rules thus need a more powerful

modeling mechanism.• Object oriented database technology• Change in database technique is expensive

Page 3: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

SubtypeSupertype

Enhanced ER modelEnhanced ER model

• Student : Undergraduate Student: Graduate Student

• Guitar : Acoustic : Electric

• Employee : Hourly Employee: Salaried Employee: Consultant

EER model extends original ER model with two new EER model extends original ER model with two new modeling constructs – modeling constructs – supertypesupertype and and subtypesubtype

Page 4: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Supertypes and SubtypesSupertypes and Subtypes

• Supertype:Supertype: A generic entity that has a A generic entity that has a relationship with one or more subtypesrelationship with one or more subtypes– Generalized typeGeneralized type

• Subtype:Subtype: A subgrouping of the generic entity A subgrouping of the generic entity that has attributes distinct from those in other that has attributes distinct from those in other subgroupingssubgroupings– Specialized typeSpecialized type

Page 5: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Example – Employee

• Hourly Employees:– Employee Number, Employee Name, Address,

Date Hired, Hourly Rate

• Salaries Employees:– Employee Number, Employee Name, Address,

Date Hired, Annual Salary, Stock Option

• Consultants– Employee Number, Employee Name, Address,

Date Hired, Contract Number, Billing Rate

Page 6: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Employee NumberEmployee NameAddressDate HiredHourly RateAnnual SalaryStock OptionContract NumberBilling Rate

EMPLOYEE

Option 1

Page 7: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Option 2

Employee NumEmployee NameAddressDate HiredHourly Rate

Employee NumEmployee NameAddressDate HiredContract NumBilling Rate

Employee NumEmployee NameAddressDate HiredAnnual SalaryStock Option

HOURLYEMPLOYEE

SALARIEDEMPLOYEE

CONSULTANT

Page 8: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Option 3All employee subtypes will have employee number, name, address, and date hired

Each employee subtype will also have its own attributes

Page 9: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Attribute Inheritance

• The property by which subtype entities inherit values of all attributes of the supertype– Attributes that are shared by all entities are

associated with the supertype– Attributes that are unique to a particular subtype are

associated with that subtype.• An entity instance of a subtype represents the

same entity instance of the supertype.– A member of a subtype must be a member of the

supertype– Not necessary vice versa

Page 10: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Figure 3-2 Employee supertype with three subtypes

All employee subtypes will have employee number, name, address, and date hired

Each employee subtype will also have its own attributes

Attributes shared by all employees are associated with EMPLOYEE. Attributes that are peculiar to each subtype are included with that subtype only.

Page 11: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

EMPLOYEE

HOURLYEMPLOYEE

SALARIEDEMPLOYEE

CONSULTANT

Page 12: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Relationships InheritanceRelationships Inheritance

• Relationships at the Relationships at the supertypesupertype level indicate level indicate that all subtypes will participate in the that all subtypes will participate in the relationshiprelationship

• The instances of a The instances of a subtypesubtype may participate in may participate in a relationship unique to that subtype. In this a relationship unique to that subtype. In this situation, the relationship is shown at the situation, the relationship is shown at the subtype levelsubtype level

Page 13: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Figure 3-3 Supertype/subtype relationships in a hospital

Both outpatients and resident patients are cared for by a responsible physician

Only resident patients are assigned to a bed

Page 14: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

When to use supertype/subtype relationships?

• There are attributes that apply to only some instances of an entity.– Result in many Null values

• The instances of a subtype participate in a relationship unique to that subtype

Page 15: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Processes to create identify Processes to create identify supertype/subtype relationshipssupertype/subtype relationships

1.1. Generalization:Generalization: The process of defining a The process of defining a more general entity type from a set of more more general entity type from a set of more specialized entity types. BOTTOM-UPspecialized entity types. BOTTOM-UP

Page 16: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Figure 3-4 Example of generalization

a) Three entity types: CAR, TRUCK, and MOTORCYCLE

All these types of vehicles have common attributes

Page 17: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Figure 3-4 Example of generalization (cont.)

So we put the shared attributes in a supertype

Note: no subtype for motorcycle, since it has no unique attributes(remember the conditions to create subtypes?)

b) Generalization to VEHICLE supertype

Page 18: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Vehicle

Car

TruckInstance ofMotorcycleInstance ofMotorcycle

Page 19: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Processes to create identify supertype/subtype Processes to create identify supertype/subtype relationshipsrelationships

2.2. Specialization:Specialization: The process of defining The process of defining one or more subtypes of the supertype and one or more subtypes of the supertype and forming supertype/subtype relationships. forming supertype/subtype relationships. TOP-DOWNTOP-DOWN

Page 20: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Figure 3-5 Example of specialization

a) Entity type PART

Only applies to manufactured parts

Applies only to purchased parts

Page 21: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.
Page 22: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

b) Specialization to MANUFACTURED PART and PURCHASED PART

Note: multivalued attribute was replaced by an associative entity relationship to another entity

Created 2 subtypes

Figure 3-5 Example of specialization (cont.)

Page 23: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Constraints in SupertypeConstraints in Supertype

• Completeness ConstraintsCompleteness Constraints: : Whether an instance Whether an instance of a supertype of a supertype mustmust also be a member of at least also be a member of at least one subtypeone subtype

• Disjointness ConstraintsDisjointness Constraints: : Whether an instance of Whether an instance of a supertype may a supertype may simultaneouslysimultaneously be a member of be a member of two (or more) subtypestwo (or more) subtypes

• Subtype DiscriminatorSubtype Discriminator: An : An attributeattribute of the of the supertype whose values determine the target supertype whose values determine the target subtype(s)subtype(s)

• The three constraints are used in combinationThe three constraints are used in combination

Page 24: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Constraints in SupertypeConstraints in Supertype

1.1. Completeness ConstraintsCompleteness Constraints: Whether an : Whether an instance of a supertype instance of a supertype mustmust also be a also be a member of at least one subtypemember of at least one subtype

– TotalTotal Specialization Rule: Yes (double line) Specialization Rule: Yes (double line)– PartialPartial Specialization Rule: No (single line) Specialization Rule: No (single line)

Page 25: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Figure 3-6 Examples of completeness constraints a) Total specialization rule

Page 26: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

PATIENT

OUT PATIENT

RESIDENT PATIENT

Page 27: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

b) Partial specialization ruleFigure 3-6 Examples of completeness constraints (cont.)

Page 28: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Vehicle

Car

TruckInstance ofMotorcycleInstance ofMotorcycle

Page 29: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Constraints in SupertypeConstraints in Supertype

2.2. Disjointness ConstraintsDisjointness Constraints: Whether an : Whether an instance of a supertype may instance of a supertype may simultaneouslysimultaneously be a member of two (or more) subtypesbe a member of two (or more) subtypes

– Disjoint RuleDisjoint Rule: An instance of the supertype can be : An instance of the supertype can be only ONE of the subtypesonly ONE of the subtypes

– Overlap RuleOverlap Rule: An instance of the supertype could : An instance of the supertype could be more than one of the subtypesbe more than one of the subtypes

Page 30: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

a) Disjoint rule

Figure 3-7 Examples of disjointness constraints

Page 31: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Figure 3-2 Employee supertype with three subtypes

All employee subtypes will have employee number, name, address, and date hired

Each employee subtype will also have its own attributes

Attributes shared by all employees are associated with EMPLOYEE. Attributes that are peculiar to each subtype are included with that subtype only.

d

Page 32: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

b) Overlap ruleFigure 3-7 Examples of disjointness constraints (cont.)

Page 33: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Constraints in SupertypeConstraints in Supertype

• When inserting a new supertype instance, how to When inserting a new supertype instance, how to determine which subtype(s) should also has determine which subtype(s) should also has corresponding entries (if any)? corresponding entries (if any)?

3.3. Subtype DiscriminatorSubtype Discriminator: An : An attributeattribute of the of the supertype whose values determine the target supertype whose values determine the target subtype(s)subtype(s)

– 2 cases: Disjoint rules and Overlap rules2 cases: Disjoint rules and Overlap rules

Page 34: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Subtype DiscriminatorSubtype Discriminator

A.A. Disjoint subtypesDisjoint subtypes– a – a simplesimple attribute attribute is added to is added to the supertype with alternative values to indicate the supertype with alternative values to indicate the possible subtypesthe possible subtypes

Page 35: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Figure 3-8 Introducing a subtype discriminator (disjoint rule)

Page 36: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

EMPLOYEE

HOURLYEMPLOYEE

SALARIEDEMPLOYEE

CONSULTANT

Page 37: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Subtype DiscriminatorSubtype Discriminator

B.B. Overlapping subtypesOverlapping subtypes– a – a compositecomposite attribute attribute is is added to the supertype. The subparts of this added to the supertype. The subparts of this composite attribute pertain to different subtypes. composite attribute pertain to different subtypes. Each subpart contains a Boolean value (Y/N) to Each subpart contains a Boolean value (Y/N) to indicate whether or not the instance belongs to the indicate whether or not the instance belongs to the associated subtypeassociated subtype

Page 38: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Values of the composite attribute

Page 39: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Figure 3-9 Subtype discriminator (overlap rule)

Page 40: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

PART

MANUFACTURED PART

PURCHASED PART

Page 41: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Supertype/subtype hierarchy

• Supertype/subtype hierarchy is a hierarchical arrangement of supertypes and subtypes, where each subtype has only one supertype.– Each subtype may also be a supertype with

subtypes

Page 42: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Example: University

Most general entity

Common attributes for everyone in

this university

Total specialization rule

Overlap rule

Subtype of PERSON become

suptertype of FACULTY

Page 43: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

Business Rule

A bank has three types of accounts: checking, saving, and loan. Following are the attributes for each type of account: CHECKING: Acct No, Date Opened, Balance, Services ChargeSAVING: Acct No, Date Opened, Balance, Interest Rate, PaymentLOAN: Acct No, Date Opened, Balance, Interest Rate, Assume that each bank account must be a member of exactly one of these subtypes.

Page 44: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

• Each case handled by the firm has a unique case number; a date opened, date closed, and judgment description are also kept on each case. A case is brought by one or more plaintiffs, and the same plaintiff may be involved in many cases. A plaintiff has a requested judgment characteristic. A case is against one or more defendants and the same defendant may be involved in many cases. A plaintiff or defendant may be a person or organization may be a defendant or a plaintiff in cases. In either situation, such legal entities are identified by an entity number, and other attributes are name and net worth.

Page 45: The Enhanced E-R (EER) Model The Enhanced E-R (EER) Model EER model is used to identify the model that has resulted form extending the original ER model.

• Each employee has a unique id and is required to store his/her name, date of birth, and skill.

• An employee may be married to another employee.• Each employee may have one or more dependents.

Dependents’ name and age are recorded. Dependents’ information does not exist without employees of the dependents.

• Each employee is supervised by one employee. An employee may supervise at most 10 other employees.

• An employee can be assigned to one or more projects. Each project is participated by two to five employees. Each project assignment is associated with hours per week the employee need to spend on.

• Each project is managed by exactly one employee. An employee may manage at most one project.