I came across couple of questions about OCL expressions. After reading some university slides and googling it I still cannot properly understand it.
I wonder if any of you guys know any good resources that I should read to understand this stuff.
Constraints that bother me:
- Everybody working in the department has the same manager.
- Nobody in the company is the manager of him/herself.
- Nobody in the company earns more than his manager.
For the 1st one I have:
context Department
inv self.stuff -> forAll(manager = self.staff.manager)
2nd one:
context Company
inv self.employee -> select(manager = manager.manager) -> isEmpty()
3rd one:
context Company
inv self.employee -> select(salary > manager.salary) -> isEmpty()
but I dont think these are right. What I'm most unsure of is whether in example 2 and 3 I actually compare individual employees with theirs actual manager / manager salary.