Enhanced E-R Model and Business Rules

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 20

Modern Database Management, Sixth Edition

60

Chapter 4 The Enhanced E-R Model and Business Rules


Chapter Objectives
The purpose of this chapter is to present some important extensions to the E-R model
(described in Chapter 3) that are useful in capturing additional business meaning. In particular we
describe two types of extensions to the E-R model. The enhanced entity-relationship (EER)
model includes constructs for supertype/subtype relationships. The inclusion of new notation for
business rules allows the designer to capture a broader range of constraints on the data model
than were previously available.
Specific student objectives are included in the beginning of the chapter. From an
instructors point of view, the objectives of this chapter are to:
1.
Introduce the concept of supertype/subtype relationships, and prepare the student to
recognize when to use these relationships in data modeling.
2.
Describe the use of specialization (top-down perspective) and generalization (bottom-up
perspective) as complementary techniques for defining supertype/subtype relationships.
3.
Introduce notation for specifying both completeness constraints and disjointness
constraints when modeling supertype/subtype relationships.
4.
Help students gain sufficient perspective so that they recognize when to use (and when not
to use) supertype/subtype relationships in realistic business situations.
5.
Describe the basic premises of a business rules paradigm.
6.
Describe a simple framework for categorizing business rules.
7.
Introduce notation for modeling typical operational constraints that can be incorporated in
your EER diagram.
Classroom Ideas
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.

Introduce the concept of supertypes and subtypes with a familiar example, such as
VEHICLE (subtypes are CAR, TRUCK, SUV, etc.).
Introduce the basic notation for supertype/subtype relationships (Figure 4-1). Use this
notation to represent the example you introduced in (1).
Discuss the EMPLOYEE example with subtypes (Figure 4-2). Use this figure to
introduce the example of attribute inheritance.
Use Figure 4-3 to discuss the two major reasons for introducing supertype/subtype
relationships: unique attributes among subtypes, and unique subtype relationships.
Contrast generalization and specialization using Figures 4-4 and 4-5. Have your students
suggest other examples that use each of these techniques.
Introduce the completeness constraint using Figure 4-6. Give other examples where either
the total specialization rule or the partial specialization rule is more appropriate.
Discuss the disjointness constraint and related notation using Figure 4-7. For
reinforcement, have the students work Problem 7 (Problems and Exercises) in class.
Introduce notation for a subtype descriminator (Figures 4-8 and 4-9). Discuss why a
different notation is required for the two cases shown in these figures.
Discuss entity clustering and illustrate with Figures 4-13 and 4-14.
Review the extended example of a supertype/subtype hierarchy shown in Figure 4-10.
For reinforcement, ask the students to work problem 2 (Problems and Exercises) in class.
Discuss the classification of business rules shown in Figure 4-15. Give examples for each
type of rule.

61

13.
14.
15.

Modern Database Management, Sixth Edition

Discuss the notion of structural assertions, and illustrate with examples shown in Figures
4-17 and 4-18.
Introduce the notion of operational assertions, and illustrate with the examples shown in
Figures 4-17 and 4-18. For each of these examples, show how the business rule is
captured with notation on the diagram.
Ask your students for examples of other business rules they have encountered recently in
their work, school, or home experience. See if they can diagram these rules using the
notation provided in this chapter.

Answers to Review Questions


1.

Define each of the following terms:


a.
Supertype. A generic entity type that has a relationship with one or more subtypes.
b.
Subtype. A subgrouping of the entities in an entity type that is meaningful to the
organization.
c.
Specialization. The process of defining one or more subtypes of the supertype,
and forming supertype/subtype relationships.
d.
Entity cluster. A set of one or more entity types and associated relationships
grouped into a single abstract entity type.
e.
Structural assertion. A statement that expresses some aspect of the static structure
of the organization.
f.
Anchor object. A business rule (a fact) on which actions are limited.
g.
Subtype discriminator. An attribute of the supertype whose values determine the
target supertype or subtypes.
h.
Total specialization rule. Specifies that each entity instance of the supertype must
be a member of some subtype in the relationship.
i.
Generalization. The process of defining a generalized entity type from a set of
more specialized entity types.
j.
Disjoint rule. Specifies that if an entity instance (of the supertype) is a member of
one subtype, it cannot simultaneously be a member of two (or more) subtypes.
k.
Overlap rule. Specifies that an entity instance can simultaneously be a member of
two (or more) subtypes.
l.
Action assertion. A statement of a constraint or control on the actions of the
organization.

