AOCL : A Pure Java Replacement for OCL

OCL (Object Constraint Language) is the standard constraint language for MDE.  Personally, I never liked it because it had the look and feel of a "hacked" language; it was not elegant nor simple.

AOCL is a pure-Java replacement for OCL.  It is literally a Java package that supports the operations and almost matches the syntax of OCL that is generated directly from a Violet class diagram or a CDSchema file.  Both are documented in this manual and how to transform these inputs into an
AOCL package.  Here is the table of contents for this document:

Violet Class Diagrams

A Violet class diagram can be used to specify an AOCL package.  Here are the rules for creating Violet Class diagrams.


The figure below shows an example of each attribute:



Converting a Violet Class Diagram into an AOCL Package

Use the following tool to create an allegory package.
> java MDL.V2Aocl




CDschema Files

A cdschema file is an intermediate representation of a class diagram.  It is a purely textual specification.  Consider the class diagram to the below left and its cdschema specification to the right:


classDiagram I22.

table(Emp,[id,name,age:int]).
table(Div,[id,name,city]).
table(SuperEmp,[degree:int]).
table(SuperDiv,[degree:int]).

subtable(Div,[SuperDiv]).
subtable(Emp,[SuperEmp]).

assoc(Emp,employs,NM,Div,worksIn,In).

A cdschema specification:
The only declaration that is in some sense new is an association declaration.  The order in which tables are listed is important.  Look at the following figure (a), which shows a Violet association and how it is mapped to an association declaration (b).


For the case of an NM association, because it is symmetrical, Emp or Dept could have been listed first, followed by its role label, followed by its association type (NM in this case), followed by a table (Dept) and its role (worksin), followed by the middle label (Job) which will become the name of an association class.

A more typical association is below.  The first table listed is at the BLACK_DIAMOND or DIAMOND end of an assoc declaration.  The remaining parameters follow.




Converting a cdschema File into an AOCL package

Use the following tool to create an allegory package.

> java MDL.V2Aocl





AOCL Examples

Consider the following class diagram (right) and its cdschema (left) as the basis for our AOCL examples.



Now consider the following database:

---eee---

Here is a sequence of queries: