Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Matching eObject with containemt(1-*) reference
Matching eObject with containemt(1-*) reference [message #131148] Thu, 04 December 2008 06:19 Go to next message
Chetan Kumar is currently offline Chetan KumarFriend
Messages: 70
Registered: July 2009
Member
Hello people,
I am trying to merge root EObjects based on the same metamodel. The
merger i am looking for is just like CVS synchronize. I have incoming
changes that have to be included under an existing parent. More on these
i'll try to explin thru the example:
I have an example model like:
Class
|
|--- students (1-*)

Student
|
|--- name: String
|--- reg_id: Integer

I have 2 instances of the Class objects with 2 different student
objects. When i say different, the attributes of the Student instance is
different.

I want to merge these 2 different Class instances into one. Ultimately
i want the different students included under the single Class instance.
Something like "incoming-changes" in CVS synchronize.

I tried to use the Diff amd Match services, and in the CompareUI that
was up ... the 2 Class instances on left and right showed up changes in
child Student objects. That's fine. But i wanted to take the Student
object from the right side and add it under the left side's Class
instance. Something like "incoming_changes" in CVS synch.

Should i extend the Match or the Diff Service to detect such a diff and
merge it ?

thanks,
Chetan Kumar
[EMF Compare] Matching eObject with containemt(1-*) reference [message #131166 is a reply to message #131148] Thu, 04 December 2008 06:25 Go to previous messageGo to next message
Chetan Kumar is currently offline Chetan KumarFriend
Messages: 70
Registered: July 2009
Member
Just changed the subject ... so that its more specific :)
Chetan Kumar wrote:

> Hello people,
> I am trying to merge root EObjects based on the same metamodel. The
> merger i am looking for is just like CVS synchronize. I have incoming
> changes that have to be included under an existing parent. More on these
> i'll try to explin thru the example:
> I have an example model like:
> Class
> |
> |--- students (1-*)

> Student
> |
> |--- name: String
> |--- reg_id: Integer

> I have 2 instances of the Class objects with 2 different student
> objects. When i say different, the attributes of the Student instance is
> different.

> I want to merge these 2 different Class instances into one. Ultimately
> i want the different students included under the single Class instance.
> Something like "incoming-changes" in CVS synchronize.

> I tried to use the Diff amd Match services, and in the CompareUI that
> was up ... the 2 Class instances on left and right showed up changes in
> child Student objects. That's fine. But i wanted to take the Student
> object from the right side and add it under the left side's Class
> instance. Something like "incoming_changes" in CVS synch.

> Should i extend the Match or the Diff Service to detect such a diff and
> merge it ?

> thanks,
> Chetan Kumar
Re: [EMF Compare] Matching eObject with containemt(1-*) reference [message #131377 is a reply to message #131166] Fri, 05 December 2008 12:44 Go to previous messageGo to next message
Cedric Brun is currently offline Cedric BrunFriend
Messages: 431
Registered: July 2009
Senior Member
Hi,

I'm not sure to really understand what you want to do. That said, you can specialize the diff engine to show different kind of differences deduced from the original ones, and then extends the merge service so that it can be merged by the user. So if that's what you're trying to do, then no need to specialize the match engine.
If you want to "force" emf compare to consider your Class1 is the same as the Class2, then you need to specialize the match engine so that you say "this Class1 *matches* this Class2. Then the differences that will show up will consider that Class1/Class2 are 2 versions of the same object and then you'll be able to merge your Students.

Is that what you're trying to do ?


Cédric

Chetan Kumar wrote:

> Just changed the subject ... so that its more specific :)
> Chetan Kumar wrote:
>
>> Hello people,
>> I am trying to merge root EObjects based on the same metamodel. The
>> merger i am looking for is just like CVS synchronize. I have incoming
>> changes that have to be included under an existing parent. More on these
>> i'll try to explin thru the example:
>> I have an example model like:
>> Class
>> |
>> |--- students (1-*)
>
>> Student
>> |
>> |--- name: String
>> |--- reg_id: Integer
>
>> I have 2 instances of the Class objects with 2 different student
>> objects. When i say different, the attributes of the Student instance is
>> different.
>
>> I want to merge these 2 different Class instances into one. Ultimately
>> i want the different students included under the single Class instance.
>> Something like "incoming-changes" in CVS synchronize.
>
>> I tried to use the Diff amd Match services, and in the CompareUI that
>> was up ... the 2 Class instances on left and right showed up changes in
>> child Student objects. That's fine. But i wanted to take the Student
>> object from the right side and add it under the left side's Class
>> instance. Something like "incoming_changes" in CVS synch.
>
>> Should i extend the Match or the Diff Service to detect such a diff
>> and
>> merge it ?
>
>> thanks,
>> Chetan Kumar


http://cedric.brun.io news and articles on eclipse and eclipse modeling.
Re: [EMF Compare] Matching eObject with containemt(1-*) reference [message #131438 is a reply to message #131377] Mon, 08 December 2008 06:44 Go to previous messageGo to next message
Chetan Kumar is currently offline Chetan KumarFriend
Messages: 70
Registered: July 2009
Member
Cédric,

I think i have to specialize the diff and merge engines. Before that i
wanted to make sure i don't unnecessarily specialize it.

Coming back to my requirement, i want to merge 2 similar objects (their
similarity is eshtablished thru an ID attribute let's say.) These similar
objects have containment relationships (0-*) of some child type(Student).
Both the similar parent objects have conflicting child containers based on
the above containment type. This is shown as a conflict properly but i
want more options while merging.

Options like: ignore changes from the right parent object, override the
left side parent object with changes from the right parent object, append
changes from the right parent objects to the left parent object. My
question was to have such options ... is it already possible thru existing
Merge ? or should i have to use the extension-point and write my merge
engine ?

Containers in my model can have more than one attribute that can be
called as an ID - for instance, an integer attribute, an enumeration, and
a cross-reference combined describe a container's identity. How do i go
about DIFFing in these cases ?

thanks,
Chetan Kumar

Cédric Brun wrote:

> Hi,

> I'm not sure to really understand what you want to do. That said, you can
specialize the diff engine to show different kind of differences deduced from
the original ones, and then extends the merge service so that it can be merged
by the user. So if that's what you're trying to do, then no need to specialize
the match engine.
> If you want to "force" emf compare to consider your Class1 is the same as
the Class2, then you need to specialize the match engine so that you say "this
Class1 *matches* this Class2. Then the differences that will show up will
consider that Class1/Class2 are 2 versions of the same object and then you'll
be able to merge your Students.

> Is that what you're trying to do ?


> Cédric
Re: [EMF Compare] Matching eObject with containemt(1-*) reference [message #131464 is a reply to message #131438] Mon, 08 December 2008 09:40 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090502090204090502030408
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hi,

I still have trouble visualizing your metamodel and the changes you
describe. Could you provide us with a sample (metamodel and models)
reproducing this?

As for the merge options, no, the existing merge does not provide
advanced features. We could try and find a way to add them though if the
case you encouter is reproducible and meaningful as a generic solution.
The merge extension point should provide you with enough flexibility to
tackle this need nevertheless. Feel free to come back to us if it does not.

Having multiple attributes identifying an object is not an issue in
itself, yet the generic engines provided with EMF Compare probably
aren't sufficient to accurately detect differences on those. I think
what you need to override isn't the diff engine but the matching engine
so that EMF Compare knows how to match similar objects based on all ID
attributes. The generic diff engine should manage to diff accurately
afterwards.

laurent Goubet
Obeo

Chetan Kumar a
Re: [EMF Compare] Matching eObject with containemt(1-*) reference [message #131778 is a reply to message #131464] Fri, 26 December 2008 05:01 Go to previous message
Chetan Kumar is currently offline Chetan KumarFriend
Messages: 70
Registered: July 2009
Member
Hi!,

I'll try to explain my use-case. Lets take a small model like this.
parent
|
|-- child (1-*) ( containment )

i have 2 separate instances of parent metamodel. (something like 2 trees).
Let us call them left and right parent.
the ID attribute(s) of parent instance are same in both the parent
instances (trees).
so i can conclude that ... the 2 different parent instances are similar
and can be merged.
so based on this ... i want to merge the sub-trees of both the parent
instances.

Now let us consider that each of the 2 parent instances have a child
instance (linked thru the containment relnship) which can be considered
different (by some means). so in the process of merging the sub-trees of
the parent instances ... i compare the child instances too ... and i find
out that ... the child of the right parent instance is not similar to that
of the left parent instance. so the right child instance is totally new
and has to be added under the left parent as part of the merger.

The conclusion that the child instances are different ... is based on
the value of multiple attributes (or cross-references).

This is my one simple part of my use-case.

I have attached 2 .xmi files thru which i have attempted to describe my
use-case. They are xmi files from the EMF standard example extlibrary
model. Library is the root object and the 2 Library instances have the
same name ("CCL"). so ... i want to merge them into one big library ... by
carefuly taking care of the respective sub-trees ...
- there can be conflicts (like same book in both libraries .. but
borrowed by different borrowers)
- there can be incoming changes to the master library instance (like new
Writers, new Books, etc)
and many more...

I hope this brings some clarity.

@laurent: I have sent the example files to you via e-mail ... for i didn't
figure out a way to attach them to this post ;)

ciao,
Chetan Kumar
[EMF Compare] Matching eObject with containemt(1-*) reference [message #620420 is a reply to message #131148] Thu, 04 December 2008 06:25 Go to previous message
Chetan Kumar is currently offline Chetan KumarFriend
Messages: 70
Registered: July 2009
Member
Just changed the subject ... so that its more specific :)
Chetan Kumar wrote:

> Hello people,
> I am trying to merge root EObjects based on the same metamodel. The
> merger i am looking for is just like CVS synchronize. I have incoming
> changes that have to be included under an existing parent. More on these
> i'll try to explin thru the example:
> I have an example model like:
> Class
> |
> |--- students (1-*)

> Student
> |
> |--- name: String
> |--- reg_id: Integer

> I have 2 instances of the Class objects with 2 different student
> objects. When i say different, the attributes of the Student instance is
> different.

> I want to merge these 2 different Class instances into one. Ultimately
> i want the different students included under the single Class instance.
> Something like "incoming-changes" in CVS synchronize.

> I tried to use the Diff amd Match services, and in the CompareUI that
> was up ... the 2 Class instances on left and right showed up changes in
> child Student objects. That's fine. But i wanted to take the Student
> object from the right side and add it under the left side's Class
> instance. Something like "incoming_changes" in CVS synch.

> Should i extend the Match or the Diff Service to detect such a diff and
> merge it ?

> thanks,
> Chetan Kumar
Re: [EMF Compare] Matching eObject with containemt(1-*) reference [message #620515 is a reply to message #131166] Fri, 05 December 2008 12:44 Go to previous message
Cedric Brun is currently offline Cedric BrunFriend
Messages: 431
Registered: July 2009
Senior Member
Hi,

I'm not sure to really understand what you want to do. That said, you can specialize the diff engine to show different kind of differences deduced from the original ones, and then extends the merge service so that it can be merged by the user. So if that's what you're trying to do, then no need to specialize the match engine.
If you want to "force" emf compare to consider your Class1 is the same as the Class2, then you need to specialize the match engine so that you say "this Class1 *matches* this Class2. Then the differences that will show up will consider that Class1/Class2 are 2 versions of the same object and then you'll be able to merge your Students.

Is that what you're trying to do ?


Cédric

Chetan Kumar wrote:

> Just changed the subject ... so that its more specific :)
> Chetan Kumar wrote:
>
>> Hello people,
>> I am trying to merge root EObjects based on the same metamodel. The
>> merger i am looking for is just like CVS synchronize. I have incoming
>> changes that have to be included under an existing parent. More on these
>> i'll try to explin thru the example:
>> I have an example model like:
>> Class
>> |
>> |--- students (1-*)
>
>> Student
>> |
>> |--- name: String
>> |--- reg_id: Integer
>
>> I have 2 instances of the Class objects with 2 different student
>> objects. When i say different, the attributes of the Student instance is
>> different.
>
>> I want to merge these 2 different Class instances into one. Ultimately
>> i want the different students included under the single Class instance.
>> Something like "incoming-changes" in CVS synchronize.
>
>> I tried to use the Diff amd Match services, and in the CompareUI that
>> was up ... the 2 Class instances on left and right showed up changes in
>> child Student objects. That's fine. But i wanted to take the Student
>> object from the right side and add it under the left side's Class
>> instance. Something like "incoming_changes" in CVS synch.
>
>> Should i extend the Match or the Diff Service to detect such a diff
>> and
>> merge it ?
>
>> thanks,
>> Chetan Kumar


http://cedric.brun.io news and articles on eclipse and eclipse modeling.
Re: [EMF Compare] Matching eObject with containemt(1-*) reference [message #620520 is a reply to message #131377] Mon, 08 December 2008 06:44 Go to previous message
Chetan Kumar is currently offline Chetan KumarFriend
Messages: 70
Registered: July 2009
Member
Cédric,

I think i have to specialize the diff and merge engines. Before that i
wanted to make sure i don't unnecessarily specialize it.

Coming back to my requirement, i want to merge 2 similar objects (their
similarity is eshtablished thru an ID attribute let's say.) These similar
objects have containment relationships (0-*) of some child type(Student).
Both the similar parent objects have conflicting child containers based on
the above containment type. This is shown as a conflict properly but i
want more options while merging.

Options like: ignore changes from the right parent object, override the
left side parent object with changes from the right parent object, append
changes from the right parent objects to the left parent object. My
question was to have such options ... is it already possible thru existing
Merge ? or should i have to use the extension-point and write my merge
engine ?

Containers in my model can have more than one attribute that can be
called as an ID - for instance, an integer attribute, an enumeration, and
a cross-reference combined describe a container's identity. How do i go
about DIFFing in these cases ?

thanks,
Chetan Kumar

Cédric Brun wrote:

> Hi,

> I'm not sure to really understand what you want to do. That said, you can
specialize the diff engine to show different kind of differences deduced from
the original ones, and then extends the merge service so that it can be merged
by the user. So if that's what you're trying to do, then no need to specialize
the match engine.
> If you want to "force" emf compare to consider your Class1 is the same as
the Class2, then you need to specialize the match engine so that you say "this
Class1 *matches* this Class2. Then the differences that will show up will
consider that Class1/Class2 are 2 versions of the same object and then you'll
be able to merge your Students.

> Is that what you're trying to do ?


> Cédric
Re: [EMF Compare] Matching eObject with containemt(1-*) reference [message #620522 is a reply to message #131438] Mon, 08 December 2008 09:40 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090502090204090502030408
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hi,

I still have trouble visualizing your metamodel and the changes you
describe. Could you provide us with a sample (metamodel and models)
reproducing this?

As for the merge options, no, the existing merge does not provide
advanced features. We could try and find a way to add them though if the
case you encouter is reproducible and meaningful as a generic solution.
The merge extension point should provide you with enough flexibility to
tackle this need nevertheless. Feel free to come back to us if it does not.

Having multiple attributes identifying an object is not an issue in
itself, yet the generic engines provided with EMF Compare probably
aren't sufficient to accurately detect differences on those. I think
what you need to override isn't the diff engine but the matching engine
so that EMF Compare knows how to match similar objects based on all ID
attributes. The generic diff engine should manage to diff accurately
afterwards.

laurent Goubet
Obeo

Chetan Kumar a
Re: [EMF Compare] Matching eObject with containemt(1-*) reference [message #620555 is a reply to message #131464] Fri, 26 December 2008 05:01 Go to previous message
Chetan Kumar is currently offline Chetan KumarFriend
Messages: 70
Registered: July 2009
Member
Hi!,

I'll try to explain my use-case. Lets take a small model like this.
parent
|
|-- child (1-*) ( containment )

i have 2 separate instances of parent metamodel. (something like 2 trees).
Let us call them left and right parent.
the ID attribute(s) of parent instance are same in both the parent
instances (trees).
so i can conclude that ... the 2 different parent instances are similar
and can be merged.
so based on this ... i want to merge the sub-trees of both the parent
instances.

Now let us consider that each of the 2 parent instances have a child
instance (linked thru the containment relnship) which can be considered
different (by some means). so in the process of merging the sub-trees of
the parent instances ... i compare the child instances too ... and i find
out that ... the child of the right parent instance is not similar to that
of the left parent instance. so the right child instance is totally new
and has to be added under the left parent as part of the merger.

The conclusion that the child instances are different ... is based on
the value of multiple attributes (or cross-references).

This is my one simple part of my use-case.

I have attached 2 .xmi files thru which i have attempted to describe my
use-case. They are xmi files from the EMF standard example extlibrary
model. Library is the root object and the 2 Library instances have the
same name ("CCL"). so ... i want to merge them into one big library ... by
carefuly taking care of the respective sub-trees ...
- there can be conflicts (like same book in both libraries .. but
borrowed by different borrowers)
- there can be incoming changes to the master library instance (like new
Writers, new Books, etc)
and many more...

I hope this brings some clarity.

@laurent: I have sent the example files to you via e-mail ... for i didn't
figure out a way to attach them to this post ;)

ciao,
Chetan Kumar
Previous Topic:[Announce] EMFT MWE 0.7.0M4 is available
Next Topic:Cross referencing ecore models - problem
Goto Forum:
  


Current Time: Thu Apr 25 16:36:04 GMT 2024

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

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

Back to the top