Vous êtes sur la page 1sur 22

December 4, 2002 Data Modeling James Cohen

ENHANCED ENTITY RELATIONSHIP (EER) MODEL


Presented by James Cohen

December 4, 2002

THE ENTITY (REVIEW)


Entity

Relationship (ER) Model represents an object


Physical person, car Conceptual school, company

Data Modeling James Cohen

ER

model is based on the perception of the real world as a collection of objects with attributes Attributes describe the entity

Single, Multi-value Composite, Simple Derived, Stored

December 4, 2002

WHAT IS AN EER MODEL?


Enhanced Entity Relationship (EER) Data Modeling EER shows complex relationships between objects in a database (multimedia, geographical). Concepts of subclasses and superclasses, specializations and generalizations. Put concepts in diagram to form EER model

Data Modeling James Cohen

December 4, 2002

SPECIALIZATION
Subgrouping into subclasses (top-down approach) Example: EMPLOYEE -> SECRETARY MANAGER, etc. Inheritance Inherit attributes and relationships from superclass (Name, Birthdate, etc.) Subclasses may have uniqe attributes

Data Modeling James Cohen

SECRETARY has TypingSpeed attribute, MANAGER has BusinessUnitManaged, etc.

December 4, 2002

SPECIALIZATION (CONT.)
SSN Name

Data Modeling James Cohen

EMPLOYEE JobType PayMethod WORKS_IN

DEPARTMENT

SECRETARY

ENGINEER
SALARY_EMP. HOURLY_EMP.

SOFTWARE_ENGINEER

December 4, 2002

MODEL SHAPES
When you have more than one subclass based on the same defining attribute (JobType), use To show class/subclass relationships, use

Data Modeling James Cohen

Used for relationships between entity types

To show relationship between two different entity types, use

December 4, 2002

GENERALIZATION
Reverse processes of defining subclasses (bottom-up approach) Bring together common attributes in entities Example: CAR (with attributes color, price, max speed) and TRUCK (with attributes color, price, tonnage) can be generalized into VEHICLE (with attributes color and price).

Data Modeling James Cohen

December 4, 2002

HIERARCHIES AND LATTICES

Hierarchy subclass participates in one class/subclass relationship


EMPLOYEE
SOFTWARE ENGINEER has all the attributes of an ENGINEER and EMPLOYEE

Data Modeling James Cohen

SECRETARY

ENGINEER

SOFTWARE ENGINEER

December 4, 2002

HIERARCHIES AND LATTICES

Lattice subclass participates in more than one class/subclass relationship


EMPLOYEE

ENGINEERING MANAGER (shared subclass) is a MANGER and an ENGINEER

Data Modeling James Cohen

SECRETARY

ENGINEER

MANAGER

ENGINEERING MANAGER

December 4, 2002

CATEGORIES
Models

a class/subclass with more than one superclass of distinct entity types. Attribute inheritance is selective.
PERSON BANK COMPANY

Data Modeling James Cohen

U
OWNER

The category, OWNER, is a subclass of the union of PERSON, BANK, and COMPANY. OWNER is either a PERSON or a BANK or a COMPANY

December 4, 2002

CONSTRAINTS
an entity can be a member of at most one subclass of a specialization d Overlap an entity may belong to more o than one subclass of a specialization Total specialization each entity of a superclass belongs to some subclass of a specialization Partial specialization each entity of a superclass does not have to belong to some subclass of a specialization
Disjoint

Data Modeling James Cohen

ATTRIBUTE INHERITANCE IN SUPERCLASS /SUBCLASS RELATIONSHIPS

December 4, 2002

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 thesuperclass. Example: In the previous slide, SECRETARY (as well asTECHNICIAN and ENGINEER) inherit theattributes Name, SSN, , from EMPLOYEE

Data Modeling James Cohen

Every SECRETARY entity will have values for theinherited attributes

December 4, 2002

SPECIALIZATION (1)

