UML and The Logical Model University of California Berkeley School of Information IS 257 Database Management IS 257 Fall 2015 Lecture Outline Review and continuation Database Design Conceptual Model ID: 760352
Download Presentation The PPT/PDF document "IS 257 – Fall 2015 Database Design: Co..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
IS 257 – Fall 2015
Database Design: Conceptual Model (cont.), UML andThe Logical Model
University of California, Berkeley
School of Information
IS 257: Database Management
Slide2IS 257 – Fall 2015
Lecture Outline
Review (and continuation)
Database Design, Conceptual Model
Assignment
2 – Personal Database Conceptual Design
Object-Oriented Modeling in
UML
The Logical Model
Slide3IS 257 – Fall 2015
Lecture Outline
Review (and continuation)
Database Design, Conceptual Model
Assignment
2 – Personal Database Conceptual Design
Object-Oriented Modeling in
UML
The Logical Model
Slide4IS 257 – Fall 2015
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
Slide5IS 257 – Fall 2015
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)
Slide6IS 257 – Fall 2015
Developing a Conceptual Model
Building the Conceptual Model for the Diveshop database
Slide7IS 257 – Fall 2015
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...
Slide8IS 257 – Fall 2015
Entities
CustomerDive OrderLine itemShipping informationDive Equipment/ Stock/InventoryDive Locations
Dive Sites
Sea Life
Shipwrecks
Slide9IS 257 – Fall 2015
Diveshop Entities: DIVECUST
Name
Customer no
Street
State/Prov
City
ZIP/Postal
Code
Country
First Contact
Phone
DiveCust
Slide10IS 257 – Fall 2015
Ordering: Full ER
CustomerNo
ShipVia
Dest
ShipVia
DiveStok
DiveItem
DiveOrds
DiveCust
Customer
No
ShipVia
Order
No
Order
No
Item
No
Item
No
Destination
Name
Destination
Destination
no
1
1
1
1
1
n
n
n
n
n
Slide11IS 257 – Fall 2015
Location/Site Selection
Dest
Going to?
DiveOrds
Destination
No
Destination
Name
Destination
Slide12IS 257 – Fall 2015
Destination/ Sites
Dest
Sites
DiveOrds
Customer
No
Order
No
Destination
Name
Destination
Site No
Destination
no
Destination
no
1
1
n
n
Slide13IS 257 – Fall 2015
Sites and Sea Life 2
Sites
BioSite
BioLife
Species
No
Site No
Site No
Destination
no
Species
No
1
1
n
n
Slide14IS 257 – Fall 2015
Sites and Shipwrecks
Sites
ShipWrck
Site No
Destination
no
Site No
1/n
1
Slide15IS 257 – Fall 2015
DiveShop ER Diagram
Customer
No
ShipVia
Dest
Sites
BioSite
ShipVia
ShipWrck
BioLife
DiveStok
DiveItem
DiveOrds
DiveCust
Customer
No
ShipVia
Order
No
Order
No
Item
No
Item
No
Destination
Name
Destination
Species
No
Site No
Destination
no
Site No
Destination
no
Species
No
Site No
1
1
1
1
1
1
1/n
1
1
n
n
n
n
n
n
n
n
1
Slide16IS 257 – Fall 2015
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
Slide17IS 257 – Fall 2015
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)
Slide18IS 257 – Fall 2015
Lecture Outline
Review (and continuation)
Database Design, Conceptual Model
Assignment
2 – Personal Database Conceptual Design
Object-Oriented
Modeling
The Logical Model
Slide19IS 257 – Fall 2015
Assignment 2
Due
Friday March 9th
Personal Database Project
Design
Note: decide groups by February 23th
The following information should be turned in for the preliminary design of your personal database project.
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)
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.)
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 in PDF format
Slide20IS 257 – Fall 2015
Discussion of Projects
Anyone have any ideas for projects for this class?
Slide21IS 257 – Fall 2015
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:
MySQLWorkbench
(for MySQL only)
DBDesigner
(optimized for MySQL databases)
Toad
(freeware version)
Many other drawing packages have ERD available (sometimes as add-ons)
Slide22IS 257 – Fall 2015
Lecture Outline
Review (and continuation)
Database Design, Conceptual Model
Assignment
2 – Personal Database Conceptual Design
Object-Oriented Modeling in
UML
The Logical Model
Slide23IS 257 – Fall 2015
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
”
, 5
th
edition)
Slide24IS 257 – Fall 2015
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
Slide25IS 257 – Fall 2015
Unified Modeling Language (UML)
Combined three competing methods
Can be used for graphically depicting
Software designs and interaction
Database
Processes
Slide26IS 257 – Fall 2015
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
Slide27IS 257 – Fall 2015
UML Relationships
An relationship is a connection between or among model elements.
The UML defines four basic kinds of relationships:
Association
Dependency
Generalization
Realization
Slide28IS 257 – Fall 2015
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
Slide29IS 257 – Fall 2015
Class Diagrams
A class diagram is a diagram that shows a set of classes, interfaces, and/or collaborations and the relationships among these elements.
Slide30IS 257 – Fall 2015
UML Class Diagram
DIVEORDS
Order NoCustomer NoSale DateShipviaPaymentMethodCCNumberNo of PeopleDepart DateReturn DateDestinationVacation CostCalcTotalInvoice()CalcEquipment()
Class Name
List of Attributes
List of operations
Slide31IS 257 – Fall 2015
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
Slide32IS 257 – Fall 2015
Differences from Entities in ER
Entities can be represented by Class diagrams
But Classes of objects also have additional operations associated with them
Slide33IS 257 – Fall 2015
Operations
Three basic types for database
Constructor
Query
Update
Slide34IS 257 – Fall 2015
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.
Slide35IS 257 – Fall 2015
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.
Slide36IS 257 – Fall 2015
Associations: Unary relationships
Person
Is-married-to
0..1
0..1
Employee
manages
*
0..1
manager
Slide37IS 257 – Fall 2015
Associations: Binary Relationship
Employee
Parking
Place
One-to-one
Is-assigned
0..1
0..1
Product
Line
Product
One-to-many
contains
1
*
Student
Course
Many-to-many
Registers-for
*
*
Slide38IS 257 – Fall 2015
Associations: Ternary Relationships
Vendor
Warehouse
*
*
Supplies
Part
*
Slide39IS 257 – Fall 2015
Association Classes
Student
Course
Registers-for
*
*
Registration
________________
TermGrade________________CheckEligibility()
Computer Account
_________________acctIDPasswordServerSpace
*
0..1
issues
Slide40IS 257 – Fall 2015
Derived Attributes, Associations, and Roles
Student_________namessndateOfBirth/age
Course Offering____________termsectiontimelocation
Registers-for
*
1
Course
____________crseCodecrseTitlecreditHrs
*
*
Scheduled-for
{age = currentDate – dateOfBirth}
*
*
/Takes
/participant
Derived
attribute
Derived role
Derived association
Slide41IS 257 – Fall 2015
Generalization
Employee
____________empNameempNumberaddressdateHired____________printLabel()
Hourly Employee_______________HourlyRate_______________computeWages()
Salaried Employee_______________Annual Salstockoption_______________Contributepension()
Consultant_______________contractNumberbillingRate_______________computeFees()
Slide42IS 257 – Fall 2015
Other Diagramming methods
SOM (Semantic Object Model)
Object Definition Language (ODL)
Not really diagramming
Access relationships display
Hybrids
Slide43IS 257 – Fall 2015
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
Slide44IS 257 – Fall 2015
DIVEORDS
DIVEORDSid OrderNoSaleDate
SHIPVIA
DESTINATION
DIVEITEM
PaymentMethodCCNumberCCExpDateNoOfPeopleDepartDateReturnDateVacationCost
DIVECUST
Slide45IS 257 – Fall 2015
Lecture Outline
Review (and continuation)
Database Design, Conceptual Model
Assignment
2 – Personal Database Conceptual Design
Object-Oriented Modeling in
UML
The Logical Model
Slide46IS 257 – Fall 2015
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
Slide47IS 257 – Fall 2015
Logical Model: Mapping to a Relational Model
Each
entity
in the ER Diagram becomes a relation.
A properly
normalized
ER diagram will indicate where intersection relations for
many-to-many
mappings are needed.
Relationships are indicated by common columns (or domains) in tables that are related.
We will examine the tables for the Diveshop derived from the ER diagram
Slide48IS 257 – Fall 2015
DiveShop ER Diagram
Customer
No
ShipVia
Dest
Sites
BioSite
ShipVia
ShipWrck
BioLife
DiveStok
DiveItem
DiveOrds
DiveCust
Customer
No
ShipVia
Order
No
Order
No
Item
No
Item
No
Destination
Name
Destination
Species
No
Site No
Destination
no
Site No
Destination
no
Species
No
Site No
1
1
1
1
1
1
1/n
1
1
n
n
n
n
n
n
n
n
1
Slide49IS 257 – Fall 2015
Customer = DIVECUST
Slide50IS 257 – Fall 2015
Dive Order = DIVEORDS
Slide51IS 257 – Fall 2015
Line item = DIVEITEM
Slide52IS 257 – Fall 2015
Shipping information = SHIPVIA
Slide53IS 257 – Fall 2015
Dive Equipment Stock= DIVESTOK
Slide54IS 257 – Fall 2015
Dive Locations = DEST
Slide55IS 257 – Fall 2015
Dive Sites = SITE
Slide56IS 257 – Fall 2015
Sea Life = BIOLIFE
Slide57IS 257 – Fall 2015
BIOSITE -- linking relation
Slide58IS 257 – Fall 2015
Shipwrecks = SHIPWRK
Slide59IS 257 – Fall 2015
Mapping to Other Models
Hierarchical
Need to make decisions about access paths
Network
Need to pre-specify all of the links and sets
Object-Oriented
What are the objects, datatypes, their methods and the access points for them
Object-Relational
Same as relational, but what new datatypes might be needed or useful (more on OR later)
Slide60IS 257 – Fall 2015
Next Time
Normalization
and the relational model
Implementing DBs in MySQL