Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Where are the constraints???
Where are the constraints??? [message #41359] Fri, 19 October 2007 08:23 Go to next message
Eclipse UserFriend
Originally posted by: marco.pantel.unibw.de

Hello everybody!

I tried the OCL library example with ocl 1.1 but I can't find any
OCL-constraint in the ecore-file. Where do they reside? :)

Regards,
M. Pantel
Re: Where are the constraints??? [message #41390 is a reply to message #41359] Fri, 19 October 2007 13:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Marco,

What do you mean by the OCL library example? What is the plug-in ID?

None of the SDK examples in the EMF Validation or MDT OCL components have
constraints in Ecore files. EMF doesn't (yet) support the definition of
OCL constraints in Ecore models. See
https://bugs.eclipse.org/bugs/show_bug.cgi?id=191689 for details.

Cheers,

Christian


Marco Pantel wrote:

> Hello everybody!
>
> I tried the OCL library example with ocl 1.1 but I can't find any
> OCL-constraint in the ecore-file. Where do they reside? :)
>
> Regards,
> M. Pantel
Re: Where are the constraints??? [message #41421 is a reply to message #41390] Fri, 19 October 2007 21:11 Go to previous messageGo to next message
Steffen Mazanek is currently offline Steffen MazanekFriend
Messages: 40
Registered: July 2009
Member
Christian, please correct me If I am wrong.

To add constraints to an EMF metamodel presently one has to
follow the steps in this tutorial:

http://www.eclipse.org/articles/article.php?file=Article-EMF -Codegen-with-OCL/index.html

Basically one has to add the OCL constraints as EAnnotations
and include particular additional templates for code generation.

Thereafter these constraints are automatically checked when a
particular instance model is validated.

Or is there an easier way to include OCL checking in the
model validation process?


Christian W. Damus schrieb:
> Hi, Marco,
>
> What do you mean by the OCL library example? What is the plug-in ID?
>
> None of the SDK examples in the EMF Validation or MDT OCL components have
> constraints in Ecore files. EMF doesn't (yet) support the definition of
> OCL constraints in Ecore models. See
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=191689 for details.
>
> Cheers,
>
> Christian
>
>
> Marco Pantel wrote:
>
>> Hello everybody!
>>
>> I tried the OCL library example with ocl 1.1 but I can't find any
>> OCL-constraint in the ecore-file. Where do they reside? :)
>>
>> Regards,
>> M. Pantel
>
Re: Where are the constraints??? [message #41451 is a reply to message #41421] Fri, 19 October 2007 22:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Steffen,

This is not the only way to add constraints to an EMF model, and it doesn't
purport to be "the" way to do this.

Another option is to define constraints externally to your model using the
Validation Framework component of EMF. Have a look at the
org.eclipse.emf.validation.examples.ocl plug-in for examples of:

- defining OCL constraints right in your plugin.xml using the static
constraint provider
- incorporating OCL constraints defined in *.ocl files into the
validation framework using a dynamic constraint provider

To answer your original question: the OCL constraints as implemented in the
article are all specified using EAnnotations, annotating EClasses,
EStructuralFeatures, and EOperations. There is no EConstraint element in
Ecore.

HTH,

Christian


Steffen Mazanek wrote:

> Christian, please correct me If I am wrong.
>
> To add constraints to an EMF metamodel presently one has to
> follow the steps in this tutorial:
>
>
http://www.eclipse.org/articles/article.php?file=Article-EMF -Codegen-with-OCL/index.html
>
> Basically one has to add the OCL constraints as EAnnotations
> and include particular additional templates for code generation.
>
> Thereafter these constraints are automatically checked when a
> particular instance model is validated.
>
> Or is there an easier way to include OCL checking in the
> model validation process?
>
>

-----8<-----
Re: Where are the constraints??? [message #41492 is a reply to message #41451] Sun, 21 October 2007 16:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: steffen.mazanek.unibw.de

Christian,

thanks a lot for this clarification!

Bye,
Steffen

Christian W. Damus schrieb:
> Hi, Steffen,
>
> This is not the only way to add constraints to an EMF model, and it doesn't
> purport to be "the" way to do this.
>
> Another option is to define constraints externally to your model using the
> Validation Framework component of EMF. Have a look at the
> org.eclipse.emf.validation.examples.ocl plug-in for examples of:
>
> - defining OCL constraints right in your plugin.xml using the static
> constraint provider
> - incorporating OCL constraints defined in *.ocl files into the
> validation framework using a dynamic constraint provider
>
> To answer your original question: the OCL constraints as implemented in the
> article are all specified using EAnnotations, annotating EClasses,
> EStructuralFeatures, and EOperations. There is no EConstraint element in
> Ecore.
>
> HTH,
>
> Christian
>
>
> Steffen Mazanek wrote:
>
>> Christian, please correct me If I am wrong.
>>
>> To add constraints to an EMF metamodel presently one has to
>> follow the steps in this tutorial:
>>
>>
> http://www.eclipse.org/articles/article.php?file=Article-EMF -Codegen-with-OCL/index.html
>> Basically one has to add the OCL constraints as EAnnotations
>> and include particular additional templates for code generation.
>>
>> Thereafter these constraints are automatically checked when a
>> particular instance model is validated.
>>
>> Or is there an easier way to include OCL checking in the
>> model validation process?
>>
>>
>
> -----8<-----
Re: Where are the constraints??? [message #41506 is a reply to message #41390] Mon, 22 October 2007 02:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marco.pantel.unibw.de

Hi Christian,

I ran the org.eclipse.emf.examples.library v2.3.0 in my runtime
workbench. The workbench complained successfully when I tried to violate
one of the contraints. But what I wanted to know is, where the
contraints of that example are defined.
Now that you mentioned that EMF does not support defining the
constraints in ecores, where else can I find the example's OCL-definitions?

Regards,
Marco


Christian W. Damus schrieb:
> Hi, Marco,
>
> What do you mean by the OCL library example? What is the plug-in ID?
>
> None of the SDK examples in the EMF Validation or MDT OCL components have
> constraints in Ecore files. EMF doesn't (yet) support the definition of
> OCL constraints in Ecore models. See
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=191689 for details.
>
> Cheers,
>
> Christian
>
>
> Marco Pantel wrote:
>
>> Hello everybody!
>>
>> I tried the OCL library example with ocl 1.1 but I can't find any
>> OCL-constraint in the ecore-file. Where do they reside? :)
>>
>> Regards,
>> M. Pantel
>
Re: Where are the constraints??? [message #41535 is a reply to message #41506] Mon, 22 October 2007 15:00 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Marco,

I'm assuming, then, that you have one or more of the following example
plug-ins:

- org.eclipse.emf.validation.examples.general
- org.eclipse.emf.validation.examples.ocl

These examples both use the EMF Validation Framework's
org.eclipse.emf.validation.constraintProviders extension point to
contribute constraints *externally* to the Ecore model. You will find the
constraint definitions in the plugin.xml files of the above-named plug-ins.
The second example (validation.examples.ocl) also has an OCL constraint
provider that parses constraints defined in the *.ocl file.

HTH,

Christian


Marco Pantel wrote:

> Hi Christian,
>
> I ran the org.eclipse.emf.examples.library v2.3.0 in my runtime
> workbench. The workbench complained successfully when I tried to violate
> one of the contraints. But what I wanted to know is, where the
> contraints of that example are defined.
> Now that you mentioned that EMF does not support defining the
> constraints in ecores, where else can I find the example's
> OCL-definitions?
>
> Regards,
> Marco
>
>
> Christian W. Damus schrieb:
>> Hi, Marco,
>>
>> What do you mean by the OCL library example? What is the plug-in ID?
>>
>> None of the SDK examples in the EMF Validation or MDT OCL components have
>> constraints in Ecore files. EMF doesn't (yet) support the definition of
>> OCL constraints in Ecore models. See
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=191689 for details.
>>
>> Cheers,
>>
>> Christian
>>
>>
>> Marco Pantel wrote:
>>
>>> Hello everybody!
>>>
>>> I tried the OCL library example with ocl 1.1 but I can't find any
>>> OCL-constraint in the ecore-file. Where do they reside? :)
>>>
>>> Regards,
>>> M. Pantel
>>
Previous Topic:Resolving oclIsTypeOf() across ecore package boundaries / Custom Ecore Metamodel Binding / Implement
Next Topic:recursion
Goto Forum:
  


Current Time: Thu Apr 25 06:07:24 GMT 2024

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

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

Back to the top