简体   繁体   中英

UML Activity diagrams: how to select between two objects in an expansion region

I'm trying to express that an action inside an expansion region should take its first parameter from outside the expansion region on the first iteration and from a partial result on successive iterations. This is the activity diagram I'm trying to pull off:

UML 活动图

I understand that the specification allows interpreting that, on the first expansion region iteration, "Template Input" should start by receiving a token from "Validated dataset", then pass that token to the "Apply template and store..." pin. However, on successive iterations, "Template Input" will receive a token from "Partial result".

Is this a valid interpretation?

On the other hand, I'm not 100% sure about the output parameter. I understand it should return the last partial result after completing the iteration.

Any other suggestions to improve the activity diagram will be greatly appreciated.

Follow up

I carefully took Axel Scheithauer's suggestions and made a second, improved diagram.

Specifically:

  • Changed to «stream» instead of «iterative». About "The second and all following executions will receive the Partial result from its output pin.", I hope I had understood that correctly. Two edges at the same input pin do not feel correct, but if I understand correctly, just one of them will have a token at any given moment.
  • Used «overwrite» on the output pin.

Now for the issues:

  • Now, there are proper Activity Parameter Nodes at the top.
  • I do not mix pin and object notation anymore (I kept pin notation).
  • Replaced object notation with two-pin notation.
  • Added a Fork on Partial result .
  • Output pin on the expansion region now outside of it.
  • About the interrupting edges: I intend to cease processing when any action that uses an XSLT processor fails. Added interruptible regions and an accept event. I hope that is correct. From my process point of view, it is not essential to portray how the error happens, but how to handle it.
  • Added a merge node to Error report .

Apart from the corrected diagram, I made a simple animation showing how I understand the tokens flows through actions and in the «stream» expansion region. I'm aware that input collections may have more or less than four elements; I panted them for illustration. Am I right?

在此处输入图像描述

No, it doesn't work like this. Each item in the input collection gets processed separately, and so each execution of it gets its own unchanged copy of the Validated dataset .

Section 16.12.3: tokens offered on ActivityEdges that cross into an ExpansionRegion from outside it are duplicated for each expansion execution

In order to get what you want, you need to use «stream» instead of «iterative».

If the value is stream, there is exactly one expansion execution

You don't even need the central buffer. The first execution of Apply Template will consume the token with the Validated Dataset . The second and all following executions will receive the Partial result from its own output pin.

Output pins on expansion regions are allowed, but no semantics is defined in UML

ExpansionRegions may also have OutputPins and ActivityEdges that cross out of the ExpansionRegion from inside it. However, the semantics are undefined for offering tokens to such OutputPins or ActivityEdges.

That is a little strange. I think it makes sense to define, that any token that is offered to the output pin will be stored there, but only offered to the outgoing edge once all executions are completed. This would correspond to the behavior defined for expansion nodes:

When the ExpansionRegion completes all expansion executions, it offers the output collections on its output ExpansionNodes on any ActivityEdges outgoing from those nodes (they are not offered during the execution of the ExpansionRegion).

In order to only return the final result you could use «overwrite» on the output pin. This way, each subsequent result will overwrite the previous results.

Issues with the diagram

I think there are some issues that you should correct in the diagram that are not related to your questions.

  • The rectangles in the top row of the diagram are probably Activity Parameter Nodes. As such they are supposed to overlap the border of the diagram. Also their types would be shown inside the rectangles and they would need to be connected to input pins on the other side.
  • You are mixing pin (eg Partial res validation ) and object notation (eg Partial result ). I recommend sticking with one possiblity.
  • Object notation is only possible, where an object flow connects two pins. For example the rectangle labeled Templates on an object flow connecting a pin to an expansion node is not correct.
  • The partial result is used multiple times. Since a token can only be consumed once, this is a deadlock. You need to use a fork node to split it into four.
  • The output pin on the expansion region should be on the outside of it.
  • The zigzag shaped arrows are exception handlers. I guess you wanted them to be interrupting edges, but those can only be used within interruptible regions. You would need to add these regions. Then you also need a decision node to test the result of the validations and if it's a failure leave the interruptible region via an interrupting edge.
  • The three incoming edges to Error Report mean, that all of them must have a token. You need to add a merge node before the action.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM