【问题标题】:How to design an entity which is sub-entity of similar entity in UML diagram?如何设计一个实体,它是 UML 图中相似实体的子实体?
【发布时间】:2014-05-17 13:49:31
【问题描述】:

我正在根据以下规范设计 XML 和 oracle 数据库。这个问题看起来很混乱,但很简单。我正在尝试为以下设计 UML 图:

A multinational network of hotels owns the hotels in the countries all over the world. etc. The
network of hotels is described by a name and an address of its headquarters. An address of
headquarters consists of country, city, street and building number and it optionally includes
phone and email address.
The network has many hotels in many different countries. However each one of its hotels is
located in a different city. A hotel is described by a name and address that consists of country,
city, street and building number and it optionally includes phone and email address. A name of a
hotel together with a city name uniquely identifies each hotel, e.g. Sheraton at Suwa, or Holiday
Inn at Port Villa.

我的问题是第一段。当我们说“ 酒店网络由其总部的名称和地址来描述。”
这是否意味着一家酒店可以有一个或多个总部(因为它说的是复数总部)?下图是否正确或我需要创建另一个实体并定义总部,然后我应该说“总部”包含“酒店”

【问题讨论】:

    标签: sql xml oracle oracle10g uml


    【解决方案1】:

    图表几乎是正确的,我只使用组合或聚合而不是关联。

    【讨论】:

    • 我的困惑是关于根不是任何酒店的子。所以我想我应该说 1 到 0..* 关系船
    【解决方案2】:

    这看起来像是一个“家庭作业”问题。如果这是一项真正的任务,那么您必须明确要求,然后才能进行认真的分析、设计和编码。

    因此,在现实世界中,如果需求中的一句话不清楚,请停下来让您的客户向您说明。

    在“家庭作业”世界中,在我看来,酒店和总部是完全两种不同的东西,它们可能存在于完全不同的地方和不同的建筑物中。

    您可以将总部设在大城市的商务中心,拥有所有者、秘书、会计等。

    那么你可以在海边拥有10家不同度假胜地的酒店。

    对于总部的建模,我会使用 hierarchical recursive tree-style 数据结构。作为公司所有者的结构,总部等应该非常灵活。公司可以很容易地被收购,它的总部可以搬到任何地方(至少从法律角度来看)。另一方面,酒店是物理实体,一旦用砖、铁、玻璃建成,就不能改变地址或搬到另一个城市。

    有关如何对总部数据结构建模的提示,您可以使用 Google 或关注旧的 Stack Overflow 相关文章Relationships in a UML class diagram

    【讨论】:

      猜你喜欢
      • 2018-01-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多