2.

Match the following terms and definitions:


h supertype
k entity cluster
i structural assertion
a subtype
j specialization
d anchor object
f action
l subtype discriminator
c attribute inheritance
b overlap rule
e corresponding object
g derived fact

Chapter 4

3.

4.

5.

6.
7.

62

Contrast the following terms:


a.
Supertype; subtype. A supertype is a generalized entity type that has one or more
subtypes, while a subtype is a subgrouping of the entities in a supertype.
b.
Generalization; specialization. Generalization is the process of defining a
generalized entity type from a set of more specialized entity types while
specialization is the process of defining one or more subtypes of the supertype.
c.
Anchor object; corresponding object. An anchor object is a business rule on
which actions are limited whereas a corresponding object influences the ability to
perform an action on another business rule.
d.
Disjoint rule; overlap rule. With the disjoint rule an instance of a supertype may
be a member of only one subtype at a given time. With the overlap rule an instance
of a supertype may simultaneously be a member of two or more subtypes.
e.
Structural assertion; action assertion. A structural assertion express the static
structure of an organization whereas an action assertion is a statement of control
on the actions of an organization.
f.
Total specialization rule; partial specialization rule. With the total specialization
rule, each instance of the supertype must be a member of some subtype in the
relationship. With the partial specialization rule, an instance of the supertype is
allowed not to belong to any subtype.
Two conditions that indicate a designer should consider using supertype/subtype
relationships:
a.
There are attributes that apply to some (but not all) of the instances of an entity
type.
b.
The instances of a subtype participate in the relationship unique to that subtype.
The reasons for entity clustering are:
a.
Complex enterprise-wide E-R diagram.
b.
Ability to have a hierarchical decomposition of data model.
c.
Desire to focus part of the model on an area of interest to some community of
users.
d.
Ability to create several different entity clusters each with a different focus.
An example of a supertype/subtype relationship:
The supertype PERSON has many possible subtypes: MALE, FEMALE, INFANT,
TEENAGER, etc.
Give an example of a:
a.
Structural assertion: a person is a customer of a store.
b.
Action assertion: a customer must have a credit limit greater than zero in
order to charge a purchase.

Modern Database Management, Sixth Edition

63

8.
9.

10.
11.

Attribute inheritance is the property that subtype entities inherit values of all attributes of
the supertype. This property is important because it makes it unnecessary to include
supertype attributes redundantly with subtypes.
Give examples of:
a.
Supertype/ subtype relationship where the disjoint rule applies: PERSON has
subtypes MALE and FEMALE.
b.
Supertype/ subtype relationship where the overlap rule applies: PERSON has
subtypes INSTRUCTOR and STUDENT.
The types of business rules that are normally captured in an EER diagram include terms,
relationship constraints, and supertype/ subtype relationships (see Figure 4-11).
The purpose of a subtype discriminator is to determine the target subtype (or subtypes) for
each instance of a supertype.

Solutions to Problems and Exercises


1.

An example listing follows:


Attribute Name

Data Value

SSN

736-94-1802

Name

Essica James

Address

25 Lake Dr. Medford OR 95106

Sex

female

Date_of_Birth

Oct. 23, 1967

Date_Hired

June 10, 1994

Salary

$30,000

Position

Financial anlayst

3.

Chapter 4

64
Person_Type

2.

Student?
Employee?

Address
Name

Alumnus?

Sex

SSN

Date_of_
Birth

PERSON
Person_Type:

Salary
Employee?=Y
Employee
_Type

