Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Enhanced E-R (EER) Model

Similar presentations


Presentation on theme: "The Enhanced E-R (EER) Model"— Presentation transcript:

1 The 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.

2 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

3 Enhanced ER model Student : Undergraduate Student : Graduate Student
EER model extends original ER model with two new modeling constructs – supertype and subtype Supertype Subtype Student : Undergraduate Student : Graduate Student Guitar : Acoustic : Electric Employee : Hourly Employee : Salaried Employee : Consultant

4 Supertypes and Subtypes
Supertype: A generic entity that has a relationship with one or more subtypes Generalized type Subtype: A subgrouping of the generic entity that has attributes distinct from those in other subgroupings Specialized type

5 Example – Employee Hourly Employees: Salaries Employees: Consultants
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

6 Option 1 EMPLOYEE Employee Number Employee Name Address Date Hired
Hourly Rate Annual Salary Stock Option Contract Number Billing Rate EMPLOYEE

7 Option 2 HOURLY SALARIED CONSULTANT EMPLOYEE EMPLOYEE Employee Num
Employee Name Address Date Hired Hourly Rate HOURLY EMPLOYEE Employee Num Employee Name Address Date Hired Annual Salary Stock Option SALARIED EMPLOYEE Employee Num Employee Name Address Date Hired Contract Num Billing Rate CONSULTANT

8 Option 3 All employee subtypes will have employee number, name, address, and date hired Each employee subtype will also have its own attributes

9 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

10 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.

11 HOURLY EMPLOYEE EMPLOYEE SALARIED EMPLOYEE CONSULTANT

12 Relationships Inheritance
Relationships at the supertype level indicate that all subtypes will participate in the relationship The instances of a subtype may participate in a relationship unique to that subtype. In this situation, the relationship is shown at the subtype level

13 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

14 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

15 Figure 3-1 Basic notation for supertype/subtype notation
a) EER notation

16 Processes to create identify supertype/subtype relationships
Generalization: The process of defining a more general entity type from a set of more specialized entity types. BOTTOM-UP

17 Figure 3-4 Example of generalization
a) Three entity types: CAR, TRUCK, and MOTORCYCLE All these types of vehicles have common attributes

18 Figure 3-4 Example of generalization (cont.)
b) Generalization to VEHICLE supertype So we put the shared attributes in a supertype Draw example Note: no subtype for motorcycle, since it has no unique attributes (remember the conditions to create subtypes?)

19 Vehicle Car Instance of Motorcycle Truck

20 Processes to create identify supertype/subtype relationships
Specialization: The process of defining one or more subtypes of the supertype and forming supertype/subtype relationships. TOP-DOWN

21 Figure 3-5 Example of specialization
a) Entity type PART Only applies to manufactured parts Applies only to purchased parts

22

23 Figure 3-5 Example of specialization (cont.)
b) Specialization to MANUFACTURED PART and PURCHASED PART Note: multivalued attribute was replaced by an associative entity relationship to another entity Created 2 subtypes

24 Constraints in Supertype
Completeness Constraints: Whether an instance of a supertype must also be a member of at least one subtype Disjointness Constraints: Whether an instance of a supertype may simultaneously be a member of two (or more) subtypes Subtype Discriminator: An attribute of the supertype whose values determine the target subtype(s) The three constraints are used in combination

25 Constraints in Supertype
Completeness Constraints: Whether an instance of a supertype must also be a member of at least one subtype Total Specialization Rule: Yes (double line) Partial Specialization Rule: No (single line)

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

27 PATIENT OUT PATIENT RESIDENT PATIENT

28 Figure 3-6 Examples of completeness constraints (cont.)
b) Partial specialization rule

29 Vehicle Car Instance of Motorcycle Truck

30 Constraints in Supertype
Disjointness Constraints: Whether an instance of a supertype may simultaneously be a member of two (or more) subtypes Disjoint Rule: An instance of the supertype can be only ONE of the subtypes Overlap Rule: An instance of the supertype could be more than one of the subtypes

31 Figure 3-7 Examples of disjointness constraints
a) Disjoint rule

32 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 d Attributes shared by all employees are associated with EMPLOYEE. Attributes that are peculiar to each subtype are included with that subtype only.

33 Figure 3-7 Examples of disjointness constraints (cont.)
b) Overlap rule

34 Constraints in Supertype
When inserting a new supertype instance, how to determine which subtype(s) should also has corresponding entries (if any)? Subtype Discriminator: An attribute of the supertype whose values determine the target subtype(s) 2 cases: Disjoint rules and Overlap rules

35 Subtype Discriminator
Disjoint subtypes– a simple attribute is added to the supertype with alternative values to indicate the possible subtypes

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

37 EMPLOYEE HOURLY EMPLOYEE SALARIED EMPLOYEE CONSULTANT

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

39 Values of the composite attribute

40 Figure 3-9 Subtype discriminator (overlap rule)

41 PART MANUFACTURED PART PURCHASED PART

42 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

43 Example: University Most general entity Total specialization rule
Common attributes for everyone in this university Overlap rule Subtype of PERSON become suptertype of FACULTY

44 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 Charge SAVING: Acct No, Date Opened, Balance, Interest Rate, Payment LOAN: Acct No, Date Opened, Balance, Interest Rate, Assume that each bank account must be a member of exactly one of these subtypes.

45 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.

46 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.


Download ppt "The Enhanced E-R (EER) Model"

Similar presentations


Ads by Google