Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » how to view the merged model?
how to view the merged model? [message #931885] Wed, 03 October 2012 16:06 Go to next message
Kosala Yapa is currently offline Kosala YapaFriend
Messages: 159
Registered: September 2010
Senior Member
Hi all,

I have two ecore models, which i am going to merge.


File fileModelA = new File(file1);
File fileModelB = new File(file2);

//register XMI resource factory for all other extensions
new XMIResourceFactoryImpl());

ResourceSet resourceSet = new ResourceSetImpl();

//Loading resources
EObject model1 = ModelUtils.load(fileModelA,resourceSet);
EObject model2 = ModelUtils.load(fileModelB,resourceSet);

//matching models
MatchModel match = MatchService.doContentMatch(model1, model2, Collections.<String, Object> emptyMap());

//Differencing models
DiffModel diff = DiffService.doDiff(match);

// Merges all differences from model1 to model2
List<DiffElement> differences = new ArrayList<DiffElement>(diff.getOwnedElements());

now if i display differences, that is empty. This is because of differences are merged.

//display differences
System.out.println("---------------display differences----------------------");
Iterator<DiffElement> it = diff.getDifferences().iterator();
while (it.hasNext()){

if i did not do merge, that display differences.

Problem: How can I display/view merged model?

Thanks in advance!

Re: how to view the merged model? [message #957521 is a reply to message #931885] Thu, 25 October 2012 09:33 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1895
Registered: July 2009
Senior Member

Displaying the model is more of an EMF question. Once you have merged the differences, you should either
- save the model to disk and open it in the Ecore editor (or whatever editor you use to create these models), or
- create a "console" printer for the EMF model.

I don't think EMF provides any mean to print a model to the console/standard output, so you'll have to create it yourself. Your best bet is solution 1, opening the file in its own editor.

Laurent Goubet

[Updated on: Thu, 25 October 2012 09:33]

Report message to a moderator

Previous Topic:How to compare unordered list
Next Topic:compare XML files not having same MetaModel ?
Goto Forum:

Current Time: Fri Sep 24 15:34:11 GMT 2021

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

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

Back to the top