Home » Archived » GMT (Generative Modeling Technologies) » [EOL] uml first steps
[EOL] uml first steps [message #381208] |
Thu, 31 January 2008 14:40 |
Eclipse User |
|
|
|
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: [EOL] uml first steps [message #381210 is a reply to message #381208] |
Thu, 31 January 2008 14:53 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Dimitrios Kolovos 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 |
Eclipse User |
|
|
|
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 |
Dimitrios Kolovos 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 |
Eclipse User |
|
|
|
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: [EOL] uml first steps [message #611190 is a reply to message #381208] |
Thu, 31 January 2008 14:53 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Dimitrios Kolovos 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 |
Eclipse User |
|
|
|
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 |
Dimitrios Kolovos 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 |
Eclipse User |
|
|
|
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
|
|
| |
Goto Forum:
Current Time: Thu Sep 26 10:01:47 GMT 2024
Powered by FUDForum. Page generated in 0.04467 seconds
|