+ All Categories
Home > Documents > 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Date post: 05-Jan-2016
Category:
Upload: shon-hopkins
View: 217 times
Download: 0 times
Share this document with a friend
22
1 The Enhanced Entity The Enhanced Entity Relationship Diagrams Relationship Diagrams (E-ERDs) (E-ERDs)
Transcript
Page 1: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

11

The Enhanced Entity The Enhanced Entity Relationship Diagrams Relationship Diagrams

(E-ERDs)(E-ERDs)

Page 2: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 22

Supertypes and SubtypesSupertypes and Subtypes

Subtype:Subtype: A subgrouping of the entities in an A subgrouping of the entities in an entity type that has attributes distinct from entity type that has attributes distinct from those in other subgroupingsthose in other subgroupings

Supertype:Supertype: A generic entity type that has a A generic entity type that has a relationship with one or more subtypesrelationship with one or more subtypes

Attribute Inheritance:Attribute Inheritance: Subtype entities inherit values of all Subtype entities inherit values of all

attributes of the supertypeattributes of the supertype An instance of a subtype is also an instance An instance of a subtype is also an instance

of the supertypeof the supertype

Page 3: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 33

Figure 4-1 Basic notation for supertype/subtype notation

a) EER notation

Page 4: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 44

Different modeling tools may have different notation for the same modeling constructs

b) Microsoft

Visio Notation

Figure 4-1 Basic notation for supertype/subtype notation (cont.)

Page 5: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 55

Figure 4-2 Employee supertype with three subtypes

All employee subtypes will have emp nbr, name, address, and date-hired

Each employee subtype will also have its own attributes

Page 6: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 66

Relationships and SubtypesRelationships and Subtypes

Relationships at the Relationships at the supertypesupertype level level indicate that all subtypes will indicate that all subtypes will participate in the relationshipparticipate in the relationship

The instances of a The instances of a subtypesubtype may may participate in a relationship unique to participate in a relationship unique to that subtype. In this situation, the that subtype. In this situation, the relationship is shown at the subtype relationship is shown at the subtype levellevel

Page 7: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 77

Figure 4-3 Supertype/subtype relationships in a hospital

Both outpatients and resident patients are cared for by a responsible physician

Only resident patients are assigned to a bed

Page 8: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 88

Generalization and Generalization and SpecializationSpecialization

Generalization:Generalization: The process of The process of defining a more general entity type from defining a more general entity type from a set of more specialized entity types. a set of more specialized entity types. BOTTOM-UPBOTTOM-UP

Specialization:Specialization: The process of The process of defining one or more subtypes of the defining one or more subtypes of the supertype and forming supertype and forming supertype/subtype relationships. TOP-supertype/subtype relationships. TOP-DOWNDOWN

Page 9: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 99

Figure 4-4 Example of generalization

a) Three entity types: CAR, TRUCK, and MOTORCYCLE

All these types of vehicles have common attributes

Page 10: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 1010

Figure 4-4 Example of generalization (cont.)

So we put the shared attributes in a supertype

Note: no subtype for motorcycle, since it has no unique attributes

b) Generalization to VEHICLE supertype

Page 11: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 1111

Figure 4-5 Example of specialization

a) Entity type PART

Only applies to manufactured parts

Applies only to purchased parts

Page 12: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 1212

b) Specialization to MANUFACTURED PART and PURCHASED PART

Note: multivalued attribute was replaced by an associative entity relationship to another entity

Created 2 subtypes

Figure 4-5 Example of specialization (cont.)

Page 13: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 1313

Constraints in Supertype/ Constraints in Supertype/ Completeness ConstraintCompleteness Constraint

Completeness ConstraintsCompleteness Constraints: Whether : Whether an instance of a supertype an instance of a supertype mustmust also be a also be a member of at least one subtypemember of at least one subtype Total Specialization Rule: Yes (double line)Total Specialization Rule: Yes (double line) Partial Specialization Rule: No (single line)Partial Specialization Rule: No (single line)

Page 14: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 1414

Figure 4-6 Examples of completeness constraints

a) Total specialization rule

A patient must be either an outpatient or a resident patient

Page 15: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 1515

b) Partial specialization rule

A vehicle could be a car, a truck, or neither

Figure 4-6 Examples of completeness constraints (cont.)

Page 16: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 1616

Constraints in Supertype/ Constraints in Supertype/ Disjointness constraintDisjointness constraint

Disjointness ConstraintsDisjointness Constraints: : Whether an instance of a supertype may Whether an instance of a supertype may simultaneouslysimultaneously be a member of two (or be a member of two (or more) subtypesmore) subtypes Disjoint Rule: An instance of the supertype Disjoint Rule: An instance of the supertype

can be only ONE of the subtypescan be only ONE of the subtypes Overlap Rule: An instance of the supertype Overlap Rule: An instance of the supertype

could be more than one of the subtypescould be more than one of the subtypes

Page 17: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 1717

a) Disjoint rule

Figure 4-7 Examples of disjointness constraints

A patient can either be outpatient or resident, but not both

Page 18: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 1818

b) Overlap rule

A part may be both purchased and manufactured

Figure 4-7 Examples of disjointness constraints (cont.)

Page 19: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 1919

Constraints in Supertype/ Constraints in Supertype/ Subtype DiscriminatorsSubtype Discriminators

Subtype DiscriminatorSubtype Discriminator: An attribute : An attribute of the supertype whose values determine of the supertype whose values determine the target subtype(s)the target subtype(s) DisjointDisjoint – a – a simplesimple attribute with alternative attribute with alternative

values to indicate the possible subtypesvalues to indicate the possible subtypes OverlappingOverlapping – a – a compositecomposite attribute whose attribute whose

subparts pertain to different subtypes. Each subparts pertain to different subtypes. Each subpart contains a boolean value to indicate subpart contains a boolean value to indicate whether or not the instance belongs to the whether or not the instance belongs to the associated subtypeassociated subtype

Page 20: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 2020

Figure 4-8 Introducing a subtype discriminator (disjoint rule)

A simple attribute with different possible values indicating the subtype

Page 21: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 2121

Figure 4-9 Subtype discriminator (overlap rule)A composite attribute with sub-attributes indicating “yes” or “no” to determine whether it is of each subtype

Page 22: 1 The Enhanced Entity Relationship Diagrams (E-ERDs)

Chapter 4 © 2007 by Prentice Hall© 2007 by Prentice Hall 2222

Figure 4-10 Example of supertype/subtype hierarchy


Recommended