2009.09.08 - slide 1is 257 – fall 2009 database design: conceptual model (cont.) and uml...

66
IS 257 – Fall 2009 2009.09.08 - SLIDE 1 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257: Database Management

Post on 20-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 1

Database Design: Conceptual Model (cont.) and UML

University of California, Berkeley

School of Information

IS 257: Database Management

Page 2: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 2

Lecture Outline

• Assignment 2 – Personal Database Conceptual Design

• Review (and continuation)– Database Design, Conceptual Model

• Object-Oriented Modeling

Page 3: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 3

Assignment 2

• Due Thursday Sept. 24• Personal Database Project Design

• The following information should be turned in for the preliminary design of your personal database project.

1. A written description of the data you will be using for the database, and what uses you might expect the database to have. (2-4 pages)

2. A preliminary data dictionary for the entities and attributes and format of the data elements of the database. You should have at least 5 entities with some logical connections between them. The data dictionary consists of all of the attributes that you have identified for each entity, along with indication of whether the attribute is a primary key (or part of a primary key), and what format the data will be (e.g.: text, decimal number, integer, etc.)

3. Produce an entity-relationship diagram of the database OR a UML diagram.

• These will be preliminary design specifications, so do not feel that you must follow everything that you describe here in the final database design.

• The report should be printed.

Page 4: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 4

Discussion of Projects

• How many have decided on what they want to do for their project?

• How many have an idea, but would like to work in a group?

Page 5: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 5

Lecture Outline

• Review (and continuation)– Database Design, Conceptual Model

• Object-Oriented Modeling in UML

Page 6: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 6

Database Design Process

ConceptualModel

LogicalModel

External Model

Conceptual requirements

Conceptual requirements

Conceptual requirements

Conceptual requirements

Application 1

Application 1

Application 2 Application 3 Application 4

Application 2

Application 3

Application 4

External Model

External Model

External Model

Internal Model

Page 7: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 7

Developing a Conceptual Model

• Overall view of the database that integrates all the needed information discovered during the requirements analysis.

• Elements of the Conceptual Model are represented by diagrams, Entity-Relationship or ER Diagrams, that show the meanings and relationships of those elements independent of any particular database systems or implementation details.

• Can also be represented using other modeling tools (such as UML – more later)

Page 8: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 8

Developing a Conceptual Model

• Building the Conceptual Model for the Diveshop database

Page 9: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 9

Developing a Conceptual Model

• We will look at a small business -- a diveshop that offers diving adventure vacations

• Assume that we have done interviews with the business and found out the following information about the forms used and types of information kept in files and used for business operations...

Page 10: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 10

Primary Business Operations

• The shop takes orders from customers for dive vacations.

• It ships information about the dive vacation to the customers.

• It rents diving equipment for the divers going on the trips (these may include additional people other than the customer)

• It bills the customer for the vacation and for equipment rental or sales.

Page 11: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 11

Business Operations (cont.)

• It arranges sub-trips to particular dive sites at the primary location– NOTE: This needs expanding – charter boats,

divemasters, local dive companies

• It provides information about the features of various sites to help customers choose their destinations.– Features include sea life found at the location

and shipwrecks

Page 12: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 12

Business Operations (cont.)

• Each dive order (or sale or trip) is on an invoice to one customer.– Invoices contain:

• Line items for each type of equipment ordered,• Total amount due for the invoice,• Customer information:

– Name, address, phone, credit card info.• Note: could be expanded with particular charter dates

and time, dive boats, etc.• Information must be kept on inventory of dive

equipment.• There are multiple types of dive equipment:

– The prices charged for sale or rental are maintained.

Page 13: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 13

Business Operations (cont.)

