Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF sometimes doesn't resolve Proxy
EMF sometimes doesn't resolve Proxy [message #1064710] Thu, 20 June 2013 15:29 Go to next message
Tommaso De Sica is currently offline Tommaso De Sica
Messages: 128
Registered: March 2012
Location: Italy
Senior Member

Goodevening everyone,

I've got two reference to the same EObject, one with containment true one with containment false.

The situation is this:

Object A, B and C

Object A ---containment=true--->B
Object C ---containment=false--->B

So the XMI looks like this:

<Object A id="AAA">
   <listOfB>
      <Object B id="BB1" />
      <Object B id="BB2" />
   </listOfB>
</Object A>

....

<Object C id="CCC">
   <listOfB>
      <href="#BB1" />
   </listOfB>
</Object A>


Then, I load the resource and if I try to get object BB1 from objectA.getListOfB.get(0) I've got real Object B, but if try to do the same with ObjectC:
objectC.getListOfB.get(0) I've got a Proxy.

The only way to receive real object B that I've found is:
objectC.eResource().getEObject(EcoreUtil.getURI(objectC.getListOfB.get(0)).fragment());


Why this?
Re: EMF sometimes doesn't resolve Proxy [message #1064724 is a reply to message #1064710] Thu, 20 June 2013 16:30 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26136
Registered: July 2009
Senior Member
Tommaso,

Comments below.

On 20/06/2013 5:29 PM, Tommaso De Sica wrote:
> Goodevening everyone,
>
> I've got two reference to the same EObject, one with containment true
> one with containment false.
>
> The situation is this:
>
> Object A, B and C
>
> Object A ---containment=true--->B
> Object C ---containment=false--->B
>
> So the XMI looks like this:
>
>
> <Object A id="AAA">
> <listOfB>
> <Object B id="BB1" />
> <Object B id="BB2" />
> </listOfB>
> </Object A>
>
> ...
>
> <Object C id="CCC">
> <listOfB>
> <href="#BB1" />
> </listOfB>
> </Object A>
>
>
> Then, I load the resource and if I try to get object BB1 from
> objectA.getListOfB.get(0) I've got real Object B, but if try to do the
> same with ObjectC:
> objectC.getListOfB.get(0) I've got a Proxy.
>
> The only way to receive real object B that I've found is:
>
> objectC.eResource().getEObject(EcoreUtil.getURI(objectC.getListOfB.get(0)).fragment());
>
>
> Why this?
What URI are you using to load the resource? Perhaps not an absolute URI?
Re: EMF sometimes doesn't resolve Proxy [message #1064793 is a reply to message #1064724] Fri, 21 June 2013 07:25 Go to previous messageGo to next message
Tommaso De Sica is currently offline Tommaso De Sica
Messages: 128
Registered: March 2012
Location: Italy
Senior Member

Inside XMI file I see only the UUID of referred object (it stay in the same file). Inside eProxy there is my procotol URI that will be mapped to absolute URI (file://E:/....); but I couldn't catch the moment of resolution.
Re: EMF sometimes doesn't resolve Proxy [message #1064801 is a reply to message #1064793] Fri, 21 June 2013 07:47 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26136
Registered: July 2009
Senior Member
Tommaso,


Set a breakpoint in ResourceImpl.getEObject to see what this URI doesn't
resolve.


On 21/06/2013 9:25 AM, Tommaso De Sica wrote:
> Inside XMI file I see only the UUID of referred object (it stay in the
> same file). Inside eProxy there is my procotol URI that will be mapped
> to absolute URI (file://E:/....); but I couldn't catch the moment of
> resolution.
Previous Topic:Extending the Ecore meta-metamodel (M3)
Next Topic:Show EMF Validation problems in Eclipse problems view
Goto Forum:
  


Current Time: Wed Oct 22 15:38:43 GMT 2014

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

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