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 #621140] Wed, 15 July 2009 22:42
Stephen McCants is currently offline Stephen McCantsFriend
Messages: 92
Registered: July 2009
Member
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
Previous Topic:Is EMF Compare right for this use-case?
Next Topic:[EMF Compare] 3 way content match is losing an add?
Goto Forum:
  


Current Time: Sat Jul 27 01:59:45 GMT 2024

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

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

Back to the top