Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » ChangeDescription#applyAndReverse not "circular"
ChangeDescription#applyAndReverse not "circular" [message #530743] Fri, 30 April 2010 16:37 Go to next message
Cyril Jaquier is currently offline Cyril JaquierFriend
Messages: 80
Registered: July 2009
Member
Hi all, Hi Ed,

I'm using a (slightly) modified ChangeRecorder and ChangeDescription and
I'm currently facing an issue that sounds to me as a bug in the EMF
change model.

As far as I know, it should be possible to call applyAndReverse
repeatedly and the model would switch repeatedly between 2 states.
Calling applyAndReverse twice should give me the exact same model as in
the initial state.

In order to track down the problem, I created a dummy model:

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="test"
nsURI="http://www.ruag.com/test/v1" nsPrefix="">
<eClassifiers xsi:type="ecore:EClass" name="A">
<eStructuralFeatures xsi:type="ecore:EReference" name="elements"
upperBound="-1"
eType="#//B" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="B">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
lowerBound="1" eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="children"
upperBound="-1"
eType="#//B" containment="true"/>
</eClassifiers>
</ecore:EPackage>

Here comes the example:

<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns="http://www.ruag.com/test/v1"
xmlns:change="http://www.eclipse.org/emf/2003/Change">
<A>
<elements name="B group">
<children name="B0"/>
<children name="B1"/>
<children name="B2"/>
<children name="B3"/>
</elements>
</A>
<change:ChangeDescription>
<objectChanges key="/0">
<value featureName="elements">
<listChanges index="0"
referenceValues="/0/@elements.0/@children.0"/>
<listChanges index="1"
referenceValues="/0/@elements.0/@children.1"/>
<listChanges index="2"
referenceValues="/0/@elements.0/@children.2"/>
<listChanges index="3"
referenceValues="/0/@elements.0/@children.3"/>
<listChanges kind="REMOVE" index="4"/>
</value>
</objectChanges>
</change:ChangeDescription>
</xmi:XMI>

applyAndReverse

<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.ruag.com/test/v1"
xmlns:change="http://www.eclipse.org/emf/2003/Change">
<A>
<elements name="B0"/>
<elements name="B1"/>
<elements name="B2"/>
<elements name="B3"/>
</A>
<change:ChangeDescription>
<objectChanges key="/0">
<value featureName="elements">
<listChanges index="4" referenceValues="/1/@objectsToAttach.0"/>
<listChanges kind="REMOVE" index="3"/>
<listChanges kind="REMOVE" index="2"/>
<listChanges kind="REMOVE" index="1"/>
<listChanges kind="REMOVE" index="0"/>
</value>
</objectChanges>
<objectsToAttach xsi:type="B" name="B group"/>
</change:ChangeDescription>
</xmi:XMI>

applyAndReverse

<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.ruag.com/test/v1"
xmlns:change="http://www.eclipse.org/emf/2003/Change">
<A>
<elements name="B group"/>
</A>
<change:ChangeDescription>
<objectChanges key="/0">
<value featureName="elements">
<listChanges index="0" referenceValues="/1/@objectsToAttach.0"/>
<listChanges index="1" referenceValues="/1/@objectsToAttach.1"/>
<listChanges index="2" referenceValues="/1/@objectsToAttach.2"/>
<listChanges index="3" referenceValues="/1/@objectsToAttach.3"/>
<listChanges kind="REMOVE" index="4"/>
</value>
</objectChanges>
<objectsToAttach xsi:type="B" name="B0"/>
<objectsToAttach xsi:type="B" name="B1"/>
<objectsToAttach xsi:type="B" name="B2"/>
<objectsToAttach xsi:type="B" name="B3"/>
</change:ChangeDescription>
</xmi:XMI>

