Overview of OCL BM

One means to specify operational semantic and exception pre/post conditions is to use OCL BM - which is a simpler to use form of Object Constraints Language intended for business modelling. When this is used alongside a Service Information Model (SIM) it can be used to specify conditions for a service.

The table below summarises the key aspects of the language, although in reality it is likely that only a subset of these will be used.

 

Iterator

Syntax

ANY

SELECT ANY <iters> FROM <source> WHERE <body>

 

Example

SELECT ANY Product p FROM managedProduct WHERE p.Identifier = inID

COLLECT

COLLECT <body> USING <iters> FROM <source>

 

Example

COLLECT p.StockedItem USING Product p FROM managedProduct

COLLECT NESTED

COLLECT NESTED <body> USING <iters> FROM <source>

 

Example

COLLECT NESTED p.StockedItem USING Product p FROM managedProduct

EXISTS

EXISTS <iters> IN <source> WHERE <body>

 

Example

EXISTS Product p IN managedProduct WHERE p.Identifier = inID

FORALL

FORALL <iters> IN <source> ISTRUE <body>

(iterator variables may be omitted)

ISUNIQUE

 ISUNIQUE <body> USING <iters> IN <source>

 

Example

ISUNIQUE p.StockedItem USING Product P IN managedProduct

ITERATE

ITERATE <iters> OVER <source>

RESULT <result>

INITIAL VALUE <initialvalue>

NEXT VALUE <body>

ONE

EXISTS ONE <iters> IN <source> WHERE <body>

 

Example

EXISTS ONE Produce P IN managedProduct WHERE p.Identifier = inID

REJECT

REJECT <iters> FROM <source> WHERE <body>

 

Example

REJECT Product p FROM managedProduct WHERE p.Identifier = inID

SELECT

SELECT <iters> FROM <source> WHERE <body>

 

Example

SELECT Product p FROM managedProduct WHERE p.Identifier = inID

SORTEDBY

SORT <source> WITH <iters> BY <body>

(iterator variables may be omitted)

 

Example

SORT managedProduct BY name