Student?=Y

Major_Dept

Alumnus?=Y
EMPLOYEE

STUDENT

Student_Type

ALUMNUS
Date_Hired
Degrees
Employee_Type=

Student_Type=
Year

Date
Degree

d
Faculty

FACULTY

Rank

d
Staff

STAFF

Position

Grad

GRADUATE
STUDENT

Test_Score

Undergrad

UNDERGRAD
STUDENT

Class_
Standing

Modern Database Management, Sixth Edition

65

Address

3.
Name

City/State/Zip

Telephone

PERSON

SSN

EMPLOYEE

VOLUNTEER

Date_Hired

DONOR

Donates

Skill

4.

Address
ITEM
City/State/Zip

Name

SSN

Telephone

PERSON
Person_Type:

Person_Type
O
E?

D?
V?
E?=Y
V?=Y

D?=Y

EMPLOYEE
VOLUNTEER

Date_Hired

Skill

DONOR

Donates

ITEM

Chapter 4

66

5. No none of the vehicle classifications has a unique attribute or a unique relationship.


6.
a.

PERSON

d
RUNNER

CAMPER
BIKER

b.

PERSON

d
CAMPER

RUNNER
BIKER

c.

PERSON

CAMPER

RUNNER
BIKER

d.
PERSON

RUNNER

CAMPER
BIKER

Modern Database Management, Sixth Edition

67

7.
Date_Opened

Account
_Type

ACCOUNT

Acct_No

Balance

Account_Type=

d
C

CHECKING

Service
_Change

SAVINGS

Interest
_Rate

LOAN

Payment

Interest
_Rate

Chapter 4

8.

68

a. Sample definitions:
EMPLOYEE: a person who has signed an employment agreement or contract
with the company, and who is on the company payroll.
HOURLY EMPLOYEE: an employee whose pay is based on number of hours
worked.
SALARIED EMPLOYEE: an employee who receives a fixed salary each pay
period.
CONSULTANT: an employee who has signed an employment contract and whose
pay is based on an agreed billing rate.
Employee_Number: an employees social security number.
Employee_Name: an employees name consisting of first name, middle initial, and
last name.
Address: an employees home address, consisting of street address, city, state, and
zip code.
Date_Hired: the date when an employee signed an employment agreement or
contract.
Hourly_Rate: the pay rate ($/hour) for an hourly employee.
Annual_Salary: the base annual salary for a salaried employee.
Stock_Option: the annual compensation (shares/year) of company stock for a
salaried employee.
Contract_Number: the number on the employment contract signed by a
consultant.
Billing_Rate: the compensation ($/hour or other stated period) on the employment
contract signed by a consultant.
b.
Sample integrity-constraint action assertions:
Employee_Number:
Each employee must have a unique employee number.
Employee_Name:
Each employee must have a name.
Address:
Each employee must have an address.
Date_Hired:
Each employee must have a date of hire earlier than or equal to todays
date.
Hourly_Rate:
Hourly employees must have an hourly rate which must be between $1 and
$100
Annual_Salary:
Salaried employees must have an annual salary between $1 and $999,999.
Stock Option:
Salaried employees must have a value for stock option between 0 and
10,000
Billing_Rate
Consultants must have a billing rate between $0 and $999.
Contract_Number
Consultants must have a contract number.

Modern Database Management, Sixth Edition

69

9.
a. and b.

Student_ID

Faculty
_Name

Faculty_ID

Student
_Name

Is_
qualified

FACULTY

STUDENT

Date_
Qualified

Course_ID
COURSE

Is_
assigned

Course_Name

LIM

Is_
scheduled

SECTION

Is_
registered
Section_No

Section_ID

Semester

Chapter 4

70

10.

Patient_ID

Admit_Date

PATIENT

Physician_ID

RESPONSIBLE
PHYSICIAN

Admits

OUTPATIENT

Checkback
_Date

RESIDENT
PATIENT

Is_
assigned

BED

Bed_ID

Date_
Discharge

