Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Resources Data Migration
EMF Resources Data Migration [message #418537] Thu, 17 April 2008 23:25 Go to next message
Al B is currently offline Al BFriend
Messages: 130
Registered: July 2009
Senior Member
Hi,

We have 2 model instances (resources) created from 2 different ecore
models as shown below. Now, the data in the A1 resource is used to create
element instances in the resource 'P1'. However, the 'A1' resource data
can be modified by a 3rd party application causing the P1 resource to be
out-of-synch when a new updated 'An' resource is loading in our
application. As a result, we need to find a way to determine the delta
between 'P1' and 'An' so we can migrate it into 'Pn'.

So, does anyone have any suggestion how we could leverage EMF or EMFT to
accomplish this? Thanks in advance!



+-----------+ +-------------+ +-------------+
| A.ecore |------->| A1.xml | | An.xml |
+-----------+ +-------------+ +-------------+
| / |
| / |
| /delta |
| / |
v / v
+-----------+ +-------------+ +-------------+
| P.ecore |------->| P1.xml | | Pn.xml |
+-----------+ +-------------+ +-------------+
Re: EMF Resources Data Migration [message #418538 is a reply to message #418537] Thu, 17 April 2008 23:38 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
AJ,

I'm not sure I have any idea what "delta" represents... You're
implying, perhaps that An.xml has an unresolved proxy to P1.xml and
you're trying to correct that proxy somehow to point at some newer
version of Pn.xml. If EObject.eIsProxy() is true for some object, you
can cast to InternalEObject and check InternalEObject.eProxyURI() to see
what the reference is. Are the URI's of the resources really
changing. Maybe something less abstract in the way of an example would
help...


AJ wrote:
> Hi,
>
> We have 2 model instances (resources) created from 2 different ecore
> models as shown below. Now, the data in the A1 resource is used to
> create element instances in the resource 'P1'. However, the 'A1'
> resource data can be modified by a 3rd party application causing the
> P1 resource to be out-of-synch when a new updated 'An' resource is
> loading in our application. As a result, we need to find a way to
> determine the delta between 'P1' and 'An' so we can migrate it into 'Pn'.
>
> So, does anyone have any suggestion how we could leverage EMF or EMFT
> to accomplish this? Thanks in advance!
>
>
>
> +-----------+ +-------------+ +-------------+
> | A.ecore |------->| A1.xml | | An.xml |
> +-----------+ +-------------+ +-------------+
> | / |
> | / |
> | /delta |
> | / |
> v / v
> +-----------+ +-------------+ +-------------+
> | P.ecore |------->| P1.xml | | Pn.xml |
> +-----------+ +-------------+ +-------------+
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF Resources Data Migration [message #418539 is a reply to message #418538] Fri, 18 April 2008 00:15 Go to previous messageGo to next message
Al B is currently offline Al BFriend
Messages: 130
Registered: July 2009
Senior Member
This Ed's posted message #: 2,000,199
--------------------------------------

Hi Ed,

Sorry, I should have explicitily indicated that there are not proxies
between resources (i.e. A1 and P1). In other words, when the user drags
an element from A1 into P1, an P1 element instance is created using the
data from the A1 instance, however, a proxy is not establish between them.

It might be worth mentioning that there are not model changes in any of
the 2 ecore model either.

So, the problem is that data contained by the original element in A1 can
change so the P1 resource need to be update with those changes.

For instance, looking at it from the element level let's say the A1
element ActivityDef contains properties (EObjects) from an EClass called
Property.

+-------------+ (contains) +-------------+
| ActivityDef |*-------------->| Property |
+-------------+ +-------------+

When the user drags the ActivityDef element into the P1 editor, a P1
element Task instance is created; which also contains its own properties
and some of them are populated with the property data from the ActivityDef.


+-------------+ (contains) +-------------+
| Task |*-------------->| Property |
+-------------+ +-------------+

So, we need to migrate any changes (e.g. properties added, removed, or
value modified) that occur in the ActivityDef element contained in the A1
resource into the Task element contained in the P1 resource.

I hope this more clear now.

Thanks again Ed.

-AJ
Re: EMF Resources Data Migration [message #418552 is a reply to message #418539] Fri, 18 April 2008 10:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
AJ,

Comments below.


AJ wrote:
> This Ed's posted message #: 2,000,199
> --------------------------------------
>
> Hi Ed,
>
> Sorry, I should have explicitily indicated that there are not proxies
> between resources (i.e. A1 and P1). In other words, when the user
> drags an element from A1 into P1, an P1 element instance is created
> using the data from the A1 instance, however, a proxy is not establish
> between them.
So it's effectively copied from P1.
>
> It might be worth mentioning that there are not model changes in any
> of the 2 ecore model either.
So at least the meta model has remained consistent.
>
> So, the problem is that data contained by the original element in A1
> can change so the P1 resource need to be update with those changes.
That's making more sense now.
>
> For instance, looking at it from the element level let's say the A1
> element ActivityDef contains properties (EObjects) from an EClass
> called Property.
>
> +-------------+ (contains) +-------------+
> | ActivityDef |*-------------->| Property |
> +-------------+ +-------------+
>
> When the user drags the ActivityDef element into the P1 editor, a P1
> element Task instance is created; which also contains its own
> properties and some of them are populated with the property data from
> the ActivityDef.
>
>
> +-------------+ (contains) +-------------+
> | Task |*-------------->| Property |
> +-------------+ +-------------+
>
> So, we need to migrate any changes (e.g. properties added, removed, or
> value modified) that occur in the ActivityDef element contained in the
> A1 resource into the Task element contained in the P1 resource.
Given there are no references from A1 back to P1, you'd need to
establish a correspondence between an Task in A1 and an ActivityDef in
P1. Is that problem solved already. Do they perhaps share a common ID
(or UUID, which of course would imply the UU is a misnomer)? Perhaps
they have a name that would allow them to match? In EMFT there is a
compare framework, but normally you'd be comparing instances of the same
model, not two different models, so I'm not sure it could be used in
this scenario. It's possible it might work for that though. If guess
the Property objects themselves are of the same EClass in both? The
compare framework could certainly be used in that case. I imagine
properties could be determined to correspond based on name.
>
> I hope this more clear now.
>
> Thanks again Ed.
>
> -AJ
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF Resources Data Migration [message #418561 is a reply to message #418552] Fri, 18 April 2008 14:05 Go to previous messageGo to next message
Al B is currently offline Al BFriend
Messages: 130
Registered: July 2009
Senior Member
>Is that problem solved already. Do they perhaps share a common ID (or UUID,
which of course would imply the UU is a misnomer)? Perhaps they have a name
that would allow them to match?

Yes,they do share an UID and a name that will allow us to match them.

>In EMFT there is a compare framework, but normally you'd be comparing
instances of the same model, not two different models, so I'm not sure it
could be used in this scenario. It's possible it might work for that though.

OK, I will take a look at it, however, as you pointed out it might not
help since they are two different models.

>If guess the Property objects themselves are of the same EClass in both? I
imagine properties could be determined to correspond based on name.

Unfortunately, they are not. However, the properties can be determined to
correspond based on name.

Thanks Ed!
Re: EMF Resources Data Migration [message #418592 is a reply to message #418561] Mon, 21 April 2008 16:34 Go to previous messageGo to next message
Jason Henriksen is currently offline Jason HenriksenFriend
Messages: 231
Registered: July 2009
Senior Member
Hi Guys,

Have you tried the -sdo option in generation? You might be able to get
a change log on the altered object and apply that change set to the
original object. We've had some good success using that plan and we use
a separate ecore per java package in our tree.

You might also try persisting the objects in a local database via
Derby/Hibernate and let Hibernate take care of the merging for you.
That's a kind of a heavy handed solution if you're just working on local
files. We load XML, send it down to a user, user modifies it and sends
it back. In that scenario, Hibernate work great. (To use Hibernate and
EMF you'll also need to install Teneo)

Not sure if either of those are any help but I figured I'd kick in,

Jason Henriksen
Re: EMF Resources Data Migration [message #418593 is a reply to message #418592] Mon, 21 April 2008 19:18 Go to previous messageGo to next message
Al B is currently offline Al BFriend
Messages: 130
Registered: July 2009
Senior Member
Jason,

Thank you for your comments on this. Unfortunately, the database/hibernate
approach is not an option for us at this point. However, would you mind
explaining a little bit more about the -sdo option in generation? Is that
a property that we can set via the GenModel property editor?
Re: EMF Resources Data Migration [message #418594 is a reply to message #418593] Mon, 21 April 2008 19:21 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
AJ,

It does the same thing as invoking Set SDO Defaults on the GenModel root
object, but somehow I don't think this will be a good approach. You'd
need to be saving the delta along with the model. You could accomplish
the same things with a ChangeRecorder and serialize the ChangeDescription...


AJ wrote:
> Jason,
>
> Thank you for your comments on this. Unfortunately, the
> database/hibernate approach is not an option for us at this point.
> However, would you mind explaining a little bit more about the -sdo
> option in generation? Is that a property that we can set via the
> GenModel property editor?
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How to set the input for the tree view?
Next Topic:Guarding all commands in a custom editor
Goto Forum:
  


Current Time: Fri Apr 26 22:29:29 GMT 2024

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

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

Back to the top