Re: comments on OCL



Date view Thread view Subject view Author view

Hubert Baumeister (baumeist@informatik.uni-muenchen.de)
Mon, 13 Dec 1999 16:14:01 +0100


Hi Daniel, Daniel Jackson wrote: > > hubert, > > > In my opinion, you have missunderstood the use of OCL- > > constraints. They are not intended to be executable, nor are they > > intended to be interpreted operationally. OCL-constraints are > > constraining the possible UML models. > > we understand that OCL is supposed to be declarative and not operational: > our complaint is precisely that it isn't! But still it's declarative. You just cannot express the things in it that you want, which is a very valid criticism. > > > In this case the constraint on > > allParents contraints all possible implementations of the allParents > > operation in a way to satisfy the above equation. > > indeed, it seems to me that allParents should never be called an "operation" > at all: No, the word operation is perfectly ok. The name comes from the underlying UML model, where allParents is an operation, and my intention is that OCL should be usable to constrain any aspect of the underlying UML model. > it's just a defined relation. but since OCL doesn't have transitive > closure, such relations need to be defined in this operational fashion. Operations and relations can both be treated declarative (look for example at algebraic specification, which are declarative and deal with operations and sorts, and of course first-order logic deals with operations/functions as well as predicates/relations). > what we need is not _any_ solution to the equation, but the _smallest_ > solution. one way to get this is to construe the constraint operationally: > first we add A's parent, then we call the operation recursively. i quite > agree with you that this is very undesirable in a modelling language, but we > guessed that this was probably what the OCL authors had in mind -- why else > would they have called it an operation? given that you construe it > operationally, you now have to make sure that there are no cycles in the > parents relation, otherwise the recursion doesn't terminate. I agree with you that one wants to express that allParents is the smallest set satisfying the recursive equation. Further, I don't see an obvious way to express this property (though there should be one as there has been a paper in the Formal Methods 99 which shows how to express the transitive closure of a relation in OCL, albeit quite awkward. Its URL is http://www.pst.informatik.uni-muenchen.de/personen/cengarle/ocl.ps ). However, one does not have to get operational to express this (and as you pointed out, it is no solution at all). Another solution is to use a least fixpoint operator to achieve this. So the designers of OCL could have had in mind to always take the least fixpoint of such an equation, similar to the use of initial models in algebraic specifications. The point here is that there is no formal semantics of OCL; so one can only speculate about the intentions of the designers of OCL. Thus, what we really need is a agreed upon formal semantics of OCL which could be used to discuss these kind of questions. > > so if there is a cycle in the parent relation, then allParents is not well > defined, and its use to rule out circularity is circular! > > does this make sense? Perfectly, but you should write this in your paper. It is not the problem that the underlying UML class model has operations and that OCL is used to express constraints on these operations; the real problem is that OCL lacks expressiveness. Greetings, Hubert -- Hubert Baumeister, LMU M"unchen, Institut f"ur Informatik mailto:baumeist@informatik.uni-muenchen.de http://www.informatik.uni-muenchen.de/~baumeist phone (x49-89)2178-2177 * fax -2175


Date view Thread view Subject view Author view