= KDM to UML Converter =

The goal of the KDM to UML converter plug-in is to allow practical transformations of KDM models to UML models.

''Quality disclaimer: this discoverer is provided without any guarantee: it was only tested on a small number of projects of relatively small sizes. It may not be suitable for production environments.''

== Description ==

This tool aims at converting KDM models into UML models in order to allow integrating KDM-compliant tools (i.e. discoverers) with UML-compliant tools (e.g. modelers, model transformation tools, code generators, etc), as shown in the next figure.

[[Image:../../img/kdm/MoDisco-KDM_Kdm_to_Uml_converter_overview.jpg|frame|center|Overall approach of the KDM to UML converter]]

The converter is mainly implemented by an [[ATL|ATL model-to-model transformation]] taking as input a model conforming to the KDM meta model and producing as output a model conforming to the [http://www.uml.org/ UML meta model].

The mapping between KDM and UML is described in the following table:

{| border="1" cellpadding="5" cellspacing="0" align="center" style="text-align:center"
|+KDM to UML mapping
|-
! KDM !! UML
|-
| LanguageUnit || Package
|-
| CodeModel || Model
|-
| CodeAssembly || Model
|-
| Package || Package
|-
| ClassUnit || Class
|-
| InterfaceUnit || Interface
|-
| MethodUnit || Operation
|-
| ParameterUnit || Parameter
|-
| Extends, Implements || Generalization
|-
| PrimitiveType || PrimitiveType
|-
| MemberUnit || Property, Association
|}

<!--[[Image:../../img/kdm/MoDisco-KDM_kdm_uml_mapping_table.jpg|frame|center|KDM to UML mapping]]-->

This mapping can be changed or completed easily by updating the [[ATL|ATL rules]].

The converter can also generate a trace file of the transformation to UML and a transformation log.

== User manual ==

Right-click on a KDM model file (ending in "_kdm.xmi") and choose '''Discovery > Discoverers > Discover UML model from KDM model...''' to create the UML model from the KDM model:

[[Image:../../img/kdm/MoDisco_KDMToUML_menu.png|frame|center|Menu in Eclipse to create a UML model from a KDM model]]

A discovery parameters dialog opens to let you specify the parameters of the discovery:

[[Image:../../img/kdm/MoDisco_Launching_discovery_org.eclipse.modisco.kdm.uml2converter.discoverUmlModelFromKdmModel.png|frame|center|Discoverer parameters dialog]]

* Set '''SERIALIZE_TARGET''' to true if you want to save the model to a file
* You can define '''TARGET_URI''' to the location of a file in your workspace. If it is not defined and SERIALIZE_TARGET is true, a model file will be created in the project.<br> '''Beware: the file will be overwritten if it already exists!'''
* You can set a '''CUSTOM_TRANSFORMATION''', by providing the location of an ATL ".asm" file (compiled ATL transformation) that replaces the default transformation

Once launched, a progress dialog will appear as soon as the operation begins. Depending on the size of your application, the reverse engineering process might take some time to complete:

[[Image:../../img/kdm/MoDisco_discoverer_org.eclipse.modisco.kdm.uml2converter.discoverUmlModelFromKdmModel_in_progress.png|frame|center|Progress dialog during model creation]]

At the end of the process, the newly created model file is added to the root of your project if you set SERIALIZE_TARGET to true:

[[Image:../../img/kdm/MoDisco_KDMtoUML_File_inPackageExplorer.png|frame|center|UML model in the Package Explorer]]

And the model is opened in the default model browser if you selected '''Open model in editor after discovery''':

[[Image:../../img/kdm/MoDisco_KDMtoUML_model_inModelBrowser.png|frame|center|UML model in MoDisco model browser]]

This UML model can be displayed in any modeler (you can use [[MDT/Papyrus|Papyrus]] for example). For most modelers, you would usually create a UML class diagram and then drag and drop model elements to the diagram.

[[Image:../../img/kdm/MoDisco-KDM_Uml_target_diagram.jpg|frame|center|UML diagram]]

== Current Limitations ==

The bidirectional UML Association elements are not identified by the rules: two complementary unidirectional UML Association elements are generated.

