UML基本架构建模--通用机制的通用建模技术(三)

Modeling New Semantics

新语义建模

When you create a model using UML, you work within the rules the UML lays down. That’s a good thing, because it means that you can communicate your intent without ambiguity to anyone else who knows how to read the UML. However, if you find yourself needing to express new semantics about which the UML is silent or that you need to modify the UML

在你用UML创建模型的时候,你工作在UML的规则之下.这是一件好事,因为这意味着你可以与懂得如何读UML的人毫无障碍的表达你的意图.然而,,如果你发现你需要表达的新的语义,UML却无法体现或是你需要修改UML的规则,这时你需要写一个约束.

To model new semantics,

s not already a way to express what you want by using basic UML.

re convinced there’s no other way to express these semantics, write your new semantics in a constraint placed near he element to which it refers. You can show a more explicit relationship by connecting a constraint to its elements using a dependency relationship.

lIf you need to specify your semantics more precisely and formally, write your new semantics using OCL.

For example, Figure 6-11 models a small part of a corporate human resources system.

比如,如图6-11一个公司人力资源体系中的一小部分模型.

This diagram shows that eachPerson may be a member of zero or moreTeams and that eachTeam must have at least onePerson as a member. This diagram goes on to indicate that eachTeam must have exactly onePerson as a captain and everyPerson may be the captain of zero or moreTeams. All of these semantics can be expressed using simple UML. However, to assert that a captain must also be a member of the same team is something that cuts across multiple associations and cannot be expressed using simple UML. To state this invariant, you have to write a constraint that shows the manager as a subset of the members of theTeam, connecting the two associations with a constraint. There is also a constraint that the captain must be a member for at least 1 year.

向上攀爬的。

UML基本架构建模--通用机制的通用建模技术(三)

相关文章:

你感兴趣的文章:

标签云: