Search code examples
umlmetamodel

UML - Is it possible to add ActivityPartitions to StructuredActivityNodes?


In the UML Specifications on page 476 there is the following diagram:

enter image description here

If I'm not mistaken, it should not be possible to add ActivityPartions (which are a specialization of ActivityGroups - just like StructuredActivityNodes) to a StructuredActivityNode, right? According to the diagram the only relationship between StructuredActivityNodes and ActivityGroup is a generalization/specialization relationship. There should be a composition relationship as well if Partitions in StructuredActivityNodes would be possible.

Am I wrong? I'm asking because it is possible in some tools (VisualParadigm for example) but not possible in other tools.


Solution

  • Red Beard is correct in stating that StructuredActivityNodes can contain ActivityNodes and that ActivityPartitions are not ActivityNodes. Here is the diagram that shows the latter point: UML Metamodel ActivityGroups

    From this follows, that StructuredActivityNodes cannot contain ActivityPartitions.

    However, nothing in the specification prevents us from referencing the ActivityNodes within a StructuredActivityNode from a different Partition, than the StructuredActivityNode itself.

    This could lead to the impossibility to show the partition graphically. The specification defines a textual notation for this: Just place the name of the Partition in round brackets above the name of the Node. Unfortunately this notation is not supported by many tools.

    In order to make it possible to show it graphically, the StructuredActivityNode would need to be referenced by more than one partition. This is allowed according to the diagram above. Of course, the question is then, what the semantics would be.

    Actually, there are no defined semantics. The specification defines only semantics for Partitions containing InvocationActions. The partition then specifies the target of the invocation. Having two targets would not make sense, therefore, it should not be allowed in this case (a constraint to this effect is missing though). But all other Actions can span multiple Partitions.

    Therefore this is a perfectly valid diagram, that reaches the goal:

    StructuredActivityNode in two partitions

    PS: In the used tool it was possible to create the correct model. It took some tweaking though, until the diagram looked like this.