Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » undefined on expressions(what is the result of expressions with undefined values)
undefined on expressions [message #514362] Mon, 15 February 2010 01:47 Go to next message
Alexandre Torres is currently offline Alexandre TorresFriend
Messages: 139
Registered: July 2009
Senior Member
Hi, it has been some time since I last used MDT-OCL, so forgive me if I miss something Wink

Reading the OCL specification I got the feeling that the evaluation of expressions with undefined value (OclUndefined) should evaluate to OclUndefined, except in some special situations:

• True OR-ed with anything is True
• False AND-ed with anything is False
• False IMPLIES anything is True
• anything IMPLIES True is True

I'm issuing some evaluations on the interactive console OCL (that I suppose that is still implemented over MDT-OCL, as an example) and what is happening is a bit odd: expressions of equality btw undefined and another value are evaluated as plain false values:

name.oclIsUndefined()
<false> (ok)
default.oclIsUndefined()
<true>(ok)
name=default
<false> (should be undefined ?)
default=default
<true> (should be undefined ?)
(name=default).oclIsUndefined()
<false> (should be undefined)

I'd like to know if this is a configurable output, a specific behaviour or my bad interpretation of OCL specs.

Is there a list differences btw OCL specs and the MDT-OCL implementation ?

Thanks in advance.
My OCL version is a bit old (v1.3 of 2.0 implementation)
Re: undefined on expressions [message #514377 is a reply to message #514362] Mon, 15 February 2010 06:32 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Alexandre

The OCL 2.0 specification is not entirely clear. The inconsistent "OclInvalid" and "invalid" usage is resolved in OCL 2.3 so that
"invalid" is the instance of the "OclInvalid" type in the same way that "null" is the instance of the "OclVoid" type, with the
'undefined' value clearly partitioned as invalid or null.

We have been a bit embarrassed by the number of corner case evaluation issues in MDT/OCL 1.3.0 and the lack of model-driven
extensibility. Resolution of this has been prototyped in a ReflectiveLibrary branch in CVS, but we are too close to the API freeeze
that comes with M6 in late March to incorporate such changes for MDT/OCL 3.0.0. Expect them almost immediately for MDT/OCL 4.0.0.

That said, your evaluations are as expected for OCL 2.1 (renamed as 2.2), where OclAny::= is overloaded by OclVoid and OclInvalid to
define true/false returns. The OCL 2.3 specification should be less ambiguous. '=' is another special situation.

Provision of a detailed compliance list is one of the TODOs for the new ReflectiveLibrary which should allow you to choose between a
variety of alternate 'standard' libraries or to configure your own semantics.

Regards

Ed Willink

On 15/02/2010 01:47, Alexandre Torres wrote:
> Hi, it has been some time since I last used MDT-OCL, so forgive me if I
> miss something ;)
>
> Reading the OCL specification I got the feeling that the evaluation of
> expressions with undefined value (OclUndefined) should evaluate to
> OclUndefined, except in some special situations:
>
> • True OR-ed with anything is True
> • False AND-ed with anything is False
> • False IMPLIES anything is True
> • anything IMPLIES True is True
>
> I'm issuing some evaluations on the interactive console OCL (that I
> suppose that is still implemented over MDT-OCL, as an example) and what
> is happening is a bit odd: expressions of equality btw undefined and
> another value are evaluated as plain false values:
>
> name.oclIsUndefined()
> <false> (ok)
> default.oclIsUndefined()
> <true>(ok)
> name=default
> <false> (should be undefined ?)
> default=default
> <true> (should be undefined ?)
> (name=default).oclIsUndefined()
> <false> (should be undefined)
>
> I'd like to know if this is a configurable output, a specific behaviour
> or my bad interpretation of OCL specs.
>
> Is there a list differences btw OCL specs and the MDT-OCL implementation ?
>
> Thanks in advance.
> My OCL version is a bit old (v1.3 of 2.0 implementation)
Previous Topic:[Announce] Eclipse/OMG Symposium 2010
Next Topic:Programatically Accessing OCL Comments
Goto Forum:
  


Current Time: Fri Apr 19 13:23:31 GMT 2024

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

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

Back to the top