Specialization is the process of defining a set of subclasses of a superclass The set of subclasses is based upon somedistinguishing characteristics of the entities in thesuperclass Example: {SECRETARY, ENGINEER,TECHNICIAN} is a specialization of EMPLOYEEbased upon job type. May have several specializations of the samesuperclass

Data Modeling James Cohen

December 4, 2002

GENERALIZATION

Generalization is the reverse of the specialization process Several classes with common features are generalizedinto a superclass; original classes become its subclasses

Data Modeling James Cohen

Example: CAR, TRUCK generalized into VEHICLE; both CAR, TRUCK become subclasses of the superclassVEHICLE. We can view {CAR, TRUCK} as a specialization of VEHICLE Alternatively, we can view VEHICLE as a generalization of CAR and TRUCK

December 4, 2002

GENERALIZATION AND SPECIALIZATION (1)

Diagrammatic notation are sometimes used todistinguish between generalization andspecialization Arrow pointing to the generalized superclassrepresents a generalization Arrows pointing to the specialized subclassesrepresent a specialization We do not use this notation because it is oftensubjective as to which process is more appropriatefor a particular situation. We advocate not drawing any arrows

Data Modeling James Cohen

December 4, 2002

GENERALIZATION AND SPECIALIZATION (2)


Data Modeling with Specialization and Generalization A superclass or subclass represents a collection(or set or grouping) of entities It also represents a particular type of entity Shown in rectangles in EER diagrams (as are entity types) We can call all entity types (and their corresponding collections) classes, whether they are entity types, superclasses, or subclasses

Data Modeling James Cohen

CONSTRAINTS ON SPECIALIZATION AND GENERALIZATION (1)

December 4, 2002

If we can determine exactly those entities that willbecome members of each subclass by acondition, the subclasses are called predicatedefined (or condition-defined) subclasses Condition is a constraint that determines subclassmembers Display a predicate-defined subclass by writing thepredicate condition next to the line attaching thesubclass to its superclass

Data Modeling James Cohen

CONSTRAINTS ON SPECIALIZATION AND GENERALIZATION (2)

December 4, 2002

If all subclasses in a specialization have membership condition on same attribute of the superclass, specialization is called an attribute-defined specialization Attribute is called the defining attribute of the specialization Example: JobType is the defining attribute of the specialization {SECRETARY, TECHNICIAN, ENGINEER} of EMPLOYEE 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 in the superclass by the user

Data Modeling James Cohen

CONSTRAINTS ON SPECIALIZATION ANDGENERALIZATION (4)

December 4, 2002

Disjointness Constraint: Specifies that the subclasses of the specializationmust be disjoint an entity can be a member of at most one of thesubclasses of the specialization

Data Modeling James Cohen

Specified by d in EER diagram

If not disjoint, specialization is overlapping that is the same entity may be a member of more than one subclass of the specialization Specified by o in EER diagram

CONSTRAINTS ON SPECIALIZATION AND GENERALIZATION

December 4, 2002

Completeness Constraint: Total specifies that every entity in the superclass must be a member of some subclass in the specialization/generalization Shown in EER diagrams by a double line Partial allows an entity not to belong to any of thesubclasses Shown in EER diagrams by a single line

Data Modeling James Cohen

SPECIALIZATION/GENERALIZATION HIERARCHIES,LATTICES & SHARED SUBCLASSES


In a lattice or hierarchy, a subclass inherits attributes not only of its direct superclass, but also of all its predecessor superclasses A subclass with more than one superclass is called ashared subclass (multiple inheritance) Can have: specialization hierarchies or lattices, generalization hierarchies or lattices, depending on how they were derived

December 4, 2002 Data Modeling James Cohen

We just use specialization (to stand for the end result of either specialization or generalization)

SPECIALIZATION/GENERALIZATION HIERARCHIES,LATTICES & SHARED SUBCLASSES

December 4, 2002

In specialization, start with an entity type and then define subclasses of the entity type by successives specialization called a top down conceptual refinement process. In generalization, start with many entity types and generalize those that have common properties Called a bottom up conceptual synthesis process. In practice, a combination of both processes is usually employed.

Data Modeling James Cohen

Vous aimerez peut-être aussi