Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » compare XML files not having same MetaModel ?
compare XML files not having same MetaModel ? [message #938953] Wed, 10 October 2012 09:50 Go to next message
Philippe Favrais is currently offline Philippe FavraisFriend
Messages: 23
Registered: April 2011
Junior Member
I would like to develop a compare merge plugin based on EMF Copare able to compare 2 kind of files *.xml1 and *.xml2.
As the syntaxe of the files migth not be the same, i want to that files into a same metamodel and then compare the 2 models
which then would contain only the relevant data to be compared
As i am not experimented with EMF Compare i wonder how to do it.
Where should i implement the model transformation (load and save) so that it is well integrated with EMF Compare

thank you for your advice
Philippe
Re: compare XML files not having same MetaModel ? [message #957540 is a reply to message #938953] Thu, 25 October 2012 09:47 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Philippe,

EMF Compare works on EMF models : if you implement your transformation before calling EMF Compare with them, you won't have integration problems. Note that you do not have to save the models before feeding them to compare if you're using it programmatically.

Your issue, then, is how to transform the models beforehand. For that you'll have to determine exactly what you wish to do, and with what tool : Java, ATL, ... look at the model-to-model tools on Eclipse.

Laurent Goubet
Obeo
Re: compare XML files not having same MetaModel ? [message #958898 is a reply to message #957540] Fri, 26 October 2012 09:59 Go to previous messageGo to next message
Philippe Favrais is currently offline Philippe FavraisFriend
Messages: 23
Registered: April 2011
Junior Member
As my XML file are not matching all the same XSD, i would like to transform my XML with DOM parser and to populate my EMF model. It seems that the Model2Model tools need on one side an XSD and on the other side an ECORE. In my case i may not have the XSD.

Note that all my XML files are built with the same "design rules"
when an element is not a singleton (max cardinality > 1), it has an attribute @Name which allow me to identify it uniquely. In that case, i compare the element and its attributes having the same element name and the same attribute @Name value (independently of their order in the XML file)
when an element is a singleton, i use only the element name to match and compare the element and its attributes
e.g:
<Root>
<Channel Name="abc" attr1="tt"/>
<Channel Name="def" attr1="sds"/> --> (<Channel> is not a singleton because it has an attribute @Name: so in my compare engine, i compare the elements if they have the same element name and attribute name)
<Properties Default="Off" Clock="8"> --> (<Properties> is a singleton because it do not have @Name: so it will be compared against another element <Properties/>)
</Root>

I understood that i should override load and save, but i do miss some detail or sample how to implement it.
Do you think it is the good approach ?

Philippe
Re: compare XML files not having same MetaModel ? [message #962700 is a reply to message #958898] Mon, 29 October 2012 09:01 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Philippe,

I'd say that your best bet would be to define a metamodel that can properly describe the data you have in both models instead of trying to strip irrelevant data. Or to convert one of the two to the metamodel of the other and compare these two files.

Whatever the case, you might want to ask on the EMF newsgroup whether someone already had such a need.

Laurent Goubet
Obeo
Previous Topic:how to view the merged model?
Next Topic:Add a sub menu to trigger comparison
Goto Forum:
  


Current Time: Tue Mar 19 09:35:46 GMT 2024

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

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

Back to the top