23
1 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling Susan D. Urban and Suzanne W. Dietrich Department of Computer Science and Engineering Arizona State University Tempe, AZ 85287-5406

ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

Embed Size (px)

DESCRIPTION

ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling Susan D. Urban and Suzanne W. Dietrich Department of Computer Science and Engineering Arizona State University Tempe, AZ 85287-5406. OUTLINE. Enhanced Entity-Relationship model (EER). Generalization and Specialization - PowerPoint PPT Presentation

Citation preview

Page 1: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

1 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

ADVANCED DATABASE CONCEPTS

Enhanced Entity Relationship Modeling

Susan D. Urban and Suzanne W. Dietrich

Department of Computer Science and Engineering

Arizona State University

Tempe, AZ 85287-5406

Page 2: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

2 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

OUTLINE

• Enhanced Entity-Relationship model (EER).

• Generalization and Specialization

• Categories

• Summary of Constraints Captured.

Page 3: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

3 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

THE ON-LINE SHOPPING ER SCHEMA

Page 4: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

4 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

THE ENHANCED ENTITY-RELATIONSHIP (EER) MODEL

• An entity definition is known as a class.– A specific occurrence of an entity is an instance of a class.

• Classes can be formed into superclass/subclass hierarchies using generalization and specialization.– The ISA relationship.

– Inheritance of attributes.

– Constraints on subclass membership.

• Categories are used to represent a union of classes.

The EER model extends the ER model with advanced modeling features:

Page 5: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

5 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

GENERALIZATION vs. SPECIALIZATION

• Generalization is the process of viewing several different objects in a higher level, abstract form.– Generalization suppresses the differences between objects and

emphasizes the similarities.

• Specialization is the process of viewing an object as a more refined, specialized object. – Specialization is the opposite of generalization.

– Specialization emphasizes the differences between objects.

Page 6: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

6 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

GENERALIZATION AND SPECIALIZATION IN THE EER MODEL

Page 7: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

7 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

INHERITANCE

• An instance of a subclass is an instance of its superclass (also known as the ISA relationship).– A Celebrity ISA Person.

• Due to the ISA relationship, an instance of a subclass inherits attributes from it superclass.– A Celebrity inherits ssn, name, phone, gender, and address from

Person.

– A Model inherits birthDate from Celebrity.

• The inheritance of attributes is a transitive relationship.– If a Model ISA Celebrity and a Celebrity ISA Person, then a Model

inherits ssn, name, phone, gender, and address from Person.

Page 8: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

8 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

CONSTRAINTS ON SPECIALIZATION Disjoint Constraint

• If the disjoint constraint is specified, the instances of the subclasses of a specialization must be disjoint.

• If the disjoint constraint is not specified, then the instances of subclasses can be overlapping.

Page 9: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

9 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

CONSTRAINTS ON SPECIALIZATION Completeness Constraint

• Total specialization - Every instance of a superclass must be an instance of at least one of its subclasses (also known as a covering constraint).

• Partial specialization - An instance of a superclass is not required to be an instance of any of its subclasses.

Page 10: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

10 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

SPECIALIZATION USING DISJOINT AND COMPLETENESS CONSTRAINTS

Page 11: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

11 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

CONSTRAINTS ON SUBCLASS MEMBERSHIP

A specialization can be:

• Attribute-defined - Determines membership in a subclass by placing a condition on the value of an attribute in the superclass.

• User-defined - Membership in a subclass does not depend on any specific attribute value. Membership is determined by the user.

Page 12: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

12 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

ATTRIBUTE-DEFINED SPECIALIZATION

Page 13: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

13 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

USER-DEFINED SPECIALIZATION

Page 14: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

14 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

MULTIPLE SPECIALIZATIONS OF A CLASSAttribute and User-Defined Specializations

Page 15: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

15 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

RULES FOR USE OFATTRIBUTE-DEFINED SUBCLASSES

• If the specialization attribute at the superclass level is single-valued, membership at the subclass level is always disjoint.

• If the specialization attribute at the superclass level is multi-valued, membership at the subclass level is always overlapping.

• If the specialization is total, the attribute value in the superclass is required.

• If the specialization is partial, the specialization attribute value in the superclass is optional. The presence of a value, however, implies automatic insertion at the subclass level.

Page 16: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

16 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

RULES FOR USE OF SUPERCLASS/SUBCLASS HIERARCHIES

• Deleting an entity from a superclass implies automatic deletion of the entity from all subclasses.

• Deleting an entity from a subclass does not imply deleting the entity from its superclass. However, attributed-defined constraints must not be violated.

• At the superclass level, changing the value of an attribute used for attribute-defined specialization requires appropriate changes in subclass membership.

Page 17: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

17 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

MULTIPLE INHERITANCE

• In a specialization hierarchy, every subclass has only one superclass.

• In a specialization lattice, a subclass can have more than one superclass.– The subclass is referred to as a shared subclass.– A specialization lattice demonstrates multiple inheritance. – A shared subclass must satisfy the multiple inheritance

intersection constraint, where each instance of the shared subclass is an instance of all of its superclasses.

Page 18: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

18 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

MULTIPLE INHERITANCE

StarModel = MovieStar Model

Page 19: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

19 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

SUMMARY OF EER HIERARCHY CONSTRAINTS

• ISA Constraint - an instance of a subclass must be an instance of its superclass.

• Disjoint Constraint: Disjoint vs. Overlapping subclass membership.

• Completeness Constraint: Total vs. Partial specialization at the subclass level.

• Attribute-Defined Constraint: The value of an attribute at the superclass level determines automatic membership of the instance at the subclass level.

• Multiple Inheritance Intersection Constraint - The instances of a shared subclass must represent the intersection of its superclasses.

 

Page 20: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

20 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

CATEGORIES AND CATEGORIZATION

• If a subclass can be traced to more than one base superclass, then the subclass is called a category.

• A category represents a union of its superclasses, where an instance of a category subclass must be an instance of at least one superclass, but is not necessarily a member of all superclasses.

Page 21: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

21 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

CONSTRAINTS ON CATEGORIZATION

• Total categorization - Every instance of a superclass must be an instance of the category.

• Partial categorization - An instance of a superclass is not required to be an instance of the category.

C = A B F (D E)

Page 22: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

22 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

CATEGORIES AND CATEGORIZATIONPartial Categorization of Sponsor

Page 23: ADVANCED DATABASE CONCEPTS Enhanced Entity Relationship Modeling

23 Enhanced Entity Relationship Modeling © 2002 by Dietrich and Urban

HOLLYWOOD DATABASE SCHEMA