Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Compare] reference lists seem to be handled differently than containment lists
[EMF Compare] reference lists seem to be handled differently than containment lists [message #125171] Fri, 06 June 2008 00:01 Go to next message
Jason Henriksen is currently offline Jason HenriksenFriend
Messages: 231
Registered: July 2009
Senior Member
Hi All,

I have XSD like this:

<xsd:complexType name="Floor">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="roomList"
type="com.ibm.example.building:Room"/>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="fakeList"
type="com.ibm.example.building:Room"/>
</xsd:sequence>
<xsd:attribute name="level" type="xsd:ID"/>
</xsd:complexType>

I remove an item from the roomlist and get this diff node:

<subDiffElements xsi:type="diff:RemoveModelElement">
<rightParent href="altered.xml#2"/>
<leftElement href="original.xml#bed_2"/>
</subDiffElements>

That tells me that bed_2 was removed from floor 2, but it doesn't tell
me which list used to contain the item. Was it the roomList or the
fakeList?



With references, this is no problem:

<subDiffElements xsi:type="diff:RemoveReferenceValue">
<reference
href=" http:///com/ibm/example/Building.ecore#//Room/connectsToList"
/>
<rightElement href="altered.xml#stairs_L2"/>
<leftElement href="original.xml#stairs_L2"/>
<leftRemovedTarget href="original.xml#attic"/>
</subDiffElements>

I can see from the reference url which list was altered (In this
example, connectsToList). Am I doing something wrong that prevents this
from working when I use containment?

Thanks,

Jason Henriksen
Re: [EMF Compare] reference lists seem to be handled differently than containment lists [message #125343 is a reply to message #125171] Fri, 06 June 2008 22:05 Go to previous messageGo to next message
Jason Henriksen is currently offline Jason HenriksenFriend
Messages: 231
Registered: July 2009
Senior Member
Ha! Sorted it out!

With references I get the reference spelled out for me:

<subDiffElements xsi:type="diff:RemoveReferenceValue">
<reference
href=" http:///com/ibm/example/Building.ecore#//Room/connectsToList"
/>
<rightElement href="altered.xml#stairs_L2"/>
<leftElement href="original.xml#stairs_L2"/>
<leftRemovedTarget href="original.xml#attic"/>
</subDiffElements>


With containment, I don't need it spelled out for me because I can call:

EObjectImpl target = (EObjectImpl)cur.getRightElement();
EStructuralFeature esf = target.eContainingFeature();

which I was not previously aware of. From the structural feature I get
the same info that I needed the reference tag for above.

Jason
Re: [EMF Compare] reference lists seem to be handled differently than containment lists [message #125382 is a reply to message #125343] Fri, 06 June 2008 23:11 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Jason,

Just don't cast to EObjectImpl. Cast to EObject instead. If you even
need to; what's the type?


jason henriksen wrote:
>
> Ha! Sorted it out!
>
> With references I get the reference spelled out for me:
>
> <subDiffElements xsi:type="diff:RemoveReferenceValue">
> <reference
> href=" http:///com/ibm/example/Building.ecore#//Room/connectsToList"
> />
> <rightElement href="altered.xml#stairs_L2"/>
> <leftElement href="original.xml#stairs_L2"/>
> <leftRemovedTarget href="original.xml#attic"/>
> </subDiffElements>
>
>
> With containment, I don't need it spelled out for me because I can call:
>
> EObjectImpl target = (EObjectImpl)cur.getRightElement();
> EStructuralFeature esf = target.eContainingFeature();
>
> which I was not previously aware of. From the structural feature I
> get the same info that I needed the reference tag for above.
>
> Jason
Re: [EMF Compare] reference lists seem to be handled differently than containment lists [message #619208 is a reply to message #125171] Fri, 06 June 2008 22:05 Go to previous message
Jason Henriksen is currently offline Jason HenriksenFriend
Messages: 231
Registered: July 2009
Senior Member
Ha! Sorted it out!

With references I get the reference spelled out for me:

<subDiffElements xsi:type="diff:RemoveReferenceValue">
<reference
href=" http:///com/ibm/example/Building.ecore#//Room/connectsToList"
/>
<rightElement href="altered.xml#stairs_L2"/>
<leftElement href="original.xml#stairs_L2"/>
<leftRemovedTarget href="original.xml#attic"/>
</subDiffElements>


With containment, I don't need it spelled out for me because I can call:

EObjectImpl target = (EObjectImpl)cur.getRightElement();
EStructuralFeature esf = target.eContainingFeature();

which I was not previously aware of. From the structural feature I get
the same info that I needed the reference tag for above.

Jason
Re: [EMF Compare] reference lists seem to be handled differently than containment lists [message #619211 is a reply to message #125343] Fri, 06 June 2008 23:11 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31009
Registered: July 2009
Senior Member
Jason,

Just don't cast to EObjectImpl. Cast to EObject instead. If you even
need to; what's the type?


jason henriksen wrote:
>
> Ha! Sorted it out!
>
> With references I get the reference spelled out for me:
>
> <subDiffElements xsi:type="diff:RemoveReferenceValue">
> <reference
> href=" http:///com/ibm/example/Building.ecore#//Room/connectsToList"
> />
> <rightElement href="altered.xml#stairs_L2"/>
> <leftElement href="original.xml#stairs_L2"/>
> <leftRemovedTarget href="original.xml#attic"/>
> </subDiffElements>
>
>
> With containment, I don't need it spelled out for me because I can call:
>
> EObjectImpl target = (EObjectImpl)cur.getRightElement();
> EStructuralFeature esf = target.eContainingFeature();
>
> which I was not previously aware of. From the structural feature I
> get the same info that I needed the reference tag for above.
>
> Jason
Previous Topic:[Teneo] not finding hibernate.properties
Next Topic:AttributeOverride of Parent's Component
Goto Forum:
  


Current Time: Wed Apr 01 23:46:46 GMT 2020

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

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

Back to the top