Semantic Object Modeling: Tutorial [Class 9.01] Overview

advertisement
Class 09.01
Semantic Object Modeling:
Tutorial [Class 9.01]
TableDesigner® Ver. 1.1
Overview
• Homework #6 A. and B. Bonus
– TableDesigner; Semantic Object Models (SOM)
• Starting TableDesigner
– Creating Domains and Objects
• Semantic Object Links (SOL)
– Relationships and Cardinalities
• Printing Options: SOM or Object Report
• SQL Server Model Creation
– Model Locations
• ACCESS database Model Creation
– Touchups: Define Primary Keys
1
Homework #6 Links
Resources on Website:
• Homework #6.B Assignment
– For 10 point BONUS
• Becker’s 4660 Website Links:
– Time 2008-2014 Table (.mdb file)
– SOM Appendix E;
– SOM Tutorial
– TableDesigner® Ver. 1.1
• DB Design tool (FREE software)
Exercise #6.B [10 pt. TEAM Bonus]
Due: Sec1:
Sec2:
Points: 10 BONUS points [TEAM PROJECT]
1. TURN in a separate Team Evaluation Form for each member (or You may use one
form for the entire project, if you turn in both parts A & B)
2. Pratt & Adamski: Premiere Products [PP] ONLY!
3. (10 BONUS POINTS): Perform a Semantic Object Database Design on Premiere
Products ONLY.
4. Use TableDesigner Software & Chapter Handout. See 4660 course website for free
examination copy of textbook chapter and software.
5. Assignment must have cover sheet, table of contents, index tabs. Use SAME 3-hole
punch notebook (1/2” or smaller) as for #6.A. Put your TEAM’s name [No.] on the
SPINE-- It is worth 1 POINT!
TAB 1:
–
Create the Semantic Object Model (SOM) for PP, using TableDesigner.
• Print SOM Diagram for PP (See Print Options in File drop down menu)
• Print Semantic Object Report for PP (See Print Option in File drop down menu)
TAB 2:
–
Generate the SQL Code needed to create the tables for both the PP DB.
TAB 3:
–
Generate the ACCESS ERD for PP.
•
•
Arrange the entities to minimize cross-over lines.
Adjust the primary and foreign keys to conform with our original database models.
2
Starting TableDesigner
• Open TableDesigner
from COBA Course
menu (BCIS 4620
Applications)
• Select :File/New
Model
• Try Browse for
available options
• Select :Generic
3
Expand all Windows
Model Workspace
Predefined Domains
1. Objects
2. Data Items
3. Groups
:Create/Domains (F3)
4
Create Semantic Objects
:Windows/Arrange Workspace
5
Add Attributes to Objects
1. Drag & drop Primary Key (**) text type
2. Open properties menu. Right click.
Customize Attributes
1.
2.
3.
4.
Change name
Adjust cardinalities
Data Length
Domain type
6
Create New Group ID
• Build Group ClassID
– Concatenated key
– Select Data Items for
components of key
– Rename existing items
or create new items
Customized ClassID
7
Standalone Simple Objects
Semantic Object Links (SOL)
1. Drag & drop each Semantic Object to its related object(s)
2. Note: SOL appears in both objects simultaneous
8
Adjust Cardinalities of Each SOL
Item Properties dialog box
Many-to-many relationship
1. Set minimum required
2. Set maximum required
Cardinalities Adjusted
Change Data Item Names in accordance with
User preferences
9
Print SOM Model & Objects
Drop down File Menu:
Print options (Ctrl-P)
Print Model Information:
Objects
Semantic Object Report
Page 1: College Object
Page 2: Department
Object
1 Page for each SO; Suggest. Print 2 per page when possible
10
Save SOM Model Prior to
Generating ACCESS Database (.mdb)
• :Save/”name”
• Select directory
location
• UNTCOBA.apm
• :File/Print… [SOM
Diagram]
• :File/Print Model
Information/Objects…
:Options/File Locations…
11
Create SQLGen.txt file
• :Create/SQL Text
Only…
• Change ODBC Driver
option to “SQL
Server” database
• Select “Generate”
when prompted to
save model again
• Next screen VERY
IMPORTANT!
• See next page
SQLGen.txt Code Generation
------------------< SQL Statements >----------------------- Schema Name:
-- Time
: Wed Mar 30 22:13:11 200X
SET ANSI_WARNINGS OFF;
CREATE TABLE COLLEGE(
CollegeName varchar(15) NOT NULL,
Address_Street varchar(30) NULL,
Address_City varchar(35) NULL,
Address_State varchar(2) NULL,
Address_Zip varchar(5) NULL);
Partial file listing
ALTER TABLE COLLEGE
ADD
CONSTRAINT PRM5660 PRIMARY KEY ( CollegeName )
;
CREATE TABLE DEPARTMENT(
DepartmentName varchar(15) NOT NULL,
MailingAddress_Street varchar(30) NULL,
MailingAddress_City varchar(35) NULL,
MailingAddress_State varchar(2) NULL,
MailingAddress_Zip varchar(5) NULL,
CatalogAddress_BuildingName varchar(30) NULL,
CatalogAddress_RoomNumber varchar(5) NULL,
COLLEGE_CollegeName_FK varchar(15) NULL);
12
SQLGen.txt Code Generation
CREATE TABLE CLASSES(
ID_ int NOT NULL,
ClassID_ClassCode varchar(8) NULL,
ClassID_SectionID tinyint NULL,
ClassID_SemesterCode datetime NULL,
Name varchar(25) NULL,
Description text NULL,
DEPARTMENT_DepartmentName_FK varchar(15) NULL,
PROFESSOR_ProfessorID_FK int NULL);
Partial file listing
Foreign Key
Classes:Department
ALTER TABLE CLASSES
ADD
CONSTRAINT PRM5658 PRIMARY KEY ( ID_ )
;
CREATE INDEX IDX5668 ON CLASSES(ClassID_ClassCode);
CREATE INDEX IDX5693 ON CLASSES(Name);
CREATE TABLE STUDENT_CLASSES_X(
STUDENT_StudentID_FK int NOT NULL,
CLASSES_ID_FK int NOT NULL);
Intersection Table
Student:Classes
ALTER TABLE STUDENT_CLASSES_X
ADD
CONSTRAINT PRM5709 PRIMARY KEY ( STUDENT_StudentID_FK, CLASSES_ID_FK )
;
Next Create Access Database
• :Create/Database
(F2)
• Select “Yes” when
prompted to save
model again
• Next screen VERY
IMPORTANT!
• See next page
Note: When copying .apm file from
One physical PC directory to another,
save a new copy of the model WITHOUT
Database Model “attachments”
13
Make Sure All Settings are
Correct
Database settings
For ACCESS database
:Options/Default Database
Type
14
:Options/Default Database Type
Configure…/Modify…/OK
Reassigned to Flash Drive G:
15
UNTCOBA Access Database
• Look inside You Assigned DB directory for the
.mdb Access database file. OPEN!
Entity Relationship Diagram
16
Preliminary Database Design:
Touchups
• Customize Access Database
– Adjust Attribute Names
• Note: Attributes with MixedCaseNames will
generate names like Mixed_Case_Names
– Underscores will be inserted in front of Capital letters.
– Set Your own Primary Keys
• _ID keys added to all tables may be deleted or
redefined in TableDesigner
:Edit/Primary Key Settings
17
Most Keys Adjusted
Except Classes
Changing Primary Key in Class
18
Convert to Star Diagram(s)
• Identify Dimension
and Fact Tables
• Add Time
Dimension(s)
• Group metrics and
facts by time periods
–
–
–
–
Yearly
Monthly
Weekly
Daily, etc.
• Modify ERD as
required
• Reassess primary
and foreign key
relationships
• Populate tables with
records
• Compute and store
subtotals
Star Diagram: Conformed Tables
Dimension & Fact “columns”
Time/Date
Rep
Invoice Facts
Customer
[Order No.]
Territory
Payment Facts
Part
[Invoice No.]
Vendor
Order Facts
Invoice-Order
-Payments
Key Table
Vendor Part
[Order No.]
[Logical Table]
19
Summary
• SOM Database Design Tool
– Build SO Model
– Create SQL CREATEs
– Create ACCESS database
– Modify ACCESS Relationship Diagram
• Convert to Star Schema
– Use ACCESS database as a starting point
Homework #6
• Additional below
20
Homework #6.A [TEAM PROJECT]
Due: Sec1: Oct 28 (Tues); Sec2: Oct 30 (Thurs);
Points: 20 points (Bonus 10 points)
Pratt & Adamski: Premiere Products [PP] and Henry Books [HB] Databases
•
•
1.
2.
3.
4.
5.
6.
Use 3-hole punch notebook (1/2” or smaller). Assignments must have cover
sheet, table of contents, index tabs. Put your name on the spine of the notebook.
Use tabs for each section of the PP and HB data warehouses. 5 Tabs req.
You may use the Star Diagrams from Homework #5 as the basis for this
assignment; or you may start from the TPS databases. All tables MUST be
completely loaded with required data. You must use the TIME table on my
website (for 2008-2014). Print only the Last Page of the TIME table. Use the
Time_Key as the Primary Key and replace the OrderDate as the Foreign Key in
the Fact Table with the appropriate value for the Time_Key.
Turn in copies of the SQL code used to load data into the Star Diagrams
(especially the Fact Table). Also, include a copy of the Index Pane with
appropriate indexes for each all Fact & Dimension Tables.
Turn in printouts of the data in each table (Table View/Datasheet View/Index
Views) in the Data Warehouse. Use portrait or landscape mode as appropriate.
Turn-in printouts of the ACCESS Relationship/Star diagrams (ERDs) for both
databases. BONUS (2 pts @): Turn in ERDPlus version TOO!
Turn in the relation lists for each database as in Homework #5. There may
be some changes. Specify the normality of each table.
(6 BONUS POINTS): ETL new data for the State of Florida (PROVIDED)
TURN in Team Evaluation Form for each member.
TIP: Make a backup copy of the Premiere Products and Henry Books databases before starting this
assignment.
Exercise #6.B [10 pt. TEAM Bonus]
Due: Sec1: Oct 28 (Tues); Sec2: Oct 30 (Thurs)
Points: 10 BONUS points [TEAM PROJECT]
1. TURN in a separate Team Evaluation Form for each member (or You may use one
form for the entire project, if you turn in both parts A & B)
2. Pratt & Adamski: Premiere Products [PP] ONLY!
3. (10 BONUS POINTS): Perform a Semantic Object Database Design on Premiere
Products ONLY.
4. Use TableDesigner Software & Chapter Handout. See 4660 course website for free
examination copy of textbook chapter and software.
5. Assignment must have cover sheet, table of contents, index tabs. Use SAME 3-hole
punch notebook (1/2” or smaller) as for #6.A. Put your TEAM’s name [No.] on the
SPINE-- It is worth 1 POINT!
TAB 1:
–
Create the Semantic Object Model (SOM) for PP, using TableDesigner.
• Print SOM Diagram for PP (See Print Options in File drop down menu)
• Print Semantic Object Report for PP (See Print Option in File drop down menu)
TAB 2:
–
Generate the SQL Code needed to create the tables for both the PP DB.
TAB 3:
–
Generate the ACCESS ERD for PP.
•
•
Arrange the entities to minimize cross-over lines.
Adjust the primary and foreign keys to conform with our original database models.
21
BCIS 4660 - Homework #6.A
22
TIME Table (Last Page)
Note: Examine 31-Dec-14
Required:
1. Team no. & Assignment
Info.
2. All team members
names (alphabetical
order).
3. Effort score (0%-100%);
Must sum to 100%.
4. Quality Score (A, B, C,
+, -, etc.).
5. Team Leading Rating
(1-5); Asterisk (*) by
team leader’s name.
6. Comments, if any
scores are NOT equal.
7. Your SIGNATURE!!
Your Name
Today’s date
23
Dr B’s Completed Version; Private View
My Eyes ONLY
24
Exercise #7 [GROUP PROJECT]
Due: Nov 9
Points: 40 points
Pratt & Adamski: Premier Products Star Diagram
Assignments must have cover sheet, table of contents, index tabs. Use 3-hole punch notebook (1/2”or
smaller). Put your Team Name (ID) on the spine of the notebook.
Use of ACCESS is REQUIRED for this assignment.
•
•
Perform a new Database Design for Premier Products
TAB 1: Revise your Design for the Data Warehouse using a Star-type diagram (note: may need
more than one “star”). Be sure to include a meaningful Time dimension table.
–
–
–
–
–
Create a NEW Access database .mdb file [PPDW07_TeamXX.mdb; note: XX = 01, 02, etc.]
• Turn in ACCESS ERD of revised Star Diagram with data loaded [Tab 2 below]
Load Original Premier Product data into your Star Diagram. Make sure all field types agree with original case
specifications. This is critical.
Make sure all date types in the OrderDetail Fact Table are the same as in the original case.
Use the TIME table that I will place on the Course website.
Relation Listing. On separate page, clearly identify: All relations, i.e., Fact tables, dimension tables, primary
keys, foreign keys, alternate keys, etc. Use relational notation from Pratt & Adamski. E.g.:
•
•
CUSTOMER[CustomerNum, CustomerName, …, RepNum]
TAB 2: Generate data for each of the following tables:
–
–
–
–
–
For your assigned territory: Create GOOD data for the following tables with at least as many new records as
indicated: Rep (10 records); Customer (40 records); Part (25 records); Orders (30; 10 in 2008, 10 in 2009, 10
in 2010); OrderDetail(60, at least one line for every order)
Make sure that data types agree with case requirements
Print each table with data.
Turn in .mdb file with STAR model (3.5” floppy, CD, or equivalent), or email to instructor: becker@unt.edu
• COMPRESS the PPDW07_TeamXX.mdb file before Emailing.
Note: Dates must fall between 1/1/2008 and 12/31/2010. Change any Current dates in the case to conform to
this standard (for example, if a date currently is NOT 2010, change it to 2010.
50
25
Territory Assignments
Team
Territory
PartNo
RepNo
OrdNo
CustNo State
1
NW
HW, C
90
10000
0100
WA
2
NW
HW, D
80
20000
0200
OR
3
SW
HW, F
70
30000
0300
AZ
4
SW
SG, A
60
40000
0400
NM
5
MW
SG, B
50
50000
0500
MO
6
SE
AP, G
40
60000
0600
FL
7
NE
AP, H
30
70000
0700
NY
8
NE
AP, K
20
80000
0800
ME
9
SW
SG, J
10
90000
0900
OK
10
SE
SG, K
100
100000 1000
LA
Territory Assignments
Team
Territory
PartNo
RepNo
OrdNo
11
MW
HW, L
110
110000 1100
NE
12
NW
HW, M
200
120000 1200
ID
13
SW
HW, N
190
130000 1300
NV
14
SW
SG, P
180
140000 1400
TX
15
MW
SG, R
170
150000 1500
KS
16
SE
AP, S
160
160000 1600
AL
17
NE
AP, T
150
170000 1700
NJ
18
NE
AP, U
140
180000 1800
MA
19
SW
SG, V
130
190000 1900
CO
20
SE
SG, W
120
200000 2000
MS
CustNo State
26
53
Premier Products Star Diagram
Territory
27
Modifications
• Add Territory table
– TerritoryCode: NE, NW, SW, SE, MW
– TerritoryName: Northeast, etc.
• Add TerritoryCode to OrderDetail
Part Table
28
Customer Table
Rep Table
29
OrderDetail Table
TIME Table
30
31
Download