The Sequence Diagram (sd) is used to represent the interaction between structural elements (Blocks and Actors) of a system, as a sequence of message exchanges between the Blocks/Actors:
Sequence Diagrams are composed of Block/Actor Lifelines and the Message Events that are exchanged between the Lifelines. The Lifeline symbol has a trailing dashed line that represents the object's timeline where the time flows top to bottom.
A message is shown on an sd as a line with different arrowheads and annotations depending on the type of message (synchronous or asynchronous). The logic needed to produce and/or consume the identified messages can be optionally shown on the sd as Execution Specifications.
An example sd is:
The symbols available in sds are:
Symbol | Name | Description |
---|---|---|
Comment | Makes a note anywhere in the diagram. Are always surrounded by * characters. Note: If you do not want Cradle to automatically add an * go to the Graphics Settings section of Project Setup and turn off the Automatically add asterisks to diagram's comment symbols option. | |
Picture | Allows you to choose the location of a GIF or JPEG image to be displayed as a diagram symbol. An image can also be embedded in the other diagram symbols. | |
Note Callout | Multi-purpose symbol which attaches to other symbols in order to show certain attributes of the model element. It can show frames, categories, tags, related items, or simply a piece of standalone text. | |
Tag | The Tag symbol is used to display a tag value contained in a symbol's stereotype frames, or cross reference link attributes, anchored to the selected symbol. In the following example the Tag symbol displays the at tag value specified in the Lifeline stereotype Time frame. The at tag value can be displayed on the diagram using the Tag symbol. | |
Lifeline | Lifelines represent a structural element (Part) of a system and a timeline flowing top to bottom:
When the symbol is placed on the drawing area the Name Symbol dialog is presented to allow you to enter a lifeline object name and to specify the structural element the Lifeline symbol represents. The structural element (i.e. «block » or «actor» element) is specified by the Referenced Element section as shown below. When producing a rapid prototype specify the Lifeline name and then later use the rename symbol option to specify the actual Block or Actor the Lifeline represents. When the Lifeline Referenced Element is later specified, using the Rename option, an internal link is created between the «lifeline» and the selected referenced element. The Lifeline name or Referenced Element name is displayed using the Hide replacement name checkbox in the Modelling sidebar. The Lifeline stereotype's specification has two special stereotype frames that can be used to define tags to be associated with the Lifeline on the diagram. The stereotype frames are displayed below along with the menus used to specify a Tag and its value. In the following example the user specified the Lifeline stereotype's specification has two special stereotype frames that can be used to define tags to be associated with the Lifeline on the diagram. The stereotype frames are displayed below along with the menus used to specify a Tag and its value. The {} Tag symbol was then used to display the after(00:00:14) Tag on a Lifeline as shown below: If you want to specify an actual stereotype element (i.e. «valueType») in the tag expression instead of a static value:
| |
Execution Specification | Execution Specification nodes are overlaid on Lifelines and correspond to executions by the Lifeline Block/Actor. When the Execution Specifications are nested, the control bars are stacked from left to right: | |
Alternative Combined Fragment | A combined fragment is one or more processing sequences enclosed in a frame and executed under specific named conditions. The Alternative Combined Fragment (denoted «Alt») models if…then…else constructs. Alternative Combined Fragment is used to designate a mutually exclusive choice between two or more sets of message sequences to be executed. An Alternative Combined Fragment element is drawn using a frame with the string «Alt» placed inside the frame's name box in the upper left corner with a user specified name. The combined fragment frame can be divided into what SysML calls operands (IF Then operand and Else operand) by selecting the frame and pressing the right mouse button and then selecting Swimlanes…. From the Swimlanes dialog specify two swimlanes which will divide the frame into two or more segments: top segment is the IF Then operand, and the bottom segment is the Else operand. Next, specify a guard condition for the If Then operand. During execution if this operand's guard equates to true, then that operand gets executed and the Else operand gets skipped. Set the guard using the «fragment» stereotype specification's GUARD frame. The first guard expression is displayed in the upper right corner of the IF Then operand. If there is a second guard expression in the Guard frame, it is displayed in the upper right corner of the Else operand. Finally, insert the desired messages into the appropriate operand area. | |
Loop Combined Fragment | A Loop Combined Fragment enclosed a series of messages which are repeated. A Loop Combined Fragment is drawn using a frame with the string «Loop» placed inside the frame's name box in the upper left corner with a user specified name: Next, specify a guard condition that specifies a minimum and maximum looping indicator. Set the guard using the «fragment» stereotype specification's GUARD frame. The guard expression is displayed in the upper right corner of the Operand. Finally, insert the desired messages into the fragment frame. | |
Optional Combined Fragment | The Optional Combined Fragment is used to model a sequence that, given a certain condition, will occur; otherwise the sequence does not occur. An option is used to model a simple if then statement. An Optional Combined Fragment is drawn using a frame with the string «Opt» placed inside the frame's name box in the upper left corner with a user specified name. Next, specify a guard condition for the If Then operand. During execution if this operand's guard equates to true, then the messages in the operand get executed, and if the condition equates to false the operands gets skipped. Set the guard using the «fragment» stereotype specification's GUARD frame. The guard expression is displayed in the upper right corner of the operand. Finally, insert the desired messages into the fragment frame. | |
Parallel Combined Fragment | The Parallel Combined Fragment needs to be used when creating an sd that shows parallel processing activities. A Parallel Combined Fragment is drawn using a frame with the string «Par» placed inside the frame's name box in the upper left corner with a user specified name: The Parallel Combined Fragment name must be divided into horizontal operands by selecting the frame and choosing Swimlanes… from the context menu. From the Swimlanes dialog specify the number of swimlanes which will divide the frame into parallel processes and provided optional names. In the following example three parallel processing areas are defined named Process A, Process B and Process C: Finally, insert the desired messages into the fragment frame parallel areas: | |
Interaction Use | An Interaction Use fragment reuses an existing sd. The Interaction Use fragment is drawn using a frame name placed inside the frame's name box in the upper left corner: The Name Symbol dialog allows the user to enter a name and to specify the name of the sd to be reused. The Referenced Element selection list in the Name Symbol dialog is used to select the reuse Sequence/Interaction diagram. After the Referenced Diagram is specified, the frame will be updated with the name of the Referenced Diagram. The user can double click on the fragment to launch the Referenced Diagram: | |
Create Object Message | The creation of an instance (i.e. an object) is indicated by the receipt of a Create Object Message. | |
Destroy Object | An object's destruction is indicated by the occurrence of a destroy event, an X on the Lifeline. | |
Found Message | A Found Message describes the case where there is a receiving event for the message but no sending event. The Name Symbol dialog allows the user to enter a message name and also optionally specify a Referenced Diagram«activity» or «signal». For a rapid prototype just define a message name. Later select the actual activity being invoked or signal being sent. The message element (i.e. specification stereotype) has the GUARD stereotype frame that can be used to define a guard expression to be associated with the message on the diagram. | |
Lost Message | A Lost Message describes the case where there is a sending event for the message but no receiving event. The lost message path is drawn as an arrow with an open arrowhead pointing to a solid circle. The Name Symbol dialog allows the user to enter a message name and also optionally specify a Referenced Element«activity» or «signal». For a rapid prototype just define a message name. Later select the actual activity being invoked or signal being sent. The message element (i.e. specification stereotype) has the GUARD stereotype frame that can be used to defined a guard expression to be associated with the message on the diagram. Use the Attributes checkbox in the sidebar to display the guard on the diagram. If the activity or signal parameters (cross reference linked elements using «has parameter» relationship) there is a parameters checkbox that will display the parameters in the Compartments section of the Modelling sidebar. | |
Synchronous Message | A Synchronous Message requests behaviour to be performed and then waits for it to complete. A Synchronous Message corresponds to the synchronous invocation of an operation (i.e. «activity»), and is generally accompanied by a Reply Message. The Reply Message can be explicit or implicit. When the symbol is drawn between two Lifelines, the Name Symbol dialog is presented to allow the user to enter a message name and to optionally specify a Referenced Element «activity». The «activity» element is specified by the Referenced Element selection menu. For a rapid prototype just define a message name. Later, the message Rename option can be used to specify the actual activity to be invoked. The message name or referenced element name is displayed on the diagram by using the Hide replacement name checkbox in the Modelling sidebar. The message stereotype specification has a GUARD stereotype frame that can be used to define a guard expression to be associated with the message on the diagram. Use the Attributes checkbox in the sidebar to display the guard on the diagram. If the activity has parameters (cross reference linked elements using «has parameter» relationship) there is a parameters checkbox that will display the activity's parameters in the Compartments section of the Control sidebar. | |
Asynchronous Message | Asynchronous Messages correspond to the sending of a «signal» that does not require a reply message. When the symbol is drawn between two Lifelines, the Name Symbol dialog is presented to allow the user to enter a message name and to optionally specify a Referenced Element «signal». The «signal» element is specified by the Referenced Element selection menu. For a rapid prototype just define a message name and then later the message Rename option can be used to specify the actual signal being sent. The message name or referenced element name is displayed on the diagram by using the Hide replacement name checkbox in the Modelling sidebar. The message stereotype specification has a GUARD stereotype frame that can be used to define a guard expression to be associated with the message on the diagram. Use the Attributes checkbox in the sidebar to display the guard on the diagram. If the signal has parameters (cross reference linked elements using «has parameter» relationship) there is a parameters checkbox that will display the signal's parameters in the Compartments section of the Control sidebar. | |
Reply Message | A Reply Message shows a reply to a synchronous operation/service call, together with any return arguments. A synchronous Reply Message is drawn as a dashed arrow with an open arrowhead. When the symbol is drawn between two Lifelines, the Name Symbol dialog is presented to allow the user to enter a message name and to optionally specify a Referenced Element «activity». The «activity» element is specified by the Referenced Element selection menu. For a rapid prototype just define a message name. Later, the message Rename option can be used to specify the actual activity to be invoked. The message name or referenced element name is displayed on the diagram by using the Hide replacement name checkbox in the Control sidebar. The message stereotype specification has a GUARD stereotype frame that can be used to define a guard expression to be associated with the message on the diagram. Use the Attributes checkbox in the Control sidebar to display the guard on the diagram. If the activity has parameters (cross reference linked elements using the «has parameter» relationship) there is a parameters checkbox that will display the activity's parameters in the Control sidebar. | |
State Invariant | A State Invariant on a Lifeline is often useful to add a constraint on the required state of a Lifeline at a given point in a sequence of event occurrences. The state (of a state machine) that the Lifeline is expected to be in is shown as a rounded corner rectangle. The state element (i.e. specification stereotype) has the EVENT stereotype frame that can be used to define tags associated with the state element. | |
Duration Marker | A Duration Marker identifies a time constraint on a Lifeline in which an execution specification occurs or one or more messages occur. The Name Symbol dialog allows the user to enter a name/label for the Duration Marker and also specify the subject Lifeline using the Referenced Element selection list. For a rapid prototype the user can just define a time constraint name to be displayed, and then later use the Referenced Element Lifeline to create a duration tag to be associated with the Duration Marker symbol. Select the attributes checkbox in the Compartments sidebar panel to display the tag duration. |
The symbols along with their default stereotypes, referenced elements, stereotype frames and cross reference link attributes are:
Symbol | Name | Default Stereotype | Referenced Element | Stereotype Frames or Cross Reference Link Attributes |
---|---|---|---|---|
Comment | None | None | None | |
Picture | None | None | None | |
Note Callout | None | None | None | |
Tag | None | None | None | |
Lifeline | «lifeLine» | «block» «actor» | Lifeline frame: CONSTRAINT Tag: constraint Lifeline frame: TIME Tag: after, Tag: a, Tag: duration @Ref can be used in any tag expression to specify an actual stereotype element in the tag expression | |
Execution Specification | None | None | None | |
Alternative Combined Fragment | «fragment» | None | Fragment frame: GUARD Tag: guard @Ref can be used in any tag expression to specify an actual stereotype element in the tag expression | |
Loop Combined Fragment | «fragment» | None | Fragment frame: GUARD Tag: guard @Ref can be used in any tag expression to specify an actual stereotype element in the tag expression | |
Optional Combined Fragment | «fragment» | None | Fragment frame: GUARD Tag: guard @Ref can be used in any tag expression to specify an actual stereotype element in the tag expression | |
Parallel Combined Fragment | «fragment» | None | None | |
Interaction Use | None | None | None | |
Create Object Message | None | None | None | |
Destroy Object | None | None | None | |
Found Message | «message» | «activity» «signal» | Message frame: GUARD Tag: guard @Ref can be used in any tag expression to specify an actual stereotype element in the tag expression. | |
Lost Message | «message» | «activity» «signal» | Message frame: GUARD Tag: guard @Ref can be used in any tag expression to specify an actual stereotype element in the tag expression. | |
Synchronous Message | «message» | «activity» | Message frame: GUARD Tag: guard @Ref can be used in any tag expression to specify an actual stereotype element in the tag expression. | |
Asynchronous Message | «message» | «signal» | Message frame: GUARD Tag: guard @Ref can be used in any tag expression to specify an actual stereotype element in the tag expression. | |
Reply Message | «message» | «activity» | Message frame: GUARD Tag: guard @Ref can be used in any tag expression to specify an actual stereotype element in the tag expression. | |
State Invariant | «state» | None | State frame: EVENT Tag: callEvent Tag: signalEvent Tag: at Tag: after Tag: when Tag: guard Tag: behaviourEffect @Ref can be used in any tag expression to specify an actual stereotype | |
Duration Marker | None | «lifeline» | Lifeline frame: CONSTRAINT Tag: constraint Lifeline frame: TIME Tag: after, Tag: a, Tag: duration @Ref can be used in any tag expression to specify an actual stereotype |