Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Re: Constraints in Ecore for GMF
Re: Constraints in Ecore for GMF [message #2529] Wed, 02 August 2006 13:03 Go to next message
Radomil Dvorak is currently offline Radomil DvorakFriend
Messages: 249
Registered: July 2009
Senior Member
Hi Madanagopal,

All your Ecore level constraints will get involved by GMF Diagram\Validate
action if you enable it
in gmfgen.

With GMF audit rules you can define constraints involving additonal aspects
for your domain model
from the diagraming perspective. For instance, best practices and modeling
styles you would like to promote and
which may be violated while your domain model is still valid.
Moreover, you can define constraints for the diagram notation model to guard
also some visual aspects.
As disscused earlier in gmf newsgroup, all audits map to EMFT Validation
constraint definitions.

If you wish, keep all your constraints as basic EMF constraints and GMF
editor can contribute with additional UI services.
Alternatively, use EMFT Validation framework to get cool OCL support and UI
for constraint registry management.
Both mentioned above will be active in GMF generated diagram editors if
enabled in gmfgen.

What you are trying to do is definition of an OCL like constraint as a basic
EMF constraint which is not going to work.
Perhaps, you could try to initially model your constraints as GMF audits as
you can segregate them in a separate validation
plugin later on. Just by copying the editor's plugin.xml fragment defining
EMFT constraintProvider extension points.

This way you can focus on the constraint logic itself while getting all the
EMFT extension point plumbing for free and having in-place rule
validation within the context of the target domain elements (in *.gmfmap).
This should ensure that EMFT Validation registrations will be OK
and after getting some expertise you can stick to EMFT Validation framework
only.

I hope to have clarified this matter a bit to help you decide on the right
approach to use.
As for a tutorial, GMF existing tutorials already demonstrate audits
functionality.
Look at the GMF ecore diagram editor, try to enable validation in gmfgen and
re-generate. You will see how Ecore level
constraints are integrated.

PS: eclipse.modeling.gmf newsgroup created. Use it instead of
eclipse.technology.gmf

Regards,
/Radek


"Madanagopal" <madanagopal@gmail.com> wrote in message
news:op.tdnisxn66tuwl9@centrino.sts.tu-harburg.de...
Hello,

With reference to some previous posts
https://bugs.eclipse.org/bugs/show_bug.cgi?id=143580
i am currently trying to have constraints implemented at the Ecore level.

Moreover my requirement is to validate a class Firm with an attribute
"name" with constraint "self.name.size() > 0".

I have another possibility to implement this. Define an Audit Rule for
this constraint and then Enable the Validation Options in .gmfgen by
setting

Diagram -> Validation Decorators to "true"
Diagram -> Valdation Enabled to "true"
Providers -> Validation Provider Priority to "Medium".

This will generate diagram plugin which would have options Diagram->
Validate to validate my Model.

Now having constraints at Ecore level, what are the benifits that i get
when i use them for GMF, since I have to deal with lots of Constraints in
Design Level while writing Ecore and some in gmfmap.

Should i still have to make any changes while generating GMF Diagram
Editors with having Constraints in Ecore Level.

Please Post in your Comments.
An Example or a tutorial on this topic would be really helpful.

Madanagopal.

Attachments :
1. Ecore Snapshot
2. Ecore File
Re: Constraints in Ecore for GMF [message #8183 is a reply to message #2529] Mon, 07 August 2006 08:21 Go to previous messageGo to next message
Madanagopal is currently offline MadanagopalFriend
Messages: 39
Registered: July 2009
Member
------------Dxp1ychupkmzzh1l7h5Jua
Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15
Content-Transfer-Encoding: Quoted-Printable

Hello,

Thank you Radek for your long mail. Before you can point me further; all=
ow =

me to tell you wat i probable wish to do with Ecore Constraints.

Generally, GMF Audits and Link Mapping are the way to enforce OCL =

Constraints. I am interested to have OCL Constraints in Ecore level itse=
lf =

so that my model can be validated at this level and further i can =

implement the Constraints with Link Mapping.

What made me think this is possible:?
1. Since EMF has the inbuilt support for GMF and EMF Ecore editor can =

take OCL constraint as annotations with reference to =

http://www.eclipse.org/articles/Article-FromFrontendToCode-M DSDInPractic=
e/article.html.
2. And with the generated <package>Validator.java that contains the OCL=
=

Annotations, Can this be referenced to the gmfgen for model validation.
3. The above referenced link has got templates which help in generating=
=

the validation code for our model.

An example with the Constraints at Ecore level for GMF would be really =

helpful. Please post in your suggestions.

Please find my ecore file attached with this mail.

Regards,
Madanagopal



On Wed, 02 Aug 2006 15:03:14 +0200, Radek Dvorak =

<radek.dvorak@borland.com> wrote:

> Hi Madanagopal,
>
> All your Ecore level constraints will get involved by GMF =

> Diagram\Validate
> action if you enable it
> in gmfgen.
>
> With GMF audit rules you can define constraints involving additonal =

> aspects
> for your domain model
> from the diagraming perspective. For instance, best practices and =

> modeling
> styles you would like to promote and
> which may be violated while your domain model is still valid.
> Moreover, you can define constraints for the diagram notation model to=
=

> guard
> also some visual aspects.
> As disscused earlier in gmf newsgroup, all audits map to EMFT Validati=
on
> constraint definitions.
>
> If you wish, keep all your constraints as basic EMF constraints and GM=
F
> editor can contribute with additional UI services.
> Alternatively, use EMFT Validation framework to get cool OCL support a=
nd =

> UI
> for constraint registry management.
> Both mentioned above will be active in GMF generated diagram editors i=
f
> enabled in gmfgen.
>
> What you are trying to do is definition of an OCL like constraint as a=
=

> basic
> EMF constraint which is not going to work.
> Perhaps, you could try to initially model your constraints as GMF audi=
ts =

> as
> you can segregate them in a separate validation
> plugin later on. Just by copying the editor's plugin.xml fragment =

> defining
> EMFT constraintProvider extension points.
>
> This way you can focus on the constraint logic itself while getting al=
l =

> the
> EMFT extension point plumbing for free and having in-place rule
> validation within the context of the target domain elements (in =

> *.gmfmap).
> This should ensure that EMFT Validation registrations will be OK
> and after getting some expertise you can stick to EMFT Validation =

> framework
> only.
>
> I hope to have clarified this matter a bit to help you decide on the =

> right
> approach to use.
> As for a tutorial, GMF existing tutorials already demonstrate audits
> functionality.
> Look at the GMF ecore diagram editor, try to enable validation in gmfg=
en =

> and
> re-generate. You will see how Ecore level
> constraints are integrated.
>
> PS: eclipse.modeling.gmf newsgroup created. Use it instead of
> eclipse.technology.gmf
>
> Regards,
> /Radek
>
>
> "Madanagopal" <madanagopal@gmail.com> wrote in message
> news:op.tdnisxn66tuwl9@centrino.sts.tu-harburg.de...
> Hello,
>
> With reference to some previous posts
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=3D143580
> i am currently trying to have constraints implemented at the Ecore lev=
el.
>
> Moreover my requirement is to validate a class Firm with an attribute
> "name" with constraint "self.name.size() > 0".
>
> I have another possibility to implement this. Define an Audit Rule for=

> this constraint and then Enable the Validation Options in .gmfgen by
> setting
>
> Diagram -> Validation Decorators to "true"
> Diagram -> Valdation Enabled to "true"
> Providers -> Validation Provider Priority to "Medium".
>
> This will generate diagram plugin which would have options Diagram->
> Validate to validate my Model.
>
> Now having constraints at Ecore level, what are the benifits that i ge=
t
> when i use them for GMF, since I have to deal with lots of Constraints=
in
> Design Level while writing Ecore and some in gmfmap.
>
> Should i still have to make any changes while generating GMF Diagram
> Editors with having Constraints in Ecore Level.
>
> Please Post in your Comments.
> An Example or a tutorial on this topic would be really helpful.
>
> Madanagopal.
>
> Attachments :
> 1. Ecore Snapshot
> 2. Ecore File
>
>


------------Dxp1ychupkmzzh1l7h5Jua
Content-Disposition: attachment; filename=Employee.ecore
Content-Type: application/octet-stream; name=Employee.ecore
Content-Transfer-Encoding: Base64

PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxlY29y ZTpF
UGFja2FnZSB4bWk6dmVyc2lvbj0iMi4wIg0KICAgIHhtbG5zOnhtaT0iaHR0 cDov
L3d3dy5vbWcub3JnL1hNSSIgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9y Zy8y
MDAxL1hNTFNjaGVtYS1pbnN0YW5jZSINCiAgICB4bWxuczplY29yZT0iaHR0 cDov
L3d3dy5lY2xpcHNlLm9yZy9lbWYvMjAwMi9FY29yZSIgbmFtZT0iZW1wbG95 ZWUi
DQogICAgbnNVUkk9Imh0dHA6Ly93d3cuZWNsaXBzZS5vcmcvT0NML2V4YW1w bGVz
L2NvZGVnZW4vZW1wbG95ZWUiIG5zUHJlZml4PSJlbXAiPg0KICA8ZUNsYXNz aWZp
ZXJzIHhzaTp0eXBlPSJlY29yZTpFQ2xhc3MiIG5hbWU9IkNvbXBhbnkiPg0K ICAg
IDxlU3RydWN0dXJhbEZlYXR1cmVzIHhzaTp0eXBlPSJlY29yZTpFQXR0cmli dXRl
IiBuYW1lPSJuYW1lIiBlVHlwZT0iZWNvcmU6RURhdGFUeXBlIGh0dHA6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Ig0KICAgICAgICBlT3Bwb3NpdGU9IiMvL0Nv bXBh
bnkvZW1wbG95ZWVzIi8+DQogIDwvZUNsYXNzaWZpZXJzPg0KPC9lY29yZTpF UGFj
a2FnZT4NCg==

------------Dxp1ychupkmzzh1l7h5Jua--
Re: Constraints in Ecore for GMF [message #8481 is a reply to message #8183] Tue, 08 August 2006 00:37 Go to previous message
Radomil Dvorak is currently offline Radomil DvorakFriend
Messages: 249
Registered: July 2009
Senior Member
Hi Madanagopal,

1. I am not aware of any EMF in-built support for GMF. I also have not found
anything about OCL constraint annotations at the link you have mentioned.
If you take a closer look at the constraint implementation there, it
registers EMFT constraint implemented in Java which delegates the constraint
evaluation to oAW's check system.
It is just an example of integrating EMFT constraint definition into GMF
generated editor.

2. Actually, I think you intended to specify
http://www.eclipse.org/articles/Article-EMF-Codegen-with-OCL /article.html
link instead.
I am not sure I understand what you mean by 'referenced to the gmfgen for
model validation'.
There is no reason for anything like this as in case that EMF code generator
creates and registers an EValidator for a model package it is
automatically involved in GMF diagram validation (using
emf.ecore.util.Diagnostician) if gmfgen enables it.

3. To my understanding, the article illustrates an example of how to inject
OCL constraint check into EMF validation mechanism.
Why not just take it and reuse it in your application? Your generated
EValidator with this approach will arrive to GMF as well.
I am not convinced that GMF itself should hook custom templates into EMF
model code generation.

If your understanding of constraints defined at ecore level is only an OCL
annotation contained in metamodel ecore file,
I would advice you to post a proposal to 'eclipse.technology.emft'
newsgroup. I strongly believe it is EMFT job
and if EMFT Validation framework supports this, it will definitely be used
in GMF.

As for the GMF example, see
http://wiki.eclipse.org/index.php/GMF_Tutorial_Part_2#Valida tion.
It just defines an audit targeted to domain metamodel.

Regards,
/Radek

"Madanagopal" <madanagopal@gmail.com> wrote in message
news:op.tdwmueic6tuwl9@centrino.sts.tu-harburg.de...
Hello,

Thank you Radek for your long mail. Before you can point me further; allow
me to tell you wat i probable wish to do with Ecore Constraints.

Generally, GMF Audits and Link Mapping are the way to enforce OCL
Constraints. I am interested to have OCL Constraints in Ecore level itself
so that my model can be validated at this level and further i can
implement the Constraints with Link Mapping.

What made me think this is possible:?
1. Since EMF has the inbuilt support for GMF and EMF Ecore editor can
take OCL constraint as annotations with reference to
http://www.eclipse.org/articles/Article-FromFrontendToCode-M DSDInPractice/article.html.
2. And with the generated <package>Validator.java that contains the OCL
Annotations, Can this be referenced to the gmfgen for model validation.
3. The above referenced link has got templates which help in generating
the validation code for our model.

An example with the Constraints at Ecore level for GMF would be really
helpful. Please post in your suggestions.

Please find my ecore file attached with this mail.

Regards,
Madanagopal



On Wed, 02 Aug 2006 15:03:14 +0200, Radek Dvorak
<radek.dvorak@borland.com> wrote:

> Hi Madanagopal,
>
> All your Ecore level constraints will get involved by GMF
> Diagram\Validate
> action if you enable it
> in gmfgen.
>
> With GMF audit rules you can define constraints involving additonal
> aspects
> for your domain model
> from the diagraming perspective. For instance, best practices and
> modeling
> styles you would like to promote and
> which may be violated while your domain model is still valid.
> Moreover, you can define constraints for the diagram notation model to
> guard
> also some visual aspects.
> As disscused earlier in gmf newsgroup, all audits map to EMFT Validation
> constraint definitions.
>
> If you wish, keep all your constraints as basic EMF constraints and GMF
> editor can contribute with additional UI services.
> Alternatively, use EMFT Validation framework to get cool OCL support and
> UI
> for constraint registry management.
> Both mentioned above will be active in GMF generated diagram editors if
> enabled in gmfgen.
>
> What you are trying to do is definition of an OCL like constraint as a
> basic
> EMF constraint which is not going to work.
> Perhaps, you could try to initially model your constraints as GMF audits
> as
> you can segregate them in a separate validation
> plugin later on. Just by copying the editor's plugin.xml fragment
> defining
> EMFT constraintProvider extension points.
>
> This way you can focus on the constraint logic itself while getting all
> the
> EMFT extension point plumbing for free and having in-place rule
> validation within the context of the target domain elements (in
> *.gmfmap).
> This should ensure that EMFT Validation registrations will be OK
> and after getting some expertise you can stick to EMFT Validation
> framework
> only.
>
> I hope to have clarified this matter a bit to help you decide on the
> right
> approach to use.
> As for a tutorial, GMF existing tutorials already demonstrate audits
> functionality.
> Look at the GMF ecore diagram editor, try to enable validation in gmfgen
> and
> re-generate. You will see how Ecore level
> constraints are integrated.
>
> PS: eclipse.modeling.gmf newsgroup created. Use it instead of
> eclipse.technology.gmf
>
> Regards,
> /Radek
>
>
> "Madanagopal" <madanagopal@gmail.com> wrote in message
> news:op.tdnisxn66tuwl9@centrino.sts.tu-harburg.de...
> Hello,
>
> With reference to some previous posts
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=143580
> i am currently trying to have constraints implemented at the Ecore level.
>
> Moreover my requirement is to validate a class Firm with an attribute
> "name" with constraint "self.name.size() > 0".
>
> I have another possibility to implement this. Define an Audit Rule for
> this constraint and then Enable the Validation Options in .gmfgen by
> setting
>
> Diagram -> Validation Decorators to "true"
> Diagram -> Valdation Enabled to "true"
> Providers -> Validation Provider Priority to "Medium".
>
> This will generate diagram plugin which would have options Diagram->
> Validate to validate my Model.
>
> Now having constraints at Ecore level, what are the benifits that i get
> when i use them for GMF, since I have to deal with lots of Constraints in
> Design Level while writing Ecore and some in gmfmap.
>
> Should i still have to make any changes while generating GMF Diagram
> Editors with having Constraints in Ecore Level.
>
> Please Post in your Comments.
> An Example or a tutorial on this topic would be really helpful.
>
> Madanagopal.
>
> Attachments :
> 1. Ecore Snapshot
> 2. Ecore File
>
>
Previous Topic:GMF -> load diagram
Next Topic:Format Conversion problem with External labels
Goto Forum:
  


Current Time: Mon Dec 30 16:31:47 GMT 2024

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

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

Back to the top