47
 Slide 4-1 Exercise 1. a property or description of an entity 2. a set of possible values for an attribute. 3. an object in the real world that is distinguishable from other objects such as the green dragon toy. 4. an association among two or more entities. 5. a collection of similar entities such as all of the toys in the toy department. . a collection of similar relationships !. a "ey constraint that indicates that one entity can be associated with many of another entity. #. a "ey constraint that indicates that many of one entity can be associated with many of another entity. $. an entity that cannot be identi%ed uni&uely without considering some primary "ey attributes of another identifying owner entity. 1'. maximum number of instances of an entity that can participate in an instance of a relationship 11. is the least number of instances of an entity that can participate in an instance of a relationship a. Domain b. Entity c. Relationship d. Entity set e. One-to-many relationship f . Relationship set g. Attribute h. Minimum cardinality i. Weak entity  j. Maimum cardinality k. Many-to-many relationship

Pert.5.Eer Modeling

Embed Size (px)

Citation preview

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 1/47

 

Slide 4-1

Exercise1. a property or description of an entity

2. a set of possible values for an attribute.

3. an object in the real world that is distinguishablefrom other objects such as the green dragon toy.

4. an association among two or more entities.

5. a collection of similar entities such as all of thetoys in the toy department.

. a collection of similar relationships

!. a "ey constraint that indicates that one entitycan be associated with many of another entity.

#. a "ey constraint that indicates that many of oneentity can be associated with many of anotherentity.

$. an entity that cannot be identi%ed uni&uelywithout considering some primary "ey attributesof another identifying owner entity.

1'. maximum number of instances of an entity thatcan participate in an instance of a relationship

11. is the least number of instances of an entity thatcan participate in an instance of a relationship

a. Domain

b. Entity

c. Relationship

d. Entity set

e. One-to-many

relationshipf. Relationship set

g. Attribute

h. Minimumcardinality

i. Weak entity j. Maimum

cardinality

k. Many-to-manyrelationship

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 2/47

2

Enhanced(Extended)elationship*+iagram

!he main reference of this presentation is the tetbook and""! from # Elmasri $ %a&athe' (undamental of Database)ystems' *th edition' +,,*' hapter *Additional resources# presentation prepared by "rof )te&en

A. Demurjian' )rhttp#//000.engr.uconn.edu/1ste&e/courses.html2

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 3/47

 

Slide 4-3

,utline

)uperclass/)ubclass Relationship)peciali3ation/4enerali3ation

!ype

5nheritance/onstraints/6pdatesategori3ation

7igher-Degree Relationships

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 4/47

 

Slide 4-4

n ance * o e0oncepts

ncludes all modeling concepts of basic E)dditional conceptssubclasses(superclassesspecialiation(generaliation categories

attribute inheritance 6he resulting model is called the enhanced*E) or Extended E) -E2) or EE) model

t is used to model applications morecompletely and accurately if neededt includes some object*oriented conceptssuch as inheritance

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 5/47

 

Slide 4-5

7ubclass

Entity type describes# 6ype of entity

 6he entity set

Eample# 8EM"9O:EE;

Employee can be sub-grouped into#7ecretary

Engineer

 6echnician

/anager!hese are called the subclass ofEM"9O:EE entity type.

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 6/47

 

Slide 4-6

7uper*class

EM"9O:EE entity type is the super class ofengineer' secretary $ technician class.

)ubclass represent the same mini-0orldentity of the superclass' but in a distinct

speci<c role.

Entity in a subclass must be a member of asuperclass' but not &ice-&ersa= Eample>?

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 7/47

 

Slide 4-7

 )elationship

)uperclass/subclass relationshipis the relationship bet0een asuperclass and any one of itssubclass or it simply

class/subclass relationshipEmployee(7ecretaryEmployee(6echnician

!hese are also called 5)-A

relationships )ERE!AR: 5)-AEM"9O:EE' !E7%55A% 5)-AEM"9O:EE' >2.

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 8/47

 

Slide 4-8

 6ype inheritance

An entity that is member of a subclassinherits all attributes of the entity as amember of the superclass

5t also inherits all relationships

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 9/47

 

Slide 4-9

7pecialiation

5s a process of de<ning a set of subclassesof an entity type the superclass2On the basis of some distinguishingcharacteristic of the entity in thesuperclass

May ha&e se&eral speciali3ation based ondi@erent characteristics)ERE!AR:' E%45%EER)' $ !E7%55A% arespeciali3ation of EM"9O:EE based on jobtype attribute

)A9AR5EDEM"9O:EE' 7O6R9:EM"9O:EEare speciali3ation of EM"9O:EE based onthe method of pay 

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 10/47

 