• Destination information includes:– Name of the destination– information about the location (accomodations,

night life, travel cost, average temperatures for different times of the year

• Destinations have associated dive sites.• Dive Sites have associated features

– Sea life – Shipwrecks– Note: could be expanded to include the boats,

etc that go to specific sites

Page 14: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 14

Business Operations (cont.)

• One record is kept for each order by a customer and will include the method of payment, total price, and location information. (I.e. Customers may have multiple orders)

• The company needs to know how an order is to be shipped.

• The shop has to keep track of what equipment is on-hand and when replacements or additional equipment is needed

Page 15: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 15

Entities

• Customer

• Dive Order

• Line item

• Shipping information

• Dive Equipment/ Stock/Inventory

• Dive Locations

• Dive Sites

• Sea Life

• Shipwrecks

Page 16: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 16

Diveshop Entities: DIVECUST

Name

Customer no

Street

State/ProvCityZIP/Postal

Code

Country

First Contact

PhoneDiveCust

Page 17: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 17

Diveshop Entities: DIVEORDS

CustomerNo

Order no

SaleDate

ShipVia

DestinationCCExpDate

CCNumber

PaymentMethodDiveOrds

No ofPeople

VacationCost

ReturnDate

DepartDate

Page 18: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 18

Diveshop Entities: DIVEITEM

Item no

Order no

Rental/Sale

Qty

Line Note

DiveItem

Page 19: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 19

Diveshop Entities: SHIPVIA

Ship Via

ShipCost

ShipVia

Page 20: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 20

Diveshop Entities: DIVESTOK

Description

Item No

EquipmentClass

ReorderPoint

On Hand Cost

SalePrice

DiveStokRentalPrice

Page 21: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 21

Diveshop Entities: DEST

Destinationname

Destination no

Avg Temp (F)

SpringTemp (F) Avg

Temp (C)Summer

Temp (C)

SummerTemp (F)

TravelCost

WinterTemp (C)

FallTemp (F)

FallTemp (C)Dest

WinterTemp (F)

Accommodations

Body ofWater

NightLife

SpringTemp (C)

Page 22: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 22

Diveshop Entities: SITES

Destinationno

Site no

Site Name

SiteNotes

SiteHighlight

DistanceFrom Town (M)

DistanceFrom Town (Km)

Skill Level

Visibility(ft)

Depth (m)

Depth (ft)Sites

Visibility (m)

Current

Page 23: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 23

Diveshop Entities: BIOSITE

SpeciesNo

SiteNo

BioSite

Page 24: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 24

Diveshop Entities: BIOLIFE

Category

Species no

CommonName

Length(cm)

SpeciesName

Length(in)

Notesexternal

GraphicexternalBioLife

Page 25: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 25

Diveshop Entities: SHIPWRCK

Site no

Ship Name

Category

InterestType Tonnage

Length (ft)

Beam(m)

Beam(ft)

Length(m)Shipwrck

Cause

Commentsexternal

DateSunk

Passengers/Crew

Graphicexternal

Survivors

Condition

Page 26: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 26

Functional areas

• Ordering

• Inventory

• Supplies

• Shipping

• Billing

• Location/Site Selection– We will concentrate on Ordering and

Location/Site Selection (these are joined tasks)

Page 27: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 27

Ordering

Orders(DIVORDS)

Customer(DIVECUST)

Customers place OrdersEach Order needs Customer information

Page 28: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 28

Ordering

DiveOrdsOrdersDiveCust

Customer No ship

ShipVia

Order No

Ship Via

DiveItem Repeatingattribute

Customer No

Page 29: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 29

Ordering Normalization

DiveCust Orders

Customer No

DiveOrds

Ship

ShipVia

Order No

Ship Via

DiveItemContains

Item No

QtyOrder No

Customer No

Rental/sale

Page 30: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 30

Details of DiveItem

DiveStokSuppliesSupplier

Company# Has

DiveItem

Item No

Item No

On Hand

Sale Price

Order No

m n

We’re ignoring this part...

Page 31: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 31

Ordering: Full ER

CustomerNo

ShipVia

DestShipVia

DiveStok

DiveItem

DiveOrds

DiveCust

CustomerNo

ShipVia

OrderNo

OrderNo

ItemNo

ItemNo

DestinationName

Destination

Destinationno 1

1

1

1

1n

n

n

n

n

Page 32: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 32

Location/Site Selection

DestGoing

to?DiveOrds

DestinationNo

DestinationName

Destination

Page 33: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 33

Destination/ Sites

Dest

Sites

DiveOrds

CustomerNo

OrderNo

DestinationName

DestinationSite No

Destinationno

Destinationno

1

1

n

n

Page 34: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 34

Sites and Sea Life 1

BioLife

Sites

Site NoDestination

no

Multiple occurrencesof sea life...

Page 35: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 35

Diveshop ER diagram: BioSite

SpeciesNo

SiteNo

BioSite

Page 36: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 36

Sites and Sea Life 2

Sites

BioSite

BioLifeSpeciesNo

Site No

Site No

Destinationno

SpeciesNo

1

1

n

n

Page 37: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 37

Sites and Shipwrecks

Sites

ShipWrck

Site NoDestination

no

Site No

1/n

1

Page 38: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 38

DiveShop ER DiagramCustomer

No

ShipVia

Dest

Sites

BioSite

ShipVia

ShipWrck

BioLife DiveStok

DiveItem

DiveOrds

DiveCust

CustomerNo

ShipVia

OrderNo

OrderNo

ItemNo

ItemNo

DestinationName

Destination

SpeciesNo

Site No

Destinationno

Site No

Destinationno

SpeciesNo

Site No

1

1

1

1

1

1

1/n

1

1n

n

n

n

n

n

n

n

1

Page 39: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 39

What must be calculated?

• Total price for equipment rental?

• Total price for equipment sale?

• Total price of an order?– Vacation price– Equipment (rental or sale)– Shipping

Page 40: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 40

What is Missing??

• Not really an “enterprise-wide” database– No personnel

• Sales people• Dive masters• Boat captains and crew• payroll

– No Local arrangements• Dive Boats

– Charter bookings?

• Hotels?

– Suppliers/Wholesalers for dive equipment• Orders for new/replacement equipment

– No history (only current or last order)

Page 41: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 41

Querying Access

• Assignment 1 requires some queries that are not immediately obvious in Access– Such as number 8

• must calculate the total cost for rental

• Pattern matching queries

• Demo

Page 42: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 42

Tools for ER (and UML) diagrams

• Microsoft Visio has a UML-like set of diagramming templates for databases

• For Macs OmniGraffle has UML or spreadsheet templates that can be used for ER diagrams

• More sophisticated (and open source) CASE tools are available such as:– DBDesigner (optimized for MySQL databases)– Toad (freeware version)

• Many other drawing packages have ERD available (sometimes as add-ons)

Page 43: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 43

Lecture Outline

• Review (and continuation)– Database Design, Conceptual Model

• Object-Oriented Modeling in UML

Page 44: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 44

Object-Oriented Modeling

• Becoming increasingly important as– Object-Oriented and Object-Relational DBMS

continue to proliferate– Databases become more complex and have

more complex relationships than are easily captured in ER or EER diagrams

• (Most UML examples based on McFadden, “Modern Database Management”, 5th edition)

Page 45: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 45

Object Benefits

• Encapsulate both data and behavior

• Object-oriented modeling methods can be used for both database design and process design– Real-World applications have more than just

the data in the database they also involve the processes, calculations, etc performed on that data to get real tasks done

– OOM can be used for more challenging and complex problems

Page 46: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 46

Unified Modeling Language (UML)

• Combined three competing methods

• Can be used for graphically depicting– Software designs and interaction– Database– Processes

Page 47: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 47

CLASS

• A class is a named description of a set of objects that share the same attributes, operations, relationships, and semantics. – An object is an instance of a class that encapsulates

state and behavior.• These objects can represent real-world things or conceptual

things.– An attribute is a named property of a class that

describes a range of values that instances of that class might hold.

– An operation is a named specification of a service that can be requested from any of a class's objects to affect behavior in some way or to return a value without affecting behavior

Page 48: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 48

UML Relationships

• An relationship is a connection between or among model elements.

• The UML defines four basic kinds of relationships: – Association– Dependency– Generalization– Realization

Page 49: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 49

UML Diagrams

• The UML defines nine types of diagrams: – activity diagram– class diagram

• Describes the data and some behavioral (operations) of a system

– collaboration diagram– component diagram– deployment diagram– object diagram– sequence diagram– statechart diagram– use case diagram

Page 50: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 50

Class Diagrams

• A class diagram is a diagram that shows a set of classes, interfaces, and/or collaborations and the relationships among these elements.

Page 51: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 51

UML Class Diagram

DIVEORDS

Order NoCustomer NoSale DateShipviaPaymentMethodCCNumberNo of PeopleDepart DateReturn DateDestinationVacation Cost

CalcTotalInvoice()CalcEquipment()

Class Name

List of Attributes

List of operations

Page 52: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 52

Object Diagrams

307:DIVORDS

Order No = 307Customer No = 1480Sale Date = 9/1/99Ship Via = UPSPaymentMethod = VisaCCNumber = 12345 678 90CCExpDate = 1/1/01No of People = 2Depart Date = 11/8/00Return Date = 11/15/00Destination = FijiVacation Cost = 10000

Page 53: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 53

Differences from Entities in ER• Entities can be represented by Class

diagrams

• But Classes of objects also have additional operations associated with them

Page 54: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 54

Operations

• Three basic types for database– Constructor– Query– Update

Page 55: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 55

Associations

• An association is a relationship that describes a set of links between or among objects.

• An association can have a name that describes the nature of this relationship. You can put a triangle next to this name to indicate the direction in which the name should be read.

Page 56: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 56

Associations

• An association contains an ordered list of association ends. – An association with exactly two association

ends is called a binary association– An association with more than two ends is

called an n-ary association.

Page 57: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 57

Associations: Unary relationships

PersonIs-married-to

0..1

0..1

Employeemanages

*

0..1

manager

Page 58: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 58

Associations: Binary Relationship

EmployeeParkingPlace

One-to-one

Is-assigned0..1 0..1

ProductLine

Product

One-to-many

contains1 *

Student Course

Many-to-many

Registers-for* *

Page 59: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 59

Associations: Ternary Relationships

Vendor Warehouse* *Supplies

Part

*

Page 60: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 60

Association Classes

Student CourseRegisters-for

* *

Registration________________TermGrade________________CheckEligibility()

Computer Account_________________

acctIDPassword

ServerSpace* 0..1issues

Page 61: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 61

Derived Attributes, Associations, and Roles

Student_________

namessn

dateOfBirth/age

Course Offering

____________term

sectiontime

location

Registers-for

* 1

Course ____________

crseCodecrseTitlecreditHrs

* *

Scheduled-for

{age = currentDate – dateOfBirth}

* *

/Takes

/participant

Derivedattribute

Derived role

Derived association

Page 62: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 62

GeneralizationEmployee

____________empName

empNumberaddress

dateHired____________

printLabel()

Hourly Employee_______________

HourlyRate_______________computeWages()

Salaried Employee_______________

Annual Salstockoption

_______________Contributepension()

Consultant_______________contractNumber

billingRate_______________

computeFees()

Page 63: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 63

Other Diagramming methods

• SOM (Semantic Object Model)

• Object Definition Language (ODL)– Not really diagramming

• Access relationships display

• Hybrids

Page 64: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 64

Application of SOM to Diveshop

DIVECUST

Address Street City StateProvince ZIPPostalCode CountryPhoneFirstContact

Name

DIVEORDS

1.1

1.1

1.1

1.1

1.1

1.1

1.1

1.1

1.N

1.1

Page 65: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 65

DIVEORDS

DIVEORDSid OrderNoSaleDate

SHIPVIA

DESTINATION

DIVEITEMPaymentMethodCCNumberCCExpDateNoOfPeopleDepartDateReturnDateVacationCost

DIVECUST

Page 66: 2009.09.08 - SLIDE 1IS 257 – Fall 2009 Database Design: Conceptual Model (cont.) and UML University of California, Berkeley School of Information IS 257:

IS 257 – Fall 2009 2009.09.08 - SLIDE 66

Next Time

• Logical Model

• Normalization and the relational model

• Implementing DBs in Access