Update on UML modeling features in IBM Rational Software Architect Version 8.0: Part 2. UML modeling enhancements

This article, the second in a three-part series, highlights some of the new functionality in the UML modeling components of Rational Software Architect Version 8.0 and explains how to take advantage of several recently added features. It describes enhancements to the Project Explorer view, the improved model search, improvements made to model validation and refactoring, the smoother experience when working with model fragments, additional functionality when working with UML profiles, and modeling viewpoints. It also describes support for changes in the UML specification

Wayne Diu, Software developer, IBM Canada

Wayne DiuWayne Diu is an IBM Rational software developer. He has designed and implemented Unified Modeling Language (UML) features on the Rational Modeling Platform, such as server integration and model search. In addition, Wayne was one of the developers responsible for establishing the metamodel integration framework platform. Wayne has also developed a diverse collection of other tool features such as printing, validation marker enhancements, and refactoring support.


developerWorks Contributing author
        level

16 November 2010

Also available in Chinese Portuguese

In addition to diagram enhancements and general changes in the Modeling perspective, numerous changes have been made to improve productivity and to comply with the UML specification.

Project Explorer enhancements

Filtering by name

In the Project Explorer, it is possible to display a text box that allows you to quickly filter out elements that do not interest you. Although working sets are useful in enabling filtering by entire models or projects, this textual element name filter is particularly handy if you have a large model, and you wish to see the elements of interest within it. Thus, this filter is more fine-grained.

  1. To activate the filter, click the Show/Hide Filter Box button in the Project Explorer's toolbar.
  2. Now, type some text in the filter box and press the Enter key on your keyboard.

Elements not matching the text string will be filtered out.

Tips:

  • If there are multiple elements matching your filter, use the Up or Down buttons to the right of the filter box to navigate between them.
  • In addition, for even quicker access, simply click the element of interest in the pop-up window to navigate to it immediately.
  1. To determine whether the name filter should be taken into account, click the Down arrow button in the Project Explorer and choose Customize View.
  2. In the Filters tab of the Available Customizations dialog, check or uncheck Name Filter. If Name Filter is not checked, you will not be able to show the filter box.
Figure 1. Filtering by 'Util'
The filter results list in a pop-up box

Larger view of Figure 1.

The textual filter can also be programmatically extended to support custom EMF EObjects. To extend it, implement this interface:

com.ibm.xtools.common.ui.navigator.filters.INameFilterHelper

Grouping by diagram types

Previously, the Diagrams virtual folder contained a list of all of the diagrams for a given model. Now, the diagrams are grouped by their types.

Showing the physical location of model files

In some workflows, you might have models stored within subfolders of a project. Traditionally, the Project Explorer has displayed all of the models as children directly underneath the project. This became confusing if many of the models were given the same name. For example, if you created a Helper.emx model in each folder, it would become difficult to tell them apart.

Now it is possible to show the models and profiles with respect to the folder structure:

  1. Click Window > Preferences and choose Views >Project Explorer
  2. Then, check the check box labelled Show UML model and profile under its physical workspace file.

Note:
If you have UML Model files and UML Profile files filtered in the Filters tab of the Available Customizations view, those files will be hidden. Do not turn on the filters for UML Model files and UML Profile files if the Show UML model and profile under its physical workspace file preference is enabled, because the models and profiles will become completely hidden from your workspace.

  1. To further emphasize the physical location of the file, it is possible to display the workspace path of the resource next to the root resource's name:
  2. Show the Preferences view, and choose Modeling >Views > Project Explorer. The Display workspace path in labels drop-down menu allows you to choose one of three options (see Figure 2):
    • None
    • For models and profiles
    • For models, profiles, and fragment roots

The last two options will result in the resources' physical locations being displayed in the Project Explorer.

Figure 2. Project Explorer Preferences view
The Preferences options in the Project Explorer

Working with the enhanced Element Imports functionality

When working with Element Imports, we are usually more concerned about the imported element, not the Element Import itself. Thus, several changes have been made to focus on the imported element, not the Element Import:

  • The Element Import no longer displays the name of the imported element in brackets so that it will sort with the rest of the directly contained elements in the Project Explorer. In fact, if the Project Explorer is set to sort by Type then Alphabetical or Type then Storage Order, the sorting will be by the type of the imported element.
  • If you select the Element Import / imported element in the Project Explorer, you will now see the properties of the imported element in the pop-up properties and in the Properties view. If you are interested in seeing the properties of the Element Import, choose Element Import Properties from the context menu. Alternatively, visualize the Element Import on the diagram and show its properties.
  • The icon of the imported element (rather than an Element Import icon) is shown in the Project Explorer. A small shortcut icon will appear at the bottom-left of the icon to indicate that it is an Element Import.
  • When adding new elements under the Element Import, you will be adding directly to the imported element, rather than having to navigate back to the original element. Similarly, when deleting the element under the Element Import, you will be deleting from the element import directly. In other words, the focus will be preserved in both cases.
  • Navigating to the Project Explorer from diagrams, properties, and the Inheritance Explorer will make a better choice of selecting the element underneath the Element Import.
  • It is possible to view the contents of the Element Import even if the element belongs to a model that has been filtered out by a working set. If you want to navigate to the actual element filtered out by a working set, and there is no corresponding imported element in context, you will get a message that notifies you of this.

FormatHelper and Point are both Element Imports (see Figure 3), so they appear with a shortcut decoration in the Project Explorer. Also, the properties displayed are for the imported element, not the Element Import.

Figure 3. Displaying the properties of an Element Import
A pop-up properties dialog box on the diagram

Larger view of Figure 3.


Search enhancements

Working sets are now supported by the Search infrastructure. It is possible to drag from the search results onto the diagram surface. Also, expanding a search result will show the references to the element.

Two new columns have been added:

  • The element type has been moved into a separate column for easier sorting.
  • A new column indicates the last modification date.

Finally, search results are now contributed by using a public provider mechanism defined in com.ibm.xtools.rmp.ui.search, which allows programmatically contributing to the search results.

Figure 4. Using working sets on the model search page
The Select Working Set sequence

Larger view of Figure 4.


Validation improvements

Communicating validation results

The results of model validation are communicated visually to the user. Validation errors and warnings are now shown on diagram elements representing elements that have validation problems.

You can validate your model by performing one of the following series of steps:

  1. From the menu bar, select Modeling > Run Validation.
  2. From the context menu of the element in the Project Explorer, choose Validate.
  3. From the context menu of the element on the diagram, choose Validate.

As Figure 5 shows, hovering your mouse cursor over the validation decorator on the diagram element (a yellow exclamation or a red X) will display a pop-up message that describes the problem.

Figure 5. Hovering the mouse cursor over the validation decorator
A tool tip on a diagram

Larger view of Figure 5.

A Problems on Selection dialog has been added in case you need further details. It shows a list of problems for the selection and gives you the chance to see details about the constraint that was violated (by pressing the Constraint Definition(s) button) or to perform quick fixes on the problems (by pressing the Quick Fix button). It is available from any element with validation errors or warnings, for elements in both the Project Explorer and on the diagram.

Figure 6. The Problems on Selection dialog contains the relevant markers
Element and Marker columns with lists

Larger view of Figure 6.

Repairing workspace references when the model is opened

In previous versions, when a model with broken references is opened, the Repair Workspace Reference dialog opened. There, you were given the choice of attempting to repair it automatically, marking the problems, or ignoring the broken references. The Repair button searched only the immediate projects. Now, however, an additional check box has been added so that you can search the entire workspace. The search will even detect models in closed projects and prompt you to open them if necessary.

Figure 7. Repair Workspace References screen displays two problems
Two radio button choices: Repair or Mark problems

Validation rules added

Several validation rules have been added, and these are covered later under Validation rules in the Sequence diagram subsection.


Easier refactoring

Previously, when you refactored an element (renamed or moved), you could preview the changes and individually choosing the resources that should be updated. When there are many affected elements, it became tedious to select the resources to be updated. Now, you can set the initial scope beforehand, as a shortcut. The three supported scopes are workspace, project, or model.

Figure 8. Use the refactoring wizard to choose a supported scope
The Rename wizard with Workspace selected

Larger view of Figure 8.


Model fragments

Model fragments are handled more seamlessly than before. The context is preserved in the Project Explorer.

