The Rules Package

Overview

The AOM rules package builds upon a subset of the BASE::org::openehr::statement package described in the openEHR Expression Language specification, and adds a small number of classes to express leaf reference types specific to archetypes. This enables assertions to be stated within archetypes using archetype paths as values and also the matches operator and C_PRIMITIVE_OBJECT constraints.

Assertions can be used in two places in archetypes. The first is the use of expressions to express archetype slot constraints in instances of the ARCHETYPE_SLOT class (includes and excludes attributes). The second place is in the archetype rules section, where both variable declarataions and assertions are used to express object constraints ranging across multiple nodes, i.e. constraints that can’t be expressed 'inline' within the main definition section structure. In both of these places, their role is to constrain something inside the current archetype. Constraints on external resources such as terminologies are expressed in the constraint binding part in the archetype terminology, described in the [Terminology Package] section. The assertion package is illustrated below.

AOM rules
Figure 1. Rules Package

Semantics

Archetype assertions are expressions which may contain the following elements:

  • constants:

    • primitive values: including the date/time types;

    • constraints operands, i.e. C_PRIMITIVE_OBJECT instances, used as arguments to the matches operator;

    • archetype id constraints, i.e. C_STRING instances representing possible archetype identifiers, used in slot constraints.

  • any of the openEHR rules operators, i.e.:

    • arithmetic operators: +, *, -, /, ^ (exponent), % (modulo division)

    • relational operators: >, <, >=, <=, =, !=;

    • boolean operators: not, and, or, xor;

    • quantifiers applied to container variables: for_all, exists;

  • functions e.g. basic arithmetic, trigonometric and other functions;

  • the following additional semantics:

    • references to archetyped values in data, specified by archetype paths;

Variables, assignments, and external queries as described in the main openEHR Rules language are not allowed.

Class Descriptions

The following classes augment the core model described in the openEHR Expression Language specification.

Unresolved include directive in modules/AOM2/pages/rules_package.adoc - include::ROOT:partial$classes/aom2.expr_constraint.adoc[] Unresolved include directive in modules/AOM2/pages/rules_package.adoc - include::ROOT:partial$classes/aom2.expr_archetype_id_constraint.adoc[] Unresolved include directive in modules/AOM2/pages/rules_package.adoc - include::ROOT:partial$classes/aom2.expr_archetype_ref.adoc[]