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
rulessection of an archetype.
The AOM rules package is illustrated below.
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_REFto express archetype paths as proxies for runtime value references, and; -
C_PRIMITIVE_OBJECTconstraints 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 |
||
Attributes |
Signature |
Meaning |
1..1 |
item: |
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_VALUE, EXPRESSION, EXPR_LEAF |
|
Attributes |
|
item: |
The constraint. |
Functions |
|
(abstract) EXPR_VALUE.value (): |
The computed value of this node as a result of the nodes below it, for operator nodes, or else statically set or otherwise derived values. |
(abstract) EXPRESSION.type (): |
The primitive type of this node, which must be determined by redefinitions in concrete classes. |
{
"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_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 |
||
Attributes |
Signature |
Meaning |
1..1 |
item: |
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_VALUE, EXPRESSION, EXPR_LEAF, EXPR_CONSTRAINT |
|
Attributes |
|
item: |
A C_STRING representing a regular expression for matching Archetype identifiers. |
Functions |
|
(abstract) EXPR_VALUE.value (): |
The computed value of this node as a result of the nodes below it, for operator nodes, or else statically set or otherwise derived values. |
(abstract) EXPRESSION.type (): |
The primitive type of this node, which must be determined by redefinitions in concrete classes. |
{
"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_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.
|
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
path: |
The path to the archetype node. |
1..1 |
item: |
|
| 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.
|
|
Inherits: EXPR_VALUE, EXPRESSION, EXPR_LEAF, EXPR_VALUE_REF |
|
Attributes |
|
item: |
|
path: |
The path to the archetype node. |
Functions |
|
(abstract) EXPR_VALUE.value (): |
The computed value of this node as a result of the nodes below it, for operator nodes, or else statically set or otherwise derived values. |
(abstract) EXPRESSION.type (): |
The primitive type of this node, which must be determined by redefinitions in concrete classes. |
{
"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"
}
}
}