UML类图:如何从关系图传递到类图(UML class diagram: How to pass from relational diagram to class diagram)

编程入门 行业动态 更新时间:2024-10-21 15:59:19
UML类图:如何从关系图传递到类图(UML class diagram: How to pass from relational diagram to class diagram)

我正在研究锻炼跟进程序的设计。我有以下关系图,我想用它创建一个类图。

在这种情况下,我应该创建一个关联表,如下所示:

解释这种关系:肌肉可能是许多不同运动的目标,运动可能针对许多肌肉。

以下表示是否正确? 我们能改进它吗?

如果它不正确,任何人都可以建议在类图中表示它的最佳方法吗?

I'm working on a design of a workout follow up program.I have the following relational diagram and I want to create a class diagram with it.

In this case I should create an associative table as follow:

To explain the relation: a muscle may be targeted by many different exercises and an exercise may target many muscle.

Is the following representation correct? Can we improve it?

If it is not correct, can any one suggest the best way to represent it in a class diagram?

最满意答案

你的图几乎是正确的。 您应该将所有出现的List<...>替换为关联结束属性。 为此,您需要两个关联。 这是一个例子:

在此处输入图像描述

我冒昧地改变了初选的多样性。 我认为每个方向至少有一个方向。 这表明为什么使用关联更具表现力 - 使用List<...> ,您无法表达最小和最大基数。

Your diagram is almost correct. You should replace all the occurrences of List<...> with association-end properties. To do this, you will need two associations. Here's an example:

enter image description here

I took the liberty of changing the multiplicity for the primaries. I think each direction has at least one. This shows why using associations is more expressive--with a List<...>, you cannot express min and max cardinalities.

更多推荐

本文发布于:2023-08-05 09:19:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1431169.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:关系   到类图   UML   类图   pass

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!