Re: OCL: dealing with exceptions



Date view Thread view Subject view Author view Attachment view

From: Anneke Kleppe (A.Kleppe@klasse.nl)
Date: Tue 28 May 2002 - 08:20:57 BST


The current status of OCL 2.0 is that it is aligned with the UML 1.4. As 
soon as the UML 2.0 submissions stabilize, we will align OCL 2.0 with UML 
2.0. As the core of the UML 2.0 is to be the core of the MOF 2.0 also, the 
alignment of OCL with MOF follows.

Now to answer your question: no there is currently no explicit support in 
OCL 2.0 for these MOF exceptions. There might be later on, if during the 
alignment this proves to be an important issue.

BTW, you say you are expecting it, but there have not been any requests to 
the OCL submission team to include this. Please tell us, if you want 
something in. We are only human, you know. :-)

Anneke

At 01:33 PM 27-05-2002 -0500, you wrote:
>First, I appreciate the very detailed and informative response from 
>both  you and Andreas.
>
>I am trying to use OCL 1.4 with MOF 1.4 from OMG. MOF 1.4 has a special 
>"Exception" meta-class that has no subtyping relationship to its "Class" 
>or "Operation" meta-classes. In particular, Exceptions are definitely 
>_not_ Classifiers in MOF. Instead, there is an association between an 
>Operation and Exception to denote which Exceptions an Operation may raise. 
>Furthermore, in MOF 1.4, "allInstances" has obvious semantics for only for 
>Classes, not Exceptions.
>
>I am expecting, in OCL 2.0, there would be explicit support for 
>exceptions. Is that not the case?
>
>- Brian
>
>
>Anneke Kleppe wrote:
>>Hi Brian,
>>There are two ways in which to specify exceptions in OCL, depending on 
>>how your exceptions are modelled.
>>When an exception is considered to be a specific operation that is called 
>>when the condition occurs, you can use the following:
>>context yourClass:operationThatThrowsException() : SomeResultType
>>pre: -- none
>>post: someCondition implies exceptionHandler^handlingOperation().isSent()
>>someCondition can be written in exactly the same manner as in every other 
>>OCL expression. This type of expression, indicating a message being sent, 
>>is new to the OCL 2.0.
>>When an exception is specified as a class, of which a new instance has to 
>>be created when the condition occurs, you can use something like the following:
>>context yourClass:operationThatThrowsException() : SomeResultType
>>pre: -- none
>>post: Let e: Exception
>>       in someCondition implies ( self.thrownExceptions->includes( e ) and
>>                                  e.isNew() )
>>But as you can see, it all depends on how you have modelled your 
>>exceptions in the UML part of your specification. Here I assume that 
>>'yourClass' has an association with the class 'Exception', called 
>>'thrownExceptions'. But many different approaches can be used.
>>Hope this helps,
>>Anneke Kleppe
>>At 12:13 PM 22-05-2002 -0500, you wrote:
>>
>>>How can I use OCL to specify the conditions under which a particilar 
>>>exception is thrown by an operation? I have looked at the OCL 
>>>specification and there seems to be no way to do it.
>>>
>>>I am looking for a way to specify exceptions that will type-check.
>>>
>>>Any references to information about this topic are greatly appreciated.
>>>
>>>Thanks,
>>>Brian
>>>
>>>
>>>
>>>
>>>To remove yourself from this list please mail 
>>>puml-list-request@cs.york.ac.uk
>>>with a message containing the word "unsubscribe".
>>Klasse Objecten
>>Chalonhof 153
>>NL - 3762 CT Soest
>>The Netherlands
>>voice: +31(0)35-6037646
>>fax: +31(0)35-6037647
>>http://www.klasse.nl <http://www.klasse.nl/>
>
>
>
>
>
>To remove yourself from this list please mail puml-list-request@cs.york.ac.uk
>with a message containing the word "unsubscribe".
>

Klasse Objecten
Chalonhof 153
NL - 3762 CT Soest
The Netherlands
voice: +31(0)35-6037646
fax: +31(0)35-6037647
http://www.klasse.nl

Date view Thread view Subject view Author view Attachment view