Rhapsody Sequence Diagram

Home > Articles > Software Development & Management > UML

  1. Basic Sequence Diagram Notation

Sequence Diagram (SD) Activity Diagram (AD) Class Diagram (CsD). Rhapsody Modeler is the only free 'industrial strength' product of its kind that allows developers. Apr 03, 2018 In rhapsody, when you want to create a sequence diagram of a use cases, you can use Harmony Toolkit that draws automatically do that, but in a generated Sequence diagram, Harmony Toolkit doesn't consider the 'include' and 'extend' relation between use cases. How can I solve this? Uml software-design use-case rhapsody. Timing diagrams represent timing data for individual classifiers and interactions of classifiers. You can use this diagram to provide a snapshot of timing data for a particular part of a system. Timing diagrams use lifelines from sequence diagrams, but are not directly correlated to the sequence diagram in IBM® Rational® Rhapsody®. Im using IBM Rational Rhapsody 7.6 for UML modeling. Iv'e created class diagrams, use cases, sequence diagrams and i want to export it to some kind of image or PDF or something, anything that is viewable in a nice way will do. When running simulations in IBM Rational Rhapsody, it's common for new users to end up with a proliferation of animated sequence diagrams open.

< BackPage 5 of 6Next >
This chapter is from the book
Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development, 3rd Edition

This chapter is from the book

This chapter is from the book

Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development, 3rd Edition

15.4 Basic Sequence Diagram Notation

Rhapsody Sequence Diagram

Lifeline Boxes and Lifelines

In contrast to communication diagrams, in sequence diagrams the lifeline boxes include a vertical line extending below them—these are the actual lifelines. Although virtually all UML examples show the lifeline as dashed (because of UML 1 influence), in fact the UML 2 specification says it may be solid or dashed.


Each (typical synchronous) message between objects is represented with a message expression on a filled-arrowed [3] solid line between the vertical lifelines (see Figure 15.7). The time ordering is organized from top to bottom of lifelines.

Figure 15.7 Messages and focus of control with execution specification bar.

In the example of Figure 15.7 the starting message is called a found message in the UML, shown with an opening solid ball; it implies the sender will not be specified, is not known, or that the message is coming from a random source. However, by convention a team or tool may ignore showing this, and instead use a regular message line without the ball, intending by convention it is a found message. [4]

Focus of Control and Execution Specification Bars

As illustrated in Figure 15.7, sequence diagrams may also show the focus of control (informally, in a regular blocking call, the operation is on the call stack) using an execution specification bar (previously called an activation bar or simply an activation in UML 1). The bar is optional.

Guideline: Drawing the bar is more common (and often automatic) when using a UML CASE tool, and less common when wall sketching.

Illustrating Reply or Returns

There are two ways to show the return result from a message:

  1. Using the message syntax returnVar = message(parameter).

  2. Using a reply (or return) message line at the end of an activation bar.

Both are common in practice. I prefer the first approach when sketching, as it's less effort. If the reply line is used, the line is normally labelled with an arbitrary description of the returning value. See Figure 15.8.

Figure 15.8 Two ways to show a return result from a message.

Messages to 'self' or 'this'

You can show a message being sent from an object to itself by using a nested activation bar (see Figure 15.9).

Figure 15.9 Messages to 'this.'

Creation of Instances

Object creation notation is shown in Figure 15.10. Note the UML-mandated dashed line. [5] The arrow is filled if it's a regular synchronous message (such as implying invoking a Java constructor), or open (stick arrow) if an asynchronous call. The message name create is not required—anything is legal—but it's a UML idiom.

Figure 15.10 Instance creation and object lifelines.