a. Anchor object: resident patient


b. Corresponding object: responsible physician
11.

Business rule: A student may attend a concert only if that student has completed his/ her
homework:
a and b.
May
_attend

STUDENT

Has_
completed

c.
12.

a.

CONCERT

HOMEWORK

Anchor object: student


Corresponding object: Has_completed (homework)
Sample definitions:
PATIENT: a person who has been admitted to the hospital, or to a treatment

Modern Database Management, Sixth Edition

71

b.

program administered by the hospital


OUTPATIENT: a person who has been admitted to a program of treatment
administered by the hospital
RESIDENT PATIENT: a person who has been admitted for a stay in the hospital
and assigned to a bed location
RESPONSIBLE PHYSICIAN: a physician who has formally admitted to patient
to the hospital
BED: a hospital bed located within a room in the hospital
Admits: the relationship between a physician and a patient admitted to the hospital
by that physician
Is_Assigned: the relationship between a resident patient and the hospital bed to
which that patient is assigned
Patient_ID: a patients social security number
Admit_Date: the date when a patient was most recently admitted to the hospital or
to a treatment program
Checkback_Date: the date when an outpatient is scheduled for a return visit
Date_Discharged: the date when a resident patient was discharged following the
most recent stay in the hospital
Physician_ID: a unique identification number for an admitting physician
Bed_ID: a unique identification number for each hospital bed
Sample integrity constraint action assertion:
Patient_ID
Each patient must have a unique patient ID.
Admit_Date
Each patient must have an admit date which is a date no greater than today.
Checkback_Date
Each outpatient must have a checkback date which is greater than or equal to
todays date and can be null.
The checkback_date cannot be before the admit_date.
Date_Discharged
Each resident patient must have a discharge date.
The date discharged cannot be before the admit_date.
Physician_ID
Each responsible physician must have a unique physician id.
Bed_ID
Each bed must have a unique bed ID.

Chapter 4

72

13.
a. The maximum cardinality next to CUSTOMER for the Does_business_in
relationship is 0 because it is possible that a selling unit does not do business with
any customer.
b. The attributes of item would be Product_ID, Product_Description,
Product_Finish, Standard_Price, Product_line_ID, Product_Line_Name
c. The attributes of material would be: Vendor_ID, Vendor_Name, Vendor_Address,
Supply_Unit_Price, Material_ID, Unit_of_Measure, Material_Name,
Standard_Cost
14. E-R Diagram from Chapter 3 Problem 6 with Entity Clusters:

The Sales_Unit cluster can be used by people only interested in how the business is
managed, without concern for the properties listed.
The Property_Listing cluster can be used by people who are interested in property that is
currently listed or who owns that property.
15. E-R Diagram from Chapter 3, Problem 11 with Entity Clusters:

73

Modern Database Management, Sixth Edition

There are three entity clusters: Project_Detail, Employee_Detail and Dept_Detail.


Project_Detail contains the set of entities that would be used by one interested in the project
without concern for the specific employees on the project. An assumption is that the only concern
from the project side is to track employee skills and location, not individual employees.
The Employee_Detail cluster would be of most value to the user who was interested in what skills
specific employees have as well as location. Other details are available in this cluster, such as
marriage. This cluster was chosen since one can then isolate employee information without
looking at project information.
The Dept_Detail cluster was chosen since one might not be concerned about vendors, however
one might want to know what department a given employee works for. In the same way, one
might want specifics about vendors without needing information about employees or projects.
Suggestions for Field Exercises
1. Common examples of EER constructs:
a.
Supertype/subtype relationships. Ask your students to try to try to find an example
of each of the rules described in the chapter: disjoint, overlapping, partial

Chapter 4

74

