The Basic Expression Object Model
Overview
The beom package defines the Basic Expression Object Model (BEOM), a model of 'statements' and 'expressions' that can be used in various contexts in openEHR, including inside archetypes and in GDL guidelines. If the Expression Language or other syntax-based artefact is used, the model described here defines the parser output in the form of an expression tree. Other openEHR models designed for a particular purpose may reuse the beom package and further specialise some of its types specifically intended for extension.
The BEOM package structure is shown below.
Core Package
The main beom packages core and extension are illustrated below.
A group of statements to be used together is formally defined as one or more STATEMENTs in a STATEMENT_SET. There are three types of statements corresponding to the classes ASSERTION, VARIABLE_DECLARATION and ASSIGNMENT. Assertions consist of an expression tree structure that evaluates to a Boolean value. The root of the tree is a descendant of the class EXPR_ITEM that represents a Boolean-returning operator or value. An Assertion has an optional tag, enabling it to be named.
A VARIABLE_DECLARATION enables a named variable to be declared with a type, which must be one of the descendants of EXPR_DEF_TYPE.
The ASSIGNMENT class defines the usual operation of assigning a value (the source i.e. the notional right-hand side) to a variable, (the target, i.e. left-hand side). The source of an assignment can be any Expression or an EXTERNAL_QUERY, which are sub-types of EXPR_VALUE.
Expressions
Expressions are fully described statement values that may be evaluated internally (as compared to an external query) and are defined by the EXPR_XXX classes. The Expression classes model a typical evaluation tree each of whose nodes is either a leaf or an operator node. The semantics of Expressions are described in the Expressions sub-section in the Language section.
In this model, function calls are treated as leaf nodes rather than tree nodes, which would be more typical of a functional language meta-model. The leaf node approach used here treats function calls as black boxes requiring an evaluation method, enabling the main expression tree to be evaluated by use of a standard set of operators whose semantics can be safely built in.
Operator semantics are defined by the class OPERATOR_DEF, which includes the two attributes name and symbols which define the name of the operator and its allowable symbols respectively.
Other Statement Elements
External Query
An EXTERNAL_QUERY is a type of expression representing a call to an external service which obtains a value for it. This enables information items from the exterior computational environment to be treated as abstract typed values within expressions.
Operators
Operators used in BEL are represented in the OPERATOR_KIND enumeration, which is shown below.
Typing
The beom.types package is shown below.
The type system of the Expression formalism is defined via the type EXPR_TYPE_DEF and its descendants. All types have a type_name and a type_anchor, which is a variable of the coresponding primtive type from within the openEHR base_types package, i.e. Integer, Real, String, etc. The type anchor can be used for testing assignments within the implementation. A special type TYPE_DEF_OBJECT is included to enable a value reference (descendant of EXPR_VALUE_REF) to refer to a complex object, to which some expression operators can be applied, including equality and existence. The types system is extensible, as described below.
Class Descriptions
TYPE_DEF_BOOLEAN Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
TYPE_DEF_BOOLEAN |
|
|---|---|---|
Description |
Rules meta-type representing the primitive type Boolean. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
type_name: |
|
1..1 |
type_anchor: `Boolean ` |
|
| TYPE_DEF_BOOLEAN | |
|---|---|
Rules meta-type representing the primitive type Boolean. |
|
Inherits: EL_TYPE_DEF |
|
Attributes |
|
type_name: |
|
type_anchor: `Boolean ` [1..1] |
|
{
"name": "TYPE_DEF_BOOLEAN",
"documentation": "Rules meta-type representing the primitive type Boolean.",
"ancestors": [
"EL_TYPE_DEF"
],
"properties": {
"type_name": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_name",
"is_mandatory": true,
"type": "String",
"default": "\"Boolean\""
},
"type_anchor": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_anchor",
"is_mandatory": true,
"type": "Boolean"
}
}
}
TYPE_DEF_INTEGER Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
TYPE_DEF_INTEGER |
|
|---|---|---|
Description |
Rules meta-type representing the primitive type Integer. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
type_name: |
|
1..1 |
type_anchor: `Integer ` |
|
| TYPE_DEF_INTEGER | |
|---|---|
Rules meta-type representing the primitive type Integer. |
|
Inherits: EL_TYPE_DEF |
|
Attributes |
|
type_name: |
|
type_anchor: `Integer ` [1..1] |
|
{
"name": "TYPE_DEF_INTEGER",
"documentation": "Rules meta-type representing the primitive type Integer.",
"ancestors": [
"EL_TYPE_DEF"
],
"properties": {
"type_name": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_name",
"is_mandatory": true,
"type": "String",
"default": "\"Integer\""
},
"type_anchor": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_anchor",
"is_mandatory": true,
"type": "Integer"
}
}
}
TYPE_DEF_REAL Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
TYPE_DEF_REAL |
|
|---|---|---|
Description |
Rules meta-type representing the primitive type Real. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
type_name: |
|
1..1 |
type_anchor: `Real ` |
|
| TYPE_DEF_REAL | |
|---|---|
Rules meta-type representing the primitive type Real. |
|
Inherits: EL_TYPE_DEF |
|
Attributes |
|
type_name: |
|
type_anchor: `Real ` [1..1] |
|
{
"name": "TYPE_DEF_REAL",
"documentation": "Rules meta-type representing the primitive type Real.",
"ancestors": [
"EL_TYPE_DEF"
],
"properties": {
"type_name": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_name",
"is_mandatory": true,
"type": "String",
"default": "\"Real\""
},
"type_anchor": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_anchor",
"is_mandatory": true,
"type": "Real"
}
}
}
TYPE_DEF_DATE Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
TYPE_DEF_DATE |
|
|---|---|---|
Description |
Rules meta-type representing the primitive type Date. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
type_name: |
|
1..1 |
type_anchor: `Any ` |
|
| TYPE_DEF_DATE | |
|---|---|
Rules meta-type representing the primitive type Date. |
|
Inherits: EL_TYPE_DEF |
|
Attributes |
|
type_name: |
|
type_anchor: `Any ` [1..1] |
|
{
"name": "TYPE_DEF_DATE",
"documentation": "Rules meta-type representing the primitive type Date.",
"ancestors": [
"EL_TYPE_DEF"
],
"properties": {
"type_name": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_name",
"is_mandatory": true,
"type": "String",
"default": "\"Date\""
},
"type_anchor": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_anchor",
"is_mandatory": true,
"type": "Any"
}
}
}
TYPE_DEF_DATE_TIME Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
TYPE_DEF_DATE_TIME |
|
|---|---|---|
Description |
Rules meta-type representing the primitive type Date_time. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
type_name: |
|
1..1 |
type_anchor: `Any ` |
|
| TYPE_DEF_DATE_TIME | |
|---|---|
Rules meta-type representing the primitive type Date_time. |
|
Inherits: EL_TYPE_DEF |
|
Attributes |
|
type_name: |
|
type_anchor: `Any ` [1..1] |
|
{
"name": "TYPE_DEF_DATE_TIME",
"documentation": "Rules meta-type representing the primitive type Date_time.",
"ancestors": [
"EL_TYPE_DEF"
],
"properties": {
"type_name": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_name",
"is_mandatory": true,
"type": "String",
"default": "\"Date_time\""
},
"type_anchor": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_anchor",
"is_mandatory": true,
"type": "Any"
}
}
}
TYPE_DEF_TIME Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
TYPE_DEF_TIME |
|
|---|---|---|
Description |
Rules meta-type representing the primitive type Time. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
type_name: |
|
1..1 |
type_anchor: `Any ` |
|
| TYPE_DEF_TIME | |
|---|---|
Rules meta-type representing the primitive type Time. |
|
Inherits: EL_TYPE_DEF |
|
Attributes |
|
type_name: |
|
type_anchor: `Any ` [1..1] |
|
{
"name": "TYPE_DEF_TIME",
"documentation": "Rules meta-type representing the primitive type Time.",
"ancestors": [
"EL_TYPE_DEF"
],
"properties": {
"type_name": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_name",
"is_mandatory": true,
"type": "String",
"default": "\"Time\""
},
"type_anchor": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_anchor",
"is_mandatory": true,
"type": "Any"
}
}
}
TYPE_DEF_DURATION Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
TYPE_DEF_DURATION |
|
|---|---|---|
Description |
Rules meta-type representing the primitive type Duration. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
type_name: |
|
1..1 |
type_anchor: `Any ` |
|
| TYPE_DEF_DURATION | |
|---|---|
Rules meta-type representing the primitive type Duration. |
|
Inherits: EL_TYPE_DEF |
|
Attributes |
|
type_name: |
|
type_anchor: `Any ` [1..1] |
|
{
"name": "TYPE_DEF_DURATION",
"documentation": "Rules meta-type representing the primitive type Duration.",
"ancestors": [
"EL_TYPE_DEF"
],
"properties": {
"type_name": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_name",
"is_mandatory": true,
"type": "String",
"default": "\"Duration\""
},
"type_anchor": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_anchor",
"is_mandatory": true,
"type": "Any"
}
}
}
TYPE_DEF_STRING Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
TYPE_DEF_STRING |
|
|---|---|---|
Description |
Rules meta-type representing the primitive type String. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
type_name: |
|
1..1 |
type_anchor: `String ` |
|
| TYPE_DEF_STRING | |
|---|---|
Rules meta-type representing the primitive type String. |
|
Inherits: EL_TYPE_DEF |
|
Attributes |
|
type_name: |
|
type_anchor: `String ` [1..1] |
|
{
"name": "TYPE_DEF_STRING",
"documentation": "Rules meta-type representing the primitive type String.",
"ancestors": [
"EL_TYPE_DEF"
],
"properties": {
"type_name": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_name",
"is_mandatory": true,
"type": "String",
"default": "\"String\""
},
"type_anchor": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_anchor",
"is_mandatory": true,
"type": "String"
}
}
}
TYPE_DEF_URI Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
TYPE_DEF_URI |
|
|---|---|---|
Description |
Rules meta-type representing the primitive type Uri. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
type_name: |
|
1..1 |
type_anchor: `Integer ` |
|
| TYPE_DEF_URI | |
|---|---|
Rules meta-type representing the primitive type Uri. |
|
Inherits: EL_TYPE_DEF |
|
Attributes |
|
type_name: |
|
type_anchor: `Integer ` [1..1] |
|
{
"name": "TYPE_DEF_URI",
"documentation": "Rules meta-type representing the primitive type Uri.",
"ancestors": [
"EL_TYPE_DEF"
],
"properties": {
"type_name": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_name",
"is_mandatory": true,
"type": "String",
"default": "\"Uri\""
},
"type_anchor": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_anchor",
"is_mandatory": true,
"type": "Integer"
}
}
}
TYPE_DEF_TERMINOLOGY_CODE Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
TYPE_DEF_TERMINOLOGY_CODE |
|
|---|---|---|
Description |
Rules meta-type representing the primitive type Terminology_code. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
type_name: |
|
1..1 |
type_anchor: `Terminology_code ` |
|
| TYPE_DEF_TERMINOLOGY_CODE | |
|---|---|
Rules meta-type representing the primitive type Terminology_code. |
|
Inherits: EL_TYPE_DEF |
|
Attributes |
|
type_name: |
|
type_anchor: `Terminology_code ` [1..1] |
|
{
"name": "TYPE_DEF_TERMINOLOGY_CODE",
"documentation": "Rules meta-type representing the primitive type Terminology_code.",
"ancestors": [
"EL_TYPE_DEF"
],
"properties": {
"type_name": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_name",
"is_mandatory": true,
"type": "String",
"default": "\"Terminology_code\""
},
"type_anchor": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_anchor",
"is_mandatory": true,
"type": "Terminology_code"
}
}
}
TYPE_DEF_OBJECT_REF Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
TYPE_DEF_OBJECT_REF |
|
|---|---|---|
Description |
Rules meta-type representing the type Object_ref, which is assumed to by the type of any non-primitive reference target within a rule. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
type_name: |
|
| TYPE_DEF_OBJECT_REF | |
|---|---|
Rules meta-type representing the type Object_ref, which is assumed to by the type of any non-primitive reference target within a rule. |
|
Inherits: EL_TYPE_DEF |
|
Attributes |
|
type_name: |
|
type_anchor: `Any ` [1..1] |
Attribute of the openEHR primitive type (or Any) corresponding to this type definition meta-type. |
{
"name": "TYPE_DEF_OBJECT_REF",
"documentation": "Rules meta-type representing the type Object_ref, which is assumed to by the type of any non-primitive reference target within a rule.",
"ancestors": [
"EL_TYPE_DEF"
],
"properties": {
"type_name": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type_name",
"is_mandatory": true,
"type": "String",
"default": "\"Object_ref\""
}
}
}