The typical interpretation (in languages such as Java or C#) of a create message on a dashed line with a filled arrow is 'invoke the new operator and call the constructor'.

Object Lifelines and Object Destruction

In some circumstances it is desirable to show explicit destruction of an object. For example, when using C++ which does not have automatic garbage collection, or when you want to especially indicate an object is no longer usable (such as a closed database connection). The UML lifeline notation provides a way to express this destruction (see Figure 15.11).

Figure 15.11 Object destruction.

Diagram Frames in UML Sequence Diagrams

To support conditional and looping constructs (among many other things), the UML uses frames. [6] Frames are regions or fragments of the diagrams; they have an operator or label (such as loop) and a guard [7] (conditional clause). See Figure 15.12.

Figure 15.12 Example UML frame.

The following table summarizes some common frame operators:

Frame Operator



Alternative fragment for mutual exclusion conditional logic expressed in the guards.


Loop fragment while guard is true. Can also write loop(n) to indicate looping n times. There is discussion that the specification will be enhanced to define a FOR loop, such as loop(i, 1, 10)


Optional fragment that executes if guard is true.


Parallel fragments that execute in parallel.


Critical region within which only one thread can run.


The LOOP frame notation to show looping is shown in Figure 15.12.

Rhapsody Sequence Diagram Template

Conditional Messages

An OPT frame is placed around one or more messages. Notice that the guard is placed over the related lifeline. See Figure 15.13.

Figure 15.13 A conditional message.

Conditional Messages in UML 1.x Style—Still Useful?

The UML 2.x notation to show a single conditional message is heavyweight, requiring an entire OPT frame box around one message (see Figure 15.13). The older UML 1.x notation for single conditional messages in sequence diagrams is not legal in UML 2, but so simple that especially when sketching it will probably be popular for years to come. See Figure 15.14.

Figure 15.14 A conditional message in UML 1.x notation—a simple style.

Guideline: Use UML 1 style only for simple single messages when sketching.

Activity diagram

Mutually Exclusive Conditional Messages

Rhapsody Sequence Diagram Analysis And Design

An ALT frame is placed around the mutually exclusive alternatives. See Figure 15.15.

Figure 15.15 Mutually exclusive conditional messages.

Iteration Over a Collection

A common algorithm is to iterate over all members of a collection (such as a list or map), sending the same message to each. Often, some kind of iterator object is ultimately used, such as an implementation of java.util.Iterator or a C++ standard library iterator, although in the sequence diagram that low-level 'mechanism' need not be shown in the interest of brevity or abstraction.

At the time of this writing, the UML specification did not (and may never) have an official idiom for this case. Two alternatives are shown—reviewed with the leader of the UML 2 interaction specification—in Figure 15.16 and Figure 15.17.

Figure 15.16 Iteration over a collection using relatively explicit notation.

Figure 15.17 Iteration over a collection leaving things more implicit.

Note the selector expression lineItems[i] in the lifeline of Figure 15.16. The selector expression is used to select one object from a group. Lifeline participants should represent one object, not a collection.

In Java, for example, the following code listing is a possible implementation that maps the explicit use of the incrementing variable i in Figure 15.16 to an idiomatic solution in Java, using its enhanced for statement (C# has the same).

Sequence Diagram Adalah

Another variation is shown in Figure 15.17; the intent is the same, but details are excluded. A team or tool could agree on this simple style by convention to imply iteration over all the collection elements. [8]

Nesting of Frames

Frames can be nested. See Figure 15.18.

Figure 15.18 Nesting of frames.


How to Relate Interaction Diagrams?

Figure 15.19 illustrates probably better than words. An interaction occurrence (also called an interaction use) is a reference to an interaction within another interaction. It is useful, for example, when you want to simplify a diagram and factor out a portion into another diagram, or there is a reusable interaction occurrence. UML tools take advantage of them, because of their usefulness in relating and linking diagrams.

Figure 15.19 Example interaction occurrence, sd and ref frames.

They are created with two related frames:

  • a frame around an entire sequence diagram [9] , labeled with the tag sd and a name, such as AuthenticateUser

  • a frame tagged ref, called a reference, that refers to another named sequence diagram; it is the actual interaction occurrence

Interaction overview diagrams also contain a set of reference frames (interaction occurrences). These diagrams organized references into a larger structure of logic and process flow.

Guideline: Any sequence diagram can be surrounded with an sd frame, to name it. Frame and name one when you want to refer to it using a ref frame.

Rhapsody Sequence Diagram

Messages to Classes to Invoke Static (or Class) Methods

You can show class or static method calls by using a lifeline box label that indicates the receiving object is a class, or more precisely, an instance of a metaclass (see Figure 15.20).

Figure 15.20 Invoking class or static methods; showing a class object as an instance of a metaclass.

What do I mean? For example, in Java and Smalltalk, all classes are conceptually or literally instances of class Class; in .NET classes are instances of class Type. The classes Class and Type are metaclasses, which means their instances are themselves classes. A specific class, such as class Calendar, is itself an instance of class Class. Thus, class Calendar is an instance of a metaclass! It may help to drink some beer before trying to understand this.

In code, a likely implementation is:

Polymorphic Messages and Cases

Polymorphism is fundamental to OO design. How to show it in a sequence diagram? That's a common UML question. One approach is to use multiple sequence diagrams—one that shows the polymorphic message to the abstract superclass or interface object, and then separate sequence diagrams detailing each polymorphic case, each starting with a found polymorphic message. Figure 15.21 illustrates.

Figure 15.21 An approach to modeling polymorphic cases in sequence diagrams.

Asynchronous and Synchronous Calls

An asynchronous message call does not wait for a response; it doesn't block. They are used in multi-threaded environments such as .NET and Java so that new threads of execution can be created and initiated. In Java, for example, you may think of the Thread.start or Runnable.run (called by Thread.start) message as the asynchronous starting point to initiate execution on a new thread.

The UML notation for asynchronous calls is a stick arrow message; regular synchronous (blocking) calls are shown with a filled arrow (see Figure 15.22).

Figure 15.22 Asynchronous calls and active objects.


Rhapsody Sequence Diagram Tutorial

This arrow difference is subtle. And when wall sketching UML, it is common to use a stick arrow to mean a synchronous call because it's easier to draw. Therefore, when reading a UML interaction diagram don't assume the shape of the arrow is correct!

Rhapsody Sequence Diagram Execution Occurrence

An object such as the Clock in Figure 15.22 is also known as an active object—each instance runs on and controls its own thread of execution. In the UML, it may be shown with double vertical lines on the left and right sides of the lifeline box. The same notation is used for an active class whose instances are active objects.

In Java, a likely implementation for Figure 15.22 follows. Notice that the Thread object in the code is excluded from the UML diagram, because it is simply a consistent 'overhead' mechanism to realize an asynchronous call in Java.