Advanced Systems Design with Java, UML and MDA

Appendix C: Using Standard OCL

Overview

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.


Figure C.1: LOCA type hierarchy

Table C.1 shows the mapping of LOCA syntax to normal OCL syntax. e' denotes the translation of e.

Table C.1: Correspondence of OCL and LOCA

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...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Environmental Exposure (Climatics) Testing Services
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.