Homework 5
1、 领域建模
a. 阅读 Asg_RH 文档,按用例构建领域模型。
按 Task2 要求,请使用工具 UMLet,截图格式务必是 png 并控制尺寸 说明:请不要受 PCMEF 层次结构影响。你需要识别实体(E)和 中介实体(M,也称状态实体) 在单页面应用(如 vue)中,E 一般与数据库构建有关, M 一般与 store 模式 有关 在 java web 应用中,E 一般与数据库构建有关, M 一般与 session 有关
- task2
- answer
b. 数据库建模(E-R 模型)
-
按 Task 3 要求,给出系统的 E-R 模型(数据逻辑模型)
-
task3
- E-R
- 建模工具 PowerDesigner(简称PD) 或开源工具 OpenSystemArchitect
- 不负责的链接 http://www.cnblogs.com/mcgrady/archive/2013/05/25/3098588.html
- 导出 Mysql 物理数据库的脚本
/*==============================================================*/
/* DBMS name: MySQL 5.0 */
/* Created on: 2018/4/28 22:34:28 */
/*==============================================================*/
drop table if exists Bill;
drop table if exists Credit_Card;
drop table if exists Hotel;
drop table if exists Reservation;
drop table if exists Room;
drop table if exists Traveler;
/*==============================================================*/
/* Table: Bill */
/*==============================================================*/
create table Bill
(
Price double,
Email text,
Card_Number text,
Bill_Number text not null,
Reservation_Number text not null,
primary key (Bill_Number)
);
/*==============================================================*/
/* Table: Credit_Card */
/*==============================================================*/
create table Credit_Card
(
Card_Number text not null,
Owner text,
Saving double,
Security_Code text,
primary key (Card_Number)
);
/*==============================================================*/
/* Table: Hotel */
/*==============================================================*/
create table Hotel
(
Hotel_Name text not null,
City text,
Address text not null,
primary key (Hotel_Name, Address)
);
/*==============================================================*/
/* Table: Reservation */
/*==============================================================*/
create table Reservation
(
Room_Number text not null,
Check_In date not null,
Check_Out date not null,
Hotel_Name text not null,
Address text not null,
Adult_Count int,
Child_Count int,
Child_Age int,
Price double,
Traveler_Name text,
Reservation_Number text not null,
Bill_Number text not null,
primary key (Reservation_Number)
);
/*==============================================================*/
/* Table: Room */
/*==============================================================*/
create table Room
(
Room_Number text not null,
Hotel_Name text,
Address text,
Availability bool,
primary key (Room_Number)
);
/*==============================================================*/
/* Table: Traveler */
/*==============================================================*/
create table Traveler
(
Name text,
Email text not null,
Smoking bool,
primary key (Email)
);
alter table Bill add constraint FK_Reference_3 foreign key (Email)
references Traveler (Email) on delete restrict on update restrict;
alter table Bill add constraint FK_Reference_4 foreign key (Card_Number)
references Credit_Card (Card_Number) on delete restrict on update restrict;
alter table Bill add constraint FK_Reference_6 foreign key (Reservation_Number)
references Reservation (Reservation_Number) on delete restrict on update restrict;
alter table Reservation add constraint FK_Reference_1 foreign key (Room_Number)
references Room (Room_Number) on delete restrict on update restrict;
alter table Reservation add constraint FK_Reference_5 foreign key (Hotel_Name, Address)
references Hotel (Hotel_Name, Address) on delete restrict on update restrict;
alter table Reservation add constraint FK_Reference_6 foreign key (Bill_Number)
references Bill (Bill_Number) on delete restrict on update restrict;
alter table Room add constraint FK_Reference_2 foreign key (Hotel_Name, Address)
references Hotel (Hotel_Name, Address) on delete restrict on update restrict;
- 简单叙说 数据库逻辑模型 与 领域模型 的异同
都常用于系统分析与设计,特别是涉及数据表的设计。不同之处在于,领域模型偏向概念,设计者无需考虑系统内数据的具体存放方式,而更需考虑如何结合系统用例以满足用户需求。数据库逻辑模型则更适用于软件开发者,它要求对数据库有较具体的设计,比领域模型考虑更细致。