Re: OCL and constraints



Date view Thread view Subject view Author view

Bernhard Rumpe (rumpe@informatik.tu-muenchen.de)
Thu, 09 Dec 1999 11:49:23 +0100


Dear Frank, currently OCL is meant as a first order logic language, where you can describe conditions (synonym: constraint, invariants). OCL is evaluated in the context of an object structure, but does not change it. Therefore OCL is not for constraint "propagation". For this we would need to change OCL to become a constraint language, like Prolog (where you e.g. don't have quantifiers) In your particular case is: "The invariants are violated" Thats all. Its up to the modeller to ensure that this doesn't happen, by not writing such a code. I can understand your concernes, because it would help to use OCL as programming language, but thats not it purpose (currently). Hope this helps, Bernhard > "Frank V. Castellucci" wrote: > > I don't know what has been said before on the subject as I have just > joined the mailing list but I am concerned about OCL and the lack of > coverage faced in typical constraint programming. > > I believe that to be "real" OCL must consider constraint propagation. > > For example (excuse the rust in OCL syntax), where ClassA has an > association to ClassB: > > context ClassA: > inv: self.x = self.relationship.y > > context ClassB > inv: self.y = self.relationship.x > > what is the result when ClassA.x is assigned say 5 > > In a propagation system, if ClassB.y has not been assigned then by > definition it attains the value of 5 as well, of course invariant > excepts if ClassB.y is already assigned. > -- ---------------------------------------------------------------------------- | Dr. Bernhard Rumpe, Software & Systems Engineering | Munich University of Technology, 80290 Munich, Germany | Bernhard.Rumpe@in.tum.de | http://www.in.tum.de/~rumpe/


Date view Thread view Subject view Author view