Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Generating extended EMF
Generating extended EMF [message #390164] Thu, 23 December 2004 00:21 Go to next message
Eclipse UserFriend
Originally posted by: harry.raceeend.demon.nl

In the EMF tutorial "Tutorial: Generating an Extended EMF Model"
a second model Schoollibrary is created, which inherits from a previous
made libray model. I can EMF class in a separate java project, but then
I dont't understand how to go further. When I create a new EMF Project
and say that my Schoollibrary's genmodel should inherit from the other,
then I can generate code for it, but in a workbench it does not work.
I can not create children for the schoollibrary.
Can somebody give me some hints ?
Re: Generating extended EMF [message #390165 is a reply to message #390164] Thu, 23 December 2004 13:25 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060401070906090104070206
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Harry,

When you look at the SchoolLibrary in the Generator, does it show that
it inherits from Library:



Harry van Rijn wrote:

> In the EMF tutorial "Tutorial: Generating an Extended EMF Model"
> a second model Schoollibrary is created, which inherits from a
> previous made libray model. I can EMF class in a separate java
> project, but then
> I dont't understand how to go further. When I create a new EMF Project
> and say that my Schoollibrary's genmodel should inherit from the other,
> then I can generate code for it, but in a workbench it does not work.
> I can not create children for the schoollibrary.
> Can somebody give me some hints ?



--------------060401070906090104070206
Content-Type: multipart/related;
boundary="------------070309000301030506090309"


--------------070309000301030506090309
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Harry,<br>
<br>
When you look at&nbsp; the SchoolLibrary in the Generator, does it show that
it inherits from Library:<br>
<blockquote><img src="cid:part1.06000802.07000501@ca.ibm.com" alt=""><br>
</blockquote>
<br>
Harry van Rijn wrote:
<blockquote cite="midcqd323$ei5$1@www.eclipse.org" type="cite">In the
EMF tutorial "Tutorial: Generating an Extended EMF Model"
<br>
a second model Schoollibrary is created, which inherits from a previous
made libray model. I can EMF class in a separate java project, but then
<br>
I dont't understand how to go further. When I create a new EMF Project
and say that my Schoollibrary's genmodel should inherit from the other,
<br>
then I can generate code for it, but in a workbench it does not work.
<br>
I can not create children for the schoollibrary.
<br>
Can somebody give me some hints ?
<br>
</blockquote>
<br>
</body>
</html>

--------------070309000301030506090309
Content-Type: image/jpeg;
name="moz-screenshot-1.jpg"
Content-Transfer-Encoding: base64
Content-ID: <part1.06000802.07000501@ca.ibm.com>
Content-Disposition: inline;
filename="moz-screenshot-1.jpg"

/9j/4AAQSkZJRgABAQIAJQAlAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsL DBkSEw8UHRof
Hh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwL DBgNDRgyIRwh
MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy MjIyMjL/wAAR
CABDAM4DASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcI CQoL/8QAtRAA
AgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS 0fAkM2JyggkK
FhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1 dnd4eXqDhIWG
h4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW 19jZ2uHi4+Tl
5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcI CQoL/8QAtREA
AgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMz UvAVYnLRChYk
NOEl8RcYGRomJygpKjU2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DR+R7OSP2+LUK3vKz0eq/EPBut6n4l1eWz1S +mkgSAyqIm8g
7gyj70e0kYY8Zx+VehWtnb2URjt4ljVjuYjq7d2Y9WY45JyTRRTwLcqXNLVk 57FUsU6dNWjZ
aLRfcT0UUV2niBRRRQB//9k=
--------------070309000301030506090309--

--------------060401070906090104070206--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Generating extended EMF [message #390167 is a reply to message #390165] Thu, 23 December 2004 20:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: harry.raceeend.demon.nl

Hallo Ed,

Yes, I can see something like you show in the picture.
But I it is not clear to me.
I created a java-project
I added a package een.twee.drie to the src directory
I created an EMF Class Diagram with Classes for library,
authors and books. I added the relations too.
I created an EMF project, and stated: load from EMF core model.
This resulted in a picture like you show.
I right clicked on the genmodel tree root and selected
generate all.
I run ... to a new workbench, set the run box in the common tab,
and run it.
I was able to add children like authors and books to the
instance of the library model.

Now we enter EXTENDING your EMF model

So I started the same procedure as above, but now for
Schoollibray.
My confusion, or wondering starts with the fact, that
I had to created a Class Schoollibrary that inherits
from anothe Class, library. This library Class in my EMF
Diagram, is empty, only an arrow ointing from the
Schoollibrary Class to the library Class, indicates
that inheritance was in the game. I thought, maybe the
library Class here, is merely a placeholder in the EMF
Diagram in order to formulate my idea about the dependency
and that the actual link (inheritance) between the library
Class and the Schoollibrary Class would be realized later,
when generating the genmodel.
So when creating an EMF project an saying that is will also
load from an EMF core model, I had the opportunity to add
a referenced generator model. I thought, this is the key,
I go for library.genmodel.
This resluted finally in a picture you show.
But when I select generate all (on the root of the
Schoollibrary.genmodel tree) I got books.java with a interface
books extending EObject. From here the light turns off for me.
When I generated all, and started a new workbench, I could also
not edit my instance of the Schoollibrary.

I know that is a lot I ask you, and maybe my problem is not
directly EMF related, I would like you to guide me in mastering
this stuff.

Harry



Ed Merks wrote:
> Harry,
>
> When you look at the SchoolLibrary in the Generator, does it show that
> it inherits from Library:
>
>
>
> Harry van Rijn wrote:
>
>> In the EMF tutorial "Tutorial: Generating an Extended EMF Model"
>> a second model Schoollibrary is created, which inherits from a
>> previous made libray model. I can EMF class in a separate java
>> project, but then
>> I dont't understand how to go further. When I create a new EMF Project
>> and say that my Schoollibrary's genmodel should inherit from the other,
>> then I can generate code for it, but in a workbench it does not work.
>> I can not create children for the schoollibrary.
>> Can somebody give me some hints ?
>
>
Re: Generating extended EMF [message #390169 is a reply to message #390164] Fri, 24 December 2004 05:30 Go to previous messageGo to next message
Eric Giguere is currently offline Eric GiguereFriend
Messages: 58
Registered: July 2009
Member
Hi Harry

I tried the example but adapted on my project but it didn't work.
I found a way though to have the expected result. Create an Ecore model
with what ever means you like better. Then, edit the ecore file with the
text editor and insert the following attribute in the class you want to
derive from a base:
eSuperTypes=" platform:/resource/yourproject/proj-path/yourmodel.ecore#//T heBaseClass ".

NOTE: once you save the model, the ecore file link this will get resolved
to a relative path.

NOTE2: Have both project opened in your Eclipse, its very important
otherwise the ecore editor won't be able to load the file and base classes
will show as null.

The results are quite impressive. The default ecore editor will
automatically show the second ecore file since the resource gets loaded
through supertype reference. The ESuper Type editor will also let you
choose any of the classes of both models as a super type now for your new
or existing classes :). The editor only needed the trigger to load the
referenced ecore to allow full control.

Now with genmodel. You need to create the genmodel from your ecore file.
While you do so, make sure to select ONLY your new package for generation.
The other one, your base, must only be referenced. You can do this by
clicking on the browse button. Go select the base ecore project, select it
once and your all set.

Hope it helps
Eric.


Harry van Rijn wrote:

> In the EMF tutorial "Tutorial: Generating an Extended EMF Model"
> a second model Schoollibrary is created, which inherits from a previous
> made libray model. I can EMF class in a separate java project, but then
> I dont't understand how to go further. When I create a new EMF Project
> and say that my Schoollibrary's genmodel should inherit from the other,
> then I can generate code for it, but in a workbench it does not work.
> I can not create children for the schoollibrary.
> Can somebody give me some hints ?
Re: Generating extended EMF [message #390172 is a reply to message #390167] Fri, 24 December 2004 11:40 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Harry,

If you are using Omondo's class diagram to create your new derived
model, the first step should be getting all the models your new model
will use into the picture and then defining your new classes. I.e.,
your SchoolLibrary class should extend the real Library class that was
defined earlier, not some empty dummy version there of to be resolved later.


Harry van Rijn wrote:

> Hallo Ed,
>
> Yes, I can see something like you show in the picture.
> But I it is not clear to me.
> I created a java-project
> I added a package een.twee.drie to the src directory
> I created an EMF Class Diagram with Classes for library,
> authors and books. I added the relations too.
> I created an EMF project, and stated: load from EMF core model.
> This resulted in a picture like you show.
> I right clicked on the genmodel tree root and selected
> generate all.
> I run ... to a new workbench, set the run box in the common tab,
> and run it.
> I was able to add children like authors and books to the
> instance of the library model.
>
> Now we enter EXTENDING your EMF model
>
> So I started the same procedure as above, but now for
> Schoollibray.
> My confusion, or wondering starts with the fact, that
> I had to created a Class Schoollibrary that inherits
> from anothe Class, library. This library Class in my EMF
> Diagram, is empty, only an arrow ointing from the
> Schoollibrary Class to the library Class, indicates
> that inheritance was in the game. I thought, maybe the
> library Class here, is merely a placeholder in the EMF
> Diagram in order to formulate my idea about the dependency
> and that the actual link (inheritance) between the library
> Class and the Schoollibrary Class would be realized later,
> when generating the genmodel.
> So when creating an EMF project an saying that is will also
> load from an EMF core model, I had the opportunity to add
> a referenced generator model. I thought, this is the key,
> I go for library.genmodel.
> This resluted finally in a picture you show.
> But when I select generate all (on the root of the
> Schoollibrary.genmodel tree) I got books.java with a interface
> books extending EObject. From here the light turns off for me.
> When I generated all, and started a new workbench, I could also
> not edit my instance of the Schoollibrary.
>
> I know that is a lot I ask you, and maybe my problem is not
> directly EMF related, I would like you to guide me in mastering
> this stuff.
>
> Harry
>
>
>
> Ed Merks wrote:
>
>> Harry,
>>
>> When you look at the SchoolLibrary in the Generator, does it show
>> that it inherits from Library:
>>
>>
>>
>> Harry van Rijn wrote:
>>
>>> In the EMF tutorial "Tutorial: Generating an Extended EMF Model"
>>> a second model Schoollibrary is created, which inherits from a
>>> previous made libray model. I can EMF class in a separate java
>>> project, but then
>>> I dont't understand how to go further. When I create a new EMF
>>> Project and say that my Schoollibrary's genmodel should inherit from
>>> the other,
>>> then I can generate code for it, but in a workbench it does not work.
>>> I can not create children for the schoollibrary.
>>> Can somebody give me some hints ?
>>
>>
>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Generating extended EMF [message #390174 is a reply to message #390172] Fri, 24 December 2004 17:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: harry.raceeend.demon.nl

Hallo Ed,

> If you are using Omondo's class diagram to create your new derived
> model, the first step should be getting all the models your new model
> will use into the picture and then defining your new classes. I.e.,
> your SchoolLibrary class should extend the real Library class that was
> defined earlier, not some empty dummy version there of to be resolved
> later.
Do you want to say with 'into the picture' that all models should be
created in one and the same EMF Class model ? Then indeed I can inherit
from one class to another.
I'll will try that. Maybe this is the only possible way to use
Omonodo's tool for applying inheritance.

However untill now, I thought, that one could first assemble a set of
separate EMF model and use these in another (separate) model by merely
referring to them.
Re: Generating extended EMF [message #390175 is a reply to message #390174] Fri, 24 December 2004 18:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Harry,

You most certainly can create a model and then reuse it elsewhere later
as you would expect. That's what the tutorial demonstrates. But the
specifics of how to do this with Omondo are really questions for Omondo.


Harry van Rijn wrote:

> Hallo Ed,
>
>> If you are using Omondo's class diagram to create your new derived
>> model, the first step should be getting all the models your new model
>> will use into the picture and then defining your new classes. I.e.,
>> your SchoolLibrary class should extend the real Library class that
>> was defined earlier, not some empty dummy version there of to be
>> resolved later.
>
> Do you want to say with 'into the picture' that all models should be
> created in one and the same EMF Class model ? Then indeed I can inherit
> from one class to another.
> I'll will try that. Maybe this is the only possible way to use
> Omonodo's tool for applying inheritance.
>
> However untill now, I thought, that one could first assemble a set of
> separate EMF model and use these in another (separate) model by merely
> referring to them.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Generating extended EMF [message #390176 is a reply to message #390175] Fri, 24 December 2004 21:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: harry.raceeend.demon.nl

I used the Rational Rose library.mdl and schoollibrary.mdl
files from the eclipse/EMF site.
With these I could generate both library.genmodel as
schoollibrary.genmodel. After generating all, I could edit my
Schoollibary in a new workbench. So it works.
But I have no Rational Rose program, so I cannot play with the
models, that's why I tried to use EclipseUML for modeling. I
looks like EclipseUML supports inheritance...

Ed Merks wrote:
> Harry,
>
> You most certainly can create a model and then reuse it elsewhere later
> as you would expect. That's what the tutorial demonstrates. But the
> specifics of how to do this with Omondo are really questions for Omondo.
>
> Harry van Rijn wrote:
>
>> Hallo Ed,
>>
>>> If you are using Omondo's class diagram to create your new derived
>>> model, the first step should be getting all the models your new model
>>> will use into the picture and then defining your new classes. I.e.,
>>> your SchoolLibrary class should extend the real Library class that
>>> was defined earlier, not some empty dummy version there of to be
>>> resolved later.
>>
>>
>> Do you want to say with 'into the picture' that all models should be
>> created in one and the same EMF Class model ? Then indeed I can inherit
>> from one class to another.
>> I'll will try that. Maybe this is the only possible way to use
>> Omonodo's tool for applying inheritance.
>>
>> However untill now, I thought, that one could first assemble a set of
>> separate EMF model and use these in another (separate) model by merely
>> referring to them.
>
>
Generating extended EMF with EclipseUML [message #390180 is a reply to message #390176] Sun, 26 December 2004 23:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: harry.raceeend.demon.nl

Hi All,

I have figured out how to generate a EMF model that incorporates
inheritance. I.e. in another EMF model a class inherits from
a class present in another model.

NB On the Eclipse/EMF site Rational Rose *mdl file were used, to
illustrate the topic of extending an EMF model with another.
I wanted to create EMF models with the EclipseUML plugin, and
then combine these into another EMF model, also with eclipseUML.
If you are interested, here is the way how to do it.

Overview
First create some EMF models with the EclipseUML.
These first models should contain base classes.
Then create another EMF model in with classes that
inherite the base classes.
Generate your java code, and test it on properly working.

Details
Create an java project (i.e. base_project) with a src directory.
Add a package (what.ever.youlike.base or a.b.c.base).
Add a new EMF Class Diagram.
Define your base Classes (i.e. Vehicle) in the Diagram.
Add attributes (i.e. weight::EInt, Brand::EString) to the class.
Add class Passenger (with attribute weight::EFloat) to the diagram.
Make an association of 0..* Passengers between Vehicle and Passenger.
NB you need to create an assoicated class for your Vehicle class,
otherwise you cannot add children later, when testing.
Save All.

Create an EMF project (i.e. base) based on EMF ecore files.
Browse to the ecore file (base.ecore) from the previous step,
and select it. Select the base package, finish.
This results in base.genmodel (and a base.ecore duplicate).

Create another java project (i.e. derived_project) with a src directory.
Add a package (i.e. x.y.z.derived).
Add a new EMF Class Diagram, this appears in the derived.ecd file.
Define your derived Classes (i.e. Car) in the Diagram.
Add attributes to this class (i.e. owner::EString)
Now, open the derived.ecore file, you will get a resource pane.
Add the base.ecore resource to this resource pane (Right-Click
and browse)
Unfold the derived.resource and select Car class in it.
If not visible yet, activate Properties View (Main menu::
Window::Show View::Other::Properties)
In the properties pane of Car, select ESuper Types and Click on ...
(far right)
In the popup dialog, select Vehicle from the right panel and click add.
Cklick OK.
Now your Car Class inherits Vehicle. Your ecd and ecore files are
updated too. If you click on the Car Class Diagram in the derived.ecd
file) you'll see a black arrow.
Save All.

Create another EMF project (i.e. derived) based on EMF ecore files.
Browse to the ecore file (derived.ecore in the derived_project)
from the previous step, and select it.
Select only the derived package.
Click on browse, and navigate to base.genmodel, select it.
When Base package appears, select Base (the lower one) and click finish.
This results in derived.genmodel (and a derived.ecore duplicate).
Generate All

Select Run ..., new workbench (i.e. car_demo), select run in the common
tab, and run the whole.
An Eclipse workbench appears.
Create a New simple Project (i.e. car_test)
In the Example EMF Model Creation Wizard, select the Derived Model,
click next, select Car for Model Objects, click finish.

Now you can add Passengers to your Car etc.

You see that you have to manage 'a lot' of projects, only for editing
a car with its passengers. You have base_project, base (EMF project),
derived_project, derived (EMF project), car_demo (workbench) and
car_test (Test application). This seems overkill, but I am going to
appreciate it, because all phaes of your 'project' have a neatly
defined place. After months, it is still easy to follow what's going on.

Good luck.

It would be nice if this could be shown in a more real life project.
I played a bit with it, in fact I added the passengers class at the end,
as I saw that I finally got just 1 car to edit. So I edited the base.ecd
in the base_project, added the passenger class. Then I reloaded the
base.genmodel, Generate All, reloaded the derived.genmodel, Generated
All, and Run ... anew. Only the editing of the Passenger Class, the
reloadings and the Generate All, was nescessary. This took a few
minutes.

Harry van Rijn
Re: Generating extended EMF [message #878706 is a reply to message #390164] Tue, 29 May 2012 19:17 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing nameFriend
Messages: 8
Registered: February 2011
Junior Member
Hi,

I need something like that, but I need to show in my diagram editor all elements of extended model. For example:

I have a base model:
BuildingSpace(class)<--Floor(class)(extends BuildingSpace class)
<--Room(class)(extends BuildingSpace class)

I have security model (which inherits base model):
BuildingSpace(class)<--has-->Security(class)<--Camera(class)(extends Security class)
<--Sensor(class)(extends Security class)

I need to generate a diagram editor for security model which shows all classes of base model and security model and their references. But I'm only able to do one which shows (in palette and diagram panel) security model elements, it can not show Floor and Room classes.

But I can not generate it. Can anyone hepl me, please?

Thanks.

[Updated on: Tue, 29 May 2012 19:22]

Report message to a moderator

Re: Generating extended EMF [message #878865 is a reply to message #878706] Wed, 30 May 2012 05:01 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Diagram editors sound like a GMF question.

On 29/05/2012 9:17 PM, Missing name Mising name wrote:
> Hi,
>
> I need something like that, but I need to show in my diagram editor
> all elements of extended model. For example:
> I have a base model:
> BuildingSpace(class)<--Floor(class)
> <--Room(class)
>
> I have security model (which inherits base model):
> BuildingSpace(class)<--has-->Security(class)<--Camera(class)
> <--Sensor(class)
>
> I need to generate a diagram editor for security model which shows all
> classes of base model and security model and their references. But I'm
> only able to do one which shows (in palette and diagram panel)
> security model elements.
>
> But I can not generate it. Can anyone hepl me, please?
> Thanks.
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO] EOFException that can't be debugged
Next Topic:[CDO/Teneo/Hibernate] CDO import incomplete
Goto Forum:
  


Current Time: Thu Apr 18 18:14:16 GMT 2024

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

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

Back to the top