Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF] UnresolvedReferenceException on a ID reference with spaces in it.
[EMF] UnresolvedReferenceException on a ID reference with spaces in it. [message #629332] Mon, 27 September 2010 19:43 Go to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi,

I didn't notice before, but it seems when the ID field is set on a
feature, the references to a class holding this feature, will be
absolute and serialize the reference with the feature value.

In my case the class Relationships has a reference (Element2Ref) to an
object named "Elephant Talk".

<Relationships Abstract="false" Element1Ref="#AMSHLR01"
Element2Ref="#Elephant Talk" MaxConnections="0" Name="_AAATEST"
Payload="Traffic" RequireConnection="false"/>

The fact that this name holds a space(is not encoded) leads to an
exception. Is there a way to make the reference relative? (Not sure of
the name of this, but it uses a reference to the index of the object in
the resource like this: "#//@elements.1" ). How do I control how
references are serialized?

Note that the referenced object in this case ("Elephant Talk") is
generated by QVTo, and, I should look for a way for QVTo to encode it
properly.

org.eclipse.emf.ecore.xmi.UnresolvedReferenceException: Unresolved
reference 'Elephant'.
(platform:/resource/NetXstudio/Imports/27092010_CS.netxstudi o, 326, 170)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleForwardRefer ences(XMLHandler.java:1154)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.endDocument(XMLHan dler.java:1228)


thanks Christophe
Re: [EMF] UnresolvedReferenceException on a ID reference with spaces in it. [message #629389 is a reply to message #629332] Tue, 28 September 2010 06:46 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30559
Registered: July 2009
Senior Member
Christophe,

Comments below.

Christophe Bouhier wrote:
> Hi,
>
> I didn't notice before, but it seems when the ID field is set on a
> feature, the references to a class holding this feature, will be
> absolute and serialize the reference with the feature value.
Yes.
>
> In my case the class Relationships has a reference (Element2Ref) to an
> object named "Elephant Talk".
That could be problematic.
>
> <Relationships Abstract="false" Element1Ref="#AMSHLR01"
> Element2Ref="#Elephant Talk" MaxConnections="0" Name="_AAATEST"
> Payload="Traffic" RequireConnection="false"/>
>
> The fact that this name holds a space(is not encoded) leads to an
> exception. Is there a way to make the reference relative? (Not sure
> of the name of this, but it uses a reference to the index of the
> object in the resource like this: "#//@elements.1" ).
By making the feature not be an ID.
> How do I control how references are serialized?
An alternative is to define an EDataType that wraps java.lang.String,
but encodes spaces (and characters like : and # that will also cause
confusion).
>
> Note that the referenced object in this case ("Elephant Talk") is
> generated by QVTo, and, I should look for a way for QVTo to encode it
> properly.
>
> org.eclipse.emf.ecore.xmi.UnresolvedReferenceException: Unresolved
> reference 'Elephant'.
> (platform:/resource/NetXstudio/Imports/27092010_CS.netxstudi o, 326, 170)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleForwardRefer ences(XMLHandler.java:1154)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.endDocument(XMLHan dler.java:1228)
>
>
>
> thanks Christophe
Re: [EMF] UnresolvedReferenceException on a ID reference with spaces in it. [message #629437 is a reply to message #629389] Tue, 28 September 2010 09:50 Go to previous message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Thanks Ed, I found a long thread on the topic in the forum with many
more details. I have removed the ID from the feature and this is ok for
now.
rgds Christophe

On 28-09-10 08:46, Ed Merks wrote:
> Christophe,
>
> Comments below.
>
> Christophe Bouhier wrote:
>> Hi,
>>
>> I didn't notice before, but it seems when the ID field is set on a
>> feature, the references to a class holding this feature, will be
>> absolute and serialize the reference with the feature value.
> Yes.
>>
>> In my case the class Relationships has a reference (Element2Ref) to an
>> object named "Elephant Talk".
> That could be problematic.
>>
>> <Relationships Abstract="false" Element1Ref="#AMSHLR01"
>> Element2Ref="#Elephant Talk" MaxConnections="0" Name="_AAATEST"
>> Payload="Traffic" RequireConnection="false"/>
>>
>> The fact that this name holds a space(is not encoded) leads to an
>> exception. Is there a way to make the reference relative? (Not sure of
>> the name of this, but it uses a reference to the index of the object
>> in the resource like this: "#//@elements.1" ).
> By making the feature not be an ID.
>> How do I control how references are serialized?
> An alternative is to define an EDataType that wraps java.lang.String,
> but encodes spaces (and characters like : and # that will also cause
> confusion).
>>
>> Note that the referenced object in this case ("Elephant Talk") is
>> generated by QVTo, and, I should look for a way for QVTo to encode it
>> properly.
>>
>> org.eclipse.emf.ecore.xmi.UnresolvedReferenceException: Unresolved
>> reference 'Elephant'.
>> (platform:/resource/NetXstudio/Imports/27092010_CS.netxstudi o, 326, 170)
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleForwardRefer ences(XMLHandler.java:1154)
>>
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.endDocument(XMLHan dler.java:1228)
>>
>>
>>
>> thanks Christophe
Previous Topic:DragAndDropCommand
Next Topic:[CDO] How to close server ?
Goto Forum:
  


Current Time: Thu Oct 24 02:03:49 GMT 2019

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

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

Back to the top