 | Level: Intermediate Scott Cowan (scowan@ca.ibm.com), Advisory Software Developer, IBM Japan
29 Apr 2008 This article demonstrates how to use traceability queries by using IBM® Rational® RequisitePro and IBM® Rational® Systems Developer, and explores an address book project as an example.
About this article
Traceability is the ability to trace artifacts through all levels of
abstraction, from specification to implementation and vice versa. Impact
analysis is the ability to analyze the potential impact of a change to a
system through all levels of abstraction, as well as within each level of
abstraction.
Given a context element, traceability offers these types of queries:
- Specifications
- Implementations
Given a context element, these types of queries affect analysis:
This article demonstrates how to use each of these queries by using an address
book project as an example.
Prerequisites
You need the following software installed before beginning this article:
- Microsoft® Windows®
- IBM® Rational® RequisitePro®, Version 6.0.1.1
- Microsoft® Access®
- IBM® Rational® Systems Developer, Version 7.0.5, or IBM
Rational Software Modeler, Version 7.0.5
Address book example
The example used here to demonstrate traceability and impact analysis is a system
of requirements, models, and Java™ code that implement an address book.
- In Lesson 1, you build a RequisitePro project of requirements.
- For Lesson 2, you create a UML project and an analysis model of use cases from
those requirements and establish traceability back to the requirements. You also
create a design model further refining the use cases with collaborations and UML
classes and establish traceability back to the use cases.
- In Lesson 3, you create a Java project, transforms the UML classes to Java
classes, and establish traceability from the Java classes back to the UML
classes. In each of these three lessons, there are two sections: The first
section explains how to unzip and open or import the project. and the second
section describes how to create the project.
- Lessons 4 and 5 demonstrate what the traceability and impact analysis queries
are for, what is expected from each query and example results using the Address
Book system. To quickly get through lessons 1, 2, and 3 follow the first section
of each.
Address book requirements
The user needs to be able to store contact information in an address book. Each
contact needs to be able to maintain a contact's name and phone number.
The user should be able to change a contact's information and also add
and remove contacts to and from the address book.
Lesson 1. Create the
RequisitePro Address Book project
This lesson demonstrates how to unzip or create a Rational RequisitePro Address
Book project and the requirements for the address book.
Unzip and open the Address Book
RequisitePro Project file
- Unzip the Address Book RequisitePro Project.zip file (from Downloads)
to C:\RequisitePro Projects\.
- Follow the Steps 11 through 17 in the next subsection to open the
project.
Create the Address Book project
- Start Rational RequisitePro (see Figure 1).
Figure 1. Rational RequisitePro
screen
- Click File > New > Project (Figure 2).
Figure 2. Create a new project
- When the Create Project dialog opens (Figure 3), select Composite
Template.
Figure 3. Create Project dialog
in RequisitePro
- Click OK.
- When the Rational RequisitePro Project Properties dialog opens (Figure 4), in
the Name field, enter
Address Book, and in the
Directory field, use the Browse button to select
C:\RequisitePro
Projects\Address Book.
- From the Database drop-down menu, select MS Access, and then click
OK.
Figure 4. Project Properties
dialog
- When a dialog opens and asks if you want to create the directory, click
Yes, and wait for the project creation to finish.
Figure 5. Dialog to create the
project directory
- Click Close.
Figure 6. Confirmation notice
that the project has been created
- When the Project Logon dialog opens, click Cancel.
Figure 7. Project Logon screen
- Exit Rational RequisitePro.
- Start Rational Systems Developer.
- When the Workspace Launcher dialog opens, enter
C:\workspace in the Workspace field, and then click
OK.
Figure 8. Workspace Launcher
dialog
- Click Window > Open Perspective > Requirement to open
the Requirement perspective.
Figure 9. Requirement
perspective
- In the Requirement Explorer (Figure 10), click the Open a RequisitePro Project
icon:
Figure 10. Requirement
Explorer view
- When the Open a RequisitePro Project dialog appears (Figure 11), in the
"File name" field, use the drop-down menu to select
C:\RequisitePro Projects\Address Book\Address
Book.rqs,
and then click Open.
Figure 11. Open a RequisitePro
Project dialog
- When the Project Logon dialog opens, click OK.
Figure 12. Project Logon
screen
- Expand the Address Book project folder and then the Use Cases
folder under that (Figure 13).
Figure 13. Requirement
Explorer with both folders expanded
- From the Use Cases drop-down menu (Figure 14), click Create Requirement by
type > UC requirement, and then enter this requirement name:
Change contact.
Figure 14. Use Cases drop-down
menu
- Create two more use case requirements with these names:
Add contact and
Remove
contact (see Figure 13).
Figure 15. Create additional
use cases
Lesson 2. Create the UML
Address Book project
This lesson demonstrates how to unzip or create an Address Book UML project, an
Analysis and Design model, and sequence diagrams and classes, including
traceability to the requirements.
Unzip and import the Address Book UML
project
- Unzip the Address Book UML Project.zip (from Downloads) file to the workspace:
C:\workspace\
- Click Window > Open Perspective > Modeling to open the
Modeling perspective.
- Click File > Import.
- When the Import dialog opens, expand the General folder and select
Existing Projects into Workspace.
- Click Next.
- In the "Select root directory" field, enter
C:\workspace.
- Press Enter and then click Finish.
- In the Project Explorer, expand Address Book and then Models.
- From the Design model drop-down menu, click Open.
Create the Address Book UML project
- Click Window > Open Perspective > Modeling.
Figure 16. Path to open the
Modeling perspective
- After the modeling perspective opens, click File > New >
Project.
Figure 17. Creating a new
project in the Modeling perspective
- In the New Project wizard that opens, under Wizards, expand Modeling
and select Model Project.
- Click Next.
Figure 18. Selecting a new
model project
- In the Project name field, enter
Address Book.
- Click Next.
Figure 19. Name the model
project
- Complete the required information:
-
Categories list: Select General
-
Templates list: Select Blank Model
-
File name field: Enter
Analysis
- Click Finish.
Figure 20. Complete the model
project specifications
A new Address Book project that contains and Analysis model will be created.
- In the Project Explorer, expand Address Book and Models.
- In the Main diagram of the Analysis model, expand the Use Case
drawer in the Palette, and select Use Case.
- Control-click in the Main diagram 3 times to create 3 use cases. Name them:
-
Add contact
-
Remove contact
-
Change contact
Figure 21. Main diagram tab of
the Analysis model
- Click Window > Show View > Requirement Explorer to open
the Requirement Explorer.
Figure 22. Requirement
Explorer view
- From the Project Explorer, drag and drop the Change Contact use case
onto the Change Contact use case requirement.
- Drag the remaining two use cases onto the use case requirements with the same
names. The use cases and the use case requirements icons are annotated with a
small arrow to indicate they are linked.
Note:
These links trace the use cases to the use case requirements.
- Click File > Save to save the Analysis model.
- In the Project Explorer, select the Address Book project.
- Click File > New > Other.
Figure 23. Open the New wizard
- After the New wizard opens, expand Modeling and select Model in
the Wizards tree.
- Click Next.
Figure 24. Select the Model wizard under the Modeling folder
- Click Next again.
Figure 25. Create Model view
- Complete the required information:
-
Categories list: Select General
-
Templates list: Select Blank Model
-
File name field: Enter
Design
- Click Finish.
Figure 26. Select General in Categories and Blank Model in Templates
A new Design model is created in the Address Book project.
- In the Design model drop-down menu, click Add Diagram > Sequence
Diagram to create a new collaboration that contains a new sequence
diagram.
- In the Project Explorer, rename the Collaboration to
Change contact.
- Create an Unspecified lifeline on the diagram and name it
user.
- Create another lifeline, but for this one, click Create Class. Enter
the class name,
Contact and give the
lifeline the name contact.
- Create an Option Combined Fragment over the user and contact
lifelines, and name it
set name.
- Within the set name option combined fragment, create a Synchronous
Message from user to contact.
- When the "Enter operation name and owner" dialog opens:
- In the "Operation name" field, enter
setName.
- From the Operation owner drop-down menu, select Contact
- Click OK.
- Create another Option Combined Fragment over the user and contact lifelines,
and name it
set phone number.
- Within the set phone number option combined fragment, create a
Synchronous Message from user to contact and select Create New
Operation.
- When the "Enter operation name and owner dialog" opens:
- In the "Operation name" field, enter
setPhoneNumber.
- From the Operation Owner drop-down box, select Contact.
- Click OK.
Figure 27. SequenceDiagram1 view showing results
- In the Design model drop-down menu, click Add Diagram > Sequence
Diagram.
A new collaboration is created that contains a new sequence diagram.
- In the Project Explorer, rename the Collaboration to
Add contact.
- Create an Unspecified lifeline on the diagram and name it
user.
- Create another lifeline, but, for this one, click Create Class. Enter
the class name
AddressBook and give the lifeline the
name addressBook.
- Create a Synchronous Message from user to addressBook.
- When the "Enter operation name and owner" dialog opens:
- In the "Operation name" field, enter
addContact.
- From the Operation owner drop-down box, select AddressBook.
- Click OK.
Figure 28. Results for Interaction1 input
- In the Design model drop-down menu, click Add Diagram > Sequence
Diagram.
A new collaboration is created that contains a new sequence diagram.
- In the Project Explorer, rename the Collaboration to
Remove contact.
- Create an Unspecified lifeline on the diagram and name it
user.
- Create another lifeline, but, for this one, click Select Existing
Element. Select AddressBook and give the lifeline the name
addressBook.
- Create a Synchronous Message from user to addressBook and
select Create New Operation.
- When the "Enter operation name and owner" dialog opens:
- In the "Operation name" field, enter
removeContact.
- From the "Operation owner" drop-down menu, select
AddressBook
- Click OK.
Figure 29. Results for Operation name and Operation owner
- Close and save the sequence diagrams.
- On the Design model, open the Main diagram and complete these steps:
- Drag the three use cases from the Analysis model onto this diagram.
- Drag the three collaborations onto this diagram.
- In the drop-down menu of each collaboration view on the Main diagram,
uncheck Filters > Show/Hide Compartment > Structure
Compartment.
- Create a Realization relationship from each collaboration to each
use case with the same name.
Note:
These realizations trace from the collaborations to the use
cases.
Figure 30. Main diagram showing realization relationships
- In the Design model drop-down menu, click Add UML > Package.
Name it
addressbook.
Figure 31. Design model Add UML and Package menus
- Move the new classes, AddressBook and Contact, into the
addressbook package.
Note:
As types of lifelines on a sequence diagram in a
collaboration, these UML classes trace from each UML class to each corresponding
collaboration.
Figure 32. addressbook package with AddressBook and Contact classes added
- In the
addressbook package, open the Main
diagram.
- Drag AddressBook and Contact onto the diagram.
- Create a one-to-many Composition Association from AddressBook to
Contact. This creates a dependency, with AddressBook dependent on
Contact. This relationship is relevant for Impact Analysis, but is not relevant
for traceability.
Figure 33. Main tab showing association
- Click File > Save to save the model.
Lesson 3. Create the
Java Address Book project
This lesson demonstrates how to unzip or create an Address Book Java project the
Java classes for the address book and traceability to the UML classes.
Unzip and Import the Address Book Java
project
- Unzip Address Book Java Project.zip file (from Downloads) to: C:\workspace\
- Click File > Import.
- When the Import dialog opens, expand the General folder and select
Existing Projects into Workspace.
- Click Next.
- In the "Select root directory" field, type
C:\workspace and then press
Enter.
- Click Finish.
Create the Address Book Java Project
- Click File > New > Project to open the New Project
wizard (Figure 34).
Figure 34. Open the New Project
wizard
- Under Wizards (Figure 35), select Java Project and then click
Next.
Figure 35. Select Java Project in the New Project wizard
- In the Project Name field, type
addressbook (see
Figure 36) and then click Finish.
- When the "Open Associated Perspective?" dialog opens, click
No.
Figure 36. Enter "addressbook" as the project name
- In the Project Explorer, select addressbook and then click File
> New > Other (Figure 37).
Figure 37. Project Explorer view
- Under Wizards, expand Transformations and select Transformation
Configuration (Figure 38).
- Click Next.
Figure 38. Select the Transformation Configuration wizard
- When the New Transformation Configuration wizard opens, type
addressbook in
the Name field.
- Under Forward transformations, select UML to Java (Figure 39).
- Click Next.
Figure 39. Name and transformation view
- Under Selected source, expand Address Book and Models, and then
select Design.
- Under Selected target, select addressbook.
- Click Next on this screen and the three screens that follow (thus,
click Next four times).
Figure 40. Source and Target view
- Under Transformation options (Figure 41), select Create trace
relationships, and click Finish.
Note:
This transformation option traces from each created Java
class to each corresponding UML class, thereby completing the traceability from
RequisitePro requirement specifications down to Java class implementations.
Figure 41. Common screen in New Transformation Configuration wizard
- In the Project Explorer, expand addressbook.
- In the addressbook.tc drop-down menu (Figure 42), select Transform
> UML to Java. The addressbook package is created in the source
folder of the Address Book project, and both AddressBook.java and Contact.java
files are created in that package.
Figure 42. Project Explorer selections leading to addressbook.tc menu drop-down menus
- Open the AddressBook.java and Contact.java files (Figure
43).
Figure 43. Project Explorer
with classes under addressbook package
Notice this Java™doc tool annotation: @uml.annotations
derived_abstraction= (Figure
44). The value of this annotation is the URI that refers back to the UML class,
AddressBook. This is what the transformation created to persist the trace
relationship from the Java AddressBook class to the UML AddressBook class. The
same is true for Contact.java.
Figure 44. AddressBook.java screen output of code
Lesson 4. Traceability
queries
Traceability queries, instructions,and examples follow.
Query: Specifications of AddressBook
This query starts at a context element and follows immediate trace relationships
in the forward direction to discover elements that are one level of abstraction
higher. Another way to phrase this query is: "From which specifications
is this element immediately derived?"
- In the "AddressBook UML class" drop-down menu, select
Query > Traceability > Specifications. The Save As dialog
will open (see Figure 45).
Figure 45. AddressBook specifications query path
- Click OK.
Figure 46. Save as Address Book
A new diagram is created and the query results are added (Figure 47).
Figure 47. AddressBook.dnx specifications with query results added
Query: All Specifications of AddressBook
This query starts at a context element and follows all trace relationships in the
forward direction to discover all elements in higher levels of abstraction.
Another way to phrase this query is: "From which specifications is this
element derived?"
- In the "AddressBook UML class" drop-down menu, select
Query > Traceability > All Specifications.
- Wen the the Save As dialog is open, click OK.
Figure 48. All Specifications of AddressBook.dnx tab
Query: Implementations of Contact
This query starts at a context element and follows immediate trace relationships
in the reverse direction to discover elements one level of abstraction lower.
Another way to phrase this query is, "Which implementations are
immediately derived from this element?"
- In the "Contact UML class" drop-down menu, select Query
> Traceability > Implementations.
- When the Save As dialog is open, click OK. (See Figure 49.)
Figure 49. Implementations of Contact.dns tab
Query: All Implementations of Change
contact
This query starts at a context element and follows all trace relationships in the
reverse direction to discover all elements in lower levels of abstraction. Another
way to phrase this query is: "Which implementations are derived from this
element?"
- In the "Change contact UML use case" drop-down menu, select
Query > Traceability > All Implementations.(Figure 50).
- When the Save As dialog is open, click OK.
Figure 50. All Implementations of Change contact.dns tab
Lesson 5. Impact
analysis queries
Impact analysis queries, instructions,and examples follow.
Query: Suppliers of AddressBook
This query starts at a context element and follows immediate dependencies in the
forward direction to discover elements that are immediate suppliers of this
element. Another way to phrase this query is:"On which elements is this
element immediately dependent?" or "Which elements, if changed
or removed, could immediately impact this element?"
- In the "AddressBook UML class" drop-down menu, select
Query > Impact Analysis > Suppliers (Figure 51).
- When the Save As dialog opens, click OK.
Figure 51. Suppliers of AddressBook.dnx tab
Query: All Suppliers of AddressBook
This query starts at a context element and follows all dependencies in the
forward direction to discover all elements that are suppliers of this element.
Another way to phrase this query is: "On which elements is this element
dependent?" or "Which elements, if changed or removed, could
impact this element?"
- In the "AddressBook UML class" drop-down menu, select
Query > Impact Analysis > All Suppliers.(Figure 52).
- When the Save As dialog opens, click OK.
Figure 52. All Suppliers of AddressBook.dnx tab
Note:
The results of the All Specifications Traceability query are
a subset of the results of the All Suppliers Impact Analysis query. This is
because all trace relationships are dependencies. On the other hand, the results
of the All Suppliers Impact Analysis query are a superset of the results of the
All Specifications Traceability query, because not all dependencies are trace
relationships.
Query: Clients of Contact
This query starts at a context element and follows immediate dependencies in the
reverse direction to discover all elements that are immediate clients of this
element. Another way to phrase this query is: "Which elements immediately
depend on this element?" or "If this element is changed or
removed, which elements could be immediately impacted?"
- In the "Contact UML class" drop-down menu, select Query
> Impact Analysis > Clients (Figure 53).
- When the Save As dialog is open, click OK.
Figure 53. Clients of Contact.dns tab
Query: All Clients of Change contact
This query starts at a context element and follows all dependencies in the
reverse direction to discover all elements that are clients of this element.
Another way to phrase this query is: "Which elements depend on this
element?" or "If this element is changed or removed, which
elements could be impacted?"
- In the "Change contact UML use case" drop-down menu, select
Query > Impact Analysis > All Clients (Figure 54).
- When the Save As dialog is open, click OK.
Figure 54. All Clients of Change contact.dnx tab
Note:
The results of the All Implementations Traceability query are
a subset of the results of the All Clients Impact Analysis query. This is because
all trace relationships are dependencies. On the other hand, the results of the
All Clients Impact Analysis query are a superset of the results of the All
Implementations Traceability query, because not all dependencies are trace
relationships.
Summary of lessons and
benefits
In Lessons 1 through 3, you learned how to create requirements in Rational
RequisitePro, elaborate on the requirements in analysis and design UML models, and
transform the design model into a Java project while maintaining traceability
between artifacts and through the different levels of abstraction.
In Lesson 4, you learned about the different specification and implementation
traceability queries, and Lesson 5 demonstrated and explained the different
supplier and client impact analysis queries, comparing and contrasting them to the
traceability queries.
With a traceable system of requirements, models, and a Java implementation, you
can use the traceability queries to find out what requirements a context UML
element exist to satisfy or what Java elements exist to implement a context UML
element. You can also use the impact analysis queries to find out what elements
require a context UML element or what elements are required by a context UML
element.
Downloads | Description | Name | Size | Download method |
|---|
| Sample project | AddressBookRequisiteProProject.zip | 164KB | HTTP |
|---|
| Sample project | AddressBookUMLProject.zip | 10KB | HTTP |
|---|
| Sample project | AddressBookJavaProject.zip | 3KB | HTTP |
|---|
Resources Learn
Get products and technologies
Discuss
About the author  | |  | Scott is an Advisory Software Developer supporting IBM Rational software. |
Rate this page
|  |