Enhanced E-R Model and Business Rules
Enhanced E-R Model and Business Rules
Enhanced E-R Model and Business Rules
60
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.
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.
2.
Chapter 4
3.
4.
5.
6.
7.
62
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.
Data Value
SSN
736-94-1802
Name
Essica James
Address
Sex
female
Date_of_Birth
Date_Hired
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
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
PERSON
d
RUNNER
CAMPER
BIKER
b.
PERSON
d
CAMPER
RUNNER
BIKER
c.
PERSON
CAMPER
RUNNER
BIKER
d.
PERSON
RUNNER
CAMPER
BIKER
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.
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
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
71
b.
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
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.
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
NURSE
CARE
CENTER
R
Possesses
a.
b.
CERTIFICATE
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.
Chapter 4
78
79
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: