UML 三元关联 [英] UML ternary association

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

问题描述

我目前在理解 UML 中的三元关联时遇到了一些麻烦.我得到二进制的,但我不确定多重性如何在三元上起作用.我正在做我从大学得到的练习,目前的练习是这样的:

一个部门可能销售多种产品,但只面向一个市场.在一个市场上,一种产品只能由一个部门销售.

我已经阅读了不同的来源,关于我应该如何考虑两个类中的一对,我并不想弄清楚其多重性,但我的大脑就是不明白.帮助我溢出克诺比,你是我唯一的希望.

解决方案

三元关联的多重性规范似乎有些含糊不清.另请参阅
我会理解为

在任何给定的家庭中,必须有一个父亲、一个母亲和零个或多个孩子.

如果我们将其应用于您的案例,那么我会得出这样的结论:


我理解为

对于任何给定的产品,必须恰好有一个市场、一个部门和一个或多个产品

这似乎或多或少地满足了您的所有限制

  • 一个产品只能由一个部门提供给一个市场
  • 一个部门可以提供多种产品,但一种产品只能提供给一个市场

虽然我不认为它是防水的,但正如论文已经指出的那样,UML 没有足够的工具来制作防水设计,仅在末端具有多样性.因此,为了更好地衡量,您的约束也应该建模为 UML 约束.

免责声明:三元关联非常适合学术讨论,但并未真正用于 (IT) 行业,可能是因为它们太难理解了.

I'm currently having some trouble understanding ternary associations in UML. I get the binary ones, but I am unsure how multiplicity works on ternary. I'm doing exercises that I got from my university, the current one goes like this:

One department may sell many products, but only to one market. On a market one product may only be sold by one department.

I've read on different sources about how I'm supposed to think about a pair of the two classes I'm not trying to figure out the multiplicity for, but my brain just isn't getting it. Help me Overflow Kenobi, you're my only hope.

解决方案

There seems to be some ambiguity in the specification of multiplicities on ternary associations. See also this paper

But I understand it like this:

The multiplicity says something about how many times an instance may be present in this associations for any given tuple of linked instances.

As an example, consider the following (traditional) family
I would understand that as

In any given family there must be one father, one mother and zero or more children.

If we apply that to your case then I come to something like this:


I understand that as

For any given Offering there must be exactly one market, one department and one or more products

That seems to satisfy more or less all of your constraints

  • A Product can only be offered to one market by one department
  • A Department can offer multiple products, but one product can only be offered to one market

I don't think it's waterproof though, but as the paper already stated, UML does not have enough tools to make a waterproof design with the multiplicities on the ends alone. So for good measure, your constraints should also be modeled as UML constraints.

Disclaimer: Ternary associations are really nice for academical discussions, but are not really used in the (IT) industry, probably because they are so hard to understand.

这篇关于UML 三元关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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