03-enhanceermodel compatibility mode

Upload: jm-delos-reyes

Post on 02-Jun-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    1/25

    The Enhanced ER Model

    and Business Rules

    MIS 122 Second Semester SY 2009 - 2010

    Modern Database Management 8th Edition

    Jeffrey A. Hoffer, Mary B. Prescott, Fred R. McFadden

    1 2007 by Prentice Hall

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    2/25

    Objectives Definition of termsDefinition of terms

    Use ofUse of supertypesupertype/subtype relationships/subtype relationships

    Use of generalization and specialization techniquesUse of generalization and specialization techniques

    Specification of completeness andSpecification of completeness and disjointnessdisjointness constraintsconstraints

    DeveloDevelo su ert esu ert e/subt e hierarchies for realistic business/subt e hierarchies for realistic business

    Chapter 4

    situationssituations

    Develop entityDevelop entity clustersclusters

    2

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    3/25

    Supertypes and Subtypes

    Subtype:Subtype: AA subgroupingsubgrouping of the entities in an entity typeof the entities in an entity typethat has attributes distinct from those in otherthat has attributes distinct from those in other

    subgroupingssubgroupings

    SupertypeSupertype:: A generic entity type that has a relationshipA generic entity type that has a relationshipwith one or more subtypeswith one or more subtypes

    Chapter 4

    Attribute Inheritance:Attribute Inheritance:

    Subtype entities inherit values of all attributes of theSubtype entities inherit values of all attributes of thesupertypesupertype

    An instance of a subtype is also an instance of theAn instance of a subtype is also an instance of thesupertypesupertype

    3

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    4/25

    Figure 4-1 Basic notation for supertype/subtype notation

    a) EERnotation

    Chapter 4

    4

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    5/25

    b) MicrosoftVisio

    Notation

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

    Chapter 4

    5

    Different modeling tools may have different notation for the samemodeling constructs

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    6/25

    Figure 4-2 Employee supertype with three subtypes

    All employee subtypeswill have emp nbr,name, address, anddate-hired

    Each employee subtype

    Chapter 4

    6

    will also have its ownattributes

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    7/25

    Relationships and Subtypes

    Relationships at theRelationships at the supertypesupertypelevel indicate thatlevel indicate thatall subtypes will participate in the relationshipall subtypes will participate in the relationship

    The instances of aThe instances of a subtypesubtypemay participate in amay participate in arelationship unique to that subtype. In thisrelationship unique to that subtype. In this

    Chapter 4

    situation, the relationship is shown at the subtypesituation, the relationship is shown at the subtypelevellevel

    7

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    8/25

    Figure 4-3 Supertype/subtype relationships in a hospital

    Bothoutpatientsand residentpatients arecared for by aresponsible

    physician

    Chapter 4

    8

    Only resident patients areassigned to a bed

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    9/25

    Generalization and Specialization

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

    Specialization:The process of defining one or moresubtypes of the supertype and forming supertype/subtype

    Chapter 4

    re at ons ps. -

    9

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    10/25

    Figure 4-4 Example of generalization

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

    Chapter 4

    10All these types of vehicles have common attributes

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    11/25

    Figure 4-4 Example of generalization (cont.)

    So we put

    the shared

    b) Generalization to VEHICLE supertype

    Chapter 4

    11

    attri utes ina supertype

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

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    12/25

    Figure 4-5 Example of specialization

    a) Entity type PART

    Only applies tomanufactured arts

    Chapter 4

    12

    Applies only to purchased parts

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    13/25

    b) Specialization to MANUFACTURED PART and PURCHASED PART

    Created 2

    Figure 4-5 Example of specialization (cont.)

    Chapter 4

    13

    Note: multivalued attribute was replaced by anassociative entity relationship to another entity

    subtypes

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    14/25

    Constraints in Supertype/ Completeness Constraint

    Completeness ConstraintsCompleteness Constraints: Whether: Whether

    an instance of aan instance of a supertypesupertypemustmustalso bealso bea member of at least one subtypea member of at least one subtype

    Chapter 4

    Partial Specialization Rule: No (single line)Partial Specialization Rule: No (single line)

    14

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    15/25

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    16/25

    b) Partial specialization rule

    A vehiclecould be acar, a

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

    Chapter 4

    16

    ruc , orneither

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    17/25

    Constraints in Supertype/ Disjointness constraint

    Disjointness ConstraintsDisjointness Constraints: Whether an instance: Whether an instanceof a supertype mayof a supertype may simultaneouslysimultaneouslybe a member of two (or more)be a member of two (or more)

    subtypessubtypes

    Disjoint Rule: An instance of the supertype can be only ONE of theDisjoint Rule: An instance of the supertype can be only ONE of thesubtypessubtypes

    Chapter 4

    subtypessubtypes

    17

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    18/25

    a) Disjoint rule

    Figure 4-7 Examples of disjointness constraints

    A atient can either be

    Chapter 4

    18

    outpatient or resident, but notboth

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    19/25

    b) Overlap rule

    A part may be

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

    Chapter 4

    19

    both purchasedandmanufactured

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    20/25

    Constraints in Supertype/ Subtype Discriminators

    Subtype DiscriminatorSubtype Discriminator: An attribute of the supertype: An attribute of the supertypewhose values determine the target subtype(s)whose values determine the target subtype(s)

    DisjointDisjoint aa simplesimpleattribute with alternative values toattribute with alternative values toindicate the possible subtypesindicate the possible subtypes

    Chapter 4

    pertain to different subtypes. Each subpart contains apertain to different subtypes. Each subpart contains aboolean value to indicate whether or not the instanceboolean value to indicate whether or not the instance

    belongs to the associated subtypebelongs to the associated subtype

    20

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    21/25

    Figure 4-8 Introducing a subtype discriminator (disjointrule)

    A simple attribute withdifferent possible

    values indicating thesubtype

    Chapter 4

    21

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    22/25

    Figure 4-9 Subtype discriminator (overlaprule)A composite

    attribute withsub-attributesindicating yesor no todeterminewhether it is ofeach subtype

    Chapter 4

    22

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    23/25

    Figure 4-10 Example of supertype/subtype hierarchy

    Chapter 4

    23

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    24/25

    Entity ClustersEntity Clusters

    EER diagrams are difficult to read when there are too many entitiesEER diagrams are difficult to read when there are too many entitiesand relationshipsand relationships

    Solution: Group entities and relationships intoSolution: Group entities and relationships into entity clustersentity clusters

    Entity clusterEntity cluster: Set of one or more entity types and associated: Set of one or more entity types and associatedrelationships grouped into a single abstract entity typerelationships grouped into a single abstract entity type

    Chapter 4

    24

  • 8/11/2019 03-EnhanceERModel Compatibility Mode

    25/25

    Figure 4-13aPossible entityclusters for Pine

    Valley Furniture inMicrosoft Visio

    Related

    Chapter 4

    25

    entitiescould

    becomeclusters