Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Compare] 3 way content match is losing an add?
[EMF Compare] 3 way content match is losing an add? [message #138694] Wed, 15 July 2009 22:42 Go to next message
Eclipse UserFriend
Originally posted by: stephenmccants.yahoo.com

Hello,
I'm not sure if I'm doing something wrong, or if I've found a bug, but I have a model that has a
left and right that are both different from their ancestor.

Here is the ancestor:

<com.ibm.xmlns.prod.hdwb.test:TestFolder xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:com.ibm.xmlns.prod.hdwb.test="http://www.ibm.com/xmlns/prod/hdwb/test/4.0"
name="Folder 3" contextId="UUID1">
<parent href="root#/"/>
</com.ibm.xmlns.prod.hdwb.test:TestFolder>

Here is the left side, which has the name changed:

<com.ibm.xmlns.prod.hdwb.test:TestFolder xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:com.ibm.xmlns.prod.hdwb.test="http://www.ibm.com/xmlns/prod/hdwb/test/4.0"
name="Fredrick" contextId="UUID1">
<parent href="root#/"/>
</com.ibm.xmlns.prod.hdwb.test:TestFolder>

Here is the right side, which has a child ("resource") added:

<com.ibm.xmlns.prod.hdwb.test:TestFolder xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:com.ibm.xmlns.prod.hdwb.test="http://www.ibm.com/xmlns/prod/hdwb/test/4.0"
name="Folder 3" contextId="UUID1">
<parent href="root#/"/>
<resources href="third#/"/>
</com.ibm.xmlns.prod.hdwb.test:TestFolder>

I'm expecting the match model to match the three TestFolders and show an unmatched object which is
the added resource (third). Instead I only get the three TestFolders matched:

<match:MatchModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:match="http://www.eclipse.org/emf/compare/match/1.1">
<matchedElements xsi:type="match:Match3Elements" similarity="0.43478260869565216">
<leftElement href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<rightElement href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<originElement href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
</matchedElements>
<leftRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<rightRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<ancestorRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
</match:MatchModel>

This goes means that the diff model only reports the name change and does not report the add:

<diff:DiffModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:diff="http://www.eclipse.org/emf/compare/diff/1.1">
<ownedElements xsi:type="diff:DiffGroup">
<subDiffElements xsi:type="diff:DiffGroup">
<subDiffElements xsi:type="diff:DiffGroup">
<subDiffElements xsi:type="diff:UpdateAttribute">
<attribute href=" http://www.ibm.com/xmlns/prod/hdwb/test/4.0#//TestResource/n ame"/>
<leftElement href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<rightElement href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
</subDiffElements>
<rightParent href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
</subDiffElements>
<rightParent href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/root#/"/>
</subDiffElements>
</ownedElements>
<leftRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<rightRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<ancestorRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
</diff:DiffModel>

So when I merge the differences (should be mergable without problem), I only get the resulting
object has either the name change OR the add, but never both. Which I get depends on whether I
merge to the left or to the right.

I started digging into what is going on in the GenericMatchEngine and found what I think is the
problem. The initial contentMatch(rightObject, ancestor, optionMap) call on line 166
(GenericMatchEngine) works correctly and adds the child object (named "TestContext 4") to the
stillToFindFromModel1 List. The object is also added to remainingUnmatchedElements as well (pulled
from rightObjectAncestorMatch.getUnmatchedElements()).

The processUnmatchedElements(...) call (GenericMatchEngine line 202) does nothing because the
unmatched object from stillToFindFromModel1 is an instance of TestContext (part of my model) and not
an Match2Elements object.

The for loop in line 207 (GenericMatchEngine) that deals with remainingUnmatchedElements does
nothing, because the TestContext actually belongs to a different resource than the object
referencing it.

After that, the Lists are cleared and the unmatched object is simply lost.

It is worth noting that I've overridden the isSimilar(...) method, but I don't think that should
affect unmatched objects.

I'm thinking about overriding contentMatch(EObject, EObject, EObject, Map) to handle my specific case.

Any thoughts? Is this a bug or am I going about this the wrong way?

Thanks for your help!

Sincerely,
Stephen McCants
Re: [EMF Compare] 3 way content match is losing an add? [message #138711 is a reply to message #138694] Wed, 15 July 2009 23:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stephenmccants.yahoo.com

I forced it to put the unmatched element in the match model (as an unmatched element, of course),
but when I did the merge it did something I didn't want. It did successfully add the child, but it
placed it inside its parent's resource instead of a reference to the child's own resource.

Here was the resulting match model:

<?xml version="1.0" encoding="ISO-8859-1"?>
<match:MatchModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:match="http://www.eclipse.org/emf/compare/match/1.1">
<matchedElements xsi:type="match:Match3Elements" similarity="0.43478260869565216">
<leftElement href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<rightElement href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<originElement href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
</matchedElements>
<unmatchedElements remote="true" side="Right">
<element href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/third# /"/>
</unmatchedElements>
<leftRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<rightRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<ancestorRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
</match:MatchModel>

Here is the resulting diff model:

<?xml version="1.0" encoding="ISO-8859-1"?>
<diff:DiffModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:diff="http://www.eclipse.org/emf/compare/diff/1.1">
<ownedElements xsi:type="diff:DiffGroup">
<subDiffElements xsi:type="diff:DiffGroup">
<subDiffElements xsi:type="diff:DiffGroup">
<subDiffElements xsi:type="diff:UpdateAttribute">
<attribute href=" http://www.ibm.com/xmlns/prod/hdwb/test/4.0#//TestResource/n ame"/>
<leftElement href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<rightElement href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
</subDiffElements>
<subDiffElements xsi:type="diff:ModelElementChangeLeftTarget" remote="true">
<rightParent href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<leftElement href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/third# /"/>
</subDiffElements>
<rightParent href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
</subDiffElements>
<rightParent href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/root#/"/>
</subDiffElements>
</ownedElements>
<leftRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<rightRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<ancestorRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
</diff:DiffModel>

Here is the resulting object:

<com.ibm.xmlns.prod.hdwb.test:TestFolder xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:com.ibm.xmlns.prod.hdwb.test="http://www.ibm.com/xmlns/prod/hdwb/test/4.0"
name="Fredrick" contextId="_SdHucWT6Ed6p-b87WYLUSw">
<parent href="root#/"/>
<resources xsi:type="com.ibm.xmlns.prod.hdwb.test:TestContext" name="Context 4"
contextId="_SdHucWT6Ed6p-b87WYLUSw"/>
</com.ibm.xmlns.prod.hdwb.test:TestFolder>

Here is the desired object:

<com.ibm.xmlns.prod.hdwb.test:TestFolder xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:com.ibm.xmlns.prod.hdwb.test="http://www.ibm.com/xmlns/prod/hdwb/test/4.0"
name="Folder 3" contextId="UUID1">
<parent href="root#/"/>
<resources href="third#/"/>
</com.ibm.xmlns.prod.hdwb.test:TestFolder>

I'm thinking about overriding the Merge code to handle the references to another resource. Is there
a better way to go about this? Thanks!

--Stephen


Stephen McCants wrote:
> Hello,
> I'm not sure if I'm doing something wrong, or if I've found a bug,
> but I have a model that has a left and right that are both different
> from their ancestor.
>
> Here is the ancestor:
>
> <com.ibm.xmlns.prod.hdwb.test:TestFolder xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
>
> xmlns:com.ibm.xmlns.prod.hdwb.test="http://www.ibm.com/xmlns/prod/hdwb/test/4.0"
>
> name="Folder 3" contextId="UUID1">
> <parent href="root#/"/>
> </com.ibm.xmlns.prod.hdwb.test:TestFolder>
>
> Here is the left side, which has the name changed:
>
> <com.ibm.xmlns.prod.hdwb.test:TestFolder xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
>
> xmlns:com.ibm.xmlns.prod.hdwb.test="http://www.ibm.com/xmlns/prod/hdwb/test/4.0"
>
> name="Fredrick" contextId="UUID1">
> <parent href="root#/"/>
> </com.ibm.xmlns.prod.hdwb.test:TestFolder>
>
> Here is the right side, which has a child ("resource") added:
>
> <com.ibm.xmlns.prod.hdwb.test:TestFolder xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
>
> xmlns:com.ibm.xmlns.prod.hdwb.test="http://www.ibm.com/xmlns/prod/hdwb/test/4.0"
>
> name="Folder 3" contextId="UUID1">
> <parent href="root#/"/>
> <resources href="third#/"/>
> </com.ibm.xmlns.prod.hdwb.test:TestFolder>
>
> I'm expecting the match model to match the three TestFolders and show an
> unmatched object which is the added resource (third). Instead I only
> get the three TestFolders matched:
>
> <match:MatchModel xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:match="http://www.eclipse.org/emf/compare/match/1.1">
> <matchedElements xsi:type="match:Match3Elements"
> similarity="0.43478260869565216">
> <leftElement
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> <rightElement
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> <originElement
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> </matchedElements>
> <leftRoots
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> <rightRoots
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> <ancestorRoots
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> </match:MatchModel>
>
> This goes means that the diff model only reports the name change and
> does not report the add:
>
> <diff:DiffModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:diff="http://www.eclipse.org/emf/compare/diff/1.1">
> <ownedElements xsi:type="diff:DiffGroup">
> <subDiffElements xsi:type="diff:DiffGroup">
> <subDiffElements xsi:type="diff:DiffGroup">
> <subDiffElements xsi:type="diff:UpdateAttribute">
> <attribute
> href=" http://www.ibm.com/xmlns/prod/hdwb/test/4.0#//TestResource/n ame"/>
> <leftElement
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> <rightElement
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> </subDiffElements>
> <rightParent
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> </subDiffElements>
> <rightParent
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/root#/"/>
> </subDiffElements>
> </ownedElements>
> <leftRoots
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> <rightRoots
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> <ancestorRoots
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> </diff:DiffModel>
>
> So when I merge the differences (should be mergable without problem), I
> only get the resulting object has either the name change OR the add, but
> never both. Which I get depends on whether I merge to the left or to
> the right.
>
> I started digging into what is going on in the GenericMatchEngine and
> found what I think is the problem. The initial
> contentMatch(rightObject, ancestor, optionMap) call on line 166
> (GenericMatchEngine) works correctly and adds the child object (named
> "TestContext 4") to the stillToFindFromModel1 List. The object is also
> added to remainingUnmatchedElements as well (pulled from
> rightObjectAncestorMatch.getUnmatchedElements()).
>
> The processUnmatchedElements(...) call (GenericMatchEngine line 202)
> does nothing because the unmatched object from stillToFindFromModel1 is
> an instance of TestContext (part of my model) and not an Match2Elements
> object.
>
> The for loop in line 207 (GenericMatchEngine) that deals with
> remainingUnmatchedElements does nothing, because the TestContext
> actually belongs to a different resource than the object referencing it.
>
> After that, the Lists are cleared and the unmatched object is simply lost.
>
> It is worth noting that I've overridden the isSimilar(...) method, but I
> don't think that should affect unmatched objects.
>
> I'm thinking about overriding contentMatch(EObject, EObject, EObject,
> Map) to handle my specific case.
>
> Any thoughts? Is this a bug or am I going about this the wrong way?
>
> Thanks for your help!
>
> Sincerely,
> Stephen McCants
Re: [EMF Compare] 3 way content match is losing an add? [message #138733 is a reply to message #138711] Thu, 16 July 2009 07:49 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000505070507020808000308
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Hi Stephen,

I must admit I am quite lost as to what you're doing and what your
models look like (I am not fluent in xmi :p). You seem to have multiple
resources... inter-model references will only be properly matched if you
use MatchService#doResourceSetMatch(). That said, losing differences
seems like a bug to me. Can you reproduce this with the Generic engine?
If yes, could you raise a bugzilla with a use case that can be used to
reproduce this (I couldn't with UML/ecore class diagrams)?

Laurent Goubet
Obeo

Stephen McCants a
Re: [EMF Compare] 3 way content match is losing an add? [message #621141 is a reply to message #138694] Wed, 15 July 2009 23:40 Go to previous message
Stephen McCants is currently offline Stephen McCantsFriend
Messages: 92
Registered: July 2009
Member
I forced it to put the unmatched element in the match model (as an unmatched element, of course),
but when I did the merge it did something I didn't want. It did successfully add the child, but it
placed it inside its parent's resource instead of a reference to the child's own resource.

Here was the resulting match model:

<?xml version="1.0" encoding="ISO-8859-1"?>
<match:MatchModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:match="http://www.eclipse.org/emf/compare/match/1.1">
<matchedElements xsi:type="match:Match3Elements" similarity="0.43478260869565216">
<leftElement href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<rightElement href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<originElement href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
</matchedElements>
<unmatchedElements remote="true" side="Right">
<element href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/third# /"/>
</unmatchedElements>
<leftRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<rightRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<ancestorRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
</match:MatchModel>

Here is the resulting diff model:

<?xml version="1.0" encoding="ISO-8859-1"?>
<diff:DiffModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:diff="http://www.eclipse.org/emf/compare/diff/1.1">
<ownedElements xsi:type="diff:DiffGroup">
<subDiffElements xsi:type="diff:DiffGroup">
<subDiffElements xsi:type="diff:DiffGroup">
<subDiffElements xsi:type="diff:UpdateAttribute">
<attribute href=" http://www.ibm.com/xmlns/prod/hdwb/test/4.0#//TestResource/n ame"/>
<leftElement href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<rightElement href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
</subDiffElements>
<subDiffElements xsi:type="diff:ModelElementChangeLeftTarget" remote="true">
<rightParent href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<leftElement href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/third# /"/>
</subDiffElements>
<rightParent href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
</subDiffElements>
<rightParent href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/root#/"/>
</subDiffElements>
</ownedElements>
<leftRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<rightRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
<ancestorRoots href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
</diff:DiffModel>

Here is the resulting object:

<com.ibm.xmlns.prod.hdwb.test:TestFolder xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:com.ibm.xmlns.prod.hdwb.test="http://www.ibm.com/xmlns/prod/hdwb/test/4.0"
name="Fredrick" contextId="_SdHucWT6Ed6p-b87WYLUSw">
<parent href="root#/"/>
<resources xsi:type="com.ibm.xmlns.prod.hdwb.test:TestContext" name="Context 4"
contextId="_SdHucWT6Ed6p-b87WYLUSw"/>
</com.ibm.xmlns.prod.hdwb.test:TestFolder>

Here is the desired object:

<com.ibm.xmlns.prod.hdwb.test:TestFolder xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:com.ibm.xmlns.prod.hdwb.test="http://www.ibm.com/xmlns/prod/hdwb/test/4.0"
name="Folder 3" contextId="UUID1">
<parent href="root#/"/>
<resources href="third#/"/>
</com.ibm.xmlns.prod.hdwb.test:TestFolder>

I'm thinking about overriding the Merge code to handle the references to another resource. Is there
a better way to go about this? Thanks!

--Stephen


Stephen McCants wrote:
> Hello,
> I'm not sure if I'm doing something wrong, or if I've found a bug,
> but I have a model that has a left and right that are both different
> from their ancestor.
>
> Here is the ancestor:
>
> <com.ibm.xmlns.prod.hdwb.test:TestFolder xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
>
> xmlns:com.ibm.xmlns.prod.hdwb.test="http://www.ibm.com/xmlns/prod/hdwb/test/4.0"
>
> name="Folder 3" contextId="UUID1">
> <parent href="root#/"/>
> </com.ibm.xmlns.prod.hdwb.test:TestFolder>
>
> Here is the left side, which has the name changed:
>
> <com.ibm.xmlns.prod.hdwb.test:TestFolder xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
>
> xmlns:com.ibm.xmlns.prod.hdwb.test="http://www.ibm.com/xmlns/prod/hdwb/test/4.0"
>
> name="Fredrick" contextId="UUID1">
> <parent href="root#/"/>
> </com.ibm.xmlns.prod.hdwb.test:TestFolder>
>
> Here is the right side, which has a child ("resource") added:
>
> <com.ibm.xmlns.prod.hdwb.test:TestFolder xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
>
> xmlns:com.ibm.xmlns.prod.hdwb.test="http://www.ibm.com/xmlns/prod/hdwb/test/4.0"
>
> name="Folder 3" contextId="UUID1">
> <parent href="root#/"/>
> <resources href="third#/"/>
> </com.ibm.xmlns.prod.hdwb.test:TestFolder>
>
> I'm expecting the match model to match the three TestFolders and show an
> unmatched object which is the added resource (third). Instead I only
> get the three TestFolders matched:
>
> <match:MatchModel xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:match="http://www.eclipse.org/emf/compare/match/1.1">
> <matchedElements xsi:type="match:Match3Elements"
> similarity="0.43478260869565216">
> <leftElement
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> <rightElement
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> <originElement
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> </matchedElements>
> <leftRoots
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> <rightRoots
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> <ancestorRoots
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> </match:MatchModel>
>
> This goes means that the diff model only reports the name change and
> does not report the add:
>
> <diff:DiffModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:diff="http://www.eclipse.org/emf/compare/diff/1.1">
> <ownedElements xsi:type="diff:DiffGroup">
> <subDiffElements xsi:type="diff:DiffGroup">
> <subDiffElements xsi:type="diff:DiffGroup">
> <subDiffElements xsi:type="diff:UpdateAttribute">
> <attribute
> href=" http://www.ibm.com/xmlns/prod/hdwb/test/4.0#//TestResource/n ame"/>
> <leftElement
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> <rightElement
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> </subDiffElements>
> <rightParent
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> </subDiffElements>
> <rightParent
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/root#/"/>
> </subDiffElements>
> </ownedElements>
> <leftRoots
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> <rightRoots
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> <ancestorRoots
> href=" https://localhost:9443/jazz/storage/com.ibm.hdwb.test/first# /"/>
> </diff:DiffModel>
>
> So when I merge the differences (should be mergable without problem), I
> only get the resulting object has either the name change OR the add, but
> never both. Which I get depends on whether I merge to the left or to
> the right.
>
> I started digging into what is going on in the GenericMatchEngine and
> found what I think is the problem. The initial
> contentMatch(rightObject, ancestor, optionMap) call on line 166
> (GenericMatchEngine) works correctly and adds the child object (named
> "TestContext 4") to the stillToFindFromModel1 List. The object is also
> added to remainingUnmatchedElements as well (pulled from
> rightObjectAncestorMatch.getUnmatchedElements()).
>
> The processUnmatchedElements(...) call (GenericMatchEngine line 202)
> does nothing because the unmatched object from stillToFindFromModel1 is
> an instance of TestContext (part of my model) and not an Match2Elements
> object.
>
> The for loop in line 207 (GenericMatchEngine) that deals with
> remainingUnmatchedElements does nothing, because the TestContext
> actually belongs to a different resource than the object referencing it.
>
> After that, the Lists are cleared and the unmatched object is simply lost.
>
> It is worth noting that I've overridden the isSimilar(...) method, but I
> don't think that should affect unmatched objects.
>
> I'm thinking about overriding contentMatch(EObject, EObject, EObject,
> Map) to handle my specific case.
>
> Any thoughts? Is this a bug or am I going about this the wrong way?
>
> Thanks for your help!
>
> Sincerely,
> Stephen McCants
Re: [EMF Compare] 3 way content match is losing an add? [message #621143 is a reply to message #138711] Thu, 16 July 2009 07:49 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000505070507020808000308
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Hi Stephen,

I must admit I am quite lost as to what you're doing and what your
models look like (I am not fluent in xmi :p). You seem to have multiple
resources... inter-model references will only be properly matched if you
use MatchService#doResourceSetMatch(). That said, losing differences
seems like a bug to me. Can you reproduce this with the Generic engine?
If yes, could you raise a bugzilla with a use case that can be used to
reproduce this (I couldn't with UML/ecore class diagrams)?

Laurent Goubet
Obeo

Stephen McCants a
Previous Topic:[EMF Compare] 3 way content match is losing an add?
Next Topic:[EMF Tiger] Graphical Editor Support
Goto Forum:
  


Current Time: Sat Apr 20 07:18:58 GMT 2024

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

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

Back to the top