Slide 4-10

Fig 4.2

o a ons rom e

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 11/47

 

Slide 4-11

o a ons rom ediagram

)ubset symbol B)peci<c attributes' or localattributes

)peci<c relationshipsclass/subclass EM"9O:EE/)ERE!AR:resembles C#C relationship at the

instance le&el' of one entity.playing a speciali3ed role' anEM"9O:EE speciali3ed the role of)ERE!AR:

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 12/47

 

Slide 4-12

9ene%t of 7pecialiation

De<ne a set of subclasses of anentity type

Establish additional speci<c

attributes 0ith each subclassEstablish additional speci<crelationship types bet0een eachsubclass and other entity types orother subclasses

Refer to the EER diagram>=

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 13/47

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 14/47

 

Slide 4-14

:eneraliation

5dentify common featuresattributes2' and generali3e into asuperclass

Eample# truck $ car can begenerali3ed into E759E

5n&erse of the speciali3ation process

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 15/47

 

Slide 4-15

:enera at on an

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 16/47

 

Slide 4-16

:enera at on an7pecialiation

Diagrammatic notation sometimes used to distinguishbet0een generali3ation and speciali3ationrrow pointing to the generalied superclass represents ageneraliationrrows pointing to the specialied subclasses represent aspecialiation;e do not use this notation because it is often subjectiveas to which process is more appropriate for a particularsituation;e advocate not drawing any arrows in these situations

Data Modeling 0ith )peciali3ation and 4enerali3ation superclass or subclass represents a set of entities7hown in rectangles in EE) diagrams -as are entity types7ometimes all entity sets are simply called classeswhether they are entity types superclasses or subclasses

0onstra nts or 7pec a at on an

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 17/47

 

Slide 4-17

0onstra nts or 7pec a at on an:eneraliation

Attribute-de<ned speciali3ation< 9ase on values of a superclass attribute-de%ning attribute

< ll subclasses have their member condition

on the same attribute of the superclass< =redicate*de%ned -condition de%ned

subclass

<

 >ob6ype ? @EngineerA ?B de%ning predicate< 6ser-de<ned )ubclass

< Each membership is determined by the user

0onstra nts or 7pec a at on

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 18/47

 

Slide 4-18

0onstra nts or 7pec a at onand :eneraliation

Defining

attribute

Predicate condition

Predicate-defined

subclass

0onstra nts on 7pec a at on

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 19/47

 

Slide 4-19

0onstra nts on 7pec a at onand :eneraliation

!0o other conditions apply to aspeciali3ation/generali3ation#+isjointness 0onstraint#

7peci%es that the subclasses of the specialiation must bedisjointed -an entity can be a member of at most one of thesubclasses of the specialiation7peci%ed by d in EE) diagram

f not disjointed overlapC that is the same entity may be amember of more than one subclass of the specialiation7peci%ed by o in EE) diagram

0ompleteness 0onstraint# 6otal speci%es that every entity in the superclass must be amember of some subclass in the specialiation( generaliation

7hown in EE) diagrams by a double line=artial allows an entity not to belong to any of the subclasses7hown in EE) diagrams by a single line

0onstra nts on 7pec a at on

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 20/47

 

Slide 4-20

0onstra nts on 7pec a at onand :eneraliation -2

7ence' 0e ha&e four types ofspeciali3ation/generali3ation#

+isjoint total+isjoint partial,verlapping total,verlapping partial

%ote# 4enerali3ation usually is total because thesuperclass is deri&ed from the subclasses.

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 21/47

 

Slide 4-21

+isjointness constraints

)ubclasses of a speciali3ationmust be disjoint

An entity can only be at most oneof the subclass

9ook at the pre&ious EER diagram

6se d2

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 22/47

 

Slide 4-22

,verlap

!he same entity may be a member ofmore than one subclass of thespeciali3ation

6se the o2

Eample' a person can be#

student

faculty member

n alumni

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 23/47

 

Slide 4-23

l i

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 24/47

 

Slide 4-24

0ompleteness constraints

!otal speciali3ation#Every entity in the superclass must be amember of some subclass

Example the 7alariedDEmployee and

ourlyDEmployee7hown using double line

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 25/47

 

Slide 4-25

"artial speciali3ation#llows an entity not to belong to anysubclass

Example

< /anager< >ob type

Fse single line

) l

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 26/47

 

Slide 4-26

)ules

Deleting entity from a superclass

deletes it also from the subclasses

5nserting in a superclass' 0henattribute de<ned is <lled must

insert to the proper subclass as 0ell5nserting in superclass of totalspeciali3ation must insert into at

least one subclass

i h G H tti

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 27/47

 

Slide 4-27

