Re: ocl conformance test

Date view Thread view Subject view Author view Attachment view

From: Stefan Haustein (
Date: Thu 12 Feb 2004 - 15:51:48 GMT

Steffen Zschaler wrote:

>> - It seems there is no literal expression "OclUndefined". I am using 
>> "Set{true}->any(false)" now to get a "boolean" undefined, but perhaps 
>> there is a nicer solution? 
> What tool did you try them with? OclUndefined is only defined from OCL 
> 2.0 onwards, so any tool still supporting only OCL 1.x will not 
> understand it. I am not sure that your replacement will indeed evaluate 
> to OclUndefined.

I tried them with my own tool (which is not exactly an OCL tool but uses OCL as 
expression language). Concerning the replacement expression, section 6.6.1 in 
the OCL 2.0 spec clearly states that the result of the expression 
"Set{true}->any(false)" must be OclUndefined. This seems consistent with section of the version 1.5 of the UML Spec.

Do existing OCL tools support the literal "OclUndefined"? The concrete syntax 
does not seem to contain it (perhaps I overlooked it in the grammar), and 
according to section 6.2 OclVoid does not seem to be an enumeration, thus 
OclUndefined is not covered by EnumerationLiteralExpCS.

I think using the literal OclUndefined in the <result> element is OK --- this 
can be handled as a special case if the literal is not supported by a tool.

Concerning OCL 2.0 support in general, it probably makes sense to annotate tests 
that depend on 2.0 with information about which part of the 2.0 spec is required 
(tuples/OclVoid/OclUnknown/...), and not to test "deprecated" 1.5 behaviour such 
as implicit flattening?

BTW: The code for reading the XML file is really pretty simple, for other OCL 
tools probably only the test methods and the type of the model variable need to 
be changed:

Best regards,

Dipl.-Inform. Stefan Haustein
Univ. Dortmund, FB 4, LS 8   tel: +49 231 755 2499
Baroper Str. 301             fax: +49 231 755 5105
D-44221 Dortmund (Germany)

Date view Thread view Subject view Author view Attachment view