When reloading a model or model fragment that has been modified outside of the workspace, the focus in the Project Explorer is now preserved. Also, if a fragment is modified on disk, only the modified fragment is reloaded, not the entire model. For example, if you are using dynamic views, fragments and models can be changed by other users while you have the model loaded into memory. When this occurs, the context in the Project Explorer will be kept, so you spend less time trying to find your place in the model after loading fragments. This ensures a smoother workflow even when the model contents change and the model is reloaded.

Opening multiple subfragments at once

When working with a large model, portions of the model are typically fragmented into separate resources for better performance and to reduce the possibility of merge conflicts. By not opening the subfragments, less of the model is loaded into memory. This yields better performance. However, modelers with powerful machines might prefer to open all fragments immediately to eliminate the delay in case the fragment is loaded into memory later on. To accommodate this, the Open All Sub-fragments action now supports multiple selections so that you can select all the required fragments and open them all at once. Result: the time taken to load the fragments is spent upfront.

Figure 9. The Open All Sub-fragments action
The Project Explorer drop-down menu

Larger view of Figure 9.


Profiles

Profiles are used to enable domain-specific modeling: they allow UML to be extended to suit a particular domain. Frequently, the same UML model is extensible to a variety of different domains. For example, the system to keep track of loyalty points might be essentially the same between two airline brands, with a few minor differences in the way that things are named and certain attributes or operations that are company-specific. Or different viewpoints into the same system might require different profiles. For example, the financial auditing domain and the reservations domain are two largely unrelated fields that focus on very different aspects, or viewpoints, of the same system. Perhaps the number-crunching auditors do not want to share their auditing criteria or attribute values with the reservations analysts, while the reservations gurus do not want to share their formulas on when to offer loyalty discounts.

Marking models

Traditionally, it has been necessary to apply the profile directly onto the model to allow domain-specific modeling. For multiple domains, there was not much choice; you had to apply multiple profiles onto the same model or duplicate the model and apply a separate profile onto each one. In the former case, the model would then have irrelevant and potentially sensitive profiles; in the latter, the models could easily get out of sync.

Starting with Version 8, Rational Software Architect supports the concept of marking models: models that import a package and store the data regarding applied profiles and stereotypes on the imported packages. Packages are imported by using an Element Import stereotyped with the Marking Import stereotype. The profiles applied onto the marking model is applied virtually to the imported package, thus stereotypes can be applied onto the imported packages and their contents. When you apply stereotypes onto the imported package, only the marking model is modified, not the actual package's resource.

Figure 10. Use the New Model wizard template to create a new marking model
The Project Explorer context menu

Larger view of Figure 10.

To have access to the profile information, the applied profiles and resources that contain the imported packages need to be distributed, in addition to the marking model.

Note:
If you are launching a runtime environment, be sure that the following settings are present in the arguments to enable support for marking models:

-Dorg.eclipse.uml2.uml.util.UMLUtil$ProfileApplicationHelper.INSTANCE=
   com.ibm.xtools.modeler.ui.marking:com.ibm.xtools.modeler.ui.marking.internal.
   ModelerProfileApplicationHelper

-Dorg.eclipse.uml2.uml.util.UMLUtil$StereotypeApplicationHelper.INSTANCE=
   com.ibm.xtools.modeler.ui.marking:com.ibm.xtools.modeler.ui.marking.internal.
   ModelerStereotypeApplicationHelper

Stereotype properties

Stereotype properties can now be displayed on diagrams in either of these two ways:

  1. The first way is to right-click to show the context menu of the diagram element and then select Filters >Stereotype and Visibility Style > Show Stereotype Compartment When Not Empty. This makes visible the stereotype compartment that contains the names and values of the attributes.
  2. The second way is by adding a Stereotype Attribute Note in either of these ways:
    1. Right-click the element with the stereotype, and select Add UML > Stereotype Attribute Note. A note attached to the original stereotyped element will be added.
    2. Alternatively, from the palette:
      1. Select the UML Common palette drawer (see Figure 11).
      2. In the Comment palette group, choose the Stereotype Attribute Note Attachment tool item.
      3. Then click the stereotyped element and drag the cursor to a blank area of the diagram.
      4. In the ensuing context menu, choose Create Stereotype Attribute Note Attachment to new Element: Stereotype Attribute Note.
Figure 11. Displaying stereotype properties
A UML diagram

Larger view of Figure 11.

Property sets

Property sets are used to group a collection of attributes (or properties). They supercharge the functionality of profiles and simplify application of stereotypes. A property set profile is applied to a package in a model (or the model root). Stereotypes in a property set profile are similar to required stereotypes in that they are implicitly applied to the elements of the specified metaclass. Also, it is possible to save sets of values and apply them to quickly replace the defaults defined in the profile.

To create a property set profile:

  1. First, create a normal UML profile, and then apply the deployed Property Set profile to it.
  2. Next, apply the PropertyProfile stereotype to the root of the profile.
  3. Now you are ready to add stereotypes. As you add stereotypes, you will find that each stereotype of the profile has the Set stereotype applied to it automatically.

Notes:

  • For every stereotype that you create, you must add a metaclass extension to the package in addition to any other desired metaclass extensions. This is because the stereotypes in property set profiles are to be applied to packages; the contents of the package where the stereotype is applied will automatically have the relevant stereotypes applied.
  • The PropertyProfilestereotype and the Set stereotype both contain properties called category, but their intended use is different. The PropertyProfile category is intended to describe a broader category, such as a language (Unified Auditing Language), while the Set category is to correspond to a specific type within the language (Class). The Set's category is important, because if it does not mach, the property set's UI will not show.

After creating the property set profile, it is to be applied to a model or package. When you browse the model, relevant elements inside the model will have a Property tab labelled Property Sets. From there, you can set the desired values. If you change the values from the defaults, the corresponding stereotype will be automatically applied to the element. (Also, the attribute name will appear in bold to indicate that the stereotype has been changed.) Clicking the Apply Defaults button will restore the default values and reverse the automatically applied stereotype.


UML compliance

Two new UML diagrams described in the UML specification are now supported in Rational Software Architect: the interaction overview diagram and the timing diagram. In addition, support for several new elements has been added, which are described in the following subsections.

Interaction overview diagram

The interaction overview diagram can be thought of as an activity diagram that has been restricted to control flows and embedded sequence diagrams. Thus, they are useful in expressing control flows, as well as the individual interactions that occur. Sequence diagrams that appear on interaction overview diagrams do not have to be created from scratch; you can reuse existing ones and either drag them onto the interaction overview diagram or select the Interaction Reference palette tool from the Interaction Overview palette drawer.

To work with the contents inside the referenced sequence diagrams (called the Interaction Reference), from the context menu of the interaction reference diagram element, select Filters > Show Inline Sequence Diagram.

Figure 12. An interaction overview diagram
Interaction overview diagram tab with UML diagram

Larger view of Figure 12.

Timing diagram

The timing diagram portrays lifelines across a period of time. The vertical axis represents time in sequence diagrams, but the timing diagram uses the horizontal axis to represent time. States or conditions are added to the horizontal lifelines to represent changes in states or conditions over time. As with sequence diagrams, there is the concept of messages. However, because the focus is on states and conditions over time, the messages are sent between these states or conditions.

Figure 13. A timing diagram
A payment collection timing diagram

Larger view of Figure 13.

Sequence diagrams

The UML Modeler component now adds support for lost messages and found messages.

Lost messages and found messages

To comply with the UML specification, it is now possible to create lost messages and found messages.

  • To create a lost message, drag the message to an empty area of the diagram.
  • To create a found message, drag the message, starting from an empty area of the diagram.
Figure 14. Lost and Found messages in a sequence diagram
Check-in Sequence Diagram tab view

Larger view of Figure 14.

Refactorings

Deleting a message's referenced signal or operation updates the name of the message to \Unspecified\ on the sequence diagram, in addition to removing the referenced signal or operation. You can rename the message as you wish.

Moving an operation from one class to another yields the same result unless the operation is moved to a superclass and is still visible from the class where it is invoked. Again, in this case, the messages between lifelines will be set to \Unspecified\.

Validation rules

If you had diagrams where you performed such refactorings before these enhancements, you can still benefit. As an example, suppose you open a diagram where you previously moved an operation corresponding to a message on a sequence diagram from one classifier to another. As a result, the diagram now contains an invalid message.

A validation rule to handle invalid messages in sequence diagrams has been introduced. The constraint for this rule can be found in this UML 2.2 specification:

UML 2.2 > UML 2.2 Specification > Interactions Package > Messages > Message signature operation should be contained in target lifeline classifier

When invoking a private operation and validating the model, a warning is now generated when validating the model. The validation constraint is controlled by UML 2.2 private operation call specification:

UML 2.2 > UML 2.2 Specification > Interactions Package > Messages > Private operation call (or UML 2.2 > Model Quality Dimensions > Correctness > Private operation call).

Tip:
To see the constraint definition, as well as to enable or disable the constraint, select the Preferences view, and then, select Model Validation >Constraints.

Figure 15. The Model Validation, Constraints page in the Preferences view
Private operation call

Activity diagrams

Start Object Behavior action

The Start Object Behavior action element is now supported. To create a Start Object Behavior Action:

  1. Select the Actions palette drawer.
  2. Choose the Start Object Behavior tool item from the Object Actions tool group.

Tip:

You can also find the Start Object Behavior action in the Object Action submenu in the Add UML context menu.

Figure 16. A Start Object Behavior in an activity diagram
Activity Diagram tab view

Larger view of Figure 16.

State machine diagram

Entry and exit points

It is now possible to add entry points and exit points to the borders of composite states and orthogonal states.

  1. To do so, add a composite state or orthogonal state to the state machine (from the State Machine palette drawer, select the State types group, and then select either Composite State or Orthogonal State).
  2. Then, from the State Machine palette drawer, choose the Pseudostate Types tool group, followed by Entry Point or Exit Point.

Tip:

You can also find Entry Point or Exit Point options in the Add UML context menu.

Any Receive Event

The Any Receive Event action is now supported.

  1. To add an Any Receive Event, first add a transition to a state's region.
  2. From the properties of the transition, activate the Triggers tab, and then click the Add button.
  3. In the Event Type drop-down menu, choose Any Receive Event.
  4. Click the OK button.
Figure 17. Selecting an Any Receive Event in a sequence diagram with an entry point and an exit point
The Add Trigger dialog window

Larger view of Figure 17.


Viewpoints

Viewpoints have been enhanced to support an active language. It is also possible to share viewpoints, and an API has been added to the extension point to better support viewpoint use among different domains.

Active language

It is now possible to associate the active language with a viewpoint. In the Preferences dialog window (Modeling > Viewpoints page, shown in Figure 18), a new tab titled Active Language is now available. It can be used to configure the default language for user-defined viewpoints.

Figure 18. The Active Language tab on the Viewpoints preference page
The Viewpoints dialog window

Exporting and importing viewpoints

Additionally, viewpoints can now be shared. On the Viewpoints preference page, two buttons have been added to support importing and exporting viewpoints. Click Export on the Viewpoints preference page to display the "Export viewpoints" window.

Figure 19. "Export viewpoints" dialog window
Activated within the Viewpoints window

Compare Merge enhancements

Improved alias support

When merging two versions of a model where the alias has been modified, the revision now shows as a single Modify change rather than an Add and Delete pair of changes.

Figure 20. Merging a model where the alias has been changed
The Compare Merge editor

Larger view of Figure 20.

Option added to filter the export log

When you perform a merge session, it is possible to filter the display to hide the changes that you are not interested in. When you click the Save List of Changes button, a Save Changes dialog window will now be displayed before the file is generated. With this dialog's options, you can decide whether you would like the filter settings to be applied to the log file or not.

Figure 21. The Save Changes dialog window in a merge session
'Currently visible deltas on delta tree' selected

Larger view of Figure 21.


What's next

This article provided an overview of the new functionality in the UML Modeler component of Rational Software Architect Version 8.0. By taking advantage of these enhancements, you will be able to model more effectively and efficiently, with an emphasis on clearer diagrams, problem prevention and resolution, and workflows that support collaboration.

The next and last article in this series describes important API changes and additions that allow extending Rational Software Architect features.


Acknowledgements

The author expresses his gratitude to Dusko Misic and Michael Hanner for reviewing this article and to Judith Broadhurst for editing.

Resources

Learn

Get products and technologies

Discuss

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Rational software on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational
ArticleID=577181
ArticleTitle=Update on UML modeling features in IBM Rational Software Architect Version 8.0: Part 2. UML modeling enhancements
publish-date=11162010