Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » Custom Matching Strategy
Custom Matching Strategy [message #1723753] Wed, 17 February 2016 15:48 Go to next message
Rupak Das is currently offline Rupak DasFriend
Messages: 2
Registered: February 2016
Junior Member
I am new to EMF Compare and I want to create my own matching strategy. I found the presentation "What every developer should know about EMF Compare" which have some code snippets on how to create a custom matching strategy (Couldn't add the presentation link here). But it seems classes like GenericMatchEngine and MatchModel are not part of the latest EMF Compare version (3.x) anymore. I also read the Overriding the Match engine section from EMF Compare Developer Guide, and I was expecting an example of how to extend DefaultMatchEngine. Can someone please provide a link or code snippet about how to customize DefaultMatchEngine?

Thanks.
Re: Custom Matching Strategy [message #1723825 is a reply to message #1723753] Thu, 18 February 2016 09:48 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi,

There is no real example of how to create your own match engine, as that is a very big part of EMF Compare and needs quite a lot of logic. You might want to look at how to implement smaller parts of the matching process. Overriding the match engine tells you how to replace the IMatchEngine as a whole. you'll have to look at the default implementation (DefaultMatchEngine) for an example of the needed logic if you want to go that high level. Otherwise, you might want to take a look at how to replace the IEObjectMatcher (which is explained in the Defining custom identifiers section below the earlier). IEObjectMatchers are the main part of the match engine and that's what will create the "Match" objects that will tell EMF Compare what elements should be diffed with what other one. Even lower level stands the IEqualityHelper that will actually tell EMF Compare (throughout the whole process which EObject is equal to which other. This last part can be replaced by modifying the IEqualityHelperFactory that you'll pass to the comparison factory (you can see that being used in the same section as above, Defining custom identifiers).

As you might guess, overriding this part of the comparison process is far from trivial. Could you share on your use case and what issues you are trying to solve? There might be better ways to tackle this endeavor.

Laurent Goubet
Obeo
Re: Custom Matching Strategy [message #1723853 is a reply to message #1723753] Thu, 18 February 2016 13:45 Go to previous messageGo to next message
Rupak Das is currently offline Rupak DasFriend
Messages: 2
Registered: February 2016
Junior Member
Thank you for your detailed response. I am just playing with the Purchase Order Schema from XML Schema Part 0: Primer Second Edition, w3.org. I want to match two purchaseOrder together even if they have some differences (e.g. price change of particular item, zip code change in billTo etc.). According to your suggestion I guess modifying the id computation of item and billTo using Defining custom identifiers might solve the problem.
Re: Custom Matching Strategy [message #1724648 is a reply to message #1723853] Thu, 25 February 2016 09:21 Go to previous message
Laurent Delaigue is currently offline Laurent DelaigueFriend
Messages: 5
Registered: December 2015
Junior Member
Hello!

If you have a way to compute a stable ID for the purchase orders it will probably resolve your problem. Matching objects without IDs if far from trivial and requires the use of heuristics, which often don't achieve 100% success, unfortunately.
Please let us know how it turns out for your case.
Previous Topic:EMFCompare's EGit Recursive model merger
Next Topic:Containment reference in EMF Compare
Goto Forum:
  


Current Time: Tue Mar 19 11:09:15 GMT 2024

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

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

Back to the top