Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » [OCLinEcore] Severity as annotation
[OCLinEcore] Severity as annotation [message #1015633] Fri, 01 March 2013 13:17 Go to next message
Cedric Moonen is currently offline Cedric MoonenFriend
Messages: 274
Registered: August 2009
Senior Member
Hello,

Currently when using OCLinEcore an invariant can specify the severity of the failure by its return type: false, OclInvalid or null (true means that the invariant is satisfied).

I understand the reason why it is implemented that way instead of annotations (this way, you can have different severity within one invariant).
However, there are cases where this approach is not convenient:
- I would like to export my domain model WITH the OCL constraints which have to be evaluated. This way, they become unusable since the invariants are not standard (for your information, I would like to use EMFtoCSP).
- The constraints become more complex since you have to always wrap them inside a if then else endif statement. You can of course have utility methods but you will need to have one for each class (I'm not using complete OCL here). This also pollutes the domain model with utility methods which are not part of the domain model.

I was wondering if you could consider having also the option to specify the severity via an annotation (the same way it is currently done for the custom messages). The problem would be that there are two ways to specify the severity at the same time (via annotation and via return of the invariant), even if having both at the same time doesn't make any sense. You could have a rule there which specify that if you have an annotated severity, it takes precedence over the invariant return (if it returns false, null or OclInvalid).

What is your opinion about it ?

Thanks,
Cédric
Re: [OCLinEcore] Severity as annotation [message #1015637 is a reply to message #1015633] Fri, 01 March 2013 13:50 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Until you have an API defined by the OCL specification and tools that
comply with it portability is a no-go.

You might choose to encode the severity in the first letter(s) of the
message.

Some rigorous disciplines like their error messages to have error numbers.

There is also a problem if for instance you would like your failed
constraint to return a set of quick-fix suggestions.

Even for the messages, there is a synchronization challenge for re-use
of variables from the filing context in the explanatory message.

Of course there should be a mechanism that allows messages to be
internationalized.

I'm considering that it may just be better to allow an invariant to
optionally return a tuple of arbitrary named parts, some of whose parts
would have reserved names such as severity/message, and others could
then be user extensions. Presenting relevant parts to the user is then
relatively straightforward.

If you want annotations in your OCL-extending language then add them,
and your message handler can merge them with the tuple return.

Regards

Ed Willink


On 01/03/2013 13:17, Cedric Moonen wrote:
> Hello,
>
> Currently when using OCLinEcore an invariant can specify the severity
> of the failure by its return type: false, OclInvalid or null (true
> means that the invariant is satisfied).
>
> I understand the reason why it is implemented that way instead of
> annotations (this way, you can have different severity within one
> invariant).
> However, there are cases where this approach is not convenient:
> - I would like to export my domain model WITH the OCL constraints
> which have to be evaluated. This way, they become unusable since the
> invariants are not standard (for your information, I would like to use
> https://code.google.com/a/eclipselabs.org/p/emftocsp/).
> - The constraints become more complex since you have to always wrap
> them inside a if then else endif statement. You can of course have
> utility methods but you will need to have one for each class (I'm not
> using complete OCL here). This also pollutes the domain model with
> utility methods which are not part of the domain model.
>
> I was wondering if you could consider having also the option to
> specify the severity via an annotation (the same way it is currently
> done for the custom messages). The problem would be that there are two
> ways to specify the severity at the same time (via annotation and via
> return of the invariant), even if having both at the same time doesn't
> make any sense. You could have a rule there which specify that if you
> have an annotated severity, it takes precedence over the invariant
> return (if it returns false, null or OclInvalid).
>
> What is your opinion about it ?
>
> Thanks,
> Cédric
Previous Topic:Using drag'n'drop results in exception when loading CompleteOCL resource
Next Topic:[Announce] Eclipse OCL 4.0.2 (Juno) SR2 is now available.
Goto Forum:
  


Current Time: Thu Apr 25 16:36:56 GMT 2024

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

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

Back to the top