Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » [OCLinEcore] Invariant evaluation only after validation of another invariant
[OCLinEcore] Invariant evaluation only after validation of another invariant [message #1014783] Tue, 26 February 2013 13:11 Go to next message
Cedric Moonen is currently offline Cedric MoonenFriend
Messages: 274
Registered: August 2009
Senior Member
Hello,

I have several constraints on an object of my meta-model but for some of them, the invariant should be evaluated only if another invariant was evaluated positively (didn't produce an error).
In fact, I first evaluate certain condition and if they are not fulfilled, I don't want to evaluate another invariant (it doesn't make sense in the situation).

Is it possible to do something like that ?

Thanks,
Cédric
Re: [OCLinEcore] Invariant evaluation only after validation of another invariant [message #1014796 is a reply to message #1014783] Tue, 26 February 2013 13:32 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Cedric

No, but thanks for reminding me of this use case.

A previous discussion suggested a special dependency syntax. After a bit
more thought it seemed that making a constraint available as a
property/operation would allow a dependent constraint to be written as

inv SimpleConstraint: ...
inv ComplexConstraint: SimpleConstraint implies ...

you could do this manually now by

def checkSimpleConstraint() : Boolean = ...
inv SimpleConstraint: checkSimpleConstraint()
inv ComplexConstraint: checkSimpleConstraint() implies ...

which argues for no change needed. Just requires a smarter evaluator to
do a little Common Subexpression Elimination to detect the dependencies.
Enhancement request raised as
https://bugs.eclipse.org/bugs/show_bug.cgi?id=401786.

Regards

Ed Willink


On 26/02/2013 13:11, Cedric Moonen wrote:
> Hello,
>
> I have several constraints on an object of my meta-model but for some
> of them, the invariant should be evaluated only if another invariant
> was evaluated positively (didn't produce an error). In fact, I first
> evaluate certain condition and if they are not fulfilled, I don't want
> to evaluate another invariant (it doesn't make sense in the situation).
>
> Is it possible to do something like that ?
>
> Thanks,
> Cédric
Re: [OCLinEcore] Invariant evaluation only after validation of another invariant [message #1014807 is a reply to message #1014796] Tue, 26 February 2013 13:55 Go to previous message
Cedric Moonen is currently offline Cedric MoonenFriend
Messages: 274
Registered: August 2009
Senior Member
Hi Ed,

Thanks for your quick reply, as usual Smile

I could indeed have an additional operation returning a boolean checking the simple constraint.

Thanks,
Cédric
Previous Topic:OCL in XMI instances of Ecore
Next Topic:[OCLinEcore] Evalutaion difference beween OCL console and invariant in the model
Goto Forum:
  


Current Time: Thu Apr 25 05:42:49 GMT 2024

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

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

Back to the top