Sei sulla pagina 1di 38

Chapter 4

Enhanced Entity-Relationship
and UML Modeling

|  

  
ïhy EER

¦ ½   


     !
 "#
 

¦ $   


# 


|  

  
EER
¦    
& $   
& $  '
 ( 
 )()
*+,-|,.
 
& ½  
¦ ½  
   
&  /     
 

|  

  %
EER Modeling

¦ ‰ classes, ‰ perclasses and Inheritance


¦ ‰pecialization and Generalization
¦ Constraints and Characteristics of ‰pecialization
and Generalization
¦ Modeling of UNION Types Using Categories

|  

  
‰ classes and ‰ perclasses
¦An entity type may have additional meaningf l
s gro pings of its entities
‰ECRETARY

ENGINEER
EMPLOYEE
‰ perclasses: 123|4
TECHNICIAN ‰ classes: 5 ½$4 ,6-,
½ ,- -$, 
5$3$-78123|4 
‰ALARIED_EMPLOYEE |+348123|4

HOURLY_EMPLOYEE

Every entity that is a memer of one of these


s gro pings is also an employee

|  

  0
Example
Lname ‰‰N
Fname Addr

DEPARTMENT ïORK‰ EMPLOYEE

i
X i

Typing‰peed MANAGER
TGrade EngType HOURLY_EMP

‰ECRETARY TECHNICIAN ENGINEER ‰ALARIED_EMP

123|4'9|:5 MANAGE‰ BELONG‰_TO


5 ½$4'9|:5
½ ,- -$,'9|:5
,6-,'9|:5
1$,$6'9|:5 1$,$65 PROJECT TRADE_UNION
5$3$-7812'9|:5
|+34812'9|:5 ;3|,658½|

|  

 
ïhy class/s class relationships and
specializations
¦ 
 
& $   

& ½ /
  

123|4*, 55, ;7 $.


5 ½$4*, 55, ;7 $ Typing‰peed.
,6-,*, 55, ;7 $ EngineerType.
½ ,- -$,*, 55, ;7 $ TGrade.

|  

  <


ïhy need class/s class relationships
and specializations
¦ 5 
 

|  

  =
‰ classes vs. ‰ perclasses

¦ ½  s set 


123|4
¦    123|4
¦ 123|4  
 
¦ ½  
  s perclass/s class 
class/s class relationship.
m   123|4(5 ½$4123|4(½ ,- -$,
  ( 

|  

  >


Properties of ‰ perclasses and
‰ classes
¦ $ p 

i p p  

¦ ½ 
  i p p  


¦ 9 (  


 
i p pip
p &   
!? 

|  

  

Properties of ‰ perclasses and


‰ classes (cont.)
¦ $ $,,|½"7;
 It m st also e a memer of
the s perclass
¦ $  
& "'$ 
  ,6-,5$3$-78123|4

¦ - ! 


 
& "'$   
 

|  

  
Type inheritance

¦ ½type pp p 


p
 p   
 
¦ $ inherits 
  
relationships    
 

|  

  
Example
3 55,
$ 123|4
´
Fname, Lname, ‰‰N Addr

5 ½$4
123|4 Fname, Lname, ‰‰N Addr ½5
½ ,- -$,
Fname, Lname, ‰‰N Addr ½6
i ,6-,
Fname, Lname, ‰‰N Addr, ½

½5 X ½
½6

5 ½$4 ,6-,
½ ,- -$,

|  

  %
Example

DEPARTMENT ïORK‰ EMPLOYEE

i
X i

Typing‰peed MANAGER
TGrade EngType HOURLY_EMP

‰ECRETARY TECHNICIAN ENGINEER ‰ALARIED_EMP

½' ½ MANAGE‰ BELONG‰_TO


123|4' 9|:5
5 ½$4' 9|:5
½ ,- -$,' 9|:5 PROJECT TRADE_UNION
,6-,' 9|:5
1$,$6' 9|:5 1$,$65
5$3$-7812'9|:5
|+34812' 9|:5 ;3|,658½|
|  

  
‰pecialization

¦ ½  


*s perclass  ).

¦ ½  )


i p   
 p p   
@5 ½$4 ,6-, ½ ,- -$,A )
123|4r m  

|  

  0
‰pecialization (cont.)

¦ ½!! )
   
¦ ½123|4! 
 )'
& ;Ôm  
 
