Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Compare] Help with API
[EMF Compare] Help with API [message #88718] Tue, 10 July 2007 14:59 Go to next message
Andrew Carton is currently offline Andrew CartonFriend
Messages: 104
Registered: July 2009
Senior Member
Hi,

How would one match (and diff) between two instance models of the same
metamodel and then go on to merge those differences in java? I was
looking at the source but I can't find any concrete implementation of
MatchEngine. I tried doing a modelMatch() on DifferencesServices but it
throws and error looking for a window.

org.eclipse.emf.compare.match.statistic.DifferencesServices. getDefaultSearchWindow(DifferencesServices.java:327)

Are there any tutorials on this too or code samples ?

Thanks!
Andrew.
Re: [EMF Compare] Help with API [message #88775 is a reply to message #88718] Tue, 10 July 2007 16:09 Go to previous messageGo to next message
Cedric Brun is currently offline Cedric BrunFriend
Messages: 431
Registered: July 2009
Senior Member
Hi Andrew,

tutorials and code samples are not yet ready, it's coming :)

Though, to compare two models the process is basically this one:
EObject eObject1 = ModelUtils.load(model1URI);
EObject eObject2 = ModelUtils.load(model2URI);
final MatchModel match = new MatchService().doMatch(
eObject1, eObject2, new NullProgressMonitor());
final DiffModel diff = new DiffMaker().doDiff(match);

Then you can browse the diff, if you want to merge stuffs you'll have to
create a merger using the diffelement:
final AbstractMerger merger = MergeFactory.createMerger(element);

Then you can choose:
merger.undoInTarget();
or
merger.applyInOrigin();


The "getDefaultSearchWindow()" issue is a bug :
https://bugs.eclipse.org/bugs/show_bug.cgi?id=195859 , it appears when the
preferences have not been initialized.
There is a workaround : you should open the preferences pages and set the
default value for the "Search Window" - which is 100 by default.

Cédric


Andrew Carton wrote:

> Hi,
>
> How would one match (and diff) between two instance models of the same
> metamodel and then go on to merge those differences in java? I was
> looking at the source but I can't find any concrete implementation of
> MatchEngine. I tried doing a modelMatch() on DifferencesServices but it
> throws and error looking for a window.
>
>
org.eclipse.emf.compare.match.statistic.DifferencesServices. getDefaultSearchWindow(DifferencesServices.java:327)
>
> Are there any tutorials on this too or code samples ?
>
> Thanks!
> Andrew.


http://cedric.brun.io news and articles on eclipse and eclipse modeling.
Re: [EMF Compare] Help with API [message #88790 is a reply to message #88775] Tue, 10 July 2007 16:10 Go to previous messageGo to next message
Andrew Carton is currently offline Andrew CartonFriend
Messages: 104
Registered: July 2009
Senior Member
Thats grand, thanks very much!

Andrew.

Ar 10/07/2007 17:09, Scríobh Cédric Brun:
> Hi Andrew,
>
> tutorials and code samples are not yet ready, it's coming :)
>
> Though, to compare two models the process is basically this one:
> EObject eObject1 = ModelUtils.load(model1URI);
> EObject eObject2 = ModelUtils.load(model2URI);
> final MatchModel match = new MatchService().doMatch(
> eObject1, eObject2, new NullProgressMonitor());
> final DiffModel diff = new DiffMaker().doDiff(match);
>
> Then you can browse the diff, if you want to merge stuffs you'll have to
> create a merger using the diffelement:
> final AbstractMerger merger = MergeFactory.createMerger(element);
>
> Then you can choose:
> merger.undoInTarget();
> or
> merger.applyInOrigin();
>
>
> The "getDefaultSearchWindow()" issue is a bug :
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=195859 , it appears when the
> preferences have not been initialized.
> There is a workaround : you should open the preferences pages and set the
> default value for the "Search Window" - which is 100 by default.
>
> Cédric
>
>
> Andrew Carton wrote:
>
>> Hi,
>>
>> How would one match (and diff) between two instance models of the same
>> metamodel and then go on to merge those differences in java? I was
>> looking at the source but I can't find any concrete implementation of
>> MatchEngine. I tried doing a modelMatch() on DifferencesServices but it
>> throws and error looking for a window.
>>
>>
> org.eclipse.emf.compare.match.statistic.DifferencesServices. getDefaultSearchWindow(DifferencesServices.java:327)
>> Are there any tutorials on this too or code samples ?
>>
>> Thanks!
>> Andrew.
>
Re: [EMF Compare] Help with API [message #88805 is a reply to message #88775] Tue, 10 July 2007 16:30 Go to previous messageGo to next message
Andrew Carton is currently offline Andrew CartonFriend
Messages: 104
Registered: July 2009
Senior Member
Hey Cédric,

Unfortunately when I am doing that, I get this error. It looks like it
wants to be a plugin!

ption in thread "main" java.lang.NullPointerException at
org.eclipse.emf.compare.match.service.MatchService.parseExte nsionMetadata(MatchService.java:52)
at
org.eclipse.emf.compare.match.service.MatchService.<init>(MatchService.java:48)


EObject e1 = ModelUtils.load(URI.createURI("model1.uml"));
EObject e2 = ModelUtils.load(URI.createURI("model2.uml"));
MatchModel match = null;
match = new MatchService().doMatch(e1, e2, new
NullProgressMonitor());


Thanks again,
Andrew

Ar 10/07/2007 17
:09, Scríobh Cédric Brun:
> Hi Andrew,
>
> tutorials and code samples are not yet ready, it's coming :)
>
> Though, to compare two models the process is basically this one:
> EObject eObject1 = ModelUtils.load(model1URI);
> EObject eObject2 = ModelUtils.load(model2URI);
> final MatchModel match = new MatchService().doMatch(
> eObject1, eObject2, new NullProgressMonitor());
> final DiffModel diff = new DiffMaker().doDiff(match);
>
> Then you can browse the diff, if you want to merge stuffs you'll have to
> create a merger using the diffelement:
> final AbstractMerger merger = MergeFactory.createMerger(element);
>
> Then you can choose:
> merger.undoInTarget();
> or
> merger.applyInOrigin();
>
>
> The "getDefaultSearchWindow()" issue is a bug :
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=195859 , it appears when the
> preferences have not been initialized.
> There is a workaround : you should open the preferences pages and set the
> default value for the "Search Window" - which is 100 by default.
>
> Cédric
>
>
> Andrew Carton wrote:
>
>> Hi,
>>
>> How would one match (and diff) between two instance models of the same
>> metamodel and then go on to merge those differences in java? I was
>> looking at the source but I can't find any concrete implementation of
>> MatchEngine. I tried doing a modelMatch() on DifferencesServices but it
>> throws and error looking for a window.
>>
>>
> org.eclipse.emf.compare.match.statistic.DifferencesServices. getDefaultSearchWindow(DifferencesServices.java:327)
>> Are there any tutorials on this too or code samples ?
>>
>> Thanks!
>> Andrew.
>
Re: [EMF Compare] Help with API [message #88905 is a reply to message #88805] Wed, 11 July 2007 07:56 Go to previous message
Cedric Brun is currently offline Cedric BrunFriend
Messages: 431
Registered: July 2009
Senior Member
I did not understood you wanted to use EMF compare without using plugins and
extension points.
As you won't use the extension points you'll have to choose the match engine
by yourself. Basically the generic one should fit:

EObject eObject1 = ModelUtils.load(model1URI);
EObject eObject2 = ModelUtils.load(model2URI);
final MatchModel match = new DifferencesServices().modelMatch(
eObject1, eObject2, new NullProgressMonitor());
final DiffModel diff = new DiffMaker().doDiff(match);


Cédric


Andrew Carton wrote:

> Hey Cédric,
>
> Unfortunately when I am doing that, I get this error. It looks like it
> wants to be a plugin!
>
> ption in thread "main" java.lang.NullPointerException at
>
org.eclipse.emf.compare.match.service.MatchService.parseExte nsionMetadata(MatchService.java:52)
> at
>
org.eclipse.emf.compare.match.service.MatchService.<init>(MatchService.java:48)
>
>
> EObject e1 = ModelUtils.load(URI.createURI("model1.uml"));
> EObject e2 = ModelUtils.load(URI.createURI("model2.uml"));
> MatchModel match = null;
> match = new MatchService().doMatch(e1, e2, new
> NullProgressMonitor());
>
>
> Thanks again,
> Andrew
>
> Ar 10/07/2007 17
> :09, Scríobh Cédric Brun:
>> Hi Andrew,
>>
>> tutorials and code samples are not yet ready, it's coming :)
>>
>> Though, to compare two models the process is basically this one:
>> EObject eObject1 = ModelUtils.load(model1URI);
>> EObject eObject2 = ModelUtils.load(model2URI);
>> final MatchModel match = new MatchService().doMatch(
>> eObject1, eObject2, new NullProgressMonitor());
>> final DiffModel diff = new DiffMaker().doDiff(match);
>>
>> Then you can browse the diff, if you want to merge stuffs you'll have to
>> create a merger using the diffelement:
>> final AbstractMerger merger = MergeFactory.createMerger(element);
>>
>> Then you can choose:
>> merger.undoInTarget();
>> or
>> merger.applyInOrigin();
>>
>>
>> The "getDefaultSearchWindow()" issue is a bug :
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=195859 , it appears when
>> the preferences have not been initialized.
>> There is a workaround : you should open the preferences pages and set
>> the
>> default value for the "Search Window" - which is 100 by default.
>>
>> Cédric
>>
>>
>> Andrew Carton wrote:
>>
>>> Hi,
>>>
>>> How would one match (and diff) between two instance models of the same
>>> metamodel and then go on to merge those differences in java? I was
>>> looking at the source but I can't find any concrete implementation of
>>> MatchEngine. I tried doing a modelMatch() on DifferencesServices but it
>>> throws and error looking for a window.
>>>
>>>
>>
org.eclipse.emf.compare.match.statistic.DifferencesServices. getDefaultSearchWindow(DifferencesServices.java:327)
>>> Are there any tutorials on this too or code samples ?
>>>
>>> Thanks!
>>> Andrew.
>>


http://cedric.brun.io news and articles on eclipse and eclipse modeling.
Re: [EMF Compare] Help with API [message #608682 is a reply to message #88718] Tue, 10 July 2007 16:09 Go to previous message
Cedric Brun is currently offline Cedric BrunFriend
Messages: 431
Registered: July 2009
Senior Member
Hi Andrew,

tutorials and code samples are not yet ready, it's coming :)

Though, to compare two models the process is basically this one:
EObject eObject1 = ModelUtils.load(model1URI);
EObject eObject2 = ModelUtils.load(model2URI);
final MatchModel match = new MatchService().doMatch(
eObject1, eObject2, new NullProgressMonitor());
final DiffModel diff = new DiffMaker().doDiff(match);

Then you can browse the diff, if you want to merge stuffs you'll have to
create a merger using the diffelement:
final AbstractMerger merger = MergeFactory.createMerger(element);

Then you can choose:
merger.undoInTarget();
or
merger.applyInOrigin();


The "getDefaultSearchWindow()" issue is a bug :
https://bugs.eclipse.org/bugs/show_bug.cgi?id=195859 , it appears when the
preferences have not been initialized.
There is a workaround : you should open the preferences pages and set the
default value for the "Search Window" - which is 100 by default.

Cédric


Andrew Carton wrote:

> Hi,
>
> How would one match (and diff) between two instance models of the same
> metamodel and then go on to merge those differences in java? I was
> looking at the source but I can't find any concrete implementation of
> MatchEngine. I tried doing a modelMatch() on DifferencesServices but it
> throws and error looking for a window.
>
>
org.eclipse.emf.compare.match.statistic.DifferencesServices. getDefaultSearchWindow(DifferencesServices.java:327)
>
> Are there any tutorials on this too or code samples ?
>
> Thanks!
> Andrew.


http://cedric.brun.io news and articles on eclipse and eclipse modeling.
Re: [EMF Compare] Help with API [message #608683 is a reply to message #88775] Tue, 10 July 2007 16:10 Go to previous message
Andrew Carton is currently offline Andrew CartonFriend
Messages: 104
Registered: July 2009
Senior Member
Thats grand, thanks very much!

Andrew.

Ar 10/07/2007 17:09, Scríobh Cédric Brun:
> Hi Andrew,
>
> tutorials and code samples are not yet ready, it's coming :)
>
> Though, to compare two models the process is basically this one:
> EObject eObject1 = ModelUtils.load(model1URI);
> EObject eObject2 = ModelUtils.load(model2URI);
> final MatchModel match = new MatchService().doMatch(
> eObject1, eObject2, new NullProgressMonitor());
> final DiffModel diff = new DiffMaker().doDiff(match);
>
> Then you can browse the diff, if you want to merge stuffs you'll have to
> create a merger using the diffelement:
> final AbstractMerger merger = MergeFactory.createMerger(element);
>
> Then you can choose:
> merger.undoInTarget();
> or
> merger.applyInOrigin();
>
>
> The "getDefaultSearchWindow()" issue is a bug :
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=195859 , it appears when the
> preferences have not been initialized.
> There is a workaround : you should open the preferences pages and set the
> default value for the "Search Window" - which is 100 by default.
>
> Cédric
>
>
> Andrew Carton wrote:
>
>> Hi,
>>
>> How would one match (and diff) between two instance models of the same
>> metamodel and then go on to merge those differences in java? I was
>> looking at the source but I can't find any concrete implementation of
>> MatchEngine. I tried doing a modelMatch() on DifferencesServices but it
>> throws and error looking for a window.
>>
>>
> org.eclipse.emf.compare.match.statistic.DifferencesServices. getDefaultSearchWindow(DifferencesServices.java:327)
>> Are there any tutorials on this too or code samples ?
>>
>> Thanks!
>> Andrew.
>
Re: [EMF Compare] Help with API [message #608684 is a reply to message #88775] Tue, 10 July 2007 16:30 Go to previous message
Andrew Carton is currently offline Andrew CartonFriend
Messages: 104
Registered: July 2009
Senior Member
Hey Cédric,

Unfortunately when I am doing that, I get this error. It looks like it
wants to be a plugin!

ption in thread "main" java.lang.NullPointerException at
org.eclipse.emf.compare.match.service.MatchService.parseExte nsionMetadata(MatchService.java:52)
at
org.eclipse.emf.compare.match.service.MatchService.<init>(MatchService.java:48)


EObject e1 = ModelUtils.load(URI.createURI("model1.uml"));
EObject e2 = ModelUtils.load(URI.createURI("model2.uml"));
MatchModel match = null;
match = new MatchService().doMatch(e1, e2, new
NullProgressMonitor());


Thanks again,
Andrew

Ar 10/07/2007 17
:09, Scríobh Cédric Brun:
> Hi Andrew,
>
> tutorials and code samples are not yet ready, it's coming :)
>
> Though, to compare two models the process is basically this one:
> EObject eObject1 = ModelUtils.load(model1URI);
> EObject eObject2 = ModelUtils.load(model2URI);
> final MatchModel match = new MatchService().doMatch(
> eObject1, eObject2, new NullProgressMonitor());
> final DiffModel diff = new DiffMaker().doDiff(match);
>
> Then you can browse the diff, if you want to merge stuffs you'll have to
> create a merger using the diffelement:
> final AbstractMerger merger = MergeFactory.createMerger(element);
>
> Then you can choose:
> merger.undoInTarget();
> or
> merger.applyInOrigin();
>
>
> The "getDefaultSearchWindow()" issue is a bug :
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=195859 , it appears when the
> preferences have not been initialized.
> There is a workaround : you should open the preferences pages and set the
> default value for the "Search Window" - which is 100 by default.
>
> Cédric
>
>
> Andrew Carton wrote:
>
>> Hi,
>>
>> How would one match (and diff) between two instance models of the same
>> metamodel and then go on to merge those differences in java? I was
>> looking at the source but I can't find any concrete implementation of
>> MatchEngine. I tried doing a modelMatch() on DifferencesServices but it
>> throws and error looking for a window.
>>
>>
> org.eclipse.emf.compare.match.statistic.DifferencesServices. getDefaultSearchWindow(DifferencesServices.java:327)
>> Are there any tutorials on this too or code samples ?
>>
>> Thanks!
>> Andrew.
>
Re: [EMF Compare] Help with API [message #608691 is a reply to message #88805] Wed, 11 July 2007 07:56 Go to previous message
Cedric Brun is currently offline Cedric BrunFriend
Messages: 431
Registered: July 2009
Senior Member
I did not understood you wanted to use EMF compare without using plugins and
extension points.
As you won't use the extension points you'll have to choose the match engine
by yourself. Basically the generic one should fit:

EObject eObject1 = ModelUtils.load(model1URI);
EObject eObject2 = ModelUtils.load(model2URI);
final MatchModel match = new DifferencesServices().modelMatch(
eObject1, eObject2, new NullProgressMonitor());
final DiffModel diff = new DiffMaker().doDiff(match);


Cédric


Andrew Carton wrote:

> Hey Cédric,
>
> Unfortunately when I am doing that, I get this error. It looks like it
> wants to be a plugin!
>
> ption in thread "main" java.lang.NullPointerException at
>
org.eclipse.emf.compare.match.service.MatchService.parseExte nsionMetadata(MatchService.java:52)
> at
>
org.eclipse.emf.compare.match.service.MatchService.<init>(MatchService.java:48)
>
>
> EObject e1 = ModelUtils.load(URI.createURI("model1.uml"));
> EObject e2 = ModelUtils.load(URI.createURI("model2.uml"));
> MatchModel match = null;
> match = new MatchService().doMatch(e1, e2, new
> NullProgressMonitor());
>
>
> Thanks again,
> Andrew
>
> Ar 10/07/2007 17
> :09, Scríobh Cédric Brun:
>> Hi Andrew,
>>
>> tutorials and code samples are not yet ready, it's coming :)
>>
>> Though, to compare two models the process is basically this one:
>> EObject eObject1 = ModelUtils.load(model1URI);
>> EObject eObject2 = ModelUtils.load(model2URI);
>> final MatchModel match = new MatchService().doMatch(
>> eObject1, eObject2, new NullProgressMonitor());
>> final DiffModel diff = new DiffMaker().doDiff(match);
>>
>> Then you can browse the diff, if you want to merge stuffs you'll have to
>> create a merger using the diffelement:
>> final AbstractMerger merger = MergeFactory.createMerger(element);
>>
>> Then you can choose:
>> merger.undoInTarget();
>> or
>> merger.applyInOrigin();
>>
>>
>> The "getDefaultSearchWindow()" issue is a bug :
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=195859 , it appears when
>> the preferences have not been initialized.
>> There is a workaround : you should open the preferences pages and set
>> the
>> default value for the "Search Window" - which is 100 by default.
>>
>> Cédric
>>
>>
>> Andrew Carton wrote:
>>
>>> Hi,
>>>
>>> How would one match (and diff) between two instance models of the same
>>> metamodel and then go on to merge those differences in java? I was
>>> looking at the source but I can't find any concrete implementation of
>>> MatchEngine. I tried doing a modelMatch() on DifferencesServices but it
>>> throws and error looking for a window.
>>>
>>>
>>
org.eclipse.emf.compare.match.statistic.DifferencesServices. getDefaultSearchWindow(DifferencesServices.java:327)
>>> Are there any tutorials on this too or code samples ?
>>>
>>> Thanks!
>>> Andrew.
>>


http://cedric.brun.io news and articles on eclipse and eclipse modeling.
Previous Topic:Integrating OCL - providing EvaluationEnvironment
Next Topic:[EMF Compare] Standalone run and in-memory-only objects
Goto Forum:
  


Current Time: Tue Aug 09 12:00:23 GMT 2022

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

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

Back to the top