Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » generate code from model
generate code from model [message #472917] Sun, 20 May 2007 23:50 Go to next message
charfi asma is currently offline charfi asmaFriend
Messages: 78
Registered: July 2009
Member
hi,

how could I generate code from file.uml that contain a model and profile.

thanks .
asma
Re: generate code from model [message #472918 is a reply to message #472917] Sun, 20 May 2007 15:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Asma,

As far as I know, the only provided way to generate code from a .uml
file is to import it into EMF's Ecore/GenModel and generate the code
from there. You'd use the same new EMF project wizard as documented in
EMF's tutorials but you'd choose UML as the source of your model. I'm
not sure your profile information would get converted to Ecore
EAnnotations though...


charfi asma wrote:
> hi,
>
> how could I generate code from file.uml that contain a model and profile.
>
> thanks .
> asma
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: generate code from model [message #472919 is a reply to message #472918] Mon, 21 May 2007 06:10 Go to previous messageGo to next message
charfi asma is currently offline charfi asmaFriend
Messages: 78
Registered: July 2009
Member
hi Merks,
thank you for your help but profile information did not be converted (It
generate only java classes representing classes in the model)
when I tried to generate code from the profile (I ignore all option before
loading the profile ) profile;genmodel is inaccessible
there was problems like:
there may not be features named visibility
there may not be features named isreadonly....

I will do it in reverse (I will create my profile in java code)
thank you
asma


"Ed Merks" <merks@ca.ibm.com> a
Re: generate code from model [message #472928 is a reply to message #472919] Tue, 22 May 2007 14:33 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Charfi,


Ed's previous response correctly points out how to generate code from your
model with profile.
Profiles add extra information to an existing model and (some of) that
information will be taken into account when converting your model.
Internally, the .uml model is converted to .ecore and then code is generated
from that.

If you want, you can generate code from your profile first and then generate
code for your model. You don't mention what your ultimate goal is but you
might want to consider static profile definition.

I'm not sure why you are seeing the errors regarding "visibility" and
"isreadonly" mentioned below.

Regards,

- James.




"charfi asma" <asma@charfi.com> wrote in message
news:f2qdfs$tda$1@build.eclipse.org...
> hi Merks,
> thank you for your help but profile information did not be converted (It
> generate only java classes representing classes in the model)
> when I tried to generate code from the profile (I ignore all option before
> loading the profile ) profile;genmodel is inaccessible
> there was problems like:
> there may not be features named visibility
> there may not be features named isreadonly....
>
> I will do it in reverse (I will create my profile in java code)
> thank you
> asma
>
>
> "Ed Merks" <merks@ca.ibm.com> a
Re: generate code from model [message #472984 is a reply to message #472928] Thu, 24 May 2007 17:39 Go to previous messageGo to next message
charfi asma is currently offline charfi asmaFriend
Messages: 78
Registered: July 2009
Member
Hi James,

thank you for you relpy!
I generated .ecore and .genmodel from my .profile.uml but I ignored this
warnings:
after choosing UML model to create my ecore and genmodel,I have to load my
profile file and here I got a warning msg:
"problems were encounterned processing the models" the details are:
--operation 'uml'::transition::isconsistentwith' should be annotated as
redefinition of operation 'uml::redefinedelement::isConsistentWith'(many
warning like this one)
--discard operation 'uml::Class::inherit' because it is a duplicate of
inherited operation 'uml::Classifier::inherit',(many warning like this one)
--feature 'uml::class ownedAttribute' should be annotated as redefinition of
feature 'uml:StructuredClassifier::OwnedAttribute'(many warning like this
one)

My ultimate goal is to use myprofile.editor.presentation.myprofileEditor to
reference my profile:
I want to add constraints to my profile (on steretypes and then extract them
inorder to parse and evaluate them)
so to extract them from profile( I think that I need)
myprofile.editor.presentation.myprofileEditor

Is this right?

thank you again
asma


"James Bruck" <jbruck@ca.ibm.com> a
Re: generate code from model [message #472992 is a reply to message #472984] Thu, 24 May 2007 14:29 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Charfi,

It sounds like your profile is not being specified properly. Can you either
list the steps you use to create your profile or provide a sample so I can
have a look. Are you following the steps outlined in the "getting started
with profiles" article?

When you say that you want to extract your constraints and parse them are
you using OCL? Some OCL integration support was added this past iteration.
It would seem more useful to dynamically evaluate the constraint once your
profile is applied to a model to ensure model integrity but you mention you
want to evaluate your constraint from the profile's generated editor is that
right?

Regards,

- James.


"charfi asma" <asma@charfi.com> wrote in message
news:f33j01$8o0$1@build.eclipse.org...
> Hi James,
>
> thank you for you relpy!
> I generated .ecore and .genmodel from my .profile.uml but I ignored this
> warnings:
> after choosing UML model to create my ecore and genmodel,I have to load my
> profile file and here I got a warning msg:
> "problems were encounterned processing the models" the details are:
> --operation 'uml'::transition::isconsistentwith' should be annotated as
> redefinition of operation 'uml::redefinedelement::isConsistentWith'(many
> warning like this one)
> --discard operation 'uml::Class::inherit' because it is a duplicate of
> inherited operation 'uml::Classifier::inherit',(many warning like this
one)
> --feature 'uml::class ownedAttribute' should be annotated as redefinition
of
> feature 'uml:StructuredClassifier::OwnedAttribute'(many warning like this
> one)
>
> My ultimate goal is to use myprofile.editor.presentation.myprofileEditor
to
> reference my profile:
> I want to add constraints to my profile (on steretypes and then extract
them
> inorder to parse and evaluate them)
> so to extract them from profile( I think that I need)
> myprofile.editor.presentation.myprofileEditor
>
> Is this right?
>
> thank you again
> asma
>
>
> "James Bruck" <jbruck@ca.ibm.com> a
Re: generate code from model [message #472994 is a reply to message #472992] Fri, 25 May 2007 06:48 Go to previous messageGo to next message
charfi asma is currently offline charfi asmaFriend
Messages: 78
Registered: July 2009
Member
Hi James,

yes I followed "the getting started with profile" article.
I create a simple profile with 2 stereotypes that reference metaclass Class.
one of them have a property and constraint (when I add property I use: new
child->owned attribute property cause I did not have attribute(as specified
in the article) in my list).

I want to extract constraints using OCL,and I will evaluate them on model.
I thought that I have to use the profile generator editor because I saw that
extracting constraints from "metamodels" are using metamodels generated
editor
also, I need a namespaseUri to specify the constraints using
constraintProvider from emf validation (this namespace is provided with
..ecore model)
that's why I thought that I need to generate code from profile.
I want to use emf validatin/ocl to verify constraints, because it works with
metamodels so it should works with profiles
I hope tha I can do it :)
thanks a lot.

"James Bruck" <jbruck@ca.ibm.com> a
Re: generate code from model [message #473005 is a reply to message #472994] Fri, 25 May 2007 20:06 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
asma,

Support for evaluating OCL constraints is currently only provided for static
profiles (i.e. in an EMF-generated implementation of the profile). Support
for evaluating stereotype constraints on elements to which the stereotypes
are applied is something that a tool based on UML2 would typically provide
(we can't support it in the UML editor because we don't want to introduce a
dependency on OCL)...

Kenn

"charfi asma" <asma@charfi.com> wrote in message
news:f35192$r6e$1@build.eclipse.org...
> Hi James,
>
> yes I followed "the getting started with profile" article.
> I create a simple profile with 2 stereotypes that reference metaclass
> Class.
> one of them have a property and constraint (when I add property I use: new
> child->owned attribute property cause I did not have attribute(as
> specified in the article) in my list).
>
> I want to extract constraints using OCL,and I will evaluate them on model.
> I thought that I have to use the profile generator editor because I saw
> that extracting constraints from "metamodels" are using metamodels
> generated editor
> also, I need a namespaseUri to specify the constraints using
> constraintProvider from emf validation (this namespace is provided with
> .ecore model)
> that's why I thought that I need to generate code from profile.
> I want to use emf validatin/ocl to verify constraints, because it works
> with metamodels so it should works with profiles
> I hope tha I can do it :)
> thanks a lot.
>
> "James Bruck" <jbruck@ca.ibm.com> a
Re: generate code from model [message #473010 is a reply to message #473005] Sun, 27 May 2007 01:55 Go to previous messageGo to next message
charfi asma is currently offline charfi asmaFriend
Messages: 78
Registered: July 2009
Member
Hi kenn,
I did not understand what static profile is ?
which tool (based on UML2 ) would typically provide evaluating constraints
added to a profile?
what do I want to make is feasible or not? (plugin for evaluating stereotype
constraints on elements to which the stereotypes are applied )
thank you

asma

"Kenn Hussey" <khussey@ca.ibm.com> a
Re: generate code from model [message #473015 is a reply to message #473010] Mon, 28 May 2007 13:26 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
asma,

Sorry, static profiles are profile for which EMF has been used to generate
code (i.e. a static implementation). Support for static profiles was
introduced in this release of UML2, and allows implementation of derived
stereotype properties and streotype constraints, among other things.

I wasn't referring to a specific tool, but to the notion that support for
evaluating stereotype constraints using an OCL engine (like the one provided
by the OCL component of MDT) needs to be provided by a component/application
that has dependencies on UML2 and OCL... perhaps even the UML2 Tools
component of MDT can/will provide this kind of capability.

Kenn

"charfi asma" <asma@charfi.com> wrote in message
news:f39oq5$6v4$1@build.eclipse.org...
> Hi kenn,
> I did not understand what static profile is ?
> which tool (based on UML2 ) would typically provide evaluating constraints
> added to a profile?
> what do I want to make is feasible or not? (plugin for evaluating
> stereotype constraints on elements to which the stereotypes are applied )
> thank you
>
> asma
>
> "Kenn Hussey" <khussey@ca.ibm.com> a
Re: generate code from model [message #617165 is a reply to message #472917] Sun, 20 May 2007 15:12 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Asma,

As far as I know, the only provided way to generate code from a .uml
file is to import it into EMF's Ecore/GenModel and generate the code
from there. You'd use the same new EMF project wizard as documented in
EMF's tutorials but you'd choose UML as the source of your model. I'm
not sure your profile information would get converted to Ecore
EAnnotations though...


charfi asma wrote:
> hi,
>
> how could I generate code from file.uml that contain a model and profile.
>
> thanks .
> asma
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: generate code from model [message #617166 is a reply to message #472918] Mon, 21 May 2007 06:10 Go to previous message
charfi asma is currently offline charfi asmaFriend
Messages: 78
Registered: July 2009
Member
hi Merks,
thank you for your help but profile information did not be converted (It
generate only java classes representing classes in the model)
when I tried to generate code from the profile (I ignore all option before
loading the profile ) profile;genmodel is inaccessible
there was problems like:
there may not be features named visibility
there may not be features named isreadonly....

I will do it in reverse (I will create my profile in java code)
thank you
asma


"Ed Merks" <merks@ca.ibm.com> a
Re: generate code from model [message #617175 is a reply to message #472919] Tue, 22 May 2007 14:33 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Charfi,


Ed's previous response correctly points out how to generate code from your
model with profile.
Profiles add extra information to an existing model and (some of) that
information will be taken into account when converting your model.
Internally, the .uml model is converted to .ecore and then code is generated
from that.

If you want, you can generate code from your profile first and then generate
code for your model. You don't mention what your ultimate goal is but you
might want to consider static profile definition.

I'm not sure why you are seeing the errors regarding "visibility" and
"isreadonly" mentioned below.

Regards,

- James.




"charfi asma" <asma@charfi.com> wrote in message
news:f2qdfs$tda$1@build.eclipse.org...
> hi Merks,
> thank you for your help but profile information did not be converted (It
> generate only java classes representing classes in the model)
> when I tried to generate code from the profile (I ignore all option before
> loading the profile ) profile;genmodel is inaccessible
> there was problems like:
> there may not be features named visibility
> there may not be features named isreadonly....
>
> I will do it in reverse (I will create my profile in java code)
> thank you
> asma
>
>
> "Ed Merks" <merks@ca.ibm.com> a
Re: generate code from model [message #617543 is a reply to message #472928] Thu, 24 May 2007 17:39 Go to previous message
charfi asma is currently offline charfi asmaFriend
Messages: 78
Registered: July 2009
Member
Hi James,

thank you for you relpy!
I generated .ecore and .genmodel from my .profile.uml but I ignored this
warnings:
after choosing UML model to create my ecore and genmodel,I have to load my
profile file and here I got a warning msg:
"problems were encounterned processing the models" the details are:
--operation 'uml'::transition::isconsistentwith' should be annotated as
redefinition of operation 'uml::redefinedelement::isConsistentWith'(many
warning like this one)
--discard operation 'uml::Class::inherit' because it is a duplicate of
inherited operation 'uml::Classifier::inherit',(many warning like this one)
--feature 'uml::class ownedAttribute' should be annotated as redefinition of
feature 'uml:StructuredClassifier::OwnedAttribute'(many warning like this
one)

My ultimate goal is to use myprofile.editor.presentation.myprofileEditor to
reference my profile:
I want to add constraints to my profile (on steretypes and then extract them
inorder to parse and evaluate them)
so to extract them from profile( I think that I need)
myprofile.editor.presentation.myprofileEditor

Is this right?

thank you again
asma


"James Bruck" <jbruck@ca.ibm.com> a
Re: generate code from model [message #617570 is a reply to message #472984] Thu, 24 May 2007 14:29 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Charfi,

It sounds like your profile is not being specified properly. Can you either
list the steps you use to create your profile or provide a sample so I can
have a look. Are you following the steps outlined in the "getting started
with profiles" article?

When you say that you want to extract your constraints and parse them are
you using OCL? Some OCL integration support was added this past iteration.
It would seem more useful to dynamically evaluate the constraint once your
profile is applied to a model to ensure model integrity but you mention you
want to evaluate your constraint from the profile's generated editor is that
right?

Regards,

- James.


"charfi asma" <asma@charfi.com> wrote in message
news:f33j01$8o0$1@build.eclipse.org...
> Hi James,
>
> thank you for you relpy!
> I generated .ecore and .genmodel from my .profile.uml but I ignored this
> warnings:
> after choosing UML model to create my ecore and genmodel,I have to load my
> profile file and here I got a warning msg:
> "problems were encounterned processing the models" the details are:
> --operation 'uml'::transition::isconsistentwith' should be annotated as
> redefinition of operation 'uml::redefinedelement::isConsistentWith'(many
> warning like this one)
> --discard operation 'uml::Class::inherit' because it is a duplicate of
> inherited operation 'uml::Classifier::inherit',(many warning like this
one)
> --feature 'uml::class ownedAttribute' should be annotated as redefinition
of
> feature 'uml:StructuredClassifier::OwnedAttribute'(many warning like this
> one)
>
> My ultimate goal is to use myprofile.editor.presentation.myprofileEditor
to
> reference my profile:
> I want to add constraints to my profile (on steretypes and then extract
them
> inorder to parse and evaluate them)
> so to extract them from profile( I think that I need)
> myprofile.editor.presentation.myprofileEditor
>
> Is this right?
>
> thank you again
> asma
>
>
> "James Bruck" <jbruck@ca.ibm.com> a
Re: generate code from model [message #617578 is a reply to message #472992] Fri, 25 May 2007 06:48 Go to previous message
charfi asma is currently offline charfi asmaFriend
Messages: 78
Registered: July 2009
Member
Hi James,

yes I followed "the getting started with profile" article.
I create a simple profile with 2 stereotypes that reference metaclass Class.
one of them have a property and constraint (when I add property I use: new
child->owned attribute property cause I did not have attribute(as specified
in the article) in my list).

I want to extract constraints using OCL,and I will evaluate them on model.
I thought that I have to use the profile generator editor because I saw that
extracting constraints from "metamodels" are using metamodels generated
editor
also, I need a namespaseUri to specify the constraints using
constraintProvider from emf validation (this namespace is provided with
..ecore model)
that's why I thought that I need to generate code from profile.
I want to use emf validatin/ocl to verify constraints, because it works with
metamodels so it should works with profiles
I hope tha I can do it :)
thanks a lot.

"James Bruck" <jbruck@ca.ibm.com> a
Re: generate code from model [message #618137 is a reply to message #472994] Fri, 25 May 2007 20:06 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
asma,

Support for evaluating OCL constraints is currently only provided for static
profiles (i.e. in an EMF-generated implementation of the profile). Support
for evaluating stereotype constraints on elements to which the stereotypes
are applied is something that a tool based on UML2 would typically provide
(we can't support it in the UML editor because we don't want to introduce a
dependency on OCL)...

Kenn

"charfi asma" <asma@charfi.com> wrote in message
news:f35192$r6e$1@build.eclipse.org...
> Hi James,
>
> yes I followed "the getting started with profile" article.
> I create a simple profile with 2 stereotypes that reference metaclass
> Class.
> one of them have a property and constraint (when I add property I use: new
> child->owned attribute property cause I did not have attribute(as
> specified in the article) in my list).
>
> I want to extract constraints using OCL,and I will evaluate them on model.
> I thought that I have to use the profile generator editor because I saw
> that extracting constraints from "metamodels" are using metamodels
> generated editor
> also, I need a namespaseUri to specify the constraints using
> constraintProvider from emf validation (this namespace is provided with
> .ecore model)
> that's why I thought that I need to generate code from profile.
> I want to use emf validatin/ocl to verify constraints, because it works
> with metamodels so it should works with profiles
> I hope tha I can do it :)
> thanks a lot.
>
> "James Bruck" <jbruck@ca.ibm.com> a
Re: generate code from model [message #618148 is a reply to message #473005] Sun, 27 May 2007 01:55 Go to previous message
charfi asma is currently offline charfi asmaFriend
Messages: 78
Registered: July 2009
Member
Hi kenn,
I did not understand what static profile is ?
which tool (based on UML2 ) would typically provide evaluating constraints
added to a profile?
what do I want to make is feasible or not? (plugin for evaluating stereotype
constraints on elements to which the stereotypes are applied )
thank you

asma

"Kenn Hussey" <khussey@ca.ibm.com> a
Re: generate code from model [message #618157 is a reply to message #473010] Mon, 28 May 2007 13:26 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
asma,

Sorry, static profiles are profile for which EMF has been used to generate
code (i.e. a static implementation). Support for static profiles was
introduced in this release of UML2, and allows implementation of derived
stereotype properties and streotype constraints, among other things.

I wasn't referring to a specific tool, but to the notion that support for
evaluating stereotype constraints using an OCL engine (like the one provided
by the OCL component of MDT) needs to be provided by a component/application
that has dependencies on UML2 and OCL... perhaps even the UML2 Tools
component of MDT can/will provide this kind of capability.

Kenn

"charfi asma" <asma@charfi.com> wrote in message
news:f39oq5$6v4$1@build.eclipse.org...
> Hi kenn,
> I did not understand what static profile is ?
> which tool (based on UML2 ) would typically provide evaluating constraints
> added to a profile?
> what do I want to make is feasible or not? (plugin for evaluating
> stereotype constraints on elements to which the stereotypes are applied )
> thank you
>
> asma
>
> "Kenn Hussey" <khussey@ca.ibm.com> a
Previous Topic:Sequence Diagram - return value on message
Next Topic:UML naming rules for named elements
Goto Forum:
  


Current Time: Thu Apr 25 19:10:18 GMT 2024

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

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

Back to the top