Presentation is loading. Please wait.

Presentation is loading. Please wait.

Enhanced Entity-Relationship and Object Modeling Chapter 4

Similar presentations


Presentation on theme: "Enhanced Entity-Relationship and Object Modeling Chapter 4"— Presentation transcript:

1 Enhanced Entity-Relationship and Object Modeling Chapter 4
Database Management COP4540, SCS, FIU

2 Supertypes and Subtypes
Subtype: A subgrouping of the entities in an entity type that has distinct attributes Supertype: An entity type whose subtypes share common attributes Database Management COP4540, SCS, FIU

3 Employee supertype with three subtypes
Name Address SSN EMPLOYEE Date_hired HOURLY EMPLOYEE SALARED EMPLOYEE CONSULTANT Annual_salary Billing_rate Stock_option Contract_No. Hourly_rate Database Management COP4540, SCS, FIU

4 Attribute Inheritance
Subtype entities inherit values of all attributes of the supertype An occurrence of a subtype is also an occurrence of the supertype All common attributes of subtypes appear in the supertype Database Management COP4540, SCS, FIU

5 Use of Supertype/Subtype
There are attributes that apply to some (but not all) of the instances of an entity. The instances of a subtype participate in a relationship unique to that subtype. Database Management COP4540, SCS, FIU

6 Unique relationship for a subtype
Admit_date Physician_ID ID 1 N RESPONSIBLE PHYSICIAN Is_cared_for PATIENT Bed_ID RESIDENT PATIENT 1 Is_assigned 1 BED OUTPATIENT Checkback_date Date_discharged Database Management COP4540, SCS, FIU

7 Generalization and Specialization
Generalization: The process of defining a more general entity from a set of more specialized entities. Specialization: The process of defining one or more subtypes of the supertype. Top-down conceptual refinement process. Bottom-up conceptual synthesis. Database Management COP4540, SCS, FIU

8 Example of generalization
(a) Three entity types: CAR, TRUCK, and MOTORCYCLE Make Model No_of_Passengers VIN Name Year Make Model Engine Displacement Capacity Price CAR VIN Name Year Engine Displacement Price TRUCK Make Model VIN Name Year Cab_type Engine Displacement Price MOTORCYCLE Database Management COP4540, SCS, FIU

9 (b) Generalization to VEHICLE supertype
Make Model VIN Name Year Engine Displacement Price VEHICLE No_of_Passengers CAR TRUCK Capacity Cab_type Database Management COP4540, SCS, FIU

10 Example of specialization
(a) Entity type PART Unit_price Supplier_ID Description Part_No PART Routing_number Qty_on_hand Location Database Management COP4540, SCS, FIU

11 (b) Specialization to MANUFACTURED PART and PURCHASED PART
Description Location Supplier_ID SUPPLIER Part_No PART Qty_on_hand Routing_number Unit_Price N MANUFACTURED PART PURCHASED PART Supplies M Database Management COP4540, SCS, FIU

12 Constraints in Supertype/Subtype Relationships (1)
Completeness Constraints: Whether an instance of a supertype must also be a member of at least one subtype. Total Specialization Rule: the double line convention Partial Specialization Rule: default (single line) Database Management COP4540, SCS, FIU

13 Example of Completeness constraints
Admit_date Physician_ID ID 1 N RESPONSIBLE PHYSICIAN Is_cared_for PATIENT Bed_ID RESIDENT PATIENT 1 Is_assigned 1 BED OUTPATIENT Checkback_date Date_discharged Database Management COP4540, SCS, FIU

14 Constraints in Supertype/Subtype Relationships (2)
Disjointness Constraints: Whether an instance of a supertype may simultaneously be a member of two (or more) subtypes Disjoint Rule: the symbol “d” Overlap Rule: the symbol “o” Database Management COP4540, SCS, FIU

15 Example of disjointness constraints
(a) Disjoint rule Admit_date Physician_ID ID 1 N RESPONSIBLE PHYSICIAN Is_cared_for PATIENT d Bed_ID RESIDENT PATIENT 1 Is_assigned 1 BED OUTPATIENT Checkback_date Date_discharged Database Management COP4540, SCS, FIU

16 (b) Overlap rule   SUPPLIER PART o MANUFACTURED PART PURCHASED PART
Description Location Supplier_ID SUPPLIER Part_No PART Qty_on_hand o Routing_number Unit_Price N MANUFACTURED PART PURCHASED PART Supplies M Database Management COP4540, SCS, FIU

17 Constraints in Supertype/Subtype Relationships
Subtype Discriminators: An attribute of the supertype whose values determine the target subtypes(s). Disjoint (one subtype for each instance) Overlapping (multiple subtypes possible) Such subtype is said to be predicate-defined. Database Management COP4540, SCS, FIU

18 Example of Subtype Discriminator (1)
Name Address SSN EMPLOYEE Date_hired d Type Type = ‘H” Type = ‘C’ Type = ‘S’ HOURLY EMPLOYEE SALARED EMPLOYEE CONSULTANT Annual_salary Billing_rate Stock_option Contract_No. Hourly_rate Database Management COP4540, SCS, FIU

19 Example of Subtype Discriminator (2)
Description Location Supplier_ID P? Part_type SUPPLIER Part_No PART Qty_on_hand o M?=‘Y’ P?=‘Y’ Routing_number Unit_Price N MANUFACTURED PART PURCHASED PART Supplies M Database Management COP4540, SCS, FIU

20 Modeling of UNION Types Using Category
A category has two or more supertypes. Attribute inheritance works more selectively in the case of categories. If a category is total (not partial), it may be represented alternatively as a specialization. Database Management COP4540, SCS, FIU

21 Example of Category (1) PERSON COMPANY  ACCOUNT HOLDER BANK U M
Has_Acct N BANK Database Management COP4540, SCS, FIU

22 Example of Category (2)    BUILDING LOT PROPERTY U d BUILDING LOT
Database Management COP4540, SCS, FIU

23 An EER Conceptual schema for a university database Figure 4.10
Database Management COP4540, SCS, FIU


Download ppt "Enhanced Entity-Relationship and Object Modeling Chapter 4"

Similar presentations


Ads by Google