UML-如何使它成为正确的模型?

UML-how to make it the right model?

我需要制作一个 UML 图,但我不确定如何在其中实现 1 个特定的东西。假设我有一个 license 作为对象,它可以是 terminalanywhere license。它必须是其中之一,不能是 none。我认为 license 对象连接到 anywhere licenseterminal,两者的基数都是 0..1。这是正确的吗?我应该有其他基数还是完全不同的结构?

您所描述的听起来更像是概括,其中 license 是抽象的 class,terminalanywhere license 是其专业化。

然而,您可能只想在 license 中添加一个 location 属性,其值 terminalanywhere license 作为可能的值。然后使用可用值 terminalanywhere license 创建枚举 LocationEnum。然后添加到 `license' 属性:

location:LocationEnum

那么您的 location 必须具有 LocationEnum 中可用的值之一。

您的问题也可以通过其他方式理解,但这些是最有可能成为合适解决方案的方法。选择哪一个取决于更多的模型细节。