The UML backend can be used to import and export files in the UML 1.4 format, stored as XMI 1.1 or 1.2 files. One of the easiest ways of creating such files is with a conventional CASE tool. However, tool support for UML and XMI is still in its infancy, so that some inconvenient conversions might be required. Some tools might not produce a suitable XMI format at all. In order to import XMI files from older XMI or UML versions into Protege, you can use Poseidon 1.6. (5YQ)
Since UML and Protege have different declarative power, not all details of a knowledge model can be safely converted. Read more details about mapping between Protege ontologies and UML. (5YR)
UML import into Protege (5YS)
- Create an XMI file with your CASE tool (details on how to do this with selected tools can be found below). (5YT)
- Choose "Import..." in Protege. (5YU)
- Select UML as the import format and click OK. (5YV)
- In the following dialog box, click on the + button near the UML file name field. (5YW)
- Select the XMI file and click OK so that the name of the XMI file appears as UML file name. (5YX)
- Click OK to start the import process. (5YY)
Note: Depending on the size of the XMI file, the import process might take a few moments. In the current version, the Java console window might deliver a couple of logging messages, produced by the NetBeans JMI interface we use. These messages can be safely ignored. Note that the NetBeans interface generates two or three mdr files in your working directory, which are only needed while the application is running in order to speed up the import and export processes. You can remove these files at any time. If you encounter strange, unexpected behavior, in particular after an import/output transaction has been stopped while in progress, you should close Protege and delete the temporary files as they might contain illegal partial models. The files will be bootstrapped the next time the UML plugin is used. (5YZ)
When the import was successful, the knowledge base will contain new classes and slots, reflecting all classes from the UML file. There is currently no way to import only a sub set of the file, so that you would have to delete the classes you do not want to import before you save the UML model. (5Z0)
UML export from Protege (5Z1)
There are two ways to exporting an ontology to UML. (9W4)
Solution 1 (preferred approach) (9W5)
- In the Files menu, select Export to format -> UML 1.4 (9W6)
- Specify the xmi file name and click on OK. (9W7)
Solution 2 (9W8)
- Save your project in your usual format before you begin the export! (5Z2)
- Choose the "Save in format..." menu item in Protege. (5Z3)
- Select UML as output format and click OK. (5Z4)
- Choose a new project name (take care not to overwrite the current project). (5Z5)
- Click OK to save the project into the specified XMI file. (5Z6)
- Since after storing the XMI file Protege will reload the new project (this might modify your current knowledge base), you should reopen the original project if you want to continue at the state you had prior to the export procedure. (5Z7)
Note that the version of UML used (1.4) does not include layout information, so that the newly created UML classes may not be assigned to any model. In some CASE tools like Poseidon, apparently the only option to see the new UML classes after import is to drag the imported classes from the explorer panel into the target model. Other tools such as TogetherJ provide automated layout services that might make this much more convenient (however, their XMI support is apparently under construction). (5Z8)
UML specific extensions (5Z9)
The UML plugin can also be used to generate specific UML elements that do not have direct counterparts in Protege. These include: (5ZA)
- Stereotypes for classes and slots. (5ZB)
- Tagged values for classes and slots. (5ZC)
- Operations (methods) for classes, including parameters and return value. (5ZD)
- Association kind for instance slots (aggregation or composition). (5ZE)
In order to enable these features, include the project UML-Extensions.pprj into your project. You will find this include project in the plugins directory after installing the UML plug-in. (You will have to copy the three project files into the folder where your own project resides). This defines a new metaclass :UML-CLASS, which extends the usual :STANDARD-CLASS, and a new metaslot class. Use the "Create subclass using metaclass..." function (e.g., right-click on the :THING class) to generate classes that exploit this UML extension. You will then find additional widgets in your class and slot definition forms to enter the new UML elements. (5ZF)
Note that in the current version, this support is only unidirectional for export. This means that you can define the additional values and they will be exported into the UML XMI file, but they will not be imported from XMI files. This also means that you should not use these features when you use the UML back-end for your working files. Instead, define the UML classes in the traditional CLIPS format and only export them when you need the XMI files. Otherwise, all your extensions will be lost. We might implement bi-directional mappings (import) later, as time permits. (5ZG)
Supported CASE Tools (5ZH)
The following list of items provides some information about our experiments with third-party CASE tools. Please contact us (or simply edit this Wiki page) if you would like to share your experience with other tools. (5ZI)
MagicDraw is a full-featured UML environment written in Java. Its basic file format is UML 1.4 with XMI 1.0 or 1.1. The tool furthermore provides an export to Unisys XMI 1.0, which can be read by Rational Rose. (5ZO)
UML import from MagicDraw: MagicDraw stores its XMI files in a ZIP archive (choose XMI version 1.1), from which the XMI file can be easily extracted (you might want to rename the suffix from .xml to .xmi). However, MagicDraw generates slightly invalid XMI files, which need to be modified with a text or XML editor (such as XMLSpy or Liquid XML Editor). The following change needs to be done: Replace all occurrences of * with -1. MagicDraw apparently violates the UML standard here. Furthermore there seem to be some illegal characters in the file, and the parser might generate that he is unable to find a document root. To solve this simply open the XMI file with XMISpy and save it again (although I do not know exactly why this works). (5ZP)
UML export into MagicDraw: Since MagicDraw can only read XMI 1.0 or XMI 1.1 files, UML files exported from Protégé can not be loaded directly. It should, however, be possible to load them first into Rational Rose and to save them in an earlier XMI format there. (5ZQ)
Poseidon is a popular UML editor written completely in Java. Its Community Edition is available free of charge and our recommendation for UML editing with Protégé. Since it is based on the same Java libraries and the same UML and XMI versions like this plugin, it makes import and export of UML diagrams very safe. (5ZR)
UML import from Poseidon: Poseidon saves UML models in .zargo files, which are in fact ZIP archives including an XMI file. XMI files are quite verbose so that compressing them is certainly a good idea. In order to extract the XMI file from the .zargo, rename the file temporarily to a .zip file and use a compression program like WinZip or the extraction feature of recent Windows versions. (5ZS)
UML export into Poseidon: You can directly open XMI files in Poseidon with the File/Open Project... menu item. Select XMI as the file type in the file selection dialog. Note that the version of UML used (1.4) does not include layout information, so that the newly created UML classes may not be assigned to any model. In Poseidon, apparently the only option to see the new UML classes after import is to drag the imported classes from the explorer panel into the target model. (5ZT)
Rose is one of the leading CASE tools and supported by the founding fathers of the UML language. It is a commercial product that can be freely evaluated for 15 days. Its main disadvantage in conjunction with Protege is that it supports obsolete standards, namely UML 1.3 and XMI 1.0. In order to get XMI support, you need to download and install the XMI Rose addin, which adds a UML 1.3 submenu in the Tools menu. (5ZU)
The following paragraphs have been tested with an example Rose model from which can be downloaded as Rose or XMI files from the National Cancer Institute. (5ZV)
UML import from Rose: A given Rose model can be exported into XMI using the XMI addin mentioned above. Choose Tools/UML 1.3 XMI Addin/Export.... In the following export options dialog, select XMI version 1.0. The export process might deliver warnings, which can be ignored. The resuling XMI file can not be read by Protege, but you can open it with Poseidon and export it into a valid UML 1.4 file. (5ZW)
UML export into Rose: An XMI file created with Protege can be loaded into Rose with the XMI addin mentioned above. However, since this add-in operates on an older version of UML, it is unable to load associations (i.e., slots), so that this is of limited use. Please contact us if you find a solution to this problem. (5ZX)
Choose Tools/UML 1.3 XMI Addin/Import..., select the target model (or create a new one), and then choose the XMI file to import. (5ZY)
Together is regarded as one of the best UML tools for Java, particularly due to its excellent Round-Trip Engineering support. In recent times, the company was acquired by Borland and the product is being integrated with their JBuilder. However, since the product is not free and not easy to access, we have currently no experience with it in conjunction with Protege. Although we asked for it, the company did not even provide us with an evaluation license. Perhaps some members of the community can verify this. (5ZZ)
UML import from Together: There is a discussion about the tool's XMI format at MDR User Mailing List where they have included an XSL stylesheet that can convert Together's XMI version into what we need. (600)
UML export into Together: ? (601)
This is quite an interesting tool, which seems to be able to read and write various versions of XMI and thus could serve as a converter between Protege and other tools. Please let us know (or simply edit this Wiki page) if you have gathered experience with this tool. (5ZN)
EA is a commercial tool that offer many functionalities for a fair price. It is possible to import and export classes diagrams with Enterprise Architect. (5ZN)