Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Cross referencing model
Cross referencing model [message #1015013] Wed, 27 February 2013 08:13 Go to next message
Matthias N is currently offline Matthias NFriend
Messages: 65
Registered: June 2012
Member
Hi,
I've two Ecore models: A.ecore and B.ecore
A.ecore references some elements in B.ecore

When I open A.ecore it automatically loads B.ecore as well, that's fine:
platform:/resource/org.eatop.eel.eastadl2110/model/A.ecore
platform:/resource/org.eatop.eel.eastadl2110/model/B.ecore


Okay, now I copy those two ecore files into another location (new-folder) of my workspace and try to open them again:

platform:/resource/new-folder/A.ecore
platform:/resource/org.eatop.eel.eastadl2110/model/B.ecore


The path of B.ecore didn't get updated?!, Hence A.ecore can't load the model elements in B.ecore.

Any ideas how to solve this?
Re: Cross referencing model [message #1015020 is a reply to message #1015013] Wed, 27 February 2013 08:28 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 26285
Registered: July 2009
Senior Member
Matthias,

Comments below.

On 27/02/2013 9:13 AM, Matthias N wrote:
> Hi,
> I've two Ecore models: A.ecore and B.ecore
> A.ecore references some elements in B.ecore
>
> When I open A.ecore it automatically loads B.ecore as well, that's fine:
>
> platform:/resource/org.eatop.eel.eastadl2110/model/A.ecore
> platform:/resource/org.eatop.eel.eastadl2110/model/B.ecore
>
>
> Okay, now I copy those two ecore files into another location
> (new-folder) of my workspace and try to open them again:
>
>
> platform:/resource/new-folder/A.ecore
> platform:/resource/org.eatop.eel.eastadl2110/model/B.ecore
It looks like A.ecore's serialization contains absolute URIs for its
references to B.ecore. That's not normally how EMF's tools serialize
models. Normally I would expect references to B.ecore to look like
"B.ecore#<fragment>" but probably you have
"platform:/resource/org.eatop.eel.eastadl2110/model/B.ecore#<fragment>".
Is that the case?
>
>
> The path of B.ecore didn't get updated?!, Hence A.ecore can't load the
> model elements in B.ecore.
>
> Any ideas how to solve this?
Which tool did you use to edit/create these two models? If you edit
A.ecore and B.ecore with the Sample Ecore Editor (make some change and
then change it back so you can actually save the result), what do the
URIs in the serialization look like?
Re: Cross referencing model [message #1015065 is a reply to message #1015020] Wed, 27 February 2013 10:55 Go to previous messageGo to next message
Matthias N is currently offline Matthias NFriend
Messages: 65
Registered: June 2012
Member
Hi Ed,
we generate the Ecore models:

Below, there is a code snippet of A.ecore:
<eSuperTypes href="./A.ecore#//east_adl/infrastructure/elements/EAElement"/>
<eSuperTypes href="platform:/resource/org.eatop.eel.eastadl2110/model/B.ecore#//ginfrastructure/gelements/GEAPackage"/>        


I guess the URI of B.ecore should be sth like
./B.ecore#//
?

And yes, when I open A.ecore and edit it, save it again it works fine... But how can I tell EMF to serialize into relative URI?

[Updated on: Wed, 27 February 2013 11:04]

Report message to a moderator

Re: Cross referencing model [message #1015100 is a reply to message #1015065] Wed, 27 February 2013 13:20 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26285
Registered: July 2009
Senior Member
Matthias,

Be sure that you use an absolute URI for each resource you create. That
will ensure that when you save them, references between them will be
relative URIs whenever possible.


On 27/02/2013 11:55 AM, Matthias N wrote:
> Hi Ed,
> we generate the Ecore models:
>
> Below, there is a code snippet of A.ecore:
>
> <eSuperTypes
> href="./A.ecore#//east_adl/infrastructure/elements/EAElement"/>
> <eSuperTypes
> href="platform:/resource/org.eatop.eel.eastadl2110/model/B.ecore#//ginfrastructure/gelements/GEAPackage"/>
>
>
> I guess the URI of B.ecore should be sth like
> /B.ecore#// ?
Previous Topic:[TENEO] Load Read-only database into XMI
Next Topic:A newbie question of EMF transaction
Goto Forum:
  


Current Time: Sat Dec 20 10:36:02 GMT 2014

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

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