Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » href=""/> to EInt
href=""/> to EInt [message #886426] Thu, 14 June 2012 22:40 Go to next message
max power is currently offline max powerFriend
Messages: 9
Registered: May 2012
Junior Member
Hi all!

I have an xmi file with an uml class diagram.

Some attributes have following types:
<type xmi:type="uml:PrimitiveType" href="http:||"/>

After the import these attributes have the type PrimitiveTypeImpl.

ToString of the variable "type" returns:
org.eclipse.uml2.uml.internal.impl.PrimitiveTypeImpl@6d23f66c (eProxyURI: http:||

When I programmatically convert the uml model to ecore, the attributes have the type: EDataTypeImpl.

BUT: when I import the xmi file into an EMF Project via UI the resulting model contains attributes with type EInt. This is what I want to do programmatically, too.

I am using following code for import and conversion to ecore:

ResourceSet resourceSet = new ResourceSetImpl();
Registry packageRegistry = resourceSet.getPackageRegistry();

packageRegistry.put("http:||", UMLPackage.eINSTANCE);
packageRegistry.put("http:||", UMLPackage.eINSTANCE);

Map<String, Object> extensionToFactoryMap = resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap();
extensionToFactoryMap.put(XMI2UMLResource.FILE_EXTENSION, new UMLResourceFactoryImpl());
resourceSet.getLoadOptions().put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);

URI uri = URI.createURI("model.xmi");

Package root = UML2Util.load(resourceSet, uri, UMLPackage.Literals.PACKAGE);

Set<EPackage> result = Sets.newHashSet();
result.addAll(UMLUtil.convertToEcore(root, null));

Am I doing something wrong?

Re: href=&quot;;/&gt; to EInt [message #886647 is a reply to message #886426] Fri, 15 June 2012 11:03 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4548
Registered: July 2009
Senior Member
> Am I doing something wrong?
Yes. Your ability to workaround the misleading MDT/UML2 documentation is

Loading a UML resource is a non-trivial activity, since there is support
for more than one UML namespace (version) and you must register the
appropriate content types to ensure that the appropriate resources and
converters are used. You also need to define path-map URI mappings for

I have just added a "load" step to the canned solution to You may find
it as to

Apologies for difficulties.


Ed Willink
Previous Topic:how to load int generals from Integer
Next Topic:UML2 Tools and Indigo
Goto Forum:

Current Time: Wed Nov 25 18:30:22 GMT 2015

Powered by FUDForum. Page generated in 0.15658 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software