Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf ·...

30
Enhanced Entity-Relationship Model Vaid ˙ e Narv´ aez Computer Information Systems November 9th, 2010 c 2009,2010 Vaid ˙ e Narv´ aez

Transcript of Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf ·...

Page 1: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Enhanced Entity-Relationship Model

Vaide Narvaez

Computer Information Systems

November 9th, 2010

c© 2009,2010 Vaide Narvaez

Page 2: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Problem with ER notation

The requirements of complex software systems cannot always becaptured by ER. (semantic data modelling)

c© 2009,2010 Vaide Narvaez

Page 3: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Enhanced ER

Includes all modeling concepts of basic ER

Additional concepts: subclasses/superclasses,specialization/generalization, categories, attribute inheritance

The resulting model is called the Enhanced-ER or Extended ER(E2R or EER) model

It is used to model applications more completely and accuratelyif needed

It includes some object-oriented concepts (inheritance)

c© 2009,2010 Vaide Narvaez

Page 4: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Superclass/subclass (IS-A)

An entity may have additional meaningful sub-groupings of itsentities

Example: EMPLOYEE may be further grouped intoSECRETARY, ENGINEER, MANAGER, TECHNICIAN,SALARIED EMPLOYEE, HOURLY EMPLOYEE,

I Each of these groupings is a subset of EMPLOYEE entitiesI Each is called a subclass of EMPLOYEEI EMPLOYEE is the superclass for each of these subclasses

These are called superclass/subclass relationships.

c© 2009,2010 Vaide Narvaez

Page 5: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Superclass/subclass (example)

Copyright c©2009 Pearson Education, Inc. Publishing as Prentice Hallc© 2009,2010 Vaide Narvaez

Page 6: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Attribute inheritance

Copyright c©2009 Pearson Education, Inc. Publishing as Prentice Hall

c© 2009,2010 Vaide Narvaez

Page 7: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Relationships and subclasses

Relationships at the superclass level indicate that all subclasseswill participate in the relationship

The instances of a subclass may participate in a relationshipunique to that subclass. In this situation, the relationship isshown at the subclass level

c© 2009,2010 Vaide Narvaez

Page 8: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Example

Copyright c©2009 Pearson Education, Inc. Publishing as Prentice Hall

c© 2009,2010 Vaide Narvaez

Page 9: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Specialization

Specialization is the process of defining a set of subclasses of anentity (TOP-DOWN)

The set of subclasses is based upon some distinguishingcharacteristics of the entities in the superclassExample: (SECRETARY, ENGINEER, TECHNICIAN) is aspecialization of EMPLOYEE based upon job type.

May have several specializations of the same superclassExample: Another specialization of EMPLOYEE based inmethod of pays SALARIED EMPLOYEE, HOURLY EMPLOYEE.

c© 2009,2010 Vaide Narvaez

Page 10: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Example

!

!"#$%&'($)*(+$,$-./0(12)*$#/)-$"%(34(5$-$6$%/(78%-/#%0(!"#$%&'()*%*"+

"#$%&'()*+, -..!+/0123+45106&'+078+9)01:07*+;0<0*)2

!"#$%&'%(&)%*+

! =6+*)2+$&#>266+#?+82?'7'7(+0+62*+#?+6@A>506626+#?+0+6@$2&>5066+

! B)2+62*+#?+6@A>506626+'6+A0628+@$#7+6#12+8'6*'7(@'6)'7(+>)0&0>*2&'6*'>6+#?+*)2+27*'*'26+'7+*)2+6@$2&>5066

! 4C01$52D+E94"/4BF/GH+4;I=;44/H+B4"J;="=F;K+'6+0+6$2>'05'30*'#7+#?+4LMNOG44+A0628+@$#7+!"#$%&'(P

Q L0%+)0<2+62<2&05+6$2>'05'30*'#76+#?+*)2+6012+6@$2&>5066+

! 4C01$52D+F7#*)2&+6$2>'05'30*'#7+#?+4LMNOG44+A0628+'7+)(%*"+$",$'-& '6+E9FNF/=4RS4LMNOG44H+JOT/NGS4LMNOG44KP

