UML:1对多的关系重新presentation? [英] UML: 1-To-Many Relationship Representation?

查看:278
本文介绍了UML:1对多的关系重新presentation?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的UML,我不太明白的符号呢。

I am new to UML, and I don't quite understand the notation yet.

这是我对图的理解。

The system has many doctors. Doctors can have many patients; however, patients can only have one doctor. Therefore this is a **One-To-Many** relationship

不过,我觉得这也可以作为PTED ...间$ P $

However, I feel like this can also be interpreted as...

The system has 1 doctor. That one doctor has many patients.

这是正确间pretation为什么?

Which is the correct interpretation and why?

推荐答案

要简单地说:你的第一个跨pretation是正确的。的每个博士与许多相关患者。的每个患者与一个博士相关。 1 的多重告诉你只有多少医生与每个病人相关,没有多少是在系统中。记者了解到,一类通常重新presents一套许多实例。

To put it simply: your first interpretation is correct. Each Doctor is associated with many Patients. Each Patient is associated with one Doctor. The multiplicity of 1 tells you only how many Doctors are associated with each Patient, not how many are in the system. Understand that a class usually represents a set of many instances.

BTW,对于一个分析模型,您应该使用关联端的名字给这些关联语义。例如,每个博士治疗的许多患者。每个患者的有一个博士处理。语义会暴露你的模型是否是业务领域是正确的。如果没有语义关系可以重新present计费,治疗,在医院探访,等的治疗的推移与结束* 的推移与最终的 1

BTW, for an analysis model, you should use association-end names to give these associations semantics. For example, each Doctor treats many Patients. Each Patient is treated by one Doctor. The semantics will expose whether your model is correct for the business domain. Without semantics, the relationship could represent billing, treatment, visits at the hospital, etc. The treats goes on the end with the *, and the is treated by goes on the end with the 1.

有关较低级别的模型,您应该更换的治疗的用的 treatedPatient 的和替换的的用的 treatingDoctor 。

For a lower-level model, you should replace treats with treatedPatient and replace is treated by with treatingDoctor.

这篇关于UML:1对多的关系重新presentation?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