@5$3$-78123|4  |+348123|4A
& ;/'
@5 ½$4 ,6-, ½ ,- -$,A
¦ $   specific relationship typ

|  

  
Diagrammatically representation of
specialization in an EER diagram
«



‰pecific attri tes ‰pecific attri tes

«
«



|  

  <


Example
EMPLOYEE

i
X i

MANAGER HOURLY_EMP

‰ECRETARY TECHNICIAN ENGINEER ‰ALARIED_EMP

MANAGE‰ BELONG‰_TO

PROJECT TRADE_UNION

|  

  =
‰pecialization

½ )   '


¦ 7 
¦     
 
¦    
   

|  

  >


Generalization

¦ Generalization ! ) 


-)!


|  

  

Generalization (cont.)

NoOfPassengers LicensePlateNo NoOfAxies LicensePlateNo

Max‰peed Tonnage
$ Price ½+ : Price
VehicleID VehicleID

VehicleID Price LicensePlateNo

B - 3

NoOfPassengers i NoOfAxies

Max‰peed
$ ½+ : Tonnage

|  

  
Generalization (cont.)

¦ 9 ! @ $ ½+ :A )


B - 3
¦ $!   ! B - 3)
 $½+ :

|  

  
Generalization (cont.)

¦ 6) !
   
generalize  a single s perclass   
 s classes.

¦ ½     mm



 
m

   
/ !

|  

  %
Constraints on
‰pecialization/Generalization
¦ 7/!|! 
¦ $ )! )
¦ 5 )(6)  
¦ +) ))  
71

|  

  
Disjointness Constraint

¦ Disjointness(d) constraint  


  )/*
 
Ô  m  
 ).

¦ - i   /

|  

  0
Example
, 55, ;7 $

EMPLOYEE

i i

½5 ½6 ½ 5 25 

‰ECRETARY TECHNICIAN ENGINEER ‰ALARIED_EMP HOURLY_EMP

Disjoint s classes Disjoint s classes


|  

  
Overlap Constraint

¦ Overlap(o)   


/  m * .

p  
 
 )
¦ |! 
 o   

|  

  <


Completeness constraint

Completeness constraint total  partial.


¦ A total specialization  !
 
  )

¦  i
   
   

|  

  =
Completeness constraint (cont.)

¦ A partial specialization  


  
m   123|4 " 
!  
@5 ½$4 ,6-, ½ ,- -$,A  )
partial.

¦       


  

|  

  >


Fo r Possile Constraints

¦ ½/  


i i p
¦ ½  )'
& 7/ 
& 7/ 
& |! 
& |! 

|  

  %

‰ome insertion and deletion r les


applied to specialization/generalization
¦ 7 
    

¦ - 
  
¦ - total
specialization 
 
 )

|  

  %
The differences etween the
specialization and generalization
¦ ½ )  top-down
concept al refinement process   
 
&    
 ! )C
¦ ½)  ottom- p
concept al synthesis.
&    
  !
)

|  

  %
Modeling of UNION Types Using
Categories
¦ - ( 

p  
  
-    
 / *.+,-|,
 C     nion
type category

¦ $   


  m m   
 (  !
 

|  

  %%
Modeling of UNION Types Using Categories
(cont.)
, ;, ;$
55, $ , $
BANK
7!3 , PER‰ON COMPANY

r
U
3|
OïNER

M 2 7
OïN‰
N
1 REGI‰TERED_VEHICLE
½1
1? r
4 ½1? ½4 ½
5
r

B - CAR TR


r CK B -

|  

  %
Modeling of UNION Types Using
Categories (cont.)
¦ ½   
& |9, 25|, ;$,: 
|12$,4
& 6-5½78B - 3  $
½+ :
¦ $|9," 
 
¦ $  ? ! 
 
m    |9, |12$,4 
25|, ;$,:    

|  

  %0
Partial vs. Total Categories
¦ $  total partial
PER‰ON BANK

C1 C2

Partial r
category U
HA‰_ BANK
ACCOUNT_
ACCT
HOLDER

BUILDING LOT

r
Total
category U
PROPERTY

|  

  %
A category Or A ‰pecialization

¦ ½  !?


¦ - *. !
 )     
/ !

PROPERTY
BUILDING LOT

i
r
U
PROPERTY BUILDING LOT

Category ‰pecialization
|  

  %<


A category Or A ‰pecialization (cont.)

¦ -  
  ?
  )()C
   )

|  

  %=