Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » XMI idref reading error
XMI idref reading error [message #1734082] Fri, 03 June 2016 15:19 Go to next message
Raphael B is currently offline Raphael BFriend
Messages: 14
Registered: April 2013
Junior Member
Hello,
As I was upgrading my Ecore libraries, I got the following error when reading a file:
org.eclipse.emf.ecore.xmi.IllegalValueException: Value 'org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@5607ce2 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@3c2bbbf0 (name: Element) (instanceClassName: null) (abstract: false, interface: false)) (mixed: null, anyAttribute: [XMI_20131001:idref=SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous])' is not legal.


The relevant XMI content is the following:
<packagedElement xmi:id="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous" xmi:uuid="org.omg.sysml.SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous" xmi:type="uml:Stereotype">
  <name>Continuous</name>
  <ownedComment xmi:id="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous._ownedComment.0" xmi:uuid="org.omg.sysml.SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous._ownedComment.0" xmi:type="uml:Comment">
    <body>
...
    </body>
    <annotatedElement xmi:idref="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous"/>
  </ownedComment>


I'm guessing I get this error because the type of the annotatedElement is UML Element, which is abstract, so a proxy can't be created. Now, I don't know why a proxy would be created since the actual element should have been created already.

My code was working with EMF (ecore+ecore.xmi) 2.11.0, meaning that element with idrefs didn't require a xmi:type to be read. The code doesn't work anymore in 2.11.1, so I'm suspecting http://git.eclipse.org/c/emf/org.eclipse.emf.git/commit/?h=R2_11_maintenance&id=da4f80486a37c34d9eae223dd38fa9ee873ca36d to have introduced the problem, but I don't know EMF well enough to say.

Is there a workaround that does not involve adding an xmi:type to all idrefs?

Thanks!
Re: XMI idref reading error [message #1734090 is a reply to message #1734082] Fri, 03 June 2016 16:53 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31907
Registered: July 2009
Senior Member
I'm not sure what models are involved, but better to ask on a forum
related to that specific technology. I.e., SysML or UML2 or whatever
this is supposed to represent.


On 03.06.2016 17:19, Raphael B wrote:
> Hello,
> As I was upgrading my Ecore libraries, I got the following error when
> reading a file:
> org.eclipse.emf.ecore.xmi.IllegalValueException: Value
> 'org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@5607ce2 (eClass:
> org.eclipse.emf.ecore.impl.EClassImpl@3c2bbbf0 (name: Element)
> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
> null, anyAttribute:
> [XMI_20131001:idref=SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous])'
> is not legal.
>
> The relevant XMI content is the following:
> <packagedElement
> xmi:id="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous"
> xmi:uuid="org.omg.sysml.SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous"
> xmi:type="uml:Stereotype">
> <name>Continuous</name>
> <ownedComment
> xmi:id="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous._ownedComment.0"
> xmi:uuid="org.omg.sysml.SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous._ownedComment.0"
> xmi:type="uml:Comment">
> <body>
> ..
> </body>
> <annotatedElement
> xmi:idref="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous"/>
> </ownedComment>
>
> I'm guessing I get this error because the type of the annotatedElement
> is UML Element, which is abstract, so a proxy can't be created. Now, I
> don't know why a proxy would be created since the actual element
> should have been created already.
> My code was working with EMF (ecore+ecore.xmi) 2.11.0, meaning that
> element with idrefs didn't require a xmi:type to be read. The code
> doesn't work anymore in 2.11.1, so I'm suspecting
> http://git.eclipse.org/c/emf/org.eclipse.emf.git/commit/?h=R2_11_maintenance&id=da4f80486a37c34d9eae223dd38fa9ee873ca36d
> to have introduced the problem, but I don't know EMF well enough to say.
>
> Is there a workaround that does not involve adding an xmi:type to all
> idrefs?
>
> Thanks!


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: XMI idref reading error [message #1734093 is a reply to message #1734090] Fri, 03 June 2016 17:05 Go to previous messageGo to next message
Raphael B is currently offline Raphael BFriend
Messages: 14
Registered: April 2013
Junior Member
Alright, I'll post on the UML2 forum then.
I thought the EMF forum would be a better place, since my issue is with upgrading ecore and ecore.xmi
Re: XMI idref reading error [message #1734116 is a reply to message #1734090] Sat, 04 June 2016 06:11 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7176
Registered: July 2009
Senior Member
Hi

This does appear to be an EMF problem, albeit a crazy one.

The problem does not appear to be new. I see it with EMF 2.11.0.

The user's snippet enables the source to be identified as
http://www.omg.org/spec/SysML/20150709/SysML.xmi.

The XMI is incredibly bloated and close to criminal. ID and UUID, with
element style IDREFs to maximize the character count for simple
attributes. It is doubtful that the UUIDs will be stable.

Using the debugger suggests that the problem is actually caused when

XMIHandler.createObject(EObject peekObject, EStructuralFeature feature)

passes the first four if's and goes to super.createObject. It would
appear that the case of an xmi:idref, !isContainment(), isMany(),
isResolveProxies() and an abstract feature type has not been encountered
before. The abstract feature causes a failure when an
org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl is added to the list.

Regards

Ed Willink


On 03/06/2016 17:53, Ed Merks wrote:
> I'm not sure what models are involved, but better to ask on a forum
> related to that specific technology. I.e., SysML or UML2 or whatever
> this is supposed to represent.
>
>
> On 03.06.2016 17:19, Raphael B wrote:
>> Hello,
>> As I was upgrading my Ecore libraries, I got the following error when
>> reading a file:
>> org.eclipse.emf.ecore.xmi.IllegalValueException: Value
>> 'org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@5607ce2 (eClass:
>> org.eclipse.emf.ecore.impl.EClassImpl@3c2bbbf0 (name: Element)
>> (instanceClassName: null) (abstract: false, interface: false))
>> (mixed: null, anyAttribute:
>> [XMI_20131001:idref=SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous])'
>> is not legal.
>>
>> The relevant XMI content is the following:
>> <packagedElement
>> xmi:id="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous"
>> xmi:uuid="org.omg.sysml.SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous"
>> xmi:type="uml:Stereotype">
>> <name>Continuous</name>
>> <ownedComment
>> xmi:id="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous._ownedComment.0"
>> xmi:uuid="org.omg.sysml.SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous._ownedComment.0"
>> xmi:type="uml:Comment">
>> <body>
>> ..
>> </body>
>> <annotatedElement
>> xmi:idref="SysML.package_packagedElement_Activities.stereotype_packagedElement_Continuous"/>
>> </ownedComment>
>>
>> I'm guessing I get this error because the type of the
>> annotatedElement is UML Element, which is abstract, so a proxy can't
>> be created. Now, I don't know why a proxy would be created since the
>> actual element should have been created already.
>> My code was working with EMF (ecore+ecore.xmi) 2.11.0, meaning that
>> element with idrefs didn't require a xmi:type to be read. The code
>> doesn't work anymore in 2.11.1, so I'm suspecting
>> http://git.eclipse.org/c/emf/org.eclipse.emf.git/commit/?h=R2_11_maintenance&id=da4f80486a37c34d9eae223dd38fa9ee873ca36d
>> to have introduced the problem, but I don't know EMF well enough to say.
>>
>> Is there a workaround that does not involve adding an xmi:type to all
>> idrefs?
>>
>> Thanks!
>
Re: XMI idref reading error [message #1748541 is a reply to message #1734116] Thu, 24 November 2016 08:32 Go to previous messageGo to next message
Andreas Pleuss is currently offline Andreas PleussFriend
Messages: 18
Registered: June 2015
Junior Member
Hi,

I have the same problem. For instance, XMI exported by Enterprise Architect contains such constructs.

Is there any follow-up information about this problem? I didn't find a related bug ticket yet; should I create one?

Best regards,
Andreas

[Updated on: Thu, 24 November 2016 08:51]

Report message to a moderator

Re: XMI idref reading error [message #1748547 is a reply to message #1748541] Thu, 24 November 2016 09:55 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7176
Registered: July 2009
Senior Member
Hi

You'll find many messages regarding Enterprise Architect and RSA. They generally turn out to be incompatibilities in the use of obsolete UML versions. Eclipse UML2 supports UML 2.5 with some migration support for earlier versions but see https://wiki.eclipse.org/MDT/UML2/UML2_5.0_Migration_Guide and its predecessors if you are using non-trivial constructs.

Regards

Ed Willink
Re: XMI idref reading error [message #1748566 is a reply to message #1748541] Thu, 24 November 2016 14:00 Go to previous messageGo to next message
Raphael B is currently offline Raphael BFriend
Messages: 14
Registered: April 2013
Junior Member
Andreas,
Have you tried reading your file with EMF 2.11.0?
I ended "fixing" my issue by not upgrading EMF.

Raphael
Re: XMI idref reading error [message #1748581 is a reply to message #1748547] Thu, 24 November 2016 17:25 Go to previous messageGo to next message
Andreas Pleuss is currently offline Andreas PleussFriend
Messages: 18
Registered: June 2015
Junior Member
Hi Ed,

Thanks for the useful hint.

I was particularly wondering about the question posted above, i.e. XMI constructs such as
<ownedComment xmi:type="uml:Comment" xmi:id="xyz1" body="My comment">
    <annotatedElement xmi:idref="xyz2"/>
</ownedComment>

result in a org.eclipse.emf.ecore.xmi.IllegalValueException (as reported in the initial post of this thread). However, the XMI seems to be legal in terms of the XMI specification.

From the discussion above I understood that XMIHandler has not encountered yet the case of an xmi:idref, !isContainment(), isMany(), isResolveProxies() and an abstract feature type. So I was wondering if this should be filed as a bug.

Best regards,
Andreas
Re: XMI idref reading error [message #1748583 is a reply to message #1748566] Thu, 24 November 2016 17:40 Go to previous messageGo to next message
Andreas Pleuss is currently offline Andreas PleussFriend
Messages: 18
Registered: June 2015
Junior Member
Raphael B wrote on Thu, 24 November 2016 14:00
Andreas,
Have you tried reading your file with EMF 2.11.0?
I ended "fixing" my issue by not upgrading EMF.

Raphael


Hi Raphael,

Thanks for letting me know.
I think I'm constrained concerning the EMF version. At the moment I use a previous transformation step to remove those constructs as a temporary solution.

Best regards,
Andreas
Re: XMI idref reading error [message #1748584 is a reply to message #1748583] Thu, 24 November 2016 18:05 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7176
Registered: July 2009
Senior Member
Hi

If you can provide a simple repro, the bug can then be addressed.

Regards

Ed Willink
Re: XMI idref reading error [message #1748773 is a reply to message #1748584] Mon, 28 November 2016 14:18 Go to previous message
Andreas Pleuss is currently offline Andreas PleussFriend
Messages: 18
Registered: June 2015
Junior Member
I've filed a bug including a minimal example
https://bugs.eclipse.org/bugs/show_bug.cgi?id=508297

Best regards,
Andreas
Previous Topic:The changeRecorder consolidateChanges does not seem to handle opposite features
Next Topic:Transforming a model instance to .e4xmi and .fxml
Goto Forum:
  


Current Time: Sat Jun 19 10:23:02 GMT 2021

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

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

Back to the top