Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OCL Pre- and Post- Conditions
OCL Pre- and Post- Conditions [message #6985] Mon, 19 February 2007 02:20 Go to next message
Andy Evans is currently offline Andy Evans
Messages: 61
Registered: July 2009
Member
Hello,

Is it possible to specify pre- and post- conditions in MDT OCL and then
evaluate them
against some EMF data, i.e. a before and after state? If so, how might I go
about it?

Thanks,

Andy
Re: OCL Pre- and Post- Conditions [message #7012 is a reply to message #6985] Mon, 19 February 2007 09:30 Go to previous messageGo to next message
Eclipse User
Originally posted by: cdamus.ca.ibm.com

Hi, Ase,

Have a look at the org.eclipse.ocl.ecore.tests plug-in for some examples of
parsing operation pre- and post-conditions. In particular:

- the OCLDocumentTest.java class which parses the
model/test_constraints.ocl text file and, in the
test_multipleMixedOperationConstraints() method introspects the
operation constraints
- the org.eclipse.ocl.ecore.helper.tests.ParsingTest which demonstrates
usage of the OCLHelper API to parse operation constraints

Once a constraint has been parsed either from text (an OCL document) or via
the OCLHelper, evaluation of the constraint at run-time simply requires
binding the values of any context variables and evaluating as demonstrated
for operation body expressions in

http://www.eclipse.org/articles/Article-EMF-Codegen-with-OCL /article.html

Note that the MDT OCL component does not currently support the evaluation of
@pre and oclIsNew() expressions in post-conditions. For that, you would
need to define a custom implementation of the EvaluationEnvironment.

HTH,

Christian


ase wrote:

> Hello,
>
> Is it possible to specify pre- and post- conditions in MDT OCL and then
> evaluate them
> against some EMF data, i.e. a before and after state? If so, how might I
> go about it?
>
> Thanks,
>
> Andy
Re: OCL Pre- and Post- Conditions [message #7036 is a reply to message #7012] Mon, 19 February 2007 09:31 Go to previous message
Eclipse User
Originally posted by: cdamus.ca.ibm.com

My apologies, Andy. I mistakenly addressed you as "Ase" from the "From:"
header in your posting.

I should read more carefully than that.

Christian


Christian W. Damus wrote:

>
> Hi, Ase,
>

<snip>
Previous Topic:[Announce] MDT OCL 1.1.0 1.1M5 is available
Next Topic:diagrams of the metamodel in SVG
Goto Forum:
  


Current Time: Sat Apr 19 02:59:24 EDT 2014

Powered by FUDForum. Page generated in 0.06360 seconds