Difference between revisions of "MDT/UML2/FAQ"

From Eclipsepedia

< MDT‎ | UML2
Jump to: navigation, search
m
(What's required to load a UML (.uml) resource from a standalone application?)
 
(6 intermediate revisions by 5 users not shown)
Line 3: Line 3:
 
===What is UML2?===
 
===What is UML2?===
  
The UML2 project (an Eclipse Tools sub-project) is an EMF-based implementation of the UML&trade; 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.
+
The UML2 project (an MDT sub-project) is an EMF-based implementation of the UML&trade; 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?===
 
===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. Once you have an EMF representation of your model, you can, of course, generate code from it using EMF.
+
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?===
 
===How will issues with the UML metamodel be escalated to the OMG?===
Line 29: Line 31:
 
  resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
 
  resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
 
  Map uriMap = resourceSet.getURIConverter().getURIMap();
 
  Map uriMap = resourceSet.getURIConverter().getURIMap();
  URI uri = URI.create("jar:file:/C:/eclipse/plugins/org.eclipse.uml2.uml.resources_2.0.0.v200606221411.jar!/");
+
  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.LIBRARIES_PATHMAP), uri.appendSegment("libraries").appendSegment(""));
 
  uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), uri.appendSegment("metamodels").appendSegment(""));
 
  uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), uri.appendSegment("metamodels").appendSegment(""));
 
  uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uri.appendSegment("profiles").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?===
 
===What tools are compatible with UML2-generated models?===
  
See [MDT-UML2-Tool-Compatibility].
+
See [[MDT-UML2-Tool-Compatibility]].
  
 
[[Category:FAQ]]
 
[[Category:FAQ]]
 
[[Category:Modeling]]
 
[[Category:Modeling]]
 
[[Category:MDT]]
 
[[Category:MDT]]

Latest revision as of 20:55, 24 October 2011

Contents

[edit] 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.

[edit] 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.

[edit] 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 http://www.omg.org/issues/uml2-rtf.open.html

[edit] 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).

[edit] 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.

[edit] 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.

[edit] What tools are compatible with UML2-generated models?

See MDT-UML2-Tool-Compatibility.