Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Boolean operations and OCLUndefined
Boolean operations and OCLUndefined [message #68330] Tue, 03 March 2009 07:54 Go to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080302050500090201010307
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi Christian,

I stumbled upon this while trying to debug an OCL expression and was
wondering ... Nowhere in the OCL specification is it defined the result
of a boolean expression if one of the sides are "OCLUndefined", or at
least I didn't find a reference.

When evaluating "OCLUndefined and b", whatever the value of b, the
result will be false. Likewise, evaluating "OCLUndefined or b" will
return the value of b (see case PredefinedType.OR: and case
PredefinedType.AND: on lines 915 and 938 of the EvaluationVisitorImpl).

I would have expected results as :
OCLUndefined and true => OCLUndefined
OCLUndefined and false => false
OCLUndefined or true => true
OCLUndefined or false => OCLUndefined

But seeing how my boolean expression *should* fail and does not (my case
was the "OCLUndefined and true" is quite unsettling. Was this
implementation choice due to a gap in the specification or was that an
overlook?

Laurent Goubet
Obeo

--------------080302050500090201010307
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

begin:vcard
fn:Laurent Goubet
n:Goubet;Laurent
org:<a href="http://www.obeo.fr/">Obeo</a>
email;internet:laurent.goubet@obeo.fr
url:http://www.obeo.fr
version:2.1
end:vcard


--------------080302050500090201010307--
Re: Boolean operations and OCLUndefined [message #68351 is a reply to message #68330] Tue, 03 March 2009 19:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Laurent,

This looks like a bug to me. Any operation on 'null' (which I assume is
what you mean by "OCLUndefined") should result in 'invalid' (which MDT
OCL erroneously refers to as OclInvalid).

According to the OCL spec, the result of any operation invocation or
property access on the null value is invalid, unless it is an operation
explicitly defined for OclVoid. The only such operations are =, <>,
oclIsUndefined(), and oclIsInvalid().

At least, that is my understanding of the matter ...

Cheers,

Christian


laurent Goubet wrote:
> Hi Christian,
>
> I stumbled upon this while trying to debug an OCL expression and was
> wondering ... Nowhere in the OCL specification is it defined the result
> of a boolean expression if one of the sides are "OCLUndefined", or at
> least I didn't find a reference.
>
> When evaluating "OCLUndefined and b", whatever the value of b, the
> result will be false. Likewise, evaluating "OCLUndefined or b" will
> return the value of b (see case PredefinedType.OR: and case
> PredefinedType.AND: on lines 915 and 938 of the EvaluationVisitorImpl).
>
> I would have expected results as :
> OCLUndefined and true => OCLUndefined
> OCLUndefined and false => false
> OCLUndefined or true => true
> OCLUndefined or false => OCLUndefined
>
> But seeing how my boolean expression *should* fail and does not (my case
> was the "OCLUndefined and true" is quite unsettling. Was this
> implementation choice due to a gap in the specification or was that an
> overlook?
>
> Laurent Goubet
> Obeo
Re: Boolean operations and OCLUndefined [message #68412 is a reply to message #68351] Thu, 05 March 2009 09:49 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010807010600090507000105
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Hi Christian,

Sorry about that, the behavior of boolean operations is indeed defined
in the OCL specifications at "A.2.1.4 SEMANTICS OF OPERATIONS" (page 188
of version 2.0 formal/06-05-01).

That looked like a bug to me too yes, if I can understand that "null and
false" returns false, "null and true" should fail in my understanding.
Though it seems the OMG people don't see this like that. I guess I'll
have to cope with this behavior.

Laurent Goubet
Obeo

Christian W. Damus a
Re: Boolean operations and OCLUndefined [message #68423 is a reply to message #68412] Thu, 05 March 2009 09:52 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030900090203090409080101
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

.... and it seems I have trouble reading. I'll have to try and get a some
rest :p. The OCL specification goes in the direction of my first post :

OCLUndefined and true => OCLUndefined
OCLUndefined and false => false
OCLUndefined or true => true
OCLUndefined or false => OCLUndefined

I'll raise a bug for this

Regards,

Laurent Goubet
Obeo

laurent Goubet a
Re: Boolean operations and OCLUndefined [message #68457 is a reply to message #68423] Thu, 05 March 2009 16:19 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040501090001090907050209
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

just raised https://bugs.eclipse.org/bugs/show_bug.cgi?id=267223 with a
patch adressing this issue (no unit test to ensure the behavior though).

laurent Goubet
Obeo

laurent Goubet a
Re: Boolean operations and OCLUndefined [message #68497 is a reply to message #68457] Fri, 06 March 2009 13:47 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Thanks, Laurent! And for the patch, too, of course.

cW

laurent Goubet wrote:
> just raised https://bugs.eclipse.org/bugs/show_bug.cgi?id=267223 with a
> patch adressing this issue (no unit test to ensure the behavior though).
>
> laurent Goubet
> Obeo
>
> laurent Goubet a écrit :
>> ... and it seems I have trouble reading. I'll have to try and get a
>> some rest :p. The OCL specification goes in the direction of my first
>> post :
>>
>> OCLUndefined and true => OCLUndefined
>> OCLUndefined and false => false
>> OCLUndefined or true => true
>> OCLUndefined or false => OCLUndefined
>>
>> I'll raise a bug for this
>>
>> Regards,
>>
>> Laurent Goubet
>> Obeo

-----8<-----
Previous Topic:[Announce] MDT OCL 1.3.0 I200903050949 is available
Next Topic:OCL Console in SR2
Goto Forum:
  


Current Time: Fri Mar 29 05:32:47 GMT 2024

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

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

Back to the top