系统分析与设计 hw5

系统分析与设计  HW5


1、领域建模

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

  • b. 数据库建模(E-R 模型)
    image

-- +---------------------------------------------------------
-- | MODEL       : Reserve Hotel
-- | AUTHOR      : 
-- | GENERATED BY: Open System Architect
-- +---------------------------------------------------------
-- | WARNING     : Review before execution
-- +---------------------------------------------------------

-- +---------------------------------------------------------
-- | CREATE
-- +---------------------------------------------------------
CREATE TABLE `Location`
(
  code INTEGER NOT NULL,
  name VARCHAR NOT NULL,
  hot INTEGER NOT NULL,
  PRIMARY KEY (code)
);

CREATE TABLE `Hotel`
(
  hotel_id INTEGER NOT NULL,
  name VARCHAR NOT NULL,
  star INTEGER NOT NULL,
  hot INTEGER NOT NULL,
  code INTEGER NOT NULL,
  PRIMARY KEY (hotel_id,code)
);

CREATE TABLE `RoomDescription`
(
  room_id INTEGER NOT NULL,
  type VARCHAR NOT NULL,
  listed_price INTEGER NOT NULL,
  hotel_id INTEGER NOT NULL,
  PRIMARY KEY (room_id,hotel_id)
);

CREATE TABLE `Room`
(
  given_date DATE NOT NULL,
  isAvailable BIT NOT NULL,
  room_id INTEGER NOT NULL,
  PRIMARY KEY (given_date,room_id)
);

CREATE TABLE `CustomerInfo`
(
  email VARCHAR NOT NULL,
  name VARCHAR NOT NULL,
  gender VARCHAR NOT NULL,
  isSmoke BIT NOT NULL,
  PRIMARY KEY (email)
);

CREATE TABLE `Reservation`
(
  reservation_id INTEGER NOT NULL,
  due INTEGER NOT NULL,
  requirement VARCHAR,
  email VARCHAR NOT NULL,
  PRIMARY KEY (reservation_id)
);

CREATE TABLE `CreditCard`
(
  number INTEGER NOT NULL,
  secure_code INTEGER NOT NULL,
  type CHAR NOT NULL,
  expirty_date VARCHAR NOT NULL,
  address VARCHAR NOT NULL,
  contact VARCHAR NOT NULL,
  PRIMARY KEY (number)
);

CREATE TABLE `Payment`
(
  payment_id INTEGER NOT NULL,
  total_cost INTEGER NOT NULL,
  number INTEGER NOT NULL,
  PRIMARY KEY (payment_id)
);

  • c. 简单叙说 数据库逻辑模型 与 领域模型 的异同

    异:领域模型主要面向需求分析,而数据库逻辑模型则主要面向设计;领域模型没有给出数据字段的具体类型与主键,而数据库逻辑模型则有给出。

    同:两者都将系统的概念类以图形化的形式表示出来,定义了各个概念类的名字、属性以及类间的关系。