Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search


< MDT‎ | UML2

What is UML2?

The UML2 project (an MDT sub-project) is an EMF-based implementation of the UML™ 2.x metamodel for the Eclipse platform. The objectives of this project are to provide a useable implementation of the UML metamodel to support the development of modeling tools, a common XMI schema to facilitate interchange of semantic models, test cases as a means of validating the specification, and validation rules as a means of defining and enforcing levels of compliance.

Can I generate code from my UML (.uml) model?

The UML2 project provides an Ecore importer that can be used to create Ecore (.ecore) and generator (.genmodel) models from a UML (.uml) model via the EMF project wizard. Importing your genmodel from UML gives you the benefit of certain codegen extensions provided by UML2 to handle metamodeling constructs of CMOF that EMOF (hence Ecore) does not implement: subsetting and redefinition. Also, a handy foreign-method pattern for implementing operations. Ultimately, UML2 uses the code generation facilities provided by EMF.

How will issues with the UML metamodel be escalated to the OMG?

The UML2 UML project lead will be submitting issues to the UML™ 2.x Superstructure and Infrastructure Revision Task Forces (RTFs) based on problems discovered in the UML metamodel. The current list of open RTF issues can be found at

Is there a way to see a graphical view of my UML (.uml) model?

The UML2 project supports neither notation nor diagram interchange at this time. The project is focused on developing a robust implementation of the abstract UML syntax. It is expected that tools developed using the API will provide support for graphical modeling and diagram interchange (concrete syntax).

Is there a mechanism to convert a Rose (.mdl) model to a UML (.uml) model?

There is currently no such mechanism, although it is possible to create Ecore (.ecore) and generator (.genmodel) models from a Rose (.mdl) model via the EMF project wizard and then convert those to a UML (.uml) model using the Ecore exporter that is provided (available from the Export Model... context menu item for generator models). Any information not preserved by EMF (such as stereotypes, diagrams, etc.) would, however, be lost.

What's required to load a UML (.uml) resource from a standalone application?

In order to load a UML (.uml) resource, the package (schema), resource factory, and "pathmaps" for UML need to be registered. On the Eclipse platform, this is done through the org.eclipse.emf.ecore.generated_package, org.eclipse.emf.ecore.extension_parser, and org.eclipse.emf.ecore.uri_mapping extension points (see the plug-in manifests for the org.eclipse.uml2.uml and org.eclipse.uml2.uml.resources plug-ins). When loading resources externally from Eclipse, your application needs to perform these registrations programmatically as follows (given a variable resourceSet that points to an instance of ResourceSetImpl):

resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);

resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
Map uriMap = resourceSet.getURIConverter().getURIMap();
URI uri = URI.createURI("jar:file:/C:/eclipse/plugins/org.eclipse.uml2.uml.resources_<version>.jar!/"); // for example
uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), uri.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), uri.appendSegment("metamodels").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uri.appendSegment("profiles").appendSegment(""));

The last appendSegement("") appends a trailing slash, don't forget it when you create the URIs manually.

What tools are compatible with UML2-generated models?

See MDT-UML2-Tool-Compatibility.

Back to the top