specialization, and total specialization. Also for each example have your students
identify a candidate subtype discriminator. Ask your students to justify the use of
supertype/subtype relationships for each of these examples, using the guidelines
stated in the chapter.
b.
Business rules. For each example, ask your students to first state the rule using
structured English (following the format described in the chapter), then draw an ER diagram segment with the rule superimposed on the diagram.
2. We suggest that you use this exercise as a continuation of Field Exercise 2 in Chapter 3. Ask
your students to determine whether supertype/subtype relationships are formally modeled
in the corporate E-R diagrams. Also, ask your students to determine how business rules
are stated and enforced by each organization.
3. We suggest you assign this exercise in conjunction with Field Exercise 4 in Chapter 3.
4. Following are several questions that can be used to structure this report:
a.
How are business rules defined?
b.
Why are business rules important to an organization?
c.
What are alternative methods for capturing and expressing business rules?
d.
What advantages can an organization realize by formally capturing business rules?
Project Case
Project Questions
1.

2.
3.
4.

Yes, the ability to model supertype/subtype relationships is likely to be very important for
a hospital. A modern hospital is a triumph of specialization. Many hospital entities are
likely to have subtypes, for example:
ITEM: possible subtypes are Supply, Item, and Prescription Item
PATIENT: possible subtypes are Inpatient and Outpatient
TEST: possible subtypes are Scan and Blood test
PROCEDURE: possible subtypes are Biopsy and Surgical
Yes, the business rules paradigm can be used for competitive advantage. Business rules
allow a business to change its processes and procedures quickly in responding to
environmental changes.
Yes, the entity VISIT (scheduled for outpatients) is clearly a weak entity.
A hospital has many business rules. Two examples are the following:
a.
A patient cannot be admitted to the hospital without a referral from a responsible
physician.
b.
A nurse can be reassigned to a different care center only by permission of the nurse
in charge of the care center where the nurse is presently assigned.

Modern Database Management, Sixth Edition

75

Project Exercises
1.

Name

Address
City/State/
Zip

Person_ID

Contact_
Date

PERSON

Birth_Date

Phone

O
Specialty

PATIENT
PHYSICIAN

EMPLOYEE

Pager #

Responsible

VOLUNTEER

Skill

Date_Hired

d
Skill

NURSE

STAFF

Certificate

Assigned

TECHNICIAN
Name

Location

Job_Class
LABORATORY

Is_
Assigned

Location

CARE
CENTER

In_
Charge

Assigned

Name

Bed #

Date_
Admitted

Bed_ID

BED
d

Room #

Assigned

RESIDENT

Date
OUTPATIENT

Scheduled

VISIT
Comments

Chapter 4

2.

3.

76

Following are some sample definitions:


a.
Entity types:
Physician- a person who is licensed to practice medicine in this state.
Patient- a person who has been admitted to MountainView Community Hospital or
who is currently being treated as an outpatient by the hospital.
Employee- a person who has an employment agreement with the hospital and who
is on the hospital payroll.
Care center- an organizational unit that performs a related set of services directed
toward patient care.
b.
Attributes:
Person_ID- a persons social security number
Birth_Date- month, day, and year a person was born
Specialty- a physicians area of practice
Location- the floor number and hospital wing for a care center or laboratory.
c.
Relationships:
Assigned- associates a resident patient with a hospital bed
Scheduled- associates an outpatient with an instance of a visit to the hospital
The rule can be restated as follows:
For a nurse to be appointed nurse-in-charge of a care center, that nurse must possess an
RN certificate.
In_
Charge

NURSE

CARE
CENTER
R

Possesses

a.
b.

CERTIFICATE

Anchor object: nurse (entity)


Corresponding object: RN Certificate (entity).

4. You can perform a side-by-side comparison to show how the EER diagram provides a more
detailed and complete statement of requirements for the hospital. For example, the EER
diagram includes information about technicians as well as volunteers.

77

5.

Modern Database Management, Sixth Edition

Chapter 4

Some issues that come up during the merging:


Should there be a relationship between laboratory, patient and physician for tests?

78

79

Modern Database Management, Sixth Edition

Are items consumed by both resident patients as well as outpatients?


What to do about follow up for discharged patients.
We kept the responsible relationship between patient and physician in place of the
refers used in the ER model.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy