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

这篇内容探讨了领域建模和数据库逻辑模型的区别与联系。领域模型关注业务领域内的核心概念及其关系,是独立于软件开发的抽象表示。数据库逻辑模型则是在领域模型基础上的细化,更侧重于实际系统实现,包括实体与关系,并转化为符合关系数据模型的逻辑结构。
摘要由CSDN通过智能技术生成

1、领域建模

a.阅读Asg_RH文档,按用例构建领域模型。

      所构建领域模型如下:


b.数据库建模(E-R模型)
(1)系统的E-R模型(数据逻辑模型)


(2)导出的Mysql物理数据库的脚本如下:

drop table if exists City;

drop table if exists Customer;

drop table if exists Hotel;

drop table if exists Reservation;

drop table if exists Room;

drop table if exists Shopping_Busket;

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

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

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

/*==============================================================*/
/* Table: Reservation                                           */
/*==============================================================*/
create table Reservation
(
   Id                   int not null,
   CustomerName         longtext,
   HotelName            longtext,
   RoomType             longtext,
   CheckInDate          date,
   CheckOutDate         date,
   primary key (Id)
);

/*==============================================================*/
/* Table: Room                                                  */
/*==============================================================*/
create table Room
(
   type                 longtext not null,
   amount               int,
   primary key (type)
);

/*==============================================================*/
/* Table: Shopping_Busket                                       */
/*==============================================================*/
create table Shopping_Busket
(
   ownerName            longtext,
   reservationId        int,
   Id                   int not null,
   primary key (Id)
);

alter table Hotel add constraint "FK_Have Rooms" foreign key (RoomType)
      references Room (type) on delete restrict on update restrict;

alter table Hotel add constraint "FK_Locates In" foreign key (CityName)
      references City (name) on delete restrict on update restrict;

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

alter table Reservation add constraint "FK_Make Reservation" foreign key (CustomerName)
      references Customer (name) on delete restrict on update restrict;

alter table Reservation add constraint "FK_Reserve Hotels" foreign key (HotelName)
      references Hotel (name) on delete restrict on update restrict;

alter table Shopping_Busket add constraint "FK_Belongs to" foreign key (ownerName)
      references Customer (name) on delete restrict on update restrict;

alter table Shopping_Busket add constraint "FK_Include Reservation" foreign key (reservationId)
      references Reservation (Id) on delete restrict on update restrict;
(3)数据库逻辑模型与领域模型的异同:

      数据库逻辑模型是一个抽象的宏观层次的业务模型,其中最重要的对象是实体与关系。逻辑模型其实就是将概念模型具体化的一个过程,即按照概念结构设计阶段建立的基本E-R图,按选定的管理系统软件支持的数据模型(层次、网状、关系、面向对象),转换成相应的逻辑模型。这种转换要符合关系数据模型的原则。目前最流行就是关系模型(也就是对应的关系数据库)。
       领域模型是一个商业建模范畴的概念,是对领域内的概念类或现实世界的对象的一种抽象的可视化表示。它主要关注问题域本身,挖掘问题域中核心的领域概念,并建立领域概念之间的关系。它与软件开发没有关系,即使一个企业他不开发软件,它也具备它的业务模型,所有的同行业的企业它们的业务模型必定有非常大的共性和内在的规律性,由这个行业内的各个企业的业务模型再向上抽象出来整个行业的业务模型,这个东西即“领域模型”。

     相同点:两者都是抽象概念,将需求抽象为可视化的概念关系。
     不同点:领域模型主要关注现实世界的行为、对象和各种概念,与软件开发本身并无关系;而数据库逻辑模型则是对领域模型的进一步细化,需要摒弃无关的概念,具体实现需要的概念,并将其进一步细化为数据库、类对象等细节。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值