Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does anyone know good Object Constraint Language (OCL) tutorial?

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:

  1. Everybody working in the department has the same manager.
  2. Nobody in the company is the manager of him/herself.
  3. 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.

like image 216
Artur Avatar asked May 23 '09 19:05

Artur


People also ask

How OCL is useful in UML modeling?

OCL is part of Unified Modeling Language (UML) and it plays an important role in the analysis phase of the software lifecycle. languages can use OCL to specify constraints and other expressions attached to their models. OCL is the expression language for the Unified Modeling Language (UML).

What is object constraint language and why it is used explain in detail?

The Object Constraint Language (OCL) is a declarative language describing rules applying to Unified Modeling Language (UML) models developed at IBM and is now part of the UML standard. Initially, OCL was merely a formal specification language extension for UML.

What are the types used in the Object Constraint Language OCL )?

OCL is a typed, declarative and side-effect free specification language. Typed means that each OCL expression evaluates to a type (either one of the predefined OCL types or a type in the model where the OCL expression is used) and must conform to the rules and operations of that type.

What type of constraints is expressed by OCL?

The OCL is used to represent constraints in the UML class diagram. Therefore, we parse OCL constraints and translate them into AsmL in order to enforce these constraints on the instance-level diagrams.


2 Answers

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 :)

like image 192
Artur Avatar answered Sep 25 '22 01:09

Artur


The link to PDF file posted by @Artur has changed, Here is new link http://www.omg.org/spec/OCL/2.0/PDF/

like image 33
Manu Avatar answered Sep 23 '22 01:09

Manu