z556: session 8 data modeling entity-relationship diagram (er). unified modeling language (uml). 1

45
Z556: Session 8 Data Modeling Entity-Relationship Diagram (ER). Unified Modeling Language (UML). 1

Upload: bartholomew-anderson

Post on 23-Dec-2015

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Z556: Session 8

Data Modeling Entity-Relationship Diagram (ER).

Unified Modeling Language (UML). 1

Page 2: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Modeling

2

Cultural Model

Flow Model

Physical Model

Artifact Model

Sequence Model

E-R Diagram

Page 3: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

What is Data Modeling?

A process for identifying, documenting & organizing

data elements based on specified requirements.

3

3

Page 4: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

What is Data Modeling?

A design activity that is not limited to data analysis.

(Be Creative…)

4

4

Page 5: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

What is Data Modeling?

Can be presented in many different ways.

5

E.g., Tables Entity-Relationship diagramClass diagramActivity diagram

5

Page 6: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Why Data Modeling?

To identify essential data elements and understand their role in supporting

business processes.

6

6

Page 7: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

A Little Incentive to Pay Attention

Annual Mean Salary by Job Financial specialist $74,270

Information and Record Clerks $32,320

Loan officer $71,800

Network & Computer Systems administrator

$77,910

Paralegals $51,170

Database administrator $80,740

Advertising Sales Agents $57,440

Actuaries $107,7407

Bureau of Labor Statistics http://www.bls.gov/oes/current/oes_nat.htm

Page 8: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Data Modeling Language

Entity-Relationship (ER) Diagram

Object-Oriented (OO) Design

Unified Modeling Language (UML)

8

8

Page 9: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Case Study: KCCI Training Center

• KCCI training center organizes training programs for customers in three different areas: Investment, Real-Estate, & Human-Resources.

• For each program to run, there is a required minimum number of attendees.

• To enroll in a program or more, a customer fills a registration form and send it to the center.

• A training coordinator keeps track of the number of registered customers. When the minimum number is reached before the start date of the program, the coordinator contacts a trainer to run the program and then sends confirmation/invoice letters to the customers.

• If no trainer is available or the minimum number is not reached, cancelation letters are sent to the customers. 9

Page 10: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Case Study: KCCI Training Center

Problems: Ineffective paper-based system that fails to

meet the growing trends of the center.

Difficulty to track programs and participants.

Difficulty to locate misplaced or lost files.

Difficulty to share and access information.

Underutilized data for future planning.

10

Page 11: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Case Study: KCCI Training CenterSolution:

Develop a new information system for managing, storing, retrieving, and

analyzing all information related to training programs.

Purpose of data modeling: To identify essential data elements and

understand their role in supporting work processes. 11

Page 12: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Relationship Attribute

ER Diagram

12

o The principle data objects about which information is to be collected. E.g., person, place, document, etc.

o Entity instance: a particular occurrence of an entity.

University•Indiana University Bloomington•University of Indianapolis•University of Phoenix

Entity name

Instances

Entity

Page 13: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Attribute

ER Diagram

13

Entity

Real-word association among entities.

Entity Relationship Entity

Manager Manages Department

Relationship

Page 14: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Attribute

ER Diagram

14

Entity

o Connectivity of a relationship :Describes the constraints on the connection of the associated instance in the relationship.

Entity Relationship Entity

Entity Relationship Entity

Entity Relationship Entity1 1

1 *

**

Relationship

Page 15: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

ER Diagram

15

Entity Relationship Attribute

o Provides descriptive detail about entities and relationships.

o An attribute value: a particular occurrence of an attribute within an entity or relationship.

Student enroll

ID

Classname

dateSection

Title

Page 16: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

KCCI ER Diagram

16

Customeris

given by

Program Trainer

Coordinator

enrolls

is-contacted-

bycontacts

Manages

1

*

1

1*

* * **

Name

NameName CustID

Phone

CoID

TrnIDTitle

ProgID

Area

AddressDate

1

Page 17: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

KCCI ER Diagram

17

Customeris

given by

Program Trainer

Coordinator

enrolls

