Sie sind auf Seite 1von 51

Lecture Eleven

Entity-Relationship Modelling

Based on Chapter Eleven of this book:

Database Systems: A Practical Approach


to Design, Implementation and
Management

International Computer Science S.

Carolyn Begg, Thomas Connolly


1
Lecture11Objectives
HowtouseEntityRelationship(ER)modelingindatabase
design.

BasicconceptsassociatedwithERmodel.

DiagrammatictechniquefordisplayingERmodelusing
UnifiedModelingLanguage(UML).

HowtoidentifyandresolveproblemswithERmodelscalled
connectiontraps.

HowtobuildanERmodelfromarequirementsspecification.

2
ERdiagramofBranchviewofDreamHome

3
ConceptsoftheERModel
Entitytypes

Relationshiptypes

Attributes

4
EntityType
Entitytype
Groupofobjectswithsameproperties,
identifiedbyenterpriseashavingan
independentexistence.

Entityoccurrence
Uniquelyidentifiableobjectofanentitytype.

5
ExamplesofEntityTypes

6
ERdiagramofStaffandBranchentitytypes

7
RelationshipTypes
Relationshiptype
Setofmeaningfulassociationsamongentity
types.

Relationshipoccurrence
Uniquelyidentifiableassociation,which
includesoneoccurrencefromeach
participatingentitytype.

8
SemanticnetofHasrelationshiptype

9
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.

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
Multiplicityismadeupoftwotypesofrestrictionson
relationships:cardinalityandparticipation.

Cardinality
Describesmaximumnumberofpossiblerelationship
occurrencesforanentityparticipatinginagiven
relationshiptype.

Participation
Determineswhetheralloronlysomeentityoccurrences
participateinarelationship.

39
Multiplicityascardinalityandparticipation
constraints

40
Lecture11FurtherObjectives

HowtoidentifyandresolveproblemswithER
modelscalledconnectiontraps.

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?

45
RestructuringERmodeltoremoveFanTrap

46
SemanticNetofRestructuredERModel
withFanTrapRemoved

SG37worksatbranchB003.

47
AnExampleofaChasmTrap

48
SemanticNetofERModelwithChasmTrap

AtwhichbranchofficeispropertyPA14
available?

49
ERModelrestructuredtoremoveChasmTrap

50
SemanticNetofRestructuredERModel
withChasmTrapRemoved

51

Das könnte Ihnen auch gefallen