Modeling New semantics
New Semantic Modeling
when you create a model using UML, you Work within the rules of the UML lays down. That " s a good thing, because it means that's can communicate your intent without ambiguity to anyone else Who knows what to read the UML. However, if you find yourself needing-express new semantics about which the UML are silent or that's need to modify th E UML " s rules, then your need to write a constraint.
When you create a model with UML, you work under the rules of UML. This is a good thing, because it means that you can express your intentions without hindrance to people who know how to read UML. However, if you find that you need to express the new semantics, UML does not reflect or you need to modify the UML rules, then you need to write a constraint.
To model new semantics,
l first, Make sure there " s not already a-from-express what you want by using basic UML.
l if You " re convinced there " s no other-to-express these semantics, Write your new semantics in a constraint placed near the He element to which it refers. You can show a further explicit relationship by connecting a constraint to its elements using a dependency Relationship.
l If You need to specify your semantics more precisely and formally, write your new semantics using OCL.
To model new semantics,
l first, make sure that the basic UML you are using does not have an existing method to express your thoughts.
l If you are sure there is no other way to express these semantics, write down your new semantic constraints placed near the elements that it references. You can use dependencies to connect an element to its constraints to show a clearer relationship.
l If you need to be more precise ﹑ Specify your semantics more formally and use the object constraint language to write your new semantics.
For example, figure 6-11 models a small part of a corporate human resources system.
For example, 6-11 a small number of models in a company's human resources system.
This diagram shows . PersonMay is a member of zero or moreTeams and that eachTeammust has at least one PersonAs a member. This diagram goes in to indicate the eachTeammust has exactly one PersonAs a captain and every PersonMay is the captain of zero or moreTeams. All of these semantics can is expressed using simple UML. However, to assert that a captain must also be a member of the same team are something that cuts across multiple associatio NS and cannot is expressed using simple UML. To the invariant, you have to write a constraint that shows the manager as a subset of theTeam, connecting the associations with a constraint. There is also a constraint that the captain must was a member for at least 1.
This figure shows eachpeoplecould become 0 or oneTeamthe members, eachTeammust have at least onepeopleas a member. This picture also shows that there must be a leader in thepeople, eachpeoplecan be 0 or moreTeam's leadership. All of these semantics can be expressed using simple UML. However, to demonstrate that a leader must also be a member of the same team, which spans multiple associations, it is not possible to express this situation in simple UML. Given this situation, you have to write a constraint to show the leader asTeama subset of members that are linked to two relationships with a constraint. There is also a constraint that the leader must be a member for at least one year.
UML Basic Architecture Modeling--General modeling technology of General mechanism (III.)