系统分析与设计第五次作业

本文探讨了领域建模和数据库建模的过程,包括如何识别实体及其关系,并使用UMLet和PowerDesigner等工具创建领域模型和E-R模型。通过实际案例展示了单页应用和Java Web应用中的实体建模差异。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

领域建模

a. 阅读Asg_RH文档,按用例领域模型建模
  • 按Task2 要求,请使用工具UMLet,截图格式务必是png并控制尺寸
  • 说明:请不要受PCMEF层次结构影响。你需要识别实体(E)和中介实体(M, 也称状态实体)

    (1)在单页面应用(如vue)中,E一般与数据库建模有关,M一般与store模式有关
    (2)在java web应用中,E一般与数据库构建有关,M一般与session有关
    hw7_1

b. 数据库建模(E-R模型)
  • 按 Task 3 要求,给出系统的 E-R 模型(数据逻辑模型)
  • 建模工具 PowerDesigner(简称PD) 或开源工具 OpenSystemArchitect
  • 不负责的链接 http://www.cnblogs.com/mcgrady/archive/2013/05/25/3098588.html
  • 导出 Mysql 物理数据库的脚本
  • 简单叙说 数据库逻辑模型领域模型 的异同
数据逻辑模型

hw7_4

Mysql 物理数据库的脚本
/*==============================================================*/
/* DBMS name:      MySQL 5.0                                    */
/* Created on:     2018/4/29 22:31:12                           */
/*==============================================================*/


drop table if exists "Card Holder";

drop table if exists City;

drop table if exists "Credit Card";

drop table if exists Customer;

drop table if exists Hotel;

drop table if exists Reservation;

drop table if exists Room;

/*==============================================================*/
/* Table: "Card Holder"                                         */
/*==============================================================*/
create table "Card Holder"
(
   card_number          text,
   "first name"         longtext,
   "last name"          longtext,
   address              longtext,
   city                 longtext,
   state                longtext,
   country              longtext,
   telephone            longtext,
   email                longtext
);

/*==============================================================*/
/* Table: City                                                  */
/*==============================================================*/
create table City
(
   name                 longtext not null,
   primary key (name)
);

/*==============================================================*/
/* Table: "Credit Card"                                         */
/*==============================================================*/
create table "Credit Card"
(
   type                 text,
   card_number          text not null,
   full_name            longtext,
   card_security_code   longtext,
   primary key (card_number)
);

/*==============================================================*/
/* Table: Customer                                              */
/*==============================================================*/
create table Customer
(
   full_name            longtext not null,
   email                longtext,
   primary key (full_name)
);

/*==============================================================*/
/* Table: Hotel                                                 */
/*==============================================================*/
create table Hotel
(
   name                 longtext not null,
   roomID               int,
   "star rating"        int,
   primary key (name)
);

/*==============================================================*/
/* Table: Reservation                                           */
/*==============================================================*/
create table Reservation
(
   "hotel name"         longtext,
   city                 longtext,
   "check in date"      date,
   "check out date"     date,
   "customer's name"    longtext,
   "special requirement" longtext,
   reservationID        int not null,
   card_number          text,
   primary key (reservationID)
);

/*==============================================================*/
/* Table: Room                                                  */
/*==============================================================*/
create table Room
(
   type                 longtext,
   price                int,
   nuber                int,
   roomID               int not null,
   reservationID        int,
   primary key (roomID)
);

alter table "Card Holder" add constraint FK_Reference_2 foreign key (card_number)
      references "Credit Card" (card_number) on delete restrict on update restrict;

alter table City add constraint FK_Reference_3 foreign key (name)
      references Hotel (name) on delete restrict on update restrict;

alter table "Credit Card" add constraint FK_Reference_1 foreign key (full_name)
      references Customer (full_name) on delete restrict on update restrict;

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

alter table Reservation add constraint FK_Reference_6 foreign key (card_number)
      references "Credit Card" (card_number) on delete restrict on update restrict;

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

数据库逻辑模型与领域模型的异同
  • 领域模型 是对领域内的概念类或现实世界中对象的可视化表示。
  • 逻辑模型 介于概念模型和物理模型之间,具有物理模型的特性,在概念模型中的多对多关系,在逻辑模型中将会以增加中间实体的一对多关系的方式来实现。具体来说,逻辑模型中一方面显示了实体、实体的属性和实体之间的关系,另一方面又将继承、实体关系中的引用等在实体的属性中进行展示。
    所以在领域模型中,并不会排除需求中没有明确要求记录其相关信息的类,也不会排除没有属性的概念类。根据概念模型可以生成逻辑模型,逻辑模型是概念模型的延伸,表示概念之间的逻辑次序,是一个属于方法层次的模型。
  • 相同点:将需求抽象为可视化的概念关系
  • 不同点:数据库逻辑模型是系统设计及实现的一部分,描述的是用户需求在技术上的实现方法。领域模型用于描述业务需求,帮助用户和需求分析人员更好地理解业务需求。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值