带有约束的概念模型

Conceptual model with a constraint

我正在尝试制作此用例的概念模型:

The Actor can modify the budget but after the modification the sum of all the budget elements percentages must be 100% or 0% if there are no elements in the budget.

如何将此约束包含在我的模型中?
模型也可以找到here

只需将这样的约束附加到 Budget

如果您的工具不提供本机约束元素,您可以简单地使用注释并将约束放在花括号中。

您应该只对 contains 属性 施加约束。在 MagicDraw 中,可以显示约束的标签或 OCL 中的实际约束。

下面是一个只有标签的例子,可能更适合概念模型的观众:

这是一个 OCL 示例:

可读性差一点,嗯?