Reusing models of other tools

The interoperability beetween UML tools became one of the most important topics in the transition from UML 1 to UML 2. ArgoUML currently supports UML 1.4 only, but allows XMI import. Importing/exporting of XMI files is the only tool for interoperability. You can expect to exchange model elements with UML tools that share at least one commonly supported XMI version, but you will not be able to exchange diagram contents, as this data is not found in XMI files for XMI 1.2 and UML 1.x. Diagrams have to be manually recreated from the model.

This page deals with the reuse of other tools UML models, including the restoring of diagrams.

Prerequisites
In short, one has to obtain an XMI file that meets the following conditions:
 * XMI version between 1. and 1.2, containing a UML 1.x model (upto 1.4)
 * the (only one) top level element must be a UML:Model instance
 * references to other XMI files (href attributes) must be "resolvable"

You can skip this section if you think you got an XMI file that meets all these contitions.

XMI version
ArgoUML uses Netbeans MDR version xxx, which can parse XMI ... 1.2 files... (to be completed)

Model structure
ArgoUML currently is not very flexible about how the model is internally structured. Hopefully, this will change over time. For now, make sure your XMI file content consists of only one UML:Model element and everything inside it. You can manually edit your XMI file to meet this requirement, here is a scetch of the target structure:

 ...    ...          

XMI references (hrefs)
The resolving of href attributes (in short: hrefs) in the XMI file is done the following way: ... (to be completed)

If you are not sure if the hrefs will all be resolved, you have three options:
 * In your UML tool, it is probably possible to import all referenced model parts and save everything in one XMI file without any hrefs, thus avoiding any problems. In MagicDraw, you can do this by importing all modules by right clicking on them in the Containment Tree view and selecting Modules->Import Module from the context menu. After you've done this for each module (and some of them are nested at multiple levels for the profile), you can save the project as a single XMI file.
 * Or you can just try to import the XMI file (see next section). ArgoUML might complain about unresolved hrefs, but it will report which file is expected at which location, so you can copy the files to the requested place. As ArgoUML only reports the first unresolved href, you have to repeat the import and the copying step until all hrefs are successfully resolved.
 * (usage of profiles, to be completed)

Importing the XMI file
In ArgoUML, just select the "File->Import from XMI..." menu item and open the XMI file, that's it! If a problem occurs, it will be reported in a dialog window, so you can take appropriate actions to resolve the problem (see the sections above). If it went fine, then you can see the imported model in the explorer pane as a result: unfold parts of the tree to check the contents.

Be aware that the XMI import currently is not capable of merging models: it will clean the project prior to the import. Using profiles (see Profile Configuration is the only way to let model elements of different sources live in the same project.

Recreating the diagrams
As said before, diagram contents will not be available from XMI imports. However, in many cases the recreation of diagrams is quite easy, because of the "Add to diagram" feature of the explorer pane. Here's what to do:


 * Identify empty diagram, e.g. Activity diagrams, and create new (empty) diagrams for the remainder of the missing diagrams in appropriate places (just choose one, there's no right or wrong).
 * After having a set of (still empty) diagrams, proceed the following steps for each of them.
 * Click on a diagram to make it the current diagram, the diagram pane now switches to it.
 * Right click on each model element you want to see on that diagram and select the "Add to diagram" menu item, then click on the diagram pane, thus adding the element to it. This need to be done for nodes only, all edges (lines, arrows) will be added automatically, but you can remove any of them from the diagram afterwards.
 * Finally, rearrange the elements on the recreated diagrams, so that they look nice again.

This was done many times for models of AndroMDA projects: recreation of all class, use case and activity diagrams.

One remark about activity diagrams: the name attribute is not the label that is shown on the activity figures, so your activities will all be empty ovals. Simply copy and paste the name attribute to the activity labels (requires to make the activity oval editable by double clicking on it). This has no impact on the processing of the model by AndroMDA.