Redirected from User guide for OCL rules in XMLdation environment5: OCL Rules
What is OCL?
OCL (Object Constraint Language) is a query language originally developed for describing rules for UML models. OCL is managed by Object Management Group (OMG) and it is part of the UML standard. The official specifications can be found from OMG web pages at http://www.omg.org/spec/OCL/.
XMLdation service and OCL
In XMLdation service XML Schemas are mapped as UML models, which allows us to use OCL to create desired restrictions to an XML schema. Java code is generated based on the OCL definitions and executed against XML files in validation proces.
The benefit of this is that we do not have to edit the underlying schema in any way; the schema and all of its restrictions stay as they have originally described. Therefore creating and maintaining business rules only involves maintaining series of OCL rules, which can be done with myXML. In addition, due to the extensitivity of OCL as a language, any type of restriction (business rule) can be created.
Content of this guide
The purpose of this guide is to provide all necessary information to write business rules with OCL.
The guide consists of following parts:
In addition, following reference is included
- Available methods for OCL base types
- Example OCL rules
- Example action rules
- Mapping between schema datatypes and OCL datatypes
The collection of rules in example rules written in OCL should already help a lot when implementing new rules, as it includes examples of "real world" usage of business rules in payment messages. A more detailed usage for all available methods is listed in available methods of OCL base types.
List of all available data types in XML schemas mapped to OCL data types states how different data types are interpreted by OCL.
Multiple pages within this section use a specifc pre-made schema as a reference to explain logic of rules. The schema and an example file is attached on this page. Below is a screenshot of the reference schema
External links and further reading
Please note that this section of the wiki only focused on OCL as a language to depict rules. XMLdation offers a tool for writing and maintaining business rules in OCL language in a tool called myXML. User guide on how to use myXML is also available in a separate wiki section.
Other sources providing information regarding OCL are below:
OCL Rule User Guide, by Nomos Software, 2015
OCL Quick Reference, by Eoin Woods, July 2005
OCL Operations Reference, by Eclipse Foundation