HowTo Model Use Case Activities in SysML

HowTo Model Use Case Activities in SysML

Use case with property ownedBehavior shown in a diagram

Activities are commonly used to describe the behavior of use cases. In SysML these are separate model elements: the use case and the activity. The use case is a specification of behavior. Whereas the activity is the definition of the implementation of the behavior. Instead of an activity you can also use interactions (sequence diagrams), state machines or opaque behavior. However I favor the activity.

Typically in a SysML model the activitiy is in the namespace of the use case. You could see that in the containment tree of your modeling tool. The activity is one level below the use case:

Activity in namespace of a Use Case

Activity in namespace of a Use Case

That’s sufficient for most projects. However it does not specify what you want to specify. The activity is simply in the namespace of the use case. Nothing more. It is not the behavior of the use case. The model element UseCase has a property ownedBehavior. It references the set of behaviors – typically only one. The modeling tool MagicDraw automatically sets that property when you place an activity in the namespace of a use case:

Use Case property ownedBehavior

Use Case property ownedBehavior

You can show the relationship in the diagram. According to the specification it is possible to show a compartment owned behaviors if the use case is shown in rectangle notation instead of the ellipse notation. MagicDraw does not provide that feature, but allows to display element properties like the ownedBehavior property in the diagram:

Use case with property ownedBehavior shown in a diagram

Use case with property ownedBehavior shown in a diagram

If you write model queries use the ownedBehavior property and not the namespace containment relationship. You can move the activity to another namespace, e.g. a package, and it is still the ownedBehavior of the use case. Check how your modeling tool handles the relationship between use case and activity.

 

Leave a Reply

Your email address will not be published. Required fields are marked *