The change description after the first call to applyAndReverse seems to
miss some information. And as you can see, after the second call to
applyAndReverse, "B group" loses definitely its children :-( I observe
the same behaviour in our model.

Am I doing something wrong here or may I open a bugzilla with the testcase?

Thank you.

Regards,
Cyril Jaquier
Re: ChangeDescription#applyAndReverse not "circular" [message #530826 is a reply to message #530743] Sat, 01 May 2010 11:50 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33218
Registered: July 2009
Senior Member
Cyril,

It sounds like a bug, but one never knows what problems "slight" changes
can cause. If you open a bugzilla, I'll have a look at the behavior.


Cyril Jaquier wrote:
> Hi all, Hi Ed,
>
> I'm using a (slightly) modified ChangeRecorder and ChangeDescription
> and I'm currently facing an issue that sounds to me as a bug in the
> EMF change model.
>
> As far as I know, it should be possible to call applyAndReverse
> repeatedly and the model would switch repeatedly between 2 states.
> Calling applyAndReverse twice should give me the exact same model as
> in the initial state.
>
> In order to track down the problem, I created a dummy model:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="test"
> nsURI="http://www.ruag.com/test/v1" nsPrefix="">
> <eClassifiers xsi:type="ecore:EClass" name="A">
> <eStructuralFeatures xsi:type="ecore:EReference" name="elements"
> upperBound="-1"
> eType="#//B" containment="true"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="B">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
> lowerBound="1" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="children"
> upperBound="-1"
> eType="#//B" containment="true"/>
> </eClassifiers>
> </ecore:EPackage>
>
> Here comes the example:
>
> <?xml version="1.0" encoding="ASCII"?>
> <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns="http://www.ruag.com/test/v1"
> xmlns:change="http://www.eclipse.org/emf/2003/Change">
> <A>
> <elements name="B group">
> <children name="B0"/>
> <children name="B1"/>
> <children name="B2"/>
> <children name="B3"/>
> </elements>
> </A>
> <change:ChangeDescription>
> <objectChanges key="/0">
> <value featureName="elements">
> <listChanges index="0"
> referenceValues="/0/@elements.0/@children.0"/>
> <listChanges index="1"
> referenceValues="/0/@elements.0/@children.1"/>
> <listChanges index="2"
> referenceValues="/0/@elements.0/@children.2"/>
> <listChanges index="3"
> referenceValues="/0/@elements.0/@children.3"/>
> <listChanges kind="REMOVE" index="4"/>
> </value>
> </objectChanges>
> </change:ChangeDescription>
> </xmi:XMI>
>
> applyAndReverse
>
> <?xml version="1.0" encoding="ASCII"?>
> <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://www.ruag.com/test/v1"
> xmlns:change="http://www.eclipse.org/emf/2003/Change">
> <A>
> <elements name="B0"/>
> <elements name="B1"/>
> <elements name="B2"/>
> <elements name="B3"/>
> </A>
> <change:ChangeDescription>
> <objectChanges key="/0">
> <value featureName="elements">
> <listChanges index="4" referenceValues="/1/@objectsToAttach.0"/>
> <listChanges kind="REMOVE" index="3"/>
> <listChanges kind="REMOVE" index="2"/>
> <listChanges kind="REMOVE" index="1"/>
> <listChanges kind="REMOVE" index="0"/>
> </value>
> </objectChanges>
> <objectsToAttach xsi:type="B" name="B group"/>
> </change:ChangeDescription>
> </xmi:XMI>
>
> applyAndReverse
>
> <?xml version="1.0" encoding="ASCII"?>
> <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://www.ruag.com/test/v1"
> xmlns:change="http://www.eclipse.org/emf/2003/Change">
> <A>
> <elements name="B group"/>
> </A>
> <change:ChangeDescription>
> <objectChanges key="/0">
> <value featureName="elements">
> <listChanges index="0" referenceValues="/1/@objectsToAttach.0"/>
> <listChanges index="1" referenceValues="/1/@objectsToAttach.1"/>
> <listChanges index="2" referenceValues="/1/@objectsToAttach.2"/>
> <listChanges index="3" referenceValues="/1/@objectsToAttach.3"/>
> <listChanges kind="REMOVE" index="4"/>
> </value>
> </objectChanges>
> <objectsToAttach xsi:type="B" name="B0"/>
> <objectsToAttach xsi:type="B" name="B1"/>
> <objectsToAttach xsi:type="B" name="B2"/>
> <objectsToAttach xsi:type="B" name="B3"/>
> </change:ChangeDescription>
> </xmi:XMI>
>
> The change description after the first call to applyAndReverse seems
> to miss some information. And as you can see, after the second call to
> applyAndReverse, "B group" loses definitely its children :-( I observe
> the same behaviour in our model.
>
> Am I doing something wrong here or may I open a bugzilla with the
> testcase?
>
> Thank you.
>
> Regards,
> Cyril Jaquier


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ChangeDescription#applyAndReverse not "circular" [message #530950 is a reply to message #530826] Mon, 03 May 2010 07:01 Go to previous message
Cyril Jaquier is currently offline Cyril JaquierFriend
Messages: 80
Registered: July 2009
Member
Hi Ed,

https://bugs.eclipse.org/bugs/show_bug.cgi?id=311334

Thank you. I would really appreciate if you could have a look at it.
Eclipse project with test case is attached to the bugzilla.

Thank you.

Cheers,
Cyril


Ed Merks wrote:
> Cyril,
>
> It sounds like a bug, but one never knows what problems "slight" changes
> can cause. If you open a bugzilla, I'll have a look at the behavior.
>
>
> Cyril Jaquier wrote:
>> Hi all, Hi Ed,
>>
>> I'm using a (slightly) modified ChangeRecorder and ChangeDescription
>> and I'm currently facing an issue that sounds to me as a bug in the
>> EMF change model.
>>
>> As far as I know, it should be possible to call applyAndReverse
>> repeatedly and the model would switch repeatedly between 2 states.
>> Calling applyAndReverse twice should give me the exact same model as
>> in the initial state.
>>
>> In order to track down the problem, I created a dummy model:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <ecore:EPackage xmi:version="2.0"
>> xmlns:xmi="http://www.omg.org/XMI"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="test"
>> nsURI="http://www.ruag.com/test/v1" nsPrefix="">
>> <eClassifiers xsi:type="ecore:EClass" name="A">
>> <eStructuralFeatures xsi:type="ecore:EReference" name="elements"
>> upperBound="-1"
>> eType="#//B" containment="true"/>
>> </eClassifiers>
>> <eClassifiers xsi:type="ecore:EClass" name="B">
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>> lowerBound="1" eType="ecore:EDataType
>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="children"
>> upperBound="-1"
>> eType="#//B" containment="true"/>
>> </eClassifiers>
>> </ecore:EPackage>
>>
>> Here comes the example:
>>
>> <?xml version="1.0" encoding="ASCII"?>
>> <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
>> xmlns="http://www.ruag.com/test/v1"
>> xmlns:change="http://www.eclipse.org/emf/2003/Change">
>> <A>
>> <elements name="B group">
>> <children name="B0"/>
>> <children name="B1"/>
>> <children name="B2"/>
>> <children name="B3"/>
>> </elements>
>> </A>
>> <change:ChangeDescription>
>> <objectChanges key="/0">
>> <value featureName="elements">
>> <listChanges index="0"
>> referenceValues="/0/@elements.0/@children.0"/>
>> <listChanges index="1"
>> referenceValues="/0/@elements.0/@children.1"/>
>> <listChanges index="2"
>> referenceValues="/0/@elements.0/@children.2"/>
>> <listChanges index="3"
>> referenceValues="/0/@elements.0/@children.3"/>
>> <listChanges kind="REMOVE" index="4"/>
>> </value>
>> </objectChanges>
>> </change:ChangeDescription>
>> </xmi:XMI>
>>
>> applyAndReverse
>>
>> <?xml version="1.0" encoding="ASCII"?>
>> <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns="http://www.ruag.com/test/v1"
>> xmlns:change="http://www.eclipse.org/emf/2003/Change">
>> <A>
>> <elements name="B0"/>
>> <elements name="B1"/>
>> <elements name="B2"/>
>> <elements name="B3"/>
>> </A>
>> <change:ChangeDescription>
>> <objectChanges key="/0">
>> <value featureName="elements">
>> <listChanges index="4" referenceValues="/1/@objectsToAttach.0"/>
>> <listChanges kind="REMOVE" index="3"/>
>> <listChanges kind="REMOVE" index="2"/>
>> <listChanges kind="REMOVE" index="1"/>
>> <listChanges kind="REMOVE" index="0"/>
>> </value>
>> </objectChanges>
>> <objectsToAttach xsi:type="B" name="B group"/>
>> </change:ChangeDescription>
>> </xmi:XMI>
>>
>> applyAndReverse
>>
>> <?xml version="1.0" encoding="ASCII"?>
>> <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns="http://www.ruag.com/test/v1"
>> xmlns:change="http://www.eclipse.org/emf/2003/Change">
>> <A>
>> <elements name="B group"/>
>> </A>
>> <change:ChangeDescription>
>> <objectChanges key="/0">
>> <value featureName="elements">
>> <listChanges index="0" referenceValues="/1/@objectsToAttach.0"/>
>> <listChanges index="1" referenceValues="/1/@objectsToAttach.1"/>
>> <listChanges index="2" referenceValues="/1/@objectsToAttach.2"/>
>> <listChanges index="3" referenceValues="/1/@objectsToAttach.3"/>
>> <listChanges kind="REMOVE" index="4"/>
>> </value>
>> </objectChanges>
>> <objectsToAttach xsi:type="B" name="B0"/>
>> <objectsToAttach xsi:type="B" name="B1"/>
>> <objectsToAttach xsi:type="B" name="B2"/>
>> <objectsToAttach xsi:type="B" name="B3"/>
>> </change:ChangeDescription>
>> </xmi:XMI>
>>
>> The change description after the first call to applyAndReverse seems
>> to miss some information. And as you can see, after the second call to
>> applyAndReverse, "B group" loses definitely its children :-( I observe
>> the same behaviour in our model.
>>
>> Am I doing something wrong here or may I open a bugzilla with the
>> testcase?
>>
>> Thank you.
>>
>> Regards,
>> Cyril Jaquier
Previous Topic:EMF + DataBinding + Master/Detail problem
Next Topic:Experience with emf and .NET?
Goto Forum:
  


Current Time: Tue Sep 24 19:53:34 GMT 2024

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

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

Back to the top