EntityRelationshipmodeling
Transparencies
Chapter11Objectives
HowtouseEntityRelationship(ER)modelingindatabase
design.
BasicconceptsassociatedwithERmodel.
DiagrammatictechniquefordisplayingERmodelusing
UnifiedModelingLanguage(UML).
HowtoidentifyandresolveproblemswithERmodelscalled
connectiontraps.
HowtobuildanERmodelfromarequirementsspecification.
ERdiagramofBranchuserviewsof
DreamHome
ConceptsoftheERModel
Entitytypes
Relationshiptypes
Attributes
EntityType
Entitytype
Groupofobjectswithsameproperties,
identifiedbyenterpriseashavingan
independentexistence.
Entityoccurrence
Uniquelyidentifiableobjectofanentitytype.
ExamplesofEntityTypes
ERdiagramofStaffandBranchentitytypes
RelationshipTypes
Relationshiptype
Setofmeaningfulassociationsamongentity
types.
Relationshipoccurrence
Uniquelyidentifiableassociation,which
includesoneoccurrencefromeach
participatingentitytype.
SemanticnetofHasrelationshiptype
ERdiagramofBranchHasStaffrelationship
10
RelationshipTypes
DegreeofaRelationship
Numberofparticipatingentitiesinrelationship.
Relationshipofdegree:
twoisbinary
threeisternary
fourisquaternary.
11
BinaryrelationshipcalledPOwns
12
TernaryrelationshipcalledRegisters
13
QuaternaryrelationshipcalledArranges
14
RelationshipTypes
RecursiveRelationship
Relationshiptypewheresameentitytype
participatesmorethanonceindifferentroles.
Relationshipsmaybegivenrolenamesto
indicatepurposethateachparticipatingentity
typeplaysinarelationship.
15
RecursiverelationshipcalledSupervises
withrolenames
16
Entitiesassociatedthroughtwodistinct
relationshipswithrolenames
17
Attributes
Attribute
Propertyofanentityorarelationshiptype.
AttributeDomain
Setofallowablevaluesforoneormore
attributes.
18
Attributes
SimpleAttribute
Attributecomposedofasinglecomponent
withanindependentexistence.
CompositeAttribute
Attributecomposedofmultiplecomponents,
eachwithanindependentexistence.
19
Attributes
SinglevaluedAttribute
Attributethatholdsasinglevalueforeach
occurrenceofanentitytype.
MultivaluedAttribute
Attributethatholdsmultiplevaluesforeach
occurrenceofanentitytype.
20
Attributes
DerivedAttribute
Attributethatrepresentsavaluethatis
derivablefromvalueofarelatedattribute,
orsetofattributes,notnecessarilyinthe
sameentitytype.
21
Keys
CandidateKey
Minimalsetofattributesthatuniquelyidentifieseach
occurrenceofanentitytype.
PrimaryKey
Candidatekeyselectedtouniquelyidentifyeach
occurrenceofanentitytype.
CompositeKey
Acandidatekeythatconsistsoftwoormoreattributes.
22
ERdiagramofStaffandBranchentities
andtheirattributes
23
EntityType
StrongEntityType
Entitytypethatisnotexistencedependent
onsomeotherentitytype.
WeakEntityType
Entitytypethatisexistencedependenton
someotherentitytype.
24
StrongentitytypecalledClientandweak
entitytypecalledPreference
25
RelationshipcalledAdvertiseswithattributes
26
StructuralConstraints
Maintypeofconstraintonrelationshipsiscalled
multiplicity.
Multiplicitynumber(orrange)ofpossible
occurrencesofanentitytypethatmayrelatetoa
singleoccurrenceofanassociatedentitytype
throughaparticularrelationship.
Representspolicies(calledbusinessrules)established
byuserorcompany.
Pearson Education Limited 1995, 2005
27
StructuralConstraints
Themostcommondegreeforrelationshipsis
binary.
Binaryrelationshipsaregenerallyreferredto
asbeing:
onetoone(1:1)
onetomany(1:*)
manytomany(*:*)
28
SemanticnetofStaffManagesBranch
relationshiptype
29
MultiplicityofStaffManagesBranch(1:1)
relationship
30
SemanticnetofStaffOversees
PropertyForRentrelationshiptype
31
MultiplicityofStaffOverseesPropertyForRent
(1:*)relationshiptype
32
SemanticnetofNewspaperAdvertises
PropertyForRentrelationshiptype
33
MultiplicityofNewspaperAdvertises
PropertyForRent(*:*)relationship
34
StructuralConstraints
MultiplicityforComplexRelationships
Number(orrange)ofpossibleoccurrences
ofanentitytypeinannaryrelationship
whenother(n1)valuesarefixed.
35
SemanticnetofternaryRegistersrelationship
withvaluesforStaffandBranchentitiesfixed
36
MultiplicityofternaryRegistersrelationship
37
Summaryofmultiplicityconstraints
38
StructuralConstraints
Multiplicityismadeupoftwotypesof
restrictionsonrelationships:cardinalityand
participation.
39
StructuralConstraints
Cardinality
Describesmaximumnumberofpossible
relationshipoccurrencesforanentity
participatinginagivenrelationshiptype.
Participation
Determineswhetheralloronlysomeentity
occurrencesparticipateinarelationship.
Pearson Education Limited 1995, 2005
40
Multiplicityascardinalityandparticipation
constraints
41
ProblemswithERModels
Problemsmayarisewhendesigninga
conceptualdatamodelcalledconnectiontraps.
Oftenduetoamisinterpretationofthe
meaningofcertainrelationships.
Twomaintypesofconnectiontrapsarecalled
fantrapsandchasmtraps.
42
ProblemswithERModels
FanTrap
Whereamodelrepresentsarelationshipbetween
entitytypes,butpathwaybetweencertainentity
occurrencesisambiguous.
ChasmTrap
Whereamodelsuggeststheexistenceofa
relationshipbetweenentitytypes,butpathway
doesnotexistbetweencertainentityoccurrences.
43
AnExampleofaFanTrap
44
SemanticNetofERModelwithFanTrap
AtwhichbranchofficedoesstaffnumberSG37
work?
Pearson Education Limited 1995, 2005
45
RestructuringERmodeltoremoveFanTrap
46
47
SemanticNetofRestructuredERModel
withFanTrapRemoved
SG37worksatbranchB003.
Pearson Education Limited 1995, 2005
48
49
AnExampleofaChasmTrap
50
SemanticNetofERModelwithChasmTrap
AtwhichbranchofficeispropertyPA14
available?
Pearson Education Limited 1995, 2005
51
ERModelrestructuredtoremoveChasmTrap
52
SemanticNetofRestructuredERModel
withChasmTrapRemoved
53