Q 9@$2&>5066U6@A>5066+&250*'#76)'$6+078+6$2>'05'30*'#7+>07+A2+8'0(&0110*'>055%+&2$&2627*28+'7+44/+8'0(&016

Q F**&'A@*26+#?+0+6@A>5066+0&2+>05528+6$2>'?'>+0**&'A@*26P+V#&+2C01$52H+B%$'7(9$228 #?+94"/4BF/G

Q B)2+6@A>5066+>07+$0&*'>'$0*2+'7+6$2>'?'>+&250*'#76)'$+*%$26P+V#&2C01$52H+W4NO;I9SBO+#?+JOT/NGS4LMNOG44

!"#$%&'($)*(+$,$-./0(12)*$#/)-$"%(34(5$-$6$%/(78%-/#%0(!"#$%&'()*%*"+

"#$%&'()*+, -..!+/0123+45106&'+078+9)01:07*+;0<0*)2

,-&."'#/*0/&/!"#$%&'%(&)%*+

Copyright c©2004 Pearson Education, Inc. Publishing as Prentice Hall

c© 2009,2010 Vaide Narvaez

Page 11: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Generalization

Generalization is the process of defining a more general entity typefrom a set of more specialized entity types (BOTTOM-UP)

Several classes with common features are generalized into asuperclass; original classes become its subclasses.Example: CAR, TRUCK generalized into VEHICLE; both CAR,TRUCK become subclasses of the superclass VEHICLE

c© 2009,2010 Vaide Narvaez

Page 12: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Example4.3 Constraints and Characteristics of Specialization and Generalization I 91

(a)NoOfPassengers

LicensePlateNo

Price

LicensePlateNo

(b)LicensePlateNo

NoOfPassengers

FIGURE 4.3 Generalization. (a) Two entity types, CAR and TRUCK. (b) Generalizing CAR

and TRUCK into the superclass VEHICLE.

Sofarwe have introduced the concepts of subclasses and superclass/subclass relationships,

as well as the specialization and generalization processes. In general, a superclass or subclass

represents a collection of entities of the same type and hence also describes an entity type; that

is why superclasses and subclasses are shown in rectangles in EER diagrams, like entity types.

We next discussin more detail the properties of specializations and generalizations.

4.3 CONSTRAINTS AND CHARACTERISTICS OF

SPECIALIZATION AND GENERALIZATION

Wefirst discuss constraints that apply to a single specialization or a single generalization.

For brevity, our discussion refers only to specialization even though it applies to both spe-

cialization and generalization. We then discuss differences between specialization/gener-

alization lattices (multiple inheritance) and hierarchies (single inheritance), and elaborate on

thedifferences between the specialization and generalization processes during conceptual

database schema design.

Copyright c©2004 Pearson Education, Inc. Publishing as Prentice Hall

c© 2009,2010 Vaide Narvaez

Page 13: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Constraints of specialization

4.1 Subclasses, Superclasses, and Inheritance I 87

the entities that belong to the EMPLOYEE entity set, meaning that every entity that is a

member of one of these subgroupings is also an employee. We call each of these

subgroupings a subclass of the EMPLOYEE entity type, and the EMPLOYEE entity type is called

the superclass for each of these subclasses. Figure 4.1 shows how to diagramaticallv

represent these concepts in EERdiagrams.

We call the relationship between a superclass and anyone of its subclasses a

superclass/subclass or simply class/subclass relationship.! In our previous example,

EMPLOYEE/SECRETARY and EMPLOYEE/TECHNICIAN are two class/subclass relationships. Notice that

a member entity of the subclass represents the same real-world entity as some member of

the superclass; for example, a SECRETARY entity 'Joan Logano' is also the EMPLOYEE 'Joan

Lagana'. Hence, the subclass member is the same as the entity in the superclass, but in a

distinct specific role. When we implement a superclass/subclass relationship in the

Three specializations of EMPLOYEE:

{SECRETARY, TECHNICIAN, ENGINEER}

{MANAGER}

(HOURLY_EMPLOYEE, SALARIED_EMPLOYEE)

FIGURE 4.1 EER diagram notation to represent subclasses and specialization.

3. A class/subclass relationship is often called an IS-A (or IS-AN) relationship because of the way we

refer to the concept. We say "a SECRETARY is an EMPLOYEE,""a TECHNICIAN is an EMPLOYEE,"and so on.

Copyright c©2004 Pearson Education, Inc. Publishing as Prentice Hallc© 2009,2010 Vaide Narvaez

Page 14: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Constraints of specialization

If we can determine exactly those entities that will becomemembers of each subclass by a condition, the subclasses arecalled predicate-defined (or condition-defined) subclasses

If all subclasses in a specialization have membership conditionon same attribute of the superclass, specialization is called anattribute-defined specialization

If no condition determines membership, the subclass is calleduser-defined

c© 2009,2010 Vaide Narvaez

Page 15: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Constraints I

disjointnessThe entity instance can be a member of at most one of thesubclasses of the specializationSpecified by d in EER diagram

overlapThe entity instance can be a member of more than one of thesubclass of the specializationSpecified by o in EER diagram

c© 2009,2010 Vaide Narvaez

Page 16: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Disjointness example

92 I Chapter 4 Enhanced Entity-Relationship and UML Modeling

4.3.1 Constraints on Specialization and Generalization

In general, we may have several specializations defined on the same entity type (or super-

class), as shown in Figure 4.1. In such a case, entities may belong to subclasses in each of the

specializations. However, a specialization may also consist of a single subclass only, such as

the {MANAGER} specialization in Figure 4.1; in such a case, we do not use the circle notation.

In some specializations we can determine exactly the entities that will become

members of each subclass by placing a condition on the value of some attribute of the

superclass. Such subclasses are called predicate-defined (or condition-defined) subclasses.

For example, if the EMPLOYEE entity type has an attribute ]obType, as shown in Figure 4.4, we

can specify the condition of membership in the SECRETARY subclass by the condition

(JobType = 'Secretary'), which we call the defining predicate of the subclass. This

condition is a constraint specifying that exactly those entities of the EMPLOYEE entity type

whose attribute value for ]obType is 'Secretary' belong to the subclass. We display a

predicate-defined subclass by writing the predicate condition next to the line that

connects the subclass to the specialization circle.

If all subclasses in a specialization have their membership condition on the same

attribute of the superclass, the specialization itself is called an attribute-defined

specialization, and the attribute is called the defining attribute of the specialization.P We

display an attribute-defined specialization by placing the defining attribute name next to

the arc from the circle to the superclass, as shown in Figure 4.4.

JobType

"Secretary"

TECHNICIAN

"Engineer"

FIGURE 4.4 EER diagram notation for an attribute-defined specialization on JobType.

6. Such an attribute is called a discriminator in UML terminology.

Copyright c©2004 Pearson Education, Inc. Publishing as Prentice Hall

c© 2009,2010 Vaide Narvaez

Page 17: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Overlap example

Copyright c©2009 Pearson Education, Inc. Publishing as Prentice Hall

c© 2009,2010 Vaide Narvaez

Page 18: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Constraints II

completenessI total specialization

Every entity instance in the superclass must be a member of atleast one subclass in specializationShown in EER diagrams by a double line

I partial specializationAn entity instance in the superclass is allowed not to belong toany of the subclassesShown in EER diagrams by a single line

c© 2009,2010 Vaide Narvaez

Page 19: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Total spec. example

Copyright c©2009 Pearson Education, Inc. Publishing as Prentice Hall

c© 2009,2010 Vaide Narvaez

Page 20: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Partial spec. example

Copyright c©2009 Pearson Education, Inc. Publishing as Prentice Hall

c© 2009,2010 Vaide Narvaez

Page 21: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Example

4.1 Subclasses, Superclasses, and Inheritance I 87

the entities that belong to the EMPLOYEE entity set, meaning that every entity that is a

member of one of these subgroupings is also an employee. We call each of these

subgroupings a subclass of the EMPLOYEE entity type, and the EMPLOYEE entity type is called

the superclass for each of these subclasses. Figure 4.1 shows how to diagramaticallv

represent these concepts in EERdiagrams.

We call the relationship between a superclass and anyone of its subclasses a

superclass/subclass or simply class/subclass relationship.! In our previous example,

EMPLOYEE/SECRETARY and EMPLOYEE/TECHNICIAN are two class/subclass relationships. Notice that

a member entity of the subclass represents the same real-world entity as some member of

the superclass; for example, a SECRETARY entity 'Joan Logano' is also the EMPLOYEE 'Joan

Lagana'. Hence, the subclass member is the same as the entity in the superclass, but in a

distinct specific role. When we implement a superclass/subclass relationship in the

Three specializations of EMPLOYEE:

{SECRETARY, TECHNICIAN, ENGINEER}

{MANAGER}

(HOURLY_EMPLOYEE, SALARIED_EMPLOYEE)

FIGURE 4.1 EER diagram notation to represent subclasses and specialization.

3. A class/subclass relationship is often called an IS-A (or IS-AN) relationship because of the way we

refer to the concept. We say "a SECRETARY is an EMPLOYEE,""a TECHNICIAN is an EMPLOYEE,"and so on.

Copyright c©2004 Pearson Education, Inc. Publishing as Prentice Hallc© 2009,2010 Vaide Narvaez

Page 22: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Constraints III

Disjointness and completeness constraints are independent!

Disjoint, totalDisjoint, partialOverlapping, totalOverlapping, partial

c© 2009,2010 Vaide Narvaez

Page 23: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Hierarchies and Lattices

A specialization hierarchy has a constraint that every subclasshas only one superclass (called single inheritance)

For a specialization lattice, a subclass can be subclass of morethan one superclass (called multiple inheritance)

In a lattice or hierarchy, a subclass inherits attributes not only of itsdirect superclass, but also of all its predecessor superclasses

c© 2009,2010 Vaide Narvaez

Page 24: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Example 1

4.3 Constraints and Characteristics of Specialization and Generalization I 95

TECHNICIAN

FIGURE 4.6 A special ization lattice with shared subclass ENGINEERING_MANAGER.

have been a hierarchy except for the STUDENT_ASSISTANT subclass, which is a subclass in two

distinct class/subclass relationships. In Figure 4.7, all person entities represented in the

database are members of the PERSON entity type, which is specialized into the subclasses

{EMPLOYEE, ALUMNUS, STUDENT}. This specialization is overlapping; for example, an alumnus may

also be an employee and may also be a student pursuing an advanced degree. The subclass

STUDENT is the superclass for the specialization {GRADUATE_STUDENT, UNDERGRADUATE_STUDENT},

while EMPLOYEE is the superclass for the specialization {STUDENT_ASSISTANT, FACULTY, STAFF}.

Notice that STUDENT_ASSISTANT is also a subclass of STUDENT. Finally, STUDENT_ASSISTANT is the

superclass for the specialization into {RESEARCH_ASSISTANT, TEACHING_ASSISTANT}.

In such a specialization lattice or hierarchy, a subclass inherits the attributes not only

ofitsdirect superclass but also of all its predecessor superclasses all theway to the rootof the

hierarchy or lattice. For example, an entity in GRADUATE_STUDENT inherits all the attributes of

thatentity as a STUDENT and as a PERSON. Notice that an entity may exist in several leafnodes

ofthe hierarchy, where a leaf node is a class that has no subclasses of its own. For example,

amember of GRADUATE_STUDENT may also be a member of RESEARCH_ASSISTANT.

A subclass with more thanone superclass is called a shared subclass, such as ENGINEERING_

MANAGER in Figure 4.6. This leads to the concept known as multiple inheritance, where the

shared subclass ENGINEERING_MANAGER directly inherits attributes and relationships from

multiple classes. Notice that the existence of at least one shared subclass leads to a lattice

(and hence to multiple inheritance); if no shared subclasses existed, we would have a

hierarchy rather than a lattice. An important rule related to multiple inheritance can be

illustrated by the example of the shared subclass STUDENT_ASSISTANT in Figure 4.7, which

Copyright c©2004 Pearson Education, Inc. Publishing as Prentice Hall

c© 2009,2010 Vaide Narvaez

Page 25: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Example 296 I Chapter 4 Enhanced Entity-Relationship and UML Modeling

DegreeProgram

FIGURE 4.7 A specialization lattice with multiple inheritance for a UNIVERSITY database.Copyright c©2004 Pearson Education, Inc. Publishing as Prentice Hallc© 2009,2010 Vaide Narvaez

Page 26: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

UNION types (Categories)

A shared subclass is subclass in more than one distinctsuperclass/subclass relationships, where each relationships hasa single superclass (multiple inheritance)

In some cases, need to model a single superclass/subclassrelationship with more than one superclass

Superclasses represent different entity types

Such a subclass is called a category or UNION TYPE

c© 2009,2010 Vaide Narvaez

Page 27: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

ExampleDatabase for vehicle registration, vehicle owner can be a person, a bank (holding a lien on a vehicle) or a company.

Category (subclass) OWNER is a subset of the union of the three superclasses COMPANY, BANK, and PERSONA category member must exist in only one of its superclasses

!

!"#$%&'($)*(+$,$-./0(12)*$#/)-$"%(34(5$-$6$%/(78%-/#%0(!"#$%&'()*%*"+

"#$%&'()*+, -../+01234+56217&'+189+:)12;18*+<1=1*)3

!"#$%&'($)*+,-./-*012345

! >66+#?+*)3+7@$3&A6177B7@CA6177+&361*'#87)'$7+D3+)1=3+7338+*)@7+?1&+)1=3+1+7'8(63+7@$3&A6177+

! >+7)1&39+7@CA6177+'7+7@CA6177+'8+2#&3+*)18+#83+9'7*'8A*+7@$3&A6177B7@CA6177+&361*'#87)'$7E+D)3&3+31A)+&361*'#87)'$7+)17+1+7'8(63+7@$3&A6177 F2@6*'$63+'8)3&'*18A3G+

! H8+7#23+A1737E+8339+*#+2#936+1+7'8(63+7@$3&A6177B7@CA6177+&361*'#87)'$+D'*)+2#&3+*)18+#83+7@$3&A6177+

! :@$3&A617737 &3$&3738*+9'??3&38*+38*'*%+*%$37+

! :@A)+1+7@CA6177+'7+A16639+1+A1*3(#&%+#&+I<HJ<+KLM5+

! 5N12$63O+P1*1C173+?#&+=3)'A63+&3('7*&1*'#8E+=3)'A63+#D83&+A18+C3 1+$3&7#8E+1+C18;+F)#69'8(+1+6'38+#8+1+=3)'A63G+#&+1+A#2$18%QR "1*3(#&%+F7@CA6177G+JS<50+'7+1+7@C73*+#?+*)3+@8'#8+#?+*)3+*)&33+7@$3&A617737"JTM><LE+U><VE+189+M50:J<+

R >+A1*3(#&%+232C3&+2@7*+3N'7*+'8+1*+6317*+#83+#?+'*7+7@$3&A617737

! <#*3O+K)3+9'??3&38A3+?&#2+7)1&39+7@CA6177E+D)'A)+'7+7@C73*+#?+*)3+'8*3&73A*'#8+#?+'*7+7@$3&A617737 F7)1&39+7@CA6177+232C3&+2@7*+3N'7*+'8+166+#?+'*7+7@$3&A617737GQ

!"#$%&'($)*(+$,$-./0(12)*$#/)-$"%(34(5$-$6$%/(78%-/#%0(!"#$%&'()*%*"+

"#$%&'()*+, -../+01234+56217&'+189+:)12;18*+<1=1*)3

36"789$*&:*;"#$%&'($)

+,-./-*012345

Copyright c©2004 Pearson Education, Inc. Publishing as Prentice Hall

c© 2009,2010 Vaide Narvaez

Page 28: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

University Database102 I Chapter 4 Enhanced Entity-Relationship and UML Modeling

FIGURE 4.9 An EER conceptual schema for a UNIVERSITY database.

c© 2009,2010 Vaide Narvaez

Page 29: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Exercise 1

Draw an EER diagram for the following problem.A nonprofit organization depends on a number of different types ofpeople for its successful operation. The organization is interested inthe following properties for all of these people: SSN, Name, Address,City, State, Zip, and Telephone. Three types of people are of greatestinterest: employees, volunteers and donors. For employees theorganization wants to store their hiring date, and for volunteers – theirskills. Donors have only a relationship (named Donates) with an Itementity. A donor must have donated one or more items, but an itemmay have no donors.There are people other than employees, volunteers, and donors whoare of interest to the organization, so that a person may belong to twoor more of these groups.

c© 2009,2010 Vaide Narvaez

Page 30: Vaide Narv˙ aez´ - PAYAP UNIVERSITYcis.payap.ac.th/wp-content/uploads/2010/04/week4.pdf · Enhanced Entity-Relationship Model Vaide Narv˙ aez ... Specified by d in EER diagram

Exercise 2

At a weekend retreat, the entity PERSON has three subtypes:CAMPER, BIKER, and RUNNER. Draw a separate EER diagramsegment for each of the following situations:

At a given time, a person must be exactly one of these subtypesA person may or may not be one of these subtypes. However, aperson who is one of these subtypes cannot at the same time beone of other subtypes.A person may or may not be one of these subtypes. On the otherhand, a person may be any two (or even three) of these subtypesat the same time.At a given time, a person must be at least one of these subtypes.

c© 2009,2010 Vaide Narvaez