Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359964 - Infrastructure.xmi and other URI resolution problems
Summary: Infrastructure.xmi and other URI resolution problems
Status: VERIFIED FIXED
Alias: None
Product: MDT.UML2
Classification: Modeling
Component: Core (show other bugs)
Version: 4.0.0   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: M3   Edit
Assignee: Kenn Hussey CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-05 07:32 EDT by Ed Willink CLA
Modified: 2011-10-10 10:05 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2011-10-05 07:32:16 EDT
With UML2 4.0.0M2:

Downloading http://www.omg.org/spec/UML/20101101/Infrastructure.xmi then

opening with UML Model Editor gives numerous:

IllegalValueException: Value 'org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@9c1c74 (eProxyURI: pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Boolean

and also

IllegalValueException: Value 'org.eclipse.uml2.uml.internal.impl.EnumerationImpl@1a0a947 (name: VisibilityKind, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false)' is not legal.
....
Caused by: java.lang.UnsupportedOperationException
	at org.eclipse.emf.common.util.BasicEList$UnmodifiableEList.move(BasicEList.java:1015)
	at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.setValue(XMLHelperImpl.java:1195)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XMLHandler.java:2658)
-----
opening with Sample Reflective Ecore Editor gives:

PackageNotFoundException: Package with uri 'http://www.omg.org/spec/UML/20100901' not found.
-----
Renaming to Infrastructure.uml then

opening with UML Model Editor gives a raw XML view with explicit new line elements.
-----
Editing Infrastructure.uml to replace

<xmi:XMI xmlns:xmi="http://www.omg.org/spec/XMI/20100901" xmlns:uml="http://www.omg.org/spec/UML/20100901">

by

<xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/5" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/5 pathmap://UML_PROFILES/Ecore.profile.uml#_z1OFcHjqEdy8S4Cr8Rc_NA">

then opening with the UML Model editor changes the error slightly

IllegalValueException: Value 'org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@cc28ee (eProxyURI: http://www.omg.org/spec/UML/20100901/PrimitiveTypes.xmi#Boolean

-----

The original failure to resolve pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Boolean is puzzling since there appears to be a good pathmap registration.

The failure to resolve http://www.omg.org/spec/UML/20100901/PrimitiveTypes.xmi#Boolean is not surprising. PrimitiveTypes.xmi exists in the o.e.uml2 plugin but there is no URI mapping extension point for it.

Looking for run-time mappings CMOF2UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_URI seems to be the right value but it is never used, whereas UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_URI is.

-----

Is there any documentation explaining the intention of all the different names?

For MDT/OCL standalone JUnit tests, I found it difficult to get the correct initialization and so provided an o.e.ocl.uml.OCL.initialize method for the tests and users. My solution then may have been lucky. It's certainly wrong now.

It would be really helpful to provide a (family of) initialize(ResourceSet) routine(s) that ensure that the (non-null) local ResourceSet, or (null) global registries have the correct configuration to exploit UML 2.4.
Comment 1 Kenn Hussey CLA 2011-10-05 10:53:46 EDT
As per my comment on bug 359971, you shouldn't need to make many changes to the resources provided by the OMG in order to open them with UML2, once support for interchange has been completed (i.e., by this coming Monday).

There are, unfortunately, some small changes that do need to be made. At a minimum, references to the standard primitive types are missing xmi:type information, so you'll need to search for all such references and insert xmi:type="uml:PrimitiveType".
Comment 2 Kenn Hussey CLA 2011-10-05 21:25:37 EDT
The other thing that needs to be done is all 'classifier' references need to be removed from enumeration literals. In UML 2.4, the InstanceSpecification::classifier property is redefined by EnumerationLiteral::classifier such that it is made derived; as a result, it is invalid to serialize such references (which are redundant anyway since literals are already nested under their containing enumerations).
Comment 3 Kenn Hussey CLA 2011-10-10 10:04:42 EDT
I reported the above two problems (related to missing xmi:type attributes and erroneous 'classifier' serializatons for enumeration literals), but have my doubts that they will be addressed any time soon. In the meantime, I've added code to work around the issues when deserializing UML resources based on official OMG XMI format.
Comment 4 Kenn Hussey CLA 2011-10-10 10:05:05 EDT
The fix is available in the latest UML2 4.0 integration build.