3. OCL statement
OCL rules are used to execute constraints against XML file. These rules always return a boolean value, either true or false.
OCL rules, together with context, form the core part of the business rule. It is crucial to first understand the concept of context. In short, context is set to be complex or simpleType defined in the relevant schema, and OCL-rule is ran whenver the type defined in the context is found within the XML-file.
Restriction defined in the OCL-statement returns a boolean value. Whenever false is returned, XMLdation service will return an error message to a pre-defined location within the XML-file (defined by OCL-query), with a pre-defined error message. Whenever true is returned, the restriction passes and XML file is considered valid against that rule.
OCL-queries and error messages are defined by the creator of the OCL-rule.
Rule is written so that it matches the business rule it is depicting. For example, when a business rule is:
Debtor name must be "The initiator"
OCL-restriction is written in same form, so that valid case is depicted in the rule
|OCL:||self.Debtor.Name = "The initiator"|
|Description:||Rule defines a specific value for Debtor/Name.|