Finally got something good!
This is very informative document (PDF) from Object Management Group (OMG):
Object Constraint Language Specification
I love answering my own questions :)
Finally got something good!
This is very informative document (PDF) from Object Management Group (OMG):
Object Constraint Language Specification
I love answering my own questions :)
For beginners I would recommend this book:The Object Constraint Language: Getting Your Models Ready for MDA by Jos Warmer and Anneke Kleppe (Jos was one of the main creators of the OCL)
I also like a lot the official specification you already found (specially the chapter offering an informal description of the language).
Feel free to ask about the expressions you do not understand as well.
A quick solution on the constraints:
context Department inv: self.staff -> forAll(s1,s2| s1.manager = s2.manager)
context Company inv: self.employee->forAll(e| e.manager<>e)
context Company inv: self.employee->forAll(e| e.salary<=e.manager.salary)
Btw, I don't really see the need for the Company class (how many objects of type company do you have in the system?). If constraints two and three are true for all companies then they could be expressed using Person as context in this way (e.g. with number 2): context Person inv: self.manager<>self)
We can also add checks to see if the employee has a manager before doing the comparison
The link to PDF file posted by @Artur has changed, Here is new link http://www.omg.org/spec/OCL/2.0/PDF/