Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 4 Enhanced Entity-Relationship (EER) Modeling.

Similar presentations


Presentation on theme: "Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 4 Enhanced Entity-Relationship (EER) Modeling."— Presentation transcript:

1 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 4 Enhanced Entity-Relationship (EER) Modeling

2 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 2 Chapter Outline EER stands for Enhanced ER Enhancements: subclasses/superclasses specialization/generalization categories (UNION types) attribute and relationship inheritance EER includes some object-oriented concepts, such as inheritance

3 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 3 Subclasses and Superclasses An entity type may have subclasses of its entities Example: EMPLOYEE may be grouped into: SECRETARY, ENGINEER, TECHNICIAN, … Based on the EMPLOYEE’s Job MANAGER EMPLOYEEs who are managers SALARIED_EMPLOYEE, HOURLY_EMPLOYEE Based on the EMPLOYEE’s method of pay EMPLOYEE is the superclass for each of these subclasses

4 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 4 Subclasses and Superclasses (2) Also called IS-A relationships SECRETARY IS-A EMPLOYEE, TECHNICIAN IS-A EMPLOYEE, …. An entity cannot exist in the database merely by being a member of a subclass; it must also be a member of the superclass A member of the superclass can be optionally included as a member of any number of its subclasses

5 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 5 Generalization and Specialization The process of refining one entity types into subclass types is called specialization. A top-down process The process identifying commonalities among different entity types and define their superclass type is called generalization. A bottom-up process In real world, a database modeling process is typically mixed.

6 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 6 Condition-Defined Subclasses Specialization based on conditions of superclass attributes. Example: High-Pay-Male and High-Paid-Femail Drawing High-Pay-Male d EMPLOYEE High-Pay-Female salary  100000, Sex=F   salary  100000, Sex=M

7 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 7 Discussions d : means disjoint, each employee can belong to at most one of the subclass. We do not require total participation: an employee may not be in either class A special case of condition-defined specialization is when the condition is based on the value of a single attribute This type specializations is called attribute-defined.

8 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 8 An Attribute-defined Specialization Doubled line suggests total participation: an emmployee must be either a male or female. Male-EMP d EMPLOYEE Female-EMP F   M Sex

9 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 9 Attribute Inheritance in Superclass / Subclass Relationships An entity that is member of a subclass inherits All attributes of the entity as a member of the superclass All relationships of the entity as a member of the superclass Example: SECRETARY inherit the attributes Name, SSN, …, from EMPLOYEE SECRETARY can have additional attributes specific to secretaries (typing speed, …)

10 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 10 Additional attributes in subclasses

11 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 11 Overlapping Specialization In an overlapping specialization, indicated by an circled o, an entity in the superclass can belong to more than one subclasses. Located-in-DC o DEPARTMENT Located-in-NY   Has a location in DC Has a location in NY

12 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 12 Further Discussions A specialization can have only one subclass Example: High-Pay-EMP High-Pay-EMP EMPLOYEE salary  100000 

13 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 13 Summary Four types of specializations Total (double-lined), disjoint (d) Partial (single-lined), disjoint (d) Total (double-lined), overlapping (o) Partial (single-lined), overlapping (o) A subclass may have its own (additional) attributes A superclass may have more than one specialization.

14 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 14 Example of Overlapping Total Specialization

15 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 15 Multiple Specializations

16 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 16 User-Defined Specialization/Generalization If no condition determines membership, the subclass is called user-defined Membership in a subclass is determined by the database users by applying an operation to add an entity to the subclass Membership in the subclass is specified individually for each entity by the user Example: A HANDICAPPED subclass of EMPLOYEE

17 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 17 Specialization/Generalization Hierarchies, Lattices & Shared Subclasses (1) A subclass may itself have further subclasses specified on it forms a hierarchy or a lattice Hierarchy has a constraint that every subclass has only one superclass (called single inheritance); this is basically a tree structure In a lattice, a subclass can be subclass of more than one superclass (called multiple inheritance)

18 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 18 Shared Subclass “Engineering_Manager”

19 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 19 Categories (UNION TYPES) With specialization, all subclasses are of the same type of superclasses. SECTARY, MANAGER, and HOURLY_EMPLOYEE are all EMPLOYEEs In some cases, we need to superclasses to be of different entity types Such a subclass is called a category or UNION TYPE A category member must exist in at least one of its superclasses

20 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 20 Two categories (UNION types): OWNER, REGISTERED_VEHICLE

21 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 21 Summary Introduced the EER model concepts Class/subclass relationships Specialization and generalization Inheritance These augment the basic ER model concepts introduced in Chapter 3 EER diagrams and alternative notations were presented


Download ppt "Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 4 Enhanced Entity-Relationship (EER) Modeling."

Similar presentations


Ads by Google