2

UML/SysML Activity Diagrams - Can a Decision Node element be hanging? (i.e., no (visible) incoming edge.)

I have quite a large activity diagram with three main parallel object flows (with merging data, just to make it even more complicated) until activity completion.

Towards the end of the activity, I have a Decision Node element that selects (based on some "global" variable) which of the parallel object flows provides the activity output. For the selection I used a Decision Node element.

As a temporary simplification, I did not add the usual incoming edge to the Decision node. I left it "hanging in the air". Although the meanning is intuitive, is this allowed in strict UML/SysML?

The reason why I did it (obviously...), is that to add the incoming edge I would have to add 3 more edges (from the 3 parallel flows) and also a few more joins -- which makes an already busy diagram, even busier.

And no - I can't split it into sub-diagrams. It is what it is.

Geert Bellekens
  • 12,788
  • 2
  • 23
  • 50
avi10000
  • 101
  • 5

2 Answers2

4

(Update due to @Axel's comment) If a decision node has no ingoing edge it will immediately fire a token.

UML 2.5.1 states on p. 378

nodes that do not have incoming edges and require no input data to execute are immediately enabled.

It's questionable that the condition of a decision note can be understood by anyone if it's starting out of nowhere.

It's futile to refrain from splitting. If your diagram gets that large it can not be read by anyone and will be useless. So either you get to the point where you can cut it into manageable pieces or you are at the wrong place. There is no king's way (Euclide).

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
  • 2
    I agree that a diagram should be cut in manageable pieces. However, the decisionnode would not be dead but fire a token immediately: UML 2.5.1 _nodes that do not have incoming edges and require no input data to execute are immediately enabled_. I guess, this is also not what avi wanted. Therefore, I would model the edges, but hide them in the diagram. Of course, this will confuse the readers, so it should be made clear in the description. And there should be a diagram, where all edges are shown. There is nothing wrong in having multiple diagrams for one activity. – Axel Scheithauer May 23 '23 at 10:29
  • @AxelScheithauer Oh! I was not aware of that. I will fix my answer. – qwerty_so May 23 '23 at 10:44
  • 2
    @AxelScheithauer Re-reading I wonder whether a DecisionNode would need input in order to execute since it (usually) decides on a prepended action doing some check. – qwerty_so May 23 '23 at 22:23
  • 2
    There could be a decision input flow from the prepended action. But this is optional. You could say, this inputflow has been omitted for brevity. However, the guards could instead also simply evaluate a global variable. – Axel Scheithauer May 25 '23 at 11:52
  • Hi all - Thank you all so much for yoiur answers. – avi10000 May 28 '23 at 00:00
  • Btw, the output ctrl lines of the decision node are i/ps to actions X, Y, and Z that all have additional inputs, so the 'selected action' fires only when it is supposed to. – avi10000 May 28 '23 at 00:13
  • I was indeed aware that nodes with no i/p do fire immediately. (Although I was wondering if this really is true also for decision nodes; but the good book says 'nodes', and not 'actions', so the decision node (itself) does fire immed.) Of course in my SW the decision/selector is not fired immed. > Therefore, I would model the edges, but hide them in the diagram. So definitely I will add a note in the doc text to explain what is going on. – avi10000 May 28 '23 at 00:13
  • The diagram started out as small, IMO – two parallel flow channels each of 3 actions, and one combiner action. But in SW v2.0, a 3rd channel was added comprising a further 3 actions, the channel combiner was split into 2 channel combiners, and two switches (decisions) were added. But it's still the same diagram, just now with 11 actions and two decision nodes and a whole lot of edges added, so I was happy to elide (hide) some edges. But it's still basically the same one-concept diagram. I am just the modeler, not the SW designer. He would not agree to split it. – avi10000 May 28 '23 at 00:23
  • Axel's answer of May 23 @10:29 includes the best answers, imo. Thank you. – avi10000 May 28 '23 at 00:28
2

Per UML 2.5.1, section 15.3.3.6, Decision Nodes, pg 390:

A DecisionNode shall have at least one and at most two incoming ActivityEdges, and at least one outgoing ActivityEdge. If it has two incoming edges, then one shall be identified as the decisionInputFlow, the other being called the primary incoming edge.

Additionally, it is the token on the primary incoming edge that traverses the outgoing edge in which the guard evaluates to true. If the decision node has only one incoming edge and the incoming is an object flow the value of that token is used to evaluate the guards. If the node has a decision input flow the value of that token is used in the evaluation of the guards only. Bottom line is a decision node SHALL have at least one incoming edge, and if it has only one incoming edge it is the primary incoming edge. If you don't include an incoming edge it is semantically incorrect.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Ron
  • 21
  • 1
  • You are right. There is even a formal constraint `incoming_outgoing_edges` to this effect. However, many tools don't enforce this rule and honestly, it would be very annoying to get all these error messages. What is the interpretation of a formally incorrect activity? You could say, an incorrect activity is meaningless. Or you could read between the lines of the specification. I read there, that such decision nodes get a token. But of course, in between the lines the ink is invisible, so it is open to debate. PS: The Cameo simulation engine will not give it a token. – Axel Scheithauer Jun 02 '23 at 14:01
  • Hi, > Bottom line is a decision node SHALL have at least one incoming edge, I agree. But I might hide (elide) it (because, as mentioned above, it seems it brings with it a mechanism comprising 3 additional incoming edges). Thanks. – avi10000 Jun 06 '23 at 22:39
  • Thanks everybody for all the answers. – avi10000 Jun 06 '23 at 22:39