Import Microsoft Visio diagrams into IBM Rational Software Architect: Part 2. Using the Visio Import feature to import UML class and use case diagrams

Version 8.5 of IBM Rational Software Architect introduced a new feature for importing Microsoft Visio diagrams. In this second article in a three-part series, Rakesh Choudhary describes how to import UML class and use case diagrams created in Visio 2010.


Rakesh Choudhary (, Software Engineer, IBM

author photoRakesh joined IBM in 2008. He has been in the software industry for more than seven years and has worked as a software developer for Rational Application Developer and Rational Software Architect. He is directly involved in the design and implementation of the Visio Import feature in RSA.

19 February 2013


  • You need a basic understanding of working with UML diagrams in Microsoft Visio 2010, as well as UML diagrams in IBM® Rational® Software Architect, Version 8.5.
  • You need to understand the purpose of Sketcher diagram elements in IBM Rational Software Architect.
  • It would be helpful to be aware of steps to generate .xmi files from UML diagrams in Visio. This article describes how to do that in Visio 2010, but the steps might be quite different for other versions of Visio.

Steps for importing a UML diagram

There are two pages in the Visio file that was used during import. The diagrams in Figures 1 and 2 show screen captures of both pages, which are titled Class-Diagram and UseCase-Diagram.

Figure 1. Class diagram drawn in Visio
Screen capture of the class diagram
Figure 2. Use case diagram drawn in Visio
Screen capture of the use case diagram

1. Generate the .xmi file

Visio exposes only the visual information in a UML diagram, not the semantic information. However, it can generate a semantic file from a UML diagram. This file is generated in .xmi format and corresponds to XMI Version 1.0. You need this semantic file whenever the UML diagram contains at least one class diagram.

Follow these steps to generate the .xmi file in Visio 2010:

  1. Open the Visio UML diagram file.
  2. Press ALT + F11 (Alt and F11 keys simultaneously) to open a Microsoft Visual Basic window for the open UML diagram.
  3. Use the following function in the opened window and save it:
    Sub ExportXMI()
    Application.Addons(UML Background Add-on).Run (/CMD=400 /XMIFILE=C:\work\
    End Sub
  4. Select Run from the task bar at the top, and click Run Sub/UserForm from the drop-down menu.
Figure 3. Run the ExportXMI routine
The Run menu in the Visual Basic window


  • Directories mentioned in the path should exist in the local drive before you run this command.
  • After running ExportXMI, a file named Sample.xmi will be created in this directory:

2. Create a target project

Bring up the New Project wizard in the Rational Software Architect workbench. A simple resource project is sufficient to store the imported diagrams.

Figure 4. New Project wizard
Select a wizard view with Project selected

3. Import the Visio model into a project

There are multiple ways to launch the Visio Diagram Import wizard, but you can follow these steps for this example:

  1. Select the target project, and right-click, and then select Import on the context menu.
  2. In the Import wizard, from the Select page, click Modeling > Visio Diagram.
  3. Click Next.
Figure 5. Under Modeling, select Visio Diagram
Import window shows options on the Select page

4. Specify source and destination files

  1. Next to the "Source file" field, click the Browse button (see Figure 6), find and select the Visio file on your system, and then verify the selection by checking the preview image.
  2. For Diagram Type, select UML from the drop-down menu to indicate the target domain in Rational Software Architect as UML.
  3. As soon as you have selected UML, a field for the .xmi file is added. Click the Browse button next to .xmi file field to select the corresponding .xmi file.
  4. Under Destination, make sure that the appropriate project is selected.
Figure 6. Import Visio wizard dialog window
Import Visio page with Browse selected
  1. After you provided all input, click Finish.

5. Monitor progress

As soon as you click Finish, the import process begins. The progress monitor reports the status of the import, as Figure 7 shows. You can cancel the import at any point.

Figure 7. Progress monitor
Progress bar for converting Class Diagram page

6. Review the import

When the import process finishes, it creates following resources, as the example in Figure 8 shows:

  • A model resource (.emx), which contains UML diagrams and semantic information
  • A profile resource (.epx), which contains the imported UML profile
  • An HTML report that contains details about import
Figure 8. Imported model in the Project Explorer view
Details highlighted under UML System 5 directory

In the Diagrams folder in Project Explorer, double-click a diagram to view the imported diagram. The visual layout is similar to Visio.

Figure 9. Imported class diagram
Class diagram layout in Rational Software Architect

If you are not able to import an element for some reason, that element will show as a Sketcher element in light red color in the same location. Details about why that element was not imported will be in the HTML report.

7. Review the report

After each Visio import, an HTML report is created in the Reports folder within the target folder that you selected in the import wizard. The report file name follows this convention:
<Visio source file name> <long format date and time>.html.
For example: Sample 2013-01-15 13-00-23.html

Figure 10. Import process report
Screen capture of a report

Open the HTML report in a browser to view the details. The multiple sections begin with a summary that states the total time required for the import and the number of errors, information, and warnings reported by the import process.

Each table in the report consists of six columns:

Serial number of a message within a table
Severity of message: INFO, WARNING, or ERROR
A short sentence that describes what happened (not why) during the import
Type of Visio element that this message corresponds to: document, page, or shape type
What action was taken by the import process (for example, if an element could not be imported and a Sketcher element is drawn, then drawing a Sketcher element is the action taken)
Hyperlinked text that describes details about the message type

8. Find elements that could not be imported

There are two ways to locate an element that you were not able to import:

  • You can open the diagram and look for light red Sketcher element. But this is cumbersome when there are dozens of diagrams and many shapes in each diagram, and opening each page and looking for Sketcher elements is time-consuming.
  • The better option is to create a task for each element that was not imported. You can open the Tasks view, double-click a task, and that will take you to that corresponding Sketcher element in a diagram.

9. Use the imported model for transformation

You can use the imported model for many UML-related transformations in Rational Software Architect. There is one point to keep in mind for that: The top-level element type of the imported model is Model type, but transformations in Rational Software Architect expect top-level element types to be Package. However, you can convert Model to Package by right-clicking Model and selecting Refactor > Convert Model to Package. Then the top-level element type is Package and it is ready to use in transformations.

Important points to remember

  • Not all class diagram elements are generated in .xmi. No attempt is made to import elements that are not present in the .xmi file. Therefore, the usual approach is to show the Sketcher shape for elements that cannot be imported.
  • Sometimes, a user makes a mistake in connecting two elements in Visio. Visually they could look like they are connected, but if it is inspected carefully (by zooming) it is noticed that they are actually not connected. Visio does not generate semantic information (in .xmi) for such connections. Most of the disconnected connections are imported but not all. For example, disconnected Association connection is not imported. Details of why a connection could not be made are in the report.
  • The .vdx and .xmi files are independent, so mapping should be done to map a shape in the .vdx file to an element in the .xmi file. Name and type of shape distinguish between elements. For some shape types, for example the Class, even attribute and operation compartments are parsed to differentiate between two shapes (if their names are the same). Occasionally, two elements of the same type and same name cannot be imported. This means that no mapping from a shape in .vdx to an element in .xmi could be found. (Explaining why is beyond the scope of this article.)


There is only one preference for a UML import.

  1. In the Preferences page, type uml in the text field.
  2. Select the page named UML: Modeling > Visio Import > UML, where you will find a box checked for "System attempts to resolve potential ambiguity."
Figure 11. UML import preference
Preferences page, UML view

This preference maps the semantic model to the visual model. It is related to mapping between a shape in the Visio file and the corresponding element in the .xmi file that contains semantic information. These two files (.vdx and .xmi) are independent, and you need a mechanism to match shapes in .vdx and elements in .xmi. Selecting this preference will match two shapes with identical names, attributes, and so forth. For example, if there are two shapes that are of the UML class type, both are named Person, and both have identical attributes and operations, it is impossible to distinguish between them in .xmi.

Checking the preference check box will match the shape and corresponding element randomly. This is done only for shapes that don't have connection shapes connected to them. This is safe, because the two classes are identical anyway.


There are several benefits of importing Visio UML diagrams into Rational Software Architect:

  • Rational Software Architect supports UML 2.2, so, essentially, a model is transformed into UML 2.2.
  • UML profiles are supported extensively in Rational Software Architect. This helps in the extension of a model.
  • Extensive features of Rational Software Architect, such as model-to-model transformation, can be used on the imported model.



Get products and technologies



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

ArticleTitle=Import Microsoft Visio diagrams into IBM Rational Software Architect: Part 2. Using the Visio Import feature to import UML class and use case diagrams