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

Post on 12-Jan-2016

213 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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

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

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)

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

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)

An Example-- A Preliminary Entity-Relationship Model

An Example-- A Refined Entity-Relationship Diagram

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

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)

• 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

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

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

Symbol:

Weak Entity

EMPLOYEE SPOUSE

ERD - Extended Concepts

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)

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

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

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

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

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

More Unary Relationship!

Course

has a prerequisite

is a prerequisite of

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

More Unary Relationship!(A complete graph)

Course

has a prerequisite

is a prerequisite of

Why? Can you explain the above diagram?

Ternary Relationship

A relationship that simultaneously involves 3 entities!

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)

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)

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

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)

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

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)

top related