bis 360 – lecture six (part 2) conceptual data modeling (chapter 10 and partial chapter 12)

28
BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

Upload: benedict-mccoy

Post on 12-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

BIS 360 – Lecture Six (Part 2)

Conceptual Data Modeling

(Chapter 10 and partial Chapter 12)

Page 2: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

1. Determine system requirements (ch. 7)

2. Structure system requirements (ch. 8-10) 3. Generate alternative for selection (ch. 11)

SDLCWhere are we?

Project ID and Selection

Project Initiation & Planning

Analysis

Logical Design

Physical Design

Implementation

Maintenance

Data ModelingProcessing ModelingLogic Modeling

Page 3: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

Differences between Modeling

• Data Modeling - Using Entity-Relationship Diagram (ER diagram or ERD)– identify What (types of data) needed in the system

• Process Modeling - Using Data Flow Diagram (DFD)– identify Where and How (which pieces of data) to be used

• Logic Modeling - Using Structured English, Decision Table, and Decision Tree– detail System Logic and Functional Structure

Page 4: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

ERD and DFD

Data Model(ER Diagram)

Data Modeling(ER Diagramming)

Process Modeling(Data Flow Diagramming)

Process Model(Data Flow Diagram)

(more static)

(more dynamic)

Page 5: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

Some Basic Jargons

Model: An abstract representation of “reality”

Data Model: An organization of data to represent the “reality.”

Data Modeling: a technique used to create a “Data Model.”

Conceptual Data Modeling: a technique to capture both “data” and its “meaning” required by an organization

Page 6: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

Conceptual Data Modeling

It is:• presenting what data are needed in the system• independent from “how” data are stored• Independent from which DBMS to be used

Its deliverables:• A preliminary ER model

(address only Entities and Relationships)

• A refined ER diagram (with detailed attributes for each entity)

Page 7: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

An Example-- A Preliminary Entity-Relationship Model

Page 8: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

An Example-- A Refined Entity-Relationship Diagram

Page 9: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

ERD - basic concepts

Entity A thing (tangible/intangible) that can be uniquely identified -- indicated by a noun, it could be a(n):– Person– Object (e.g., machine, tool, equipment, document)– Concept (e.g., position, movie, etc.)

Symbol:a symbol for an

Entity

Page 10: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

ERD - basic concepts

Relationship:• An association between one or more

entities -- described by a verb phrase; it is bi-directional

Symbol:A Line

(with Crow’s foot)

Page 11: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

• Entity Type - the object set that shares a common group of characteristics, e.g., STUDENT (SID, Name, Phone, Major)

• Entity instance - an occurrence of an Entity Type, e.g., (1234, Mike Taylor, 387-5428, CIS)

ERD - basic concepts Entity Type vs. Entity Instance

Page 12: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

ERD - Extended Concepts

Associative Entity: a special relationship that contains its characteristics to associate instances of one or more entity types.

Symbol:

EMPLOYEE COURSEcompletes

Date

Page 13: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

Weak Entity: an “entity” depends on another entity for its existence.

Symbol:

Weak Entity

EMPLOYEE SPOUSE

ERD - Extended Concepts

Page 14: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

How to Characterize a Relationship?

Cardinality:The number of occurrences (instances) involved at each side of a relationship– zero or One– one and only one– zero or many– one or many

(Optional one)

(Mandatory one)

(Optional Many)

(Mandatory Many)

Page 15: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

Relationship: Extended Concepts

Degree of a Relationship: The number of entity types involved in a relationship.

• Unary - a R within an entity itself

• Binary - a R between two different entity types

• Ternary - a R exists among three entity types

Page 16: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

1 to 1(1:1)

1 to many(1:M)

many to many(M:N)

Binary Relationships

Employee Spouse

is a spouse of

hasVehicle Type Modelis of

registers

Course

is registered by

Student

is married to

Page 17: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

Unary Relationships

Person

is a spouse of

is married to

1 to 1

manages

1 to MEmployee

is managed by

consists of

M to NPart

is a component of

Page 18: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

Unary Relationships(a complete graph)

Person

is a spouse of

is married to

1 to 1

consists of

M to NPart

is a component of is managed by

1 to MEmployee

manages

Page 19: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

Unary Relationships

• Each Employee may manage one or more Employees.

• Each Employee must be managed by one and only one Employee.

manages

is manages by

1 to MEmployee

Page 20: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

More Unary Relationship!

Course

has a prerequisite

is a prerequisite of

Q. What is the cardinality for the above unary relationship?

Page 21: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

More Unary Relationship!(A complete graph)

Course

has a prerequisite

is a prerequisite of

Why? Can you explain the above diagram?

Page 22: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

Ternary Relationship

A relationship that simultaneously involves 3 entities!

Page 23: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

How to Characterize an Entity?

AttributeA characteristic (property) of an entity or a

relationship– Key (identifier)– Candidate key– Non-key attribute

Examples:EMP (EmpID, Name, Address, DOB)DEPT (DeptID, DeptName, DeptAddress)

Page 24: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

Foreign Key

Foreign key: It is an attribute ( or a set of attributes) that is used as a Primary Key in some other entity.

EMP DEPT

EMP (EmpID, Name, Address, DOB)

DEPT (DeptID, DeptName, DeptAddress)

Page 25: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

How to Resolve a M:N Relationship?

It is quite common to encounter a M:N relationship - which needs to be represented as an “Associative entity”.

Most DBMS can not represent a M:N relationship, we need to ...

Use the two PKs as the PK andFKs in the associative entity

Sup_PART

SUPPLIER PARTSID PID

Page 26: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

An Example for an M:N Relationship Associative Entity

SUPPLIER(SID, Name, SSN, Phone, Addr)

PART (PID, Description)

SUPPLIERSID

Name SSN PhoneAddr

PART

PID Descrip

Associative Entity Price

Sup_PARTSup_PART

(SID, PID, Price)

Page 27: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

How to Conduct the ER Diagramming?

Step 1 - Identify all interested Entities

Step 2 - Identify proper relationships between entities

Step 3 - identify the Key and non-key attributes for each entity

Step 4 - Verify the validity of the final ER diagram

Page 28: BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)

Validation of ERDRules:

• The entity name must be a noun

• The entity name must be unique

• The entity must have an identification or primary key

• Each relationship is described by a verb (phrase)