is-contacted-

bycontacts

Manage

1

*

1

1*

* * **

Name

NameName CustID

Phone

CoID

TrnIDTitle

ProgID

Area

AddressDate

1

Page 18: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

KCCI ER Diagram

18

Customeris

given by

Program Trainer

Coordinatoris-

contacted-by

contacts

Manage

1

*

1

1*

* * **

Name

NameName CustID

Phone

CoID

TrnIDTitle

ProgID

Area

AddressDate

1

Registration Form

11

Page 19: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Implementing

19

Entity (Customer)

Cust# Name Address Phone #

100 Peter Alex 335 10th 555-4444

Page 20: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Implementing

20

Attribute (address)

Entity

data instance

Cust# Name Address Phone #

100 Peter Alex 335 10th 555-4444

Page 21: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Many-to-Many Relationship

Cust_id F_name L_name address

1234 Mary Gray 456 Oak street

1235 Bill Dodds 789 Woodburn street

1236 Justin Moore 903 College avenue

Class_id

Price Date Class name

135 100 Oct-1-2013 Customer Service 101

136 200 Nov-1-2013 Types of Investment

137 100 Oct-31-2013 Property Evaluation

21

Registration

Page 22: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Many-to-Many Relationship

Registration_id Cust_id Class_id0088 1234 136

Cust_id F_name L_name Address

Class_id Price Date Class name22

CUSTOMER

REGISTRATION

PRODUCT

Page 23: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Generalization Hierarchy Diagram

Entities with common attributes can be generalized into a higher entity type

(Superset entity).

Subsets entities can be either disjoint (d) or overlapping (o).

23

23

Page 24: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Hierarchy Diagram

24

Customer TrainerCoordinator

PerID

Person

o

Name Phone

Email

Real-EstateHuman-

ResourcesInvestment

ProgID

Program

d

StartDate

EndDate

Disjoint (d) Generalization Overlap (o) Generalization

Page 25: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Object-Oriented (OO) Design

Objects are the basic unit which the organization must keep track of or that participate in a business process.

A system is a set of objects that collaborate and interact with each other.

UML is a widely accepted standard incorporating OO concepts, and provides terminology and diagram

conventions.

25

25

Page 26: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Object-Oriented Design

26

• Properties attached to each object.

Attributes:

• Functions that could change the value of object’s attribute.

Operations :

• Procedure used to carry on the operations.

Methods:26

Page 27: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

OO Concepts• Classes:

Categories to which an object belong to and share the same operation, methods, and attributes.

27

Class Name

Attribute 1Attribute 2Attribute 3Operation 1 ()Operation 2 ()Operation 3 ()

Customer

CustomerIDNameAddressSearchProgram()Enroll ()Pay () 27

Page 28: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Class Relationships in UML

Generalization: A relationship between a more general class and a more specific class.

Association: Objects in one class linked to objects in the other class.Multiplicities: 1 to 1 , 1 to * , * to *

28

Real-Estate Human-ResourcesInvestment

Program

Coordinator Program28

Page 29: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Class Relationships in UMLAggregation:

Relationship between a whole and its parts.

Composition: An aggregation relation in which the part belong to only one whole at a time.

29

Trainer Program

ProgramDescripton Program

PurposeTargetAudience 29

Page 30: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Trainer

<pk>TrainerIDNamePlaceOfWorkPhoneFaxEmailNote

Program

<pk>ProgramIDTitleTrainingAreaLocationStartDateEndDateStartTimeEndTimeCostMinAttendeesCoordinatorStatusNote

Customer

<pk>CustomerIDTitleNamePhoneFaxEmailWorkNote

Coordinator

<pk>CoordinatorIDNamePhoneEmailNote

RegistrationForm

<pk>RegFormIDDate<pk>CustomerID<pk>ProgramIDNote

Invoice

<pk>InvoiceIDDateRegistrationFormCostNote

UML Class Diagram (Attributes)

30

1..* 1..*1..*1..1

1..*

1..1

1..1

1..1Association Class

1..11..1

Page 31: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Trainer

AddTrainer()RemoveTrainer()isAvailable(:Boolean)

Program

AddProg ()ConfirmProg ()CancelProg()

Customer

NewCust()SignIn()FindProgram()Enroll(in enrl: Program)SendRegForm()Payment()

Coordinator

ProgStatus ()ConfirmLetter ()CanelLetter ()ContactTrainer()

RegistrationForm

AddProgram()RemoveProgram()AddCustomer()RemoveCustomer()

Invoice

Total (amnt: Dollar)

UML Class Diagram (Operation)

31

1..* 1..*1..*1..1

1..*

1..1

1..1

1..1

1..11..1

Page 32: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

SummaryData modeling help identify essential data elements and

understand their role in supporting business processes. Data modeling simplifies communication between system

developers and end users.Data modeling supports the development of information

systems.

32

32

Page 33: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Develop a Data Model for Choosing a Job?

• What are the entities/classes?• What are the attributes? • What are the relationships?

33

33

Page 34: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Develop a Data Model for Choosing a Job?

34

ContactPerson

<pk>CP_IDNamePhoneFaxEmailNote

Job

<pk>JobID<pk>CP_ID<pk>OrgIDTitleSalaryResponsibilitiesRequirementsStartDateLocationNote

Organization

<pk>OrgIDNamePhoneFaxEmailWebsiteTypeNote

1..* 1..11..*1..1

34

Page 35: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

The 7 Habits of Highly Effective Data Modelers

(Moody, 1996)

35

Knowledge

SkillMotivation

Habit

Moody, D. (1996) The seven habits of highly effective data modelers. Database Programming & Design, 9, 10, 57-64.

Page 36: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

The 7 Habits of Highly Effective Data Modelers (Moody, 1996)

• See for yourself (observation—Method school of data modeling)

• Generate alternatives• Keep it simple (generalization)• Test the model (prototyping/scenario)• Know when to stop• Remember the big picture• Following through

• Contextual Inquiry 36

Page 37: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Object-Orientation

• Objects• An object has attributes and operations

ILS

Z5

56

37

Attributes: Color; Size

Page 38: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Object-Orientation

• Objects• An object has attributes and operations

ILS

Z5

56

38

Operations: Make a call

Page 39: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Object-Orientation

• A class is a category to which an object belongs• E.g., Smartphone is a class for Nexus and iPhone; both

share the same attributes and operations

ILS

Z5

56

39

Page 40: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Object-Orientation• Window is a class

that has:• Attributes of: size,

location, background color, etc. IL

S Z

556

40

Page 41: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

Object-Orientation• Window is a class

that has:• Operations of:

open, close, resize, etc.

ILS

Z5

56

41

Page 42: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

UML and ER

• UML class diagrams =~ ER diagrams• Classes =~ Entities

Class Name

Attribute 1Attribute 2

Operation 1()Operation 2()

42

Entity Name

Attribute 1

Page 43: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

UML and ER

• UML class diagrams =~ ER diagrams• Classes =~ Entities

Class Name

Attribute 1Attribute 2

Operation 1()Operation 2()

Customer

<pk>Customer_id: stringCustomer_name: stringAddress: string

creditRating ()43

Example

Page 44: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

UML and ER

• UML class diagrams =~ ER diagrams• Classes =~ Entities

Class Name

Attribute 1Attribute 2

Operation 1()Operation 2()

Customer

<pk>Customer_id: stringCustomer_name: stringAddress: string

creditRating ()44

Example

CreateReadUpdateDelete

Page 45: Z556: Session 8 Data Modeling  Entity-Relationship Diagram (ER).  Unified Modeling Language (UML). 1

UML: Class Diagram

45

Customer Order

Payment

Credit Cash Check

OrderDetail

nameaddress

datestatus

amount

calcTaxcalcTotalcalcTotalWeight

numbertypeexpDate

authorized

cashTendered namebankID

authorized

quantitytaxStatus

calcSubTotalcalcWeight

1 0..*

1

1..*

1..*

1

specialization

association

aggregation

line item

http://edn.embarcadero.com/article/images/31863/classdiagramno3d.gif