ierarchy G Hattice

7ierarchy# a subclass onlyparticipates in one class/subclassrelationship

Eample# ehicle 0ith ar and !rucks

9attice# a subclass can participate inmore than one class/subclassrelationship

Eample# an Engineering Manager'must be an Engineer' and also aManager=

!he concept of multiple inheritance

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 28/47

 

Slide 4-28

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 29/47

 

Slide 4-29

Figure 4.7

 +i

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 30/47

 

Slide 4-30

+iagram

9eaf node# class that has nosubclasses

An entity may eist in se&eral lea&es

Example a student as :raduateD7tudent and

a 6eachingDssistant

Multiple inheritance#

7tudentDassistant

9ut the @=ersonA attribute is only inheritedonce

F8,8 6ypes Fsing 0ategories

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 31/47

 

Slide 4-31

F8,8 6ypes Fsing 0ategories

EngineeringManager has distinctrelation' each relation has C superclass

5n our ne0 case' a subclass has a single

relationship 0ith distinct superclass.!he subclass represent collection ofobjects' 0hich 0e call union type orcategory

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 32/47

 

Slide 4-32

Figure 4.8

Explanation

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 33/47

 

Slide 4-33

Explanation

A category OW%ER is a unionsubclass of OM"A%:' FA%G and"ER)O%

6se the 62 symbolRegisteredehicle is a unionsubclass of ar $ !ruck 

6he diIerenceJ

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 34/47

 

Slide 4-34

 6he diIerenceJ

EngineeringManager must eist inall three superclass# Manager'Engineer' )alariedEmployee

O0ner' must eist in only one superclasses

EngineeringManager# inherited allsuperclasses attributes

O0ner' selecti&e attributeinheritance' depending on thesuperclass

=artial 0ategory

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 35/47

 

Slide 4-35

=artial 0ategory

"artialcategory' mayor may notparticipate in

the relation

6otal 0ategory

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 36/47

 

Slide 4-36

 6otal 0ategory

Must be one of thesuperclasses

Eample# A building and alot must be a member of"RO"ER!: 

May be represented as agenerali3ation d2'especially 0hen thesimilarity is numerous

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 37/47

 

Slide 4-37

Fig 4.10

igher +egree )elationship

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 38/47

 

Slide 4-38

igher +egree )elationship

!ernary Relationship !ype< relates three entity types -%g4.11a %g3.1'

< 7F==HK -7F==HE)=)6=),>E06

!hree Finary Relationships< meaning is diIerentL -%g4.11b %g4.14

< 08D7F==HK -7F==HE)=)6

< 7F==HE7 -7F==HE)=),>E06< F7E7 -=),>E06=)6

  . . .)elationship

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 39/47

 

Slide 4-39

)elationship

Migure 4.11.b. 6hree binary

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 40/47

 

Slide 4-40

relationship

igher +egree )elationship

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 41/47

 

Slide 4-41

 Ternary Relationship as Weak Entity Type

• represents a ternary relationship type as a

weak entity type relating to the owner entity

types (fig4.11c)

• includes binary (identifying) relationship types

 As an dentifying Relationship Type

• a ternary relationship type with a weak entity

type and two owner entity types (fig4.1!)

igher +egree )elationship

 6ernary relationship as wea"tit t

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 42/47

 

Slide 4-42

entity type

 6ernary )elationship asdentifying )elationship 6ype

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 43/47

  Slide 4-43

dentifying )elationship 6ype

Another eample of ternary &ersusbinary relationship types (546RE

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 44/47

  Slide 4-44

binary relationship types. (546RE*.C+

;hen to use EE) model J

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 45/47

  Slide 4-45

;hen to use EE) model J

Most database projects do not needthe object-oriented model features inEER

4oal of conceptual data modeling is

to produce a model that simple andeasy to understand

Do not use complicated class/subclassrelationship if they are not needed

O@er signi<cant ad&antage o&erregular ER model

;hen to use EE) model J

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 46/47

  Slide 4-46

;hen to use EE) model J

EER model is especially useful isdomain being model is OO innature and use inheritance reducethe compleity of the design

ases using EER#;hen using attribute inheritance canreduce the use of nulls in a single entityrelation -that contains multiple subclasses

7ubclasses can be used to explicitly modeland name subsets of entity types thatparticipate in their own relationships

lternative +iagrammatic 8otations

7/23/2019 Pert.5.Eer Modeling

http://slidepdf.com/reader/full/pert5eer-modeling 47/47

  Slide 4-47

g

Symbols for entity type / class,attribute and relationship

Displaying attributes

Displaying

cardinality ratiosVarious (min,

max) notations

Notations for displaying

specialization / generalization