Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » GMT (Generative Modeling Technologies) » [EOL] uml first steps
[EOL] uml first steps [message #381208] Thu, 31 January 2008 14:40 Go to next message
Eclipse UserFriend
Originally posted by: firstname.name.gmail.com

Hey,

I would like to do my first steps with Eol and UML. I downloaded the
BuildOOInstance example, and try to adapt it for a uml usage.

Here is my Eol Program:
--8<----
var myModel:Model;
myModel := new Model;
myModel.name := 'I_Am_An_Happy_Uml_Model'
--8<----

then the launcher is,
- models:
Name:uml
and only the meta-model uri is given http:www.eclipse.org/uml2/2.1.0/UML
- common:
shared file is given

once launched, i get the following error
java.lang.StringIndexOutOfBoundsException: String index out of range: 0

any ideas.

--
F. Lagarde
Re: [Epsilon] uml first steps [message #381209 is a reply to message #381208] Thu, 31 January 2008 14:47 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi François,

Have you unchecked the "Meta-model is file-based" check box in the model
configuration dialog?

Cheers,
Dimitrios

François Lagarde wrote:
> Hey,
>
> I would like to do my first steps with Eol and UML. I downloaded the
> BuildOOInstance example, and try to adapt it for a uml usage.
>
> Here is my Eol Program:
> --8<----
> var myModel:Model;
> myModel := new Model;
> myModel.name := 'I_Am_An_Happy_Uml_Model'
> --8<----
>
> then the launcher is,
> - models:
> Name:uml
> and only the meta-model uri is given http:www.eclipse.org/uml2/2.1.0/UML
> - common:
> shared file is given
>
> once launched, i get the following error
> java.lang.StringIndexOutOfBoundsException: String index out of range: 0
>
> any ideas.
>
Re: [EOL] uml first steps [message #381210 is a reply to message #381208] Thu, 31 January 2008 14:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: firstname.name.gmail.com

In the last post, on 01/31 about 03h, "François" (François Lagarde) wrote:

François> Hey, I would like to do my first steps with Eol and UML. I
François> downloaded the BuildOOInstance example, and try to adapt it for
François> a uml usage.

ok, life is not so hard.

I forgot to two things:
- give the model file,
- uncheck the "read on load option"...

it works like a charm...

--
F. Lagarde
Re: [Epsilon] uml first steps [message #381211 is a reply to message #381209] Thu, 31 January 2008 15:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: firstname.name.gmail.com

In the last post, on 01/31 about 03h, "Dimitrios" (Dimitrios Kolovos) wrote:

Dimitrios> Hi François, Have you unchecked the "Meta-model is file-based"
Dimitrios> check box in the model configuration dialog?

yes thanks, everything works fine.

I got one question. Of course, as I want to use uml models, I want to use
profiles. How can I define extensions for stereotypes.

In a java world, I would have done something like that:

Model umlMetamodel = (Model) load(URI
.createURI(UML2Resource.UML2_METAMODEL_URI));
org.eclipse.uml2.Class metaclass = (org.eclipse.uml2.uml.Class) umlMetamodel
.getOwnedType(name);
myStereotype.createExtension(metaclass,false);

thanks.

--
F. Lagarde
Re: [Epsilon] uml first steps [message #381212 is a reply to message #381211] Thu, 31 January 2008 16:19 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi François,

You can access the UML2 metamodel by adding an "EMF Metamodel" named
UMLM2 to your launch configuration. Then you can access the EClass you
need using UMLM2!EClass.allInstances.selectOne(c|c.name=name). Finally
you can call the createExtension() method in the same way you call it
from Java.

Cheers,
Dimitrios

François Lagarde wrote:
> In the last post, on 01/31 about 03h, "Dimitrios" (Dimitrios Kolovos) wrote:
>
> Dimitrios> Hi François, Have you unchecked the "Meta-model is file-based"
> Dimitrios> check box in the model configuration dialog?
>
> yes thanks, everything works fine.
>
> I got one question. Of course, as I want to use uml models, I want to use
> profiles. How can I define extensions for stereotypes.
>
> In a java world, I would have done something like that:
>
> Model umlMetamodel = (Model) load(URI
> .createURI(UML2Resource.UML2_METAMODEL_URI));
> org.eclipse.uml2.Class metaclass = (org.eclipse.uml2.uml.Class) umlMetamodel
> .getOwnedType(name);
> myStereotype.createExtension(metaclass,false);
>
> thanks.
>
Re: [Epsilon] uml first steps [message #381214 is a reply to message #381212] Fri, 01 February 2008 08:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: firstname.name.gmail.com

In the last post, on 01/31 about 05h, "Dimitrios" (Dimitrios Kolovos) wrote:

Dimitrios> Hi François, You can access the UML2 metamodel by adding an
Dimitrios> "EMF Metamodel" named UMLM2 to your launch configuration [...]
Dimitrios> in the same way you call it from Java.

thanks for your prompt reply, but i am a little bit lost.

I added the EMF metamodel, which is an alias for uml metamodel uri. In the
launcher, I get one model named "out" which is the output profile file
(myProfile.uml) having for metamodel uml (uri).

Here is my "code":

profile.name := 'MyPorifle';
var stereotype := profile.createOwnedStereotype('myStereotype');
var elementImport := new ElementImport;
elementImport.importedElement := umlm2!EClass.allInstances().select(c | c.name='Class').at(0);

I get
java.lang.ClassCastException: org.eclipse.emf.ecore.impl.EClassImpl cannot be
cast to org.eclipse.uml2.uml.PackageableElement

It is expected since EClass is not a uml element...

I tried this:
stereotype.createExtension(uml!EClass.allInstances.select(c | c.name='Class').at(0),true)

but I get an error because createExtension can not be found. I think, instead of
this message error, that createExtension is found but not with a parameter
EClass..


--
F. Lagarde
Re: [Epsilon] uml first steps [message #381215 is a reply to message #381214] Fri, 01 February 2008 10:16 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi François,

That is correct. The runtime cannot find a createExtent() with the types
of arguments you've provided because the first argument should be a UML
class and not an EClass. I agree that the error message should be more
detailed though. Please feel free to open an enhancement request in the
bugzilla.

Since the UML2 profiles mechanism is quite complicated, I'd suggest
writing a minimal example that works using Java and then attempt to
rewrite it in EOL.

Cheers,
Dimitrios

François Lagarde wrote:
> In the last post, on 01/31 about 05h, "Dimitrios" (Dimitrios Kolovos) wrote:
>
> Dimitrios> Hi François, You can access the UML2 metamodel by adding an
> Dimitrios> "EMF Metamodel" named UMLM2 to your launch configuration [...]
> Dimitrios> in the same way you call it from Java.
>
> thanks for your prompt reply, but i am a little bit lost.
>
> I added the EMF metamodel, which is an alias for uml metamodel uri. In the
> launcher, I get one model named "out" which is the output profile file
> (myProfile.uml) having for metamodel uml (uri).
>
> Here is my "code":
>
> profile.name := 'MyPorifle';
> var stereotype := profile.createOwnedStereotype('myStereotype');
> var elementImport := new ElementImport;
> elementImport.importedElement := umlm2!EClass.allInstances().select(c | c.name='Class').at(0);
>
> I get
> java.lang.ClassCastException: org.eclipse.emf.ecore.impl.EClassImpl cannot be
> cast to org.eclipse.uml2.uml.PackageableElement
>
> It is expected since EClass is not a uml element...
>
> I tried this:
> stereotype.createExtension(uml!EClass.allInstances.select(c | c.name='Class').at(0),true)
>
> but I get an error because createExtension can not be found. I think, instead of
> this message error, that createExtension is found but not with a parameter
> EClass..
>
>
Re: [Epsilon] uml first steps [message #381216 is a reply to message #381215] Fri, 01 February 2008 12:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: firstname.name.gmail.com

In the last post, on 02/01 about 11h, "Dimitrios" (Dimitrios Kolovos) wrote:


Dimitrios> Since the UML2 profiles mechanism is quite complicated, I'd suggest
Dimitrios> writing a minimal example that works using Java and then attempt to
Dimitrios> rewrite it in EOL.

that's not really a good news.

One solution could be to load the uml model from the uml2 plugin source, which
is conformed to uml... Hence, i would be able to access to a "meta"class with
uml!Class.allinstances(c | c.name ='Class'). The result is a uml class.

But it is tricky. One of the main problem is to access to the uml metamodel. In the
tutorial[1], this done by:
Model umlLibrary = (Model) load(URI.createURI(UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_U RI));

the result is a UML Model element.


Reference(s):
[1] http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Intro duction_to_UML2_Profiles/article.html

--
F. Lagarde
Re: [Epsilon] uml first steps [message #381217 is a reply to message #381216] Fri, 01 February 2008 12:58 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi François,

I'm not saying that you cannot use EOL to do this; instead I'm saying
that (since I don't have much experience with UML2 profiles) a working
prototype in Java would help to specify exactly what you need to do so
that I can then help you write the same thing using EOL.

Cheers,
Dimitrios

François Lagarde wrote:
> In the last post, on 02/01 about 11h, "Dimitrios" (Dimitrios Kolovos) wrote:
>
>
> Dimitrios> Since the UML2 profiles mechanism is quite complicated, I'd suggest
> Dimitrios> writing a minimal example that works using Java and then attempt to
> Dimitrios> rewrite it in EOL.
>
> that's not really a good news.
>
> One solution could be to load the uml model from the uml2 plugin source, which
> is conformed to uml... Hence, i would be able to access to a "meta"class with
> uml!Class.allinstances(c | c.name ='Class'). The result is a uml class.
>
> But it is tricky. One of the main problem is to access to the uml metamodel. In the
> tutorial[1], this done by:
> Model umlLibrary = (Model) load(URI.createURI(UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_U RI));
>
> the result is a UML Model element.
>
>
> Reference(s):
> [1] http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Intro duction_to_UML2_Profiles/article.html
>
Re: [Epsilon] uml first steps [message #611187 is a reply to message #381208] Thu, 31 January 2008 14:47 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi François,

Have you unchecked the "Meta-model is file-based" check box in the model
configuration dialog?

Cheers,
Dimitrios

François Lagarde wrote:
> Hey,
>
> I would like to do my first steps with Eol and UML. I downloaded the
> BuildOOInstance example, and try to adapt it for a uml usage.
>
> Here is my Eol Program:
> --8<----
> var myModel:Model;
> myModel := new Model;
> myModel.name := 'I_Am_An_Happy_Uml_Model'
> --8<----
>
> then the launcher is,
> - models:
> Name:uml
> and only the meta-model uri is given http:www.eclipse.org/uml2/2.1.0/UML
> - common:
> shared file is given
>
> once launched, i get the following error
> java.lang.StringIndexOutOfBoundsException: String index out of range: 0
>
> any ideas.
>
Re: [EOL] uml first steps [message #611190 is a reply to message #381208] Thu, 31 January 2008 14:53 Go to previous message
Eclipse UserFriend
Originally posted by: firstname.name.gmail.com

In the last post, on 01/31 about 03h, "François" (François Lagarde) wrote:

François> Hey, I would like to do my first steps with Eol and UML. I
François> downloaded the BuildOOInstance example, and try to adapt it for
François> a uml usage.

ok, life is not so hard.

I forgot to two things:
- give the model file,
- uncheck the "read on load option"...

it works like a charm...

--
F. Lagarde
Re: [Epsilon] uml first steps [message #611192 is a reply to message #381209] Thu, 31 January 2008 15:22 Go to previous message
Eclipse UserFriend
Originally posted by: firstname.name.gmail.com

In the last post, on 01/31 about 03h, "Dimitrios" (Dimitrios Kolovos) wrote:

Dimitrios> Hi François, Have you unchecked the "Meta-model is file-based"
Dimitrios> check box in the model configuration dialog?

yes thanks, everything works fine.

I got one question. Of course, as I want to use uml models, I want to use
profiles. How can I define extensions for stereotypes.

In a java world, I would have done something like that:

Model umlMetamodel = (Model) load(URI
.createURI(UML2Resource.UML2_METAMODEL_URI));
org.eclipse.uml2.Class metaclass = (org.eclipse.uml2.uml.Class) umlMetamodel
.getOwnedType(name);
myStereotype.createExtension(metaclass,false);

thanks.

--
F. Lagarde
Re: [Epsilon] uml first steps [message #611193 is a reply to message #381211] Thu, 31 January 2008 16:19 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi François,

You can access the UML2 metamodel by adding an "EMF Metamodel" named
UMLM2 to your launch configuration. Then you can access the EClass you
need using UMLM2!EClass.allInstances.selectOne(c|c.name=name). Finally
you can call the createExtension() method in the same way you call it
from Java.

Cheers,
Dimitrios

François Lagarde wrote:
> In the last post, on 01/31 about 03h, "Dimitrios" (Dimitrios Kolovos) wrote:
>
> Dimitrios> Hi François, Have you unchecked the "Meta-model is file-based"
> Dimitrios> check box in the model configuration dialog?
>
> yes thanks, everything works fine.
>
> I got one question. Of course, as I want to use uml models, I want to use
> profiles. How can I define extensions for stereotypes.
>
> In a java world, I would have done something like that:
>
> Model umlMetamodel = (Model) load(URI
> .createURI(UML2Resource.UML2_METAMODEL_URI));
> org.eclipse.uml2.Class metaclass = (org.eclipse.uml2.uml.Class) umlMetamodel
> .getOwnedType(name);
> myStereotype.createExtension(metaclass,false);
>
> thanks.
>
Re: [Epsilon] uml first steps [message #613140 is a reply to message #381212] Fri, 01 February 2008 08:01 Go to previous message
Eclipse UserFriend
Originally posted by: firstname.name.gmail.com

In the last post, on 01/31 about 05h, "Dimitrios" (Dimitrios Kolovos) wrote:

Dimitrios> Hi François, You can access the UML2 metamodel by adding an
Dimitrios> "EMF Metamodel" named UMLM2 to your launch configuration [...]
Dimitrios> in the same way you call it from Java.

thanks for your prompt reply, but i am a little bit lost.

I added the EMF metamodel, which is an alias for uml metamodel uri. In the
launcher, I get one model named "out" which is the output profile file
(myProfile.uml) having for metamodel uml (uri).

Here is my "code":

profile.name := 'MyPorifle';
var stereotype := profile.createOwnedStereotype('myStereotype');
var elementImport := new ElementImport;
elementImport.importedElement := umlm2!EClass.allInstances().select(c | c.name='Class').at(0);

I get
java.lang.ClassCastException: org.eclipse.emf.ecore.impl.EClassImpl cannot be
cast to org.eclipse.uml2.uml.PackageableElement

It is expected since EClass is not a uml element...

I tried this:
stereotype.createExtension(uml!EClass.allInstances.select(c | c.name='Class').at(0),true)

but I get an error because createExtension can not be found. I think, instead of
this message error, that createExtension is found but not with a parameter
EClass..


--
F. Lagarde
Re: [Epsilon] uml first steps [message #613142 is a reply to message #381214] Fri, 01 February 2008 10:16 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi François,

That is correct. The runtime cannot find a createExtent() with the types
of arguments you've provided because the first argument should be a UML
class and not an EClass. I agree that the error message should be more
detailed though. Please feel free to open an enhancement request in the
bugzilla.

Since the UML2 profiles mechanism is quite complicated, I'd suggest
writing a minimal example that works using Java and then attempt to
rewrite it in EOL.

Cheers,
Dimitrios

François Lagarde wrote:
> In the last post, on 01/31 about 05h, "Dimitrios" (Dimitrios Kolovos) wrote:
>
> Dimitrios> Hi François, You can access the UML2 metamodel by adding an
> Dimitrios> "EMF Metamodel" named UMLM2 to your launch configuration [...]
> Dimitrios> in the same way you call it from Java.
>
> thanks for your prompt reply, but i am a little bit lost.
>
> I added the EMF metamodel, which is an alias for uml metamodel uri. In the
> launcher, I get one model named "out" which is the output profile file
> (myProfile.uml) having for metamodel uml (uri).
>
> Here is my "code":
>
> profile.name := 'MyPorifle';
> var stereotype := profile.createOwnedStereotype('myStereotype');
> var elementImport := new ElementImport;
> elementImport.importedElement := umlm2!EClass.allInstances().select(c | c.name='Class').at(0);
>
> I get
> java.lang.ClassCastException: org.eclipse.emf.ecore.impl.EClassImpl cannot be
> cast to org.eclipse.uml2.uml.PackageableElement
>
> It is expected since EClass is not a uml element...
>
> I tried this:
> stereotype.createExtension(uml!EClass.allInstances.select(c | c.name='Class').at(0),true)
>
> but I get an error because createExtension can not be found. I think, instead of
> this message error, that createExtension is found but not with a parameter
> EClass..
>
>
Re: [Epsilon] uml first steps [message #613143 is a reply to message #381215] Fri, 01 February 2008 12:46 Go to previous message
Eclipse UserFriend
Originally posted by: firstname.name.gmail.com

In the last post, on 02/01 about 11h, "Dimitrios" (Dimitrios Kolovos) wrote:


Dimitrios> Since the UML2 profiles mechanism is quite complicated, I'd suggest
Dimitrios> writing a minimal example that works using Java and then attempt to
Dimitrios> rewrite it in EOL.

that's not really a good news.

One solution could be to load the uml model from the uml2 plugin source, which
is conformed to uml... Hence, i would be able to access to a "meta"class with
uml!Class.allinstances(c | c.name ='Class'). The result is a uml class.

But it is tricky. One of the main problem is to access to the uml metamodel. In the
tutorial[1], this done by:
Model umlLibrary = (Model) load(URI.createURI(UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_U RI));

the result is a UML Model element.


Reference(s):
[1] http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Intro duction_to_UML2_Profiles/article.html

--
F. Lagarde
Re: [Epsilon] uml first steps [message #613144 is a reply to message #381216] Fri, 01 February 2008 12:58 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi François,

I'm not saying that you cannot use EOL to do this; instead I'm saying
that (since I don't have much experience with UML2 profiles) a working
prototype in Java would help to specify exactly what you need to do so
that I can then help you write the same thing using EOL.

Cheers,
Dimitrios

François Lagarde wrote:
> In the last post, on 02/01 about 11h, "Dimitrios" (Dimitrios Kolovos) wrote:
>
>
> Dimitrios> Since the UML2 profiles mechanism is quite complicated, I'd suggest
> Dimitrios> writing a minimal example that works using Java and then attempt to
> Dimitrios> rewrite it in EOL.
>
> that's not really a good news.
>
> One solution could be to load the uml model from the uml2 plugin source, which
> is conformed to uml... Hence, i would be able to access to a "meta"class with
> uml!Class.allinstances(c | c.name ='Class'). The result is a uml class.
>
> But it is tricky. One of the main problem is to access to the uml metamodel. In the
> tutorial[1], this done by:
> Model umlLibrary = (Model) load(URI.createURI(UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_U RI));
>
> the result is a UML Model element.
>
>
> Reference(s):
> [1] http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Intro duction_to_UML2_Profiles/article.html
>
Previous Topic:MOFScript errors
Next Topic:[Epsilon] Passing parameters to EGL templates
Goto Forum:
  


Current Time: Thu Mar 28 16:55:12 GMT 2024

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

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

Back to the top