系统分析与设计第四次作业
程序员文章站
2022-05-07 23:02:08
...
个人作业
领域建模
- a. 阅读 Asg_RH 文档,按用例构建领域模型。
- 按 Task2 要求,请使用工具 UMLet,截图格式务必是 png 并控制尺寸
- 说明:请不要受 PCMEF 层次结构影响。你需要识别实体(E)和 中介实体(M,也称状态实体)
- 在单页面应用(如 vue)中,E 一般与数据库构建有关, M 一般与 store 模式 有关
- 在 java web 应用中,E 一般与数据库构建有关, M 一般与 session 有关
- b. 数据库建模(E-R 模型)
- 按 Task 3 要求,给出系统的 E-R 模型(数据逻辑模型)
- 建模工具 PowerDesigner(简称PD) 或开源工具 OpenSystemArchitect
- 不负责的链接 http://www.cnblogs.com/mcgrady/archive/2013/05/25/3098588.html
- 导出 Mysql 物理数据库的脚本
- 简单叙说 数据库逻辑模型 与 领域模型 的异同
/*==============================================================*/
/* DBMS name: Sybase SQL Anywhere 10 */
/* Created on: 2018/4/30 0:57:40 */
/*==============================================================*/
if exists(select 1 from sys.sysforeignkey where role='FK_HOTEL_REFERENCE_LOCATION') then
alter table Hotel
delete foreign key FK_HOTEL_REFERENCE_LOCATION
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_HOTEL_HAS_ROOM') then
alter table Hotel
delete foreign key FK_HOTEL_HAS_ROOM
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_RESERVAT_REFERENCE_PAYMENT') then
alter table Reservation
delete foreign key FK_RESERVAT_REFERENCE_PAYMENT
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_RESERVAT_REFERENCE_CUSTOMER') then
alter table Reservation
delete foreign key FK_RESERVAT_REFERENCE_CUSTOMER
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_ROOM_REFERENCE_RESERVAT') then
alter table Room
delete foreign key FK_ROOM_REFERENCE_RESERVAT
end if;
if exists(
select 1 from sys.systable
where table_name='Customer'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table Customer
end if;
if exists(
select 1 from sys.systable
where table_name='Hotel'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table Hotel
end if;
if exists(
select 1 from sys.systable
where table_name='Location'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table Location
end if;
if exists(
select 1 from sys.systable
where table_name='Payment'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table Payment
end if;
if exists(
select 1 from sys.systable
where table_name='Reservation'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table Reservation
end if;
if exists(
select 1 from sys.systable
where table_name='Room'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table Room
end if;
/*==============================================================*/
/* Table: Customer */
/*==============================================================*/
create table Customer
(
customerID numeric not null,
name varchar(200) null,
"email address" varchar(200) null,
constraint PK_CUSTOMER primary key clustered (customerID)
);
/*==============================================================*/
/* Table: Hotel */
/*==============================================================*/
create table Hotel
(
hotelID numeric not null,
code numeric null,
roomNumber numeric null,
name varchar(40) null,
hot float null,
star float null,
description varchar(200) null,
constraint PK_HOTEL primary key clustered (hotelID)
);
/*==============================================================*/
/* Table: Location */
/*==============================================================*/
create table Location
(
code Number not null,
region varchar(40) null,
city varchar(40) null,
town varchar(40) null,
hot float null,
isCapital tinyint null,
constraint PK_LOCATION primary key clustered (code)
);
/*==============================================================*/
/* Table: Payment */
/*==============================================================*/
create table Payment
(
paymentID numeric not null,
constraint PK_PAYMENT primary key clustered (paymentID)
);
/*==============================================================*/
/* Table: Reservation */
/*==============================================================*/
create table Reservation
(
reservationID numeric not null,
hotelID numeric null,
"total due" numeric null,
paymentID numeric null,
Cus_customerID numeric null,
"check in date" date null,
"check out date" date null,
customerID varchar(40) null,
constraint PK_RESERVATION primary key clustered (reservationID)
);
/*==============================================================*/
/* Table: Room */
/*==============================================================*/
create table Room
(
roomNumber numeric not null,
reservationID numeric null,
type varchar(40) null,
isAvailable tinyint null,
listPrice numeric null,
"number of adult" integer null,
"number of child" integer null,
constraint PK_ROOM primary key clustered (roomNumber)
);
alter table Hotel
add constraint FK_HOTEL_REFERENCE_LOCATION foreign key (code)
references Location (code)
on update restrict
on delete restrict;
alter table Hotel
add constraint FK_HOTEL_HAS_ROOM foreign key (roomNumber)
references Room (roomNumber)
on update restrict
on delete restrict;
alter table Reservation
add constraint FK_RESERVAT_REFERENCE_PAYMENT foreign key (paymentID)
references Payment (paymentID)
on update restrict
on delete restrict;
alter table Reservation
add constraint FK_RESERVAT_REFERENCE_CUSTOMER foreign key (Cus_customerID)
references Customer (customerID)
on update restrict
on delete restrict;
alter table Room
add constraint FK_ROOM_REFERENCE_RESERVAT foreign key (reservationID)
references Reservation (reservationID)
on update restrict
on delete restrict;
数据库逻辑模型 与 领域模型 的异同
- 领域模型描述的是业务中涉及到的业务实体以及相互之间的关系, 它可以帮助需求分析人员和用户(或用户代表)认识实际业务。
- 数据库逻辑模型是领域模型的延伸,就是要将概念模型具体化,表示概念之间的逻辑次序,是一个属于方法层次的模型。具体来说,逻辑模型中一方面显示了实体、实体的属性和实体之间的关系,另一方面又将继承、实体关系中的引用等在实体的属性中进行展示。
- 相同点:领域模型和逻辑模型都是用于描述用户业务需求的模型,在“实体”的概念上有相似点,每个实体都可以有属性,表达了实体之间的关系。
- 不同点:逻辑模型是系统设计,以及实现的一部分,描述的是对用户需求在技术上的实现方法;而领域模型更关注整体,只是业务描述中提炼出来的一些概念以及其关系,与软件开发没有关系。
上一篇: 一天一大 leet(路径总和)难度:简单-Day20200707
下一篇: 系统分析与设计第五次作业