Home » Modeling » EMF » Importing and referecing metamodels
| Importing and referecing metamodels [message #428959] |
Sat, 04 April 2009 17:07  |
Eclipse User |
|
|
|
Hi guys,
I am starting with emf and I m already full of questions. I need to to the
following task: I have to build a plugin that references elements from
other two metamodels. So I wanna make a metamodel which classes will
reference an element from two metamodels. Basically I will have three
metamodels in one ecore and two metamodels will be intact while the other
will reference elements from these two. WhatŽs the best way to do this? In
the end I wanna to establish relations between the two metamodels with
this 3rd metamodel.
Sorry for my English, I am brazillian. And thanks for your patience to
read.
Best Regards,
Romulo
|
|
| |
| Re: Importing and referecing metamodels [message #428962 is a reply to message #428959] |
Sun, 05 April 2009 09:36   |
Eclipse User |
|
|
|
Originally posted by: tim.baumgartner.gmx.de
Hi Romulo,
I hope I can help you.
> I wanna make a metamodel which classes
> will reference an element from two metamodels.
This sounds as if you create two ecore models (EPackages) in some place
and then create a third model that references them (e.g. by subclassing
it's EClasses). In order to reference the two ecore files, you can use
the "Load Resource..." action in the context menu of the ecore editor.
If you use another editor, it will be available, too. After you have
loaded the resource, you see it's content and can make references to it.
When you generate code, you have at least the following options:
- Create a separate genmodel for each of the three models
- Create a single genmodel for all three models
If you choose the first option, you have to click all three models in
the Ecore Importer Wizard (in the top half). If you choose the second
option, you first create two genmodel for the two independend models and
then in the Ecore Importer Wizard for the third one, you add the
resulting genmodels (in the bottom half).
> Basically I will have three metamodels in one ecore
Do you mean "in one genmodel"? If not, then I don't understand what you
mean.
I hope this helped,
Tim
|
|
|
| Re: Importing and referecing metamodels [message #428967 is a reply to message #428962] |
Mon, 06 April 2009 03:22   |
Eclipse User |
|
|
|
Hello Tim,
I use your second option.
I had the problem that I wanted to reference an additional metamodel
afterwards. Loading an additional Ecore metamodel resource IS possible, BUT
I didn't find any way to include its genmodel. I had to edit the genmodel
XMI of my using metamodel which is for me ok, but which is, in my opinion,
not very convenient, especially for beginners.
Do you know any way of including an additional genmodel via the UI?
Ciao, Michael
"Tim Baumgartner" <tim.baumgartner@gmx.de> wrote in message
news:gracb6$ad8$1@build.eclipse.org...
> Hi Romulo,
>
> I hope I can help you.
>
>> I wanna make a metamodel which classes will reference an element from two
>> metamodels.
>
> This sounds as if you create two ecore models (EPackages) in some place
> and then create a third model that references them (e.g. by subclassing
> it's EClasses). In order to reference the two ecore files, you can use the
> "Load Resource..." action in the context menu of the ecore editor. If you
> use another editor, it will be available, too. After you have loaded the
> resource, you see it's content and can make references to it.
>
> When you generate code, you have at least the following options:
> - Create a separate genmodel for each of the three models
> - Create a single genmodel for all three models
> If you choose the first option, you have to click all three models in the
> Ecore Importer Wizard (in the top half). If you choose the second option,
> you first create two genmodel for the two independend models and then in
> the Ecore Importer Wizard for the third one, you add the resulting
> genmodels (in the bottom half).
>
>> Basically I will have three metamodels in one ecore
>
> Do you mean "in one genmodel"? If not, then I don't understand what you
> mean.
>
> I hope this helped,
> Tim
|
|
| |
| Re: Importing and referecing metamodels [message #428988 is a reply to message #428972] |
Mon, 06 April 2009 10:34   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0042_01C9B6D5.89E05700
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi Ed,
Yes, reloading via the menu works, thanks!
But the dependencies are not adjusted automatically. One has to define =
them in the dialog by hand, ok, at least one does not have to edit the =
XML, then. I would have expected that the dialog appears also via =
context menu on the root genmodel node.
Ciao, Michael
"Ed Merks" <Ed.Merks@gmail.com> wrote in message =
news:grcnl9$qob$1@build.eclipse.org...
Michael,
Have you tried using "Reload..." from either the popup or from the =
Generator main menubar item when the GenModel is open? EMF is quite =
good at automatically adjusting the GenModel to the changed underlying =
Ecore model, but adding a dependency on a new package needs your =
intervention to locate the GenPackage/GenModel for that package...
Michael M=FChlberg wrote:=20
Hello Tim,
I use your second option.
I had the problem that I wanted to reference an additional metamodel=20
afterwards. Loading an additional Ecore metamodel resource IS possible, =
BUT=20
I didn't find any way to include its genmodel. I had to edit the =
genmodel=20
XMI of my using metamodel which is for me ok, but which is, in my =
opinion,=20
not very convenient, especially for beginners.
Do you know any way of including an additional genmodel via the UI?
Ciao, Michael
"Tim Baumgartner" <tim.baumgartner@gmx.de> wrote in message=20
news:gracb6$ad8$1@build.eclipse.org...
Hi Romulo,
I hope I can help you.
I wanna make a metamodel which classes will reference an element =
from two=20
metamodels.
This sounds as if you create two ecore models (EPackages) in some =
place=20
and then create a third model that references them (e.g. by subclassing=20
it's EClasses). In order to reference the two ecore files, you can use =
the=20
"Load Resource..." action in the context menu of the ecore editor. If =
you=20
use another editor, it will be available, too. After you have loaded the =
resource, you see it's content and can make references to it.
When you generate code, you have at least the following options:
- Create a separate genmodel for each of the three models
- Create a single genmodel for all three models
If you choose the first option, you have to click all three models in =
the=20
Ecore Importer Wizard (in the top half). If you choose the second =
option,=20
you first create two genmodel for the two independend models and then in =
the Ecore Importer Wizard for the third one, you add the resulting=20
genmodels (in the bottom half).
Basically I will have three metamodels in one ecore
Do you mean "in one genmodel"? If not, then I don't understand =
what you=20
mean.
I hope this helped,
Tim=20
=20
------=_NextPart_000_0042_01C9B6D5.89E05700
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3Dtext/html;charset=3DISO-8859-1 =
http-equiv=3DContent-Type>
<META name=3DGENERATOR content=3D"MSHTML 8.00.6001.18702">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff text=3D#000000>
<DIV><FONT size=3D2 face=3DArial>Hi Ed,</FONT></DIV>
<DIV><FONT size=3D2 face=3DArial></FONT> </DIV>
<DIV><FONT size=3D2 face=3DArial>Yes, reloading via the menu works,=20
thanks!</FONT></DIV>
<DIV><FONT size=3D2 face=3DArial></FONT> </DIV>
<DIV><FONT size=3D2 face=3DArial>But the dependencies are not adjusted=20
automatically. One has to define them in the dialog by hand, ok, at =
least one=20
does not have to edit the XML, then. I would have expected that the =
dialog=20
appears also via context menu on the root genmodel node.</FONT></DIV>
<DIV><FONT size=3D2 face=3DArial></FONT> </DIV>
<DIV><FONT size=3D2 face=3DArial>Ciao, Michael</FONT></DIV>
<DIV><FONT size=3D2 face=3DArial></FONT><FONT size=3D2 =
face=3DArial></FONT> </DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; =
PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px"=20
dir=3Dltr>
<DIV>"Ed Merks" <<A=20
href=3D"mailto:Ed.Merks@gmail.com">Ed.Merks@gmail.com</A>> wrote in =
message=20
<A=20
=
href=3D"news:grcnl9$qob$1@build.eclipse.org">news:grcnl9$qob$1@build.ecli=
pse.org</A>...</DIV>Michael,<BR><BR>Have=20
you tried using "Reload..." from either the popup or from the =
Generator main=20
menubar item when the GenModel is open? EMF is quite good at=20
automatically adjusting the GenModel to the changed underlying Ecore =
model,=20
but adding a dependency on a new package needs your intervention to =
locate the=20
GenPackage/GenModel for that package...<BR><BR><BR><BR>Michael =
M=FChlberg wrote:=20
<BLOCKQUOTE cite=3Dmid:grcajg$6b7$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Hello Tim,
I use your second option.
I had the problem that I wanted to reference an additional metamodel=20
afterwards. Loading an additional Ecore metamodel resource IS possible, =
BUT=20
I didn't find any way to include its genmodel. I had to edit the =
genmodel=20
XMI of my using metamodel which is for me ok, but which is, in my =
opinion,=20
not very convenient, especially for beginners.
Do you know any way of including an additional genmodel via the UI?
Ciao, Michael
"Tim Baumgartner" <A class=3Dmoz-txt-link-rfc2396E =
href=3D"mailto:tim.baumgartner@gmx.de"><tim.baumgartner@gmx.de></A>=
wrote in message=20
<A class=3Dmoz-txt-link-freetext =
href=3D"news:gracb6$ad8$1@build.eclipse.org">news:gracb6$ad8$1@build.ecli=
pse.org</A>...
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Hi Romulo,
I hope I can help you.
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">I wanna make a metamodel =
which classes will reference an element from two=20
metamodels.
</PRE></BLOCKQUOTE><PRE wrap=3D"">This sounds as if you create two =
ecore models (EPackages) in some place=20
and then create a third model that references them (e.g. by subclassing=20
it's EClasses). In order to reference the two ecore files, you can use =
the=20
"Load Resource..." action in the context menu of the ecore editor. If =
you=20
use another editor, it will be available, too. After you have loaded the =
resource, you see it's content and can make references to it.
When you generate code, you have at least the following options:
- Create a separate genmodel for each of the three models
- Create a single genmodel for all three models
If you choose the first option, you have to click all three models in =
the=20
Ecore Importer Wizard (in the top half). If you choose the second =
option,=20
you first create two genmodel for the two independend models and then in =
the Ecore Importer Wizard for the third one, you add the resulting=20
genmodels (in the bottom half).
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Basically I will have =
three metamodels in one ecore
</PRE></BLOCKQUOTE><PRE wrap=3D"">Do you mean "in one genmodel"? =
If not, then I don't understand what you=20
mean.
I hope this helped,
Tim=20
</PRE></BLOCKQUOTE><PRE wrap=3D""><!---->
</PRE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0042_01C9B6D5.89E05700--
|
|
| |
| Re: Importing and referecing metamodels [message #429024 is a reply to message #428962] |
Mon, 06 April 2009 16:05   |
Eclipse User |
|
|
|
Hi Tim,
Thanks, got it. I loaded the ecores like you said and now I have the two
ecores on the third ecore that will reference the other two.
But now how I reference the eclasses? I initialized this ecore that has
the other two but when I create an eclass and an attribute called source
for example I cannot see in the Etype all the eclasses from the two
metamodels.
Am I doing something terriblly wrong?
Basically all I want is to parse two xmi generated from two editors and
establish relations between then. I have the ecores from these two
editors, so now I want to relate some eclasses from the metamodel with the
'third metamodel' and when I load the xmi generated, I will can fill in
the relations granted that the tree of the two others are already filled
in.
Sorry to bother you.
Best regards,
Romulo
Tim Baumgartner wrote:
> Hi Romulo,
> I hope I can help you.
>> I wanna make a metamodel which classes
>> will reference an element from two metamodels.
> This sounds as if you create two ecore models (EPackages) in some place
> and then create a third model that references them (e.g. by subclassing
> it's EClasses). In order to reference the two ecore files, you can use
> the "Load Resource..." action in the context menu of the ecore editor.
> If you use another editor, it will be available, too. After you have
> loaded the resource, you see it's content and can make references to it.
> When you generate code, you have at least the following options:
> - Create a separate genmodel for each of the three models
> - Create a single genmodel for all three models
> If you choose the first option, you have to click all three models in
> the Ecore Importer Wizard (in the top half). If you choose the second
> option, you first create two genmodel for the two independend models and
> then in the Ecore Importer Wizard for the third one, you add the
> resulting genmodels (in the bottom half).
>> Basically I will have three metamodels in one ecore
> Do you mean "in one genmodel"? If not, then I don't understand what you
> mean.
> I hope this helped,
> Tim
|
|
| |
| Re: Importing and referecing metamodels [message #429029 is a reply to message #428960] |
Mon, 06 April 2009 16:36  |
Eclipse User |
|
|
|
Tim,
I said something very stupid. Obviously in the Etype I can only set TYPES,
sorry for this stupid question.
I already got it. Is there any way though to reference the elements in the
ecore_diagram? I just seem to reference in the emf tree when I create an
ereference...
|
|
|
Goto Forum:
Current Time: Wed Nov 05 10:51:45 EST 2025
Powered by FUDForum. Page generated in 0.08810 seconds
|