OCL 1.5 Metamodel and Sum Types



Date view Thread view Subject view Author view Attachment view

From: Brian Smith (brian-l-smith@uiowa.edu)
Date: Sun 23 Feb 2003 - 22:56:20 GMT


I guess currently there are no sum types in UML/MOF. This seems like a 
big omission to me because the metamodels I am interested in seem like 
they could benefit from sum types. What is the argument for not 
including them?

Example: The OCL 1.5/2.0 metamodel

The OCL 1.5/2.0 metamodel (abstract syntax) seems like it could benefit 
from the use of sum types (union types, variants). Currently the 
metamodel uses groups of associations to basically simulate them. For 
example, in Figure 3.5 there is:

       UnspecifiedValueExp [0..1] <------- [0..1] OclMessageArg
       OclExpression       [0..1] <------- [0..1] OclMessageArg

and

       CallAction [0..1] <------- [0..1] OclMessageExp
       SendAction [0..1] <------- [0..1] OclMessageExp

I find this presentation to be confusing. Perhaps it would be better to 
explicitly include the {xor} constraint between the groups of 
associations. But, even with the {xor} constraint the multiplicities 
would still not be precise enough. I think it would be clearer to use 
some kind of sum type instead:

       (UnspecifiedValueExp | OclExpression) [1..1] <----- OclMessageArg

and

       (CallAction | SendAction) [1..1] <----- OclMessageExp

Another example would be the MOF 1.4 metamodel, which could use sum 
types to define its containment rules.

- Brian

Date view Thread view Subject view Author view Attachment view