Skip to main content



      Home
Home » Modeling » EMF » EMF XMI Persistence multiple files(One model, multiple XMI files)
icon7.gif  EMF XMI Persistence multiple files [message #912363] Thu, 13 September 2012 08:36 Go to next message
Eclipse UserFriend
Hi everyone,

I have been looking for quite some time for a solution to this problem. But I haven't found a 'readable' one yet.

I have an EMF model (ecore, ecorediag, genmodel) in which I have only 2 classes. The first one is a Group class and the other one is a Person class. When I tried to persist these two via the vogella tutorial on EMF and XMI (can't link it), I found that when my Group was being persisted, the list op persons in that group was also in the same XMI file.

So Group-> persons (0,*) -> Person translates in

<XMI>
  <Group name="bla">
    <persons ... />
    <persons ... />
    ...
  </Group>
</XMI>


I know there is a possibility to persist these objects in such a way that it looks like this

Group.xmi
<XMI>
   <Group name="bla">
      <persons href="Person.xmi#id">
      ....
   </Group>
</XMI>


Person.xmi
<XMI>
   <Person id="id">
     ...
   </Person>
</XMI>


The only question is .. how can I do this? I have found a lot of 'solutions' that say they do this... but they include strange things... and I just can't figure out how to make this work

I thank you for reading this,
regards
Re: EMF XMI Persistence multiple files [message #912377 is a reply to message #912363] Thu, 13 September 2012 08:59 Go to previous messageGo to next message
Eclipse UserFriend
It looks like the persons reference from Group to Person is a
containment reference. You have to change the GenModel property for
"Containment Proxies" to true. Then you will be able to put a Person in
a different resource than its containing Group. Simply create each
resource with the URI you want and add each Person to its own resource.
When you have the resources all set up, save them all.


On 13/09/2012 2:36 PM, Ar vraepe wrote:
> Hi everyone,
>
> I have been looking for quite some time for a solution to this
> problem. But I haven't found a 'readable' one yet.
>
> I have an EMF model (ecore, ecorediag, genmodel) in which I have only
> 2 classes. The first one is a Group class and the other one is a
> Person class. When I tried to persist these two via the vogella
> tutorial on EMF and XMI (can't link it), I found that when my Group
> was being persisted, the list op persons in that group was also in the
> same XMI file.
>
> So Group-> persons (0,*) -> Person translates in
>
>
> <XMI>
> <Group name="bla">
> <persons ... />
> <persons ... />
> ...
> </Group>
> </XMI>
>
>
> I know there is a possibility to persist these objects in such a way
> that it looks like this
>
> Group.xmi
>
> <XMI>
> <Group name="bla">
> <persons href="Person.xmi#id">
> ....
> </Group>
> </XMI>
>
>
> Person.xmi
>
> <XMI>
> <Person id="id">
> ...
> </Person>
> </XMI>
>
>
> The only question is .. how can I do this? I have found a lot of
> 'solutions' that say they do this... but they include strange
> things... and I just can't figure out how to make this work
>
> I thank you for reading this,
> regards
Re: EMF XMI Persistence multiple files [message #912748 is a reply to message #912377] Fri, 14 September 2012 01:24 Go to previous message
Eclipse UserFriend
Thank you for the quick reply!

This helped me out!



Previous Topic:Loading XML file into EMF Model
Next Topic:Genmodel Factory Inheritance
Goto Forum:
  


Current Time: Sat Nov 08 05:40:56 EST 2025

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

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

Back to the top