The Rules Package

The AOM rules package makes use of the org.openehr.lang.beom package described in the openEHR Basic Expression Language (BEL) specification and adds a small number of other classes to support two needs in the AOM:

  • representation of the assertions within ARCHETYPE_SLOT (i.e. the 'includes' and 'excludes'), which are concretely regex pattern matchers for Archetype Ids;

  • representation of statements within the rules section of an archetype.

The AOM rules package is illustrated below.

AM aom2.rules
Figure 1. am.aom2.rules Package

Archetype Slot Assertions

The ARCHETYPE_SLOT class contains includes and excludes attributes, which are constraints on archetypes allowed to populate the slot location at run-time. These are represented by ASSERTIONs containing expressions of the form:

archetype_path matches Archetype-id-regex-matcher

These are represented by the structure EXPR_ARCHETYPE_REF matches EXPR_ARCHETYPE_ID_CONSTRAINT.

Archetype Rules

The rules section of an archetype may contain various kinds of statements that may be used to express constraints ranging across multiple nodes, i.e. constraints that can’t be expressed inline within the main definition section structure. The Basic Expression Language enables the representation of the following kinds of statements in an archetype:

  • declarations of variables;

  • assignments of expression results to variables;

  • assertions of values.

Expressions (i.e. evaluable value-returning operations, function calls etc) appear within assignments and assertions. Within these expressions, two kinds of entity are needed that are not directly supported by the expression meta-types defined in the lang.beom package, as follows:

  • instances of EXPR_ARCHETYPE_REF to express archetype paths as proxies for runtime value references, and;

  • C_PRIMITIVE_OBJECT constraints as Boolean-valued sub-expressions.

The first of these allows a path reference to a leaf in an archetype (e.g. systolic blood pressure) to be used as a special kind of variable whose value can be replaced at runtime by all instances that are found at that archetype path in the data.

The second allows typical archetype constraints of the form value matches value_constraint to be used inline in expressions. This facilitates the representation of common expressions of this form within larger rules, e.g. /path/to/systolic/pressure matches {|140..160|}.

Class Descriptions

EXPR_CONSTRAINT Class

  • Definition

  • Effective

  • BMM

  • UML

Class

EXPR_CONSTRAINT

Description

Expression tree leaf item representing a constraint on a primitive type, expressed in the form of a concrete subtype of C_PRIMITIVE_OBJECT.

Inherit

`EXPR_LEAF `

Attributes

Signature

Meaning

1..1

item: C_PRIMITIVE_OBJECT

The constraint.

EXPR_CONSTRAINT

Expression tree leaf item representing a constraint on a primitive type, expressed in the form of a concrete subtype of C_PRIMITIVE_OBJECT.

Inherits: EXPR_LEAF

Attributes

item: C_PRIMITIVE_OBJECT [1..1]

The constraint.

{
    "name": "EXPR_CONSTRAINT",
    "documentation": "Expression tree leaf item representing a constraint on a primitive type, expressed in the form of a concrete subtype of C_PRIMITIVE_OBJECT.",
    "ancestors": [
        "EXPR_LEAF"
    ],
    "properties": {
        "item": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "item",
            "documentation": "The constraint.",
            "is_mandatory": true,
            "type": "C_PRIMITIVE_OBJECT"
        }
    }
}
EXPR_CONSTRAINT

EXPR_ARCHETYPE_ID_CONSTRAINT Class

  • Definition

  • Effective

  • BMM

  • UML

Class

EXPR_ARCHETYPE_ID_CONSTRAINT

Description

Expression tree leaf item representing a constraint on an archetype identifier.

Inherit

EXPR_CONSTRAINT

Attributes

Signature

Meaning

1..1
(redefined)

item: C_STRING

A C_STRING representing a regular expression for matching Archetype identifiers.

EXPR_ARCHETYPE_ID_CONSTRAINT

Expression tree leaf item representing a constraint on an archetype identifier.

Inherits: EXPR_LEAF , EXPR_CONSTRAINT

Attributes

item: C_STRING [1..1]

A C_STRING representing a regular expression for matching Archetype identifiers.

{
    "name": "EXPR_ARCHETYPE_ID_CONSTRAINT",
    "documentation": "Expression tree leaf item representing a constraint on an archetype identifier.",
    "ancestors": [
        "EXPR_CONSTRAINT"
    ],
    "properties": {
        "item": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "item",
            "documentation": "A C_STRING representing a regular expression for matching Archetype identifiers.",
            "is_mandatory": true,
            "type": "C_STRING"
        }
    }
}
EXPR_ARCHETYPE_ID_CONSTRAINT

EXPR_ARCHETYPE_REF Class

  • Definition

  • Effective

  • BMM

  • UML

Class

EXPR_ARCHETYPE_REF

Description

Expression tree leaf item representing a reference to a value found in data at a location specified by a path in the archetype definition.

  • A path referring to a value in the archetype (paths with a leading ‘/’ are in the definition section.

  • Paths with no leading ‘/’ are in the outer part of the archetype, e.g. “archetype_id/value” refers to the String value of the archetype_id attribute of the enclosing archetype.

Inherit

`EXPR_VALUE_REF `

Attributes

Signature

Meaning

1..1

path: String

The path to the archetype node.

1..1

item: ARCHETYPE_CONSTRAINT

EXPR_ARCHETYPE_REF

Expression tree leaf item representing a reference to a value found in data at a location specified by a path in the archetype definition.

  • A path referring to a value in the archetype (paths with a leading ‘/’ are in the definition section.

  • Paths with no leading ‘/’ are in the outer part of the archetype, e.g. “archetype_id/value” refers to the String value of the archetype_id attribute of the enclosing archetype.

Inherits: EXPR_VALUE_REF

Attributes

path: String [1..1]

The path to the archetype node.

item: ARCHETYPE_CONSTRAINT [1..1]

{
    "name": "EXPR_ARCHETYPE_REF",
    "documentation": "Expression tree leaf item representing a reference to a value found in data at a location specified by a path in the archetype definition.\n\n* A path referring to a value in the archetype (paths with a leading ‘/’ are in the definition section.\n* Paths with no leading ‘/’ are in the outer part of the archetype, e.g. “archetype_id/value” refers to the String value of the archetype_id attribute of the enclosing archetype.\n",
    "ancestors": [
        "EXPR_VALUE_REF"
    ],
    "properties": {
        "path": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "path",
            "documentation": "The path to the archetype node.",
            "is_mandatory": true,
            "type": "String"
        },
        "item": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "item",
            "is_mandatory": true,
            "type": "ARCHETYPE_CONSTRAINT"
        }
    }
}
EXPR_ARCHETYPE_REF