cs 157a: intro to database sys summary of chapter section 4.1 of the textbook data modeling and...
TRANSCRIPT
CS 157A: Intro to Database Sys
Summary of Chapter Section 4.1 of the textbook Data Modeling and Database Design
Copyright 2007 Thomson Course Technology Presentation compiled by Michael Goebel 2007 September 06
Enhanced Entity-Relationship (EER)Modeling: Superclass/Subclass
Relationship General Properties of Superclass/Subclass Specialization and Generalization Specialization Hierarchy Specialization Lattice Categorization Appropriate EER Construct Aggregation
Inter-entity class relationship
You enter a store to buy a piece of furniture
Store and Furniture: different independent object types (aka entity types)
Store has Furniture (has-a relationship)
STORE
Sells
FURNITURE
Intra-entity class relationship
Need to furnish your new apartment
You want a table, chairs, bed, etc.
These possess some common properties
Table/Chair/Bed is Furniture (is-a relationship)
FURNITURE
TABLE CHAIR BED
Superclass and Subclass
No relationship type between Furniture and Chair/Bed/Table
Furniture can be many different things
Furniture is Superclass (SC)
Chair/Bed/Table is Subclass (sc)
CHAIR
BED
TABLE
FURNITURE
Basic Properties of SC/sc
A Superclass/Subclass relationship One Superclass is related to one or more
Subclasses A Subclass entity only belongs to 1 Superclass A Superclass entity can belong to 1 or more (or
none) Subclasses Subclass inherits all attributes of Superclass Subclass can have its own attributes Cardinality ratio 1:1 is understood to exist
New EER diagram notation for SC/sc
Total completeness Partial completeness Disjoint Subclass Overlapping Subclasses Union of Superclasses Aggregation of
Subclasses Identifies a Subclass
d
O
U
A
U
Specialization / Generalization
Specialization is the process of discovering the distinguishing attributes of any subgroups and creating Subclasses
Specialization is a top-down approach to SC/sc Generalization is the process of gathering all
the common attributes shared by a group of entities and creating a Superclass
Generalization is a down-up approach to SC/sc
More Specialization
Inclusion of a Superclass in the specialization is called a Completeness Constraint
Completeness Constraint can be either Total or Partial
Total Specialization: every entity of the Superclass participates in the specialization relationship (shown with a solid line)
Partial Specialization: 1 or more entities of the Superclass participates in the specialization relationship (shown with a dash line)
Total/Partial Completeness
STUDENT_ATHLETE
FOOTBALL BASEBALL BASKETBALL
OTotal completeness
Partial completeness
UU
U
More Specialization: Multiple
STUDENT_ATHLETE
FOOTBALL BASEBALL BASKETBALL
OTotal completeness
Partial completeness
UU
U
CAPTAIN
U
TEAM
Predicate
How to directly determine the membership of a Subclass
Thru the use of a defining predicate
Student_Athlete Subclass membership are Sport_Teams
STUDENT_ATHLETE
FOOTBALL BASEBALL
O
UU
CAPTAIN
TEAM
SPORT_TEAMS
FOOTBALL
U
BASEBALL
Specialization Hierarchy
Already know that a Superclass can have one or more Subclasses
Those Subclasses themselves can become Superclasses of other Subclasses
The structure of Superclass-Subclass-Superclass-Subclass-etc. is limited to an inverted tree
Limitation is that a Subclass can only be related to one Superclass specialization
Specialization Lattice
Similar to the Specialization Hierarchy where a child (Subclass) is only allowed on parent (Superclass specialization)
The child (Subclass) is allowed to have 2 or more parents (Superclass) as long as each parent is from a different Specialization.
The Subclass then inherits all the attributes and relationship types from each parent, Multiple Type Inheritance
Categorization
The idea that there is only one Superclass is the overriding characteristic of the Specialization/Generalization construct
When many Superclasses and a Subclass are tied together by a single relationship type this is known as Categorization
The Subclass is known as the Category An entity which belongs to the Category must
also exist in only one of the Superclasses
Which EER Construct?
When to use Specialization/Generalization or Categorization
Not always easy to know: subjective and context specific
If Superclasses share many common attributes with same properties then Specialization/Generalization might work best
If Superclasses don't share much attributes but have a common category they could identify with, then Categorization might work best
Aggregation
Aggregation (to combine) is similar to Categorization except that it must have Total Completeness
Aggregation plays the “is a part of” in a SC/sc relationship
PC
HARDWARE
OP_SYS
A
U
THE END