Advanced Systems Design with Java, UML and MDA

The constraint language LOCA that we have used here is an alternative concrete syntax for a subset of the OCL 2.0 specification notation.
In LOCA we only use the OCL types OclAny (the supertype of booleans, numerics and strings), Boolean, Integer, Real and String, and the parameterised types Collection < T >, Set < T > and Sequence < T > (Figure C.1). Integer is a true subtype of Real since all operations of reals are applicable to integers and have the same results on integers.
Table C.1 shows the mapping of LOCA syntax to normal OCL syntax. e' denotes the translation of e.
| LOCA | OCL | Note |
|---|---|---|
| OclAny | ||
| x = y | x' = y' | |
| x / = y | x' < > y' | |
| Real | ||
| x + y | x' + y' | Likewise for -, /, * |
| x < y | x' < y' | Likewise for >, <=, >= |
| x.abs | x'.abs() | Likewise for floor, round, sqrt, sqr |
| { n 1, , n m} .max |
| Numeric expressions n 1, , n m |
| { n 1, , n m} .min |
| Numeric expressions n 1, , n m |
| { n 1, , n m} .sum |
| No duplicates in n 1, , n m |
| Integer | Above operations... |