系统分析与设计 -- hw5

1、 领域建模

  • a. 阅读 Asg_RH 文档,按用例构建领域模型。
    • 按 Task2 要求,请使用工具 UMLet,截图格式务必是 png 并控制尺寸
    • 说明:请不要受 PCMEF 层次结构影响。你需要识别实体(E)和 中介实体(M,也称状态实体)
      • 在单页面应用(如 vue)中,E 一般与数据库构建有关, M 一般与 store 模式 有关
      • 在 java web 应用中,E 一般与数据库构建有关, M 一般与 session 有关

【答】 按照用例图中提取出的实体名词,除了购物车是中介实体(M)外,其他都是实体(E),因为购物车不需要储存在数据库中,而像预订的房间等都需要储存在数据库中。虽然Task2中说到creditCard不是中介实体而是实体,但是数据库实际只要保存是否支付成功就可以了,要验证信用卡安全可以在前端进行,储存信用卡信息没太大用处。

这里写图片描述
- b. 数据库建模(E-R 模型)
- 按 Task 3 要求,给出系统的 E-R 模型(数据逻辑模型)
- 建模工具 PowerDesigner(简称PD) 或开源工具 OpenSystemArchitect
- 导出 Mysql 物理数据库的脚本
- 简单叙说 数据库逻辑模型 与 领域模型 的异同

【答】

使用PD画出数据逻辑模型:查询结果里,多间不同的旅馆坐落在目的地中,目的地由地名标识,每个旅馆由旅馆ID标识,一个旅馆内有许多房间,房间由房号标识,每一个预订都是预订房间,而每一个预订可能预订多个房间;每个旅客进行预订,但是可能不只有一个预订,每份预订由reservationID标识。billAmount指每份预订的花费,detail指每份预订的备注。
这里写图片描述
通过PD还可以由数据逻辑模型自动生成物理模型,导出的Mysql物理数据库的脚本如下

drop table if exists Customer;

drop table if exists Hotel;

drop table if exists Location;

drop table if exists Reservation;

drop table if exists Room;

drop table if exists payment;

/*==============================================================*/
/* Table: Customer                                              */
/*==============================================================*/
create table Customer
(
   customerID           numeric(8,0) not null,
   name                 varchar(40) not null,
   "email address"      varchar(40) not null,
   primary key (customerID)
);

/*==============================================================*/
/* Table: Hotel                                                 */
/*==============================================================*/
create table Hotel
(
   hotelID              numeric(8,0) not null,
   code                 numeric(8,0),
   hotelName            varchar(40) not null,
   hot                  float not null,
   star                 float not null,
   description          varchar(200),
   primary key (hotelID)
);

/*==============================================================*/
/* Table: Location                                              */
/*==============================================================*/
create table Location
(
   code                 numeric(8,0) not null,
   region               varchar(40) not null,
   city                 varchar(40) not null,
   town                 varchar(40) not null,
   hot                  float,
   primary key (code)
);

/*==============================================================*/
/* Table: Reservation                                           */
/*==============================================================*/
create table Reservation
(
   reservationID        numeric(8,0) not null,
   customerID           numeric(8,0),
   paymentID            numeric(8,0),
   "total due"          float(8,2) not null,
   "special requirements" varchar(200),
   isSmoking            bool,
   isConfirmed          bool not null,
   primary key (reservationID)
);

/*==============================================================*/
/* Table: Room                                                  */
/*==============================================================*/
create table Room
(
   roomNumber           numeric(8,0) not null,
   hotelID              numeric(8,0),
   reservationID        numeric(8,0),
   roomType             varchar(40) not null,
   date                 date not null,
   isAvaliable          bool not null,
   "list price"         float(8,2) not null,
   "number of adults"   numeric(8,0) not null,
   "number of children" numeric(8,0),
   primary key (roomNumber)
);

/*==============================================================*/
/* Table: payment                                               */
/*==============================================================*/
create table payment
(
   paymentID            numeric(8,0) not null,
   isSucceed            bool not null,
   primary key (paymentID)
);

alter table Hotel add constraint "FK_locate in" foreign key (code)
      references Location (code) on delete restrict on update restrict;

alter table Reservation add constraint FK_make foreign key (customerID)
      references Customer (customerID) on delete restrict on update restrict;

alter table Reservation add constraint "FK_pays for" foreign key (paymentID)
      references payment (paymentID) on delete restrict on update restrict;

alter table Room add constraint FK_has1 foreign key (hotelID)
      references Hotel (hotelID) on delete restrict on update restrict;

alter table Room add constraint "FK_reserved by" foreign key (reservationID)
      references Reservation (reservationID) on delete restrict on update restrict;

数据库逻辑模型与领域模型的异同:
    领域模型就是在了解了用户的需求,用户的业务领域工作情况以后,经过分析和总结,提炼出来的用以描述用户业务需求的一些概念的东西,描述的是业务中涉及到的业务实体以及相互之间的关系, 它可以帮助需求分析人员和用户(或用户代表)认识实际业务。
    逻辑模型是领域模型的延伸,就是要将概念模型具体化,表示概念之间的逻辑次序,是一个属于方法层次的模型。具体来说,逻辑模型中一方面显示了实体、实体的属性和实体之间的关系,另一方面又将继承、实体关系中的引用等在实体的属性中进行展示。
     总的来说,领域模型和逻辑模型都是用于描述用户业务需求的模型,表达了实体之间的关系;
但是逻辑模型是系统设计,以及实现的一部分,描述的是对用户需求在技术上的实现方法;而领域模型只是业务描述中提炼出来的一些概念以及其关系,与软件开发没有关系。

Python网络爬虫与推荐算法新闻推荐平台:网络爬虫:通过Python实现新浪新闻的爬取,可爬取新闻页面上的标题、文本、图片、视频链接(保留排版) 推荐算法:权重衰减+标签推荐+区域推荐+热点推荐.zip项目工程资源经过严格测试可直接运行成功且功能正常的情况才上传,可轻松复刻,拿到资料包后可轻松复现出一样的项目,本人系统开发经验充足(全领域),有任何使用问题欢迎随时与我联系,我会及时为您解惑,提供帮助。 【资源内容】:包含完整源码+工程文件+说明(如有)等。答辩评审平均分达到96分,放心下载使用!可轻松复现,设计报告也可借鉴此项目,该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的。 【提供帮助】:有任何使用问题欢迎随时与我联系,我会及时解答解惑,提供帮助 【附带帮助】:若还需要相关开发工具、学习资料等,我会提供帮助,提供资料,鼓励学习进步 【项目价值】:可用在相关项目设计中,皆可应用在项目、毕业设计、课程设计、期末/期中/大作业、工程实训、大创等学科竞赛比赛、初期项目立项、学习/练手等方面,可借鉴此优质项目实现复刻,设计报告也可借鉴此项目,也可基于此项目来扩展开发出更多功能 下载后请首先打开README文件(如有),项目工程可直接复现复刻,如果基础还行,也可在此程序基础上进行修改,以实现其它功能。供开源学习/技术交流/学习参考,勿用于商业用途。质量优质,放心下载使用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值