Primitive Types
Overview
This section describes primitive types assumed by all openEHR models. These are types supported directly by most programing languages, and usually visible via either a class interface and/or a built-in raw value type. The following table lists the primitive types assumed by openEHR.
| Type name in openEHR |
Description |
|---|---|
|
a type whose value is an 8-bit value. |
|
a type whose value is a member of an 8-bit character-set (ISO: "repertoire"). |
|
logical True/False values; usually physically represented as an integer, but need not be. |
|
32-bit integers. |
|
64-bit integers. |
|
32-bit real numbers in any interoperable representation, including single-width IEEE floating point. |
|
64-bit real numbers, in any interoperable representation including double-precision IEEE floating point. |
|
represents unicode-enabled strings. |
The figure below illustrates these types. Simple inheritance relationships are shown which facilitate the type descriptions below. Actual inheritance from or subsitutability for an Any class is not assumed, and is shown only for convenience (e.g. to indicate that the '=' operator is available on any type). The type Ordered_numeric is on the other hand is used to indicate assumed substitutability of numeric types, and is intended to be mapped to an equivalent type in a real type system (e.g. in Java, java.lang.Number). Data-oriented implementation type systems such as XML-schema do not have such operations.
base.foundation_types.primitive_types PackageUnicode
It is assumed in the openEHR specifications that Unicode is supported by the type String. Unicode is needed for all Asian, Arabic and other script languages, for both data values (particularly plain text and coded text) and for many predefined string attributes of the classes in the openEHR Reference Model. It encompasses all existing character sets. In openEHR, UTF-8 encoding is assumed.
Class Definitions
Boolean Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Boolean |
|
|---|---|---|
Description |
Class representing minimal interface of standard Boolean type. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
infix and ( |
Logical conjunction |
1..1 |
infix and_then ( |
Boolean semi-strict conjunction with other |
1..1 |
infix or ( |
Boolean disjunction with other. |
1..1 |
infix or_else ( |
Boolean semi-strict disjunction with `other'. |
1..1 |
infix xor ( |
Boolean exclusive or with `other'. |
1..1 |
infix implies ( |
Boolean implication of `other' (semi-strict) |
Invariants |
Involutive_negation: |
|
Non_contradiction: |
||
Completeness: |
||
| Boolean | |||
|---|---|---|---|
Class representing minimal interface of standard Boolean type. |
|||
Inherits: Any |
|||
Functions |
|||
Value equality. |
|||
Reference equality. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|||
infix and ( |
Logical conjunction |
||
infix and_then ( |
Boolean semi-strict conjunction with other |
||
infix or ( |
Boolean disjunction with other. |
||
infix or_else ( |
Boolean semi-strict disjunction with `other'. |
||
infix xor ( |
Boolean exclusive or with `other'. |
||
infix implies ( |
Boolean implication of `other' (semi-strict) |
||
Invariants |
|||
Involutive_negation: |
|||
Non_contradiction: |
|||
Completeness: |
|||
{
"name": "Boolean",
"documentation": "Class representing minimal interface of standard Boolean type.",
"ancestors": [
"Any"
],
"functions": {
"infix and": {
"name": "infix and",
"documentation": "Logical conjunction",
"parameters": {
"other": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "other",
"type": "Boolean"
}
},
"post_conditions": {
"Post_de_Morgan": "Result = not (not self or not other)",
"Post_commutative": "Result = (other and self)"
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"infix and_then": {
"name": "infix and_then",
"documentation": "Boolean semi-strict conjunction with other",
"parameters": {
"other": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "other",
"type": "Boolean"
}
},
"post_conditions": {
"Post_de_Morgan": "Result = not (not self or else not other)"
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"infix or": {
"name": "infix or",
"documentation": "Boolean disjunction with other.",
"parameters": {
"other": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "other",
"type": "Boolean"
}
},
"post_conditions": {
"Post_de_Morgan": "Result = not (not self and not other)",
"Post_commutative": "Result = (other or Current)",
"Post_consistent_with_semi_strict": "Result implies (self or else other)"
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"infix or_else": {
"name": "infix or_else",
"documentation": "Boolean semi-strict disjunction with `other'.",
"parameters": {
"other": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "other",
"type": "Boolean"
}
},
"post_conditions": {
"Post_de_Morgan": "Result = not (not self and then not other)"
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"infix xor": {
"name": "infix xor",
"documentation": "Boolean exclusive or with `other'.",
"parameters": {
"other": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "other",
"type": "Boolean"
}
},
"post_conditions": {
"Post_definition": "Result = ((self or other) and not (self and other))"
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"infix implies": {
"name": "infix implies",
"documentation": "Boolean implication of `other' (semi-strict)",
"parameters": {
"other": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "other",
"type": "Boolean"
}
},
"post_conditions": {
"Post_definition": "Result = (not self or else other)"
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
}
},
"invariants": {
"Involutive_negation": "is_equal (not (not self))",
"Non_contradiction": "not (self and (not self))",
"Completeness": "self or else (not self)"
}
}
Ordered Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Ordered (abstract) |
|
|---|---|---|
Description |
Abstract notional parent class of ordered, types i.e. types on which the ‘<‘ operator is defined. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability. |
|
| Ordered (abstract) | |||
|---|---|---|---|
Abstract notional parent class of ordered, types i.e. types on which the ‘<‘ operator is defined. |
|||
Inherits: Any |
|||
Functions |
|||
Value equality. |
|||
Reference equality. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|||
Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability. |
|||
{
"name": "Ordered",
"documentation": "Abstract notional parent class of ordered, types i.e. types on which the ‘<‘ operator is defined.",
"is_abstract": true,
"ancestors": [
"Any"
],
"functions": {
"infix <": {
"name": "infix <",
"documentation": "Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability.",
"is_abstract": true,
"parameters": {
"other": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "other",
"type": "Ordered"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
}
}
}
Character Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Character |
|
|---|---|---|
Inherit |
||
| Character | |||
|---|---|---|---|
Functions |
|||
Value equality. |
|||
Reference equality. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|||
Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability. |
|||
{
"name": "Character",
"ancestors": [
"Ordered"
]
}
Octet Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Octet |
|
|---|---|---|
Inherit |
||
| Octet | |||
|---|---|---|---|
Functions |
|||
Value equality. |
|||
Reference equality. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|||
Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability. |
|||
{
"name": "Octet",
"ancestors": [
"Ordered"
]
}
String Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
String |
|
|---|---|---|
Description |
Strings of characters, as used to represent textual data in any natural or formal language. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
Concatenation operator - causes ‘other’ to be appended to this string. |
|
1..1 |
is_empty (): |
True if string is empty, i.e. equal to "". |
1..1 |
is_integer (): |
True if string can be parsed as an integer. |
1..1 |
as_integer (): |
Return the integer corresponding to the integer value represented in this string. |
| String | |||
|---|---|---|---|
Strings of characters, as used to represent textual data in any natural or formal language. |
|||
Functions |
|||
Value equality. |
|||
Reference equality. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|||
Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability. |
|||
Concatenation operator - causes ‘other’ to be appended to this string. |
|||
is_empty (): |
True if string is empty, i.e. equal to "". |
||
is_integer (): |
True if string can be parsed as an integer. |
||
as_integer (): |
Return the integer corresponding to the integer value represented in this string. |
||
{
"name": "String",
"documentation": "Strings of characters, as used to represent textual data in any natural or formal language.",
"ancestors": [
"Ordered"
],
"functions": {
"infix +": {
"name": "infix +",
"documentation": "Concatenation operator - causes ‘other’ to be appended to this string.",
"parameters": {
"other": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "other",
"type": "String"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "String"
}
},
"is_empty": {
"name": "is_empty",
"documentation": "True if string is empty, i.e. equal to \"\".",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"is_integer": {
"name": "is_integer",
"documentation": "True if string can be parsed as an integer.",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"as_integer": {
"name": "as_integer",
"documentation": "Return the integer corresponding to the integer value represented in this string.",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Integer"
}
}
}
}
Uri Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Uri |
|
|---|---|---|
Inherit |
||
| Uri | |||
|---|---|---|---|
Functions |
|||
Value equality. |
|||
Reference equality. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|||
Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability. |
|||
Concatenation operator - causes ‘other’ to be appended to this string. |
|||
is_empty (): |
True if string is empty, i.e. equal to "". |
||
is_integer (): |
True if string can be parsed as an integer. |
||
as_integer (): |
Return the integer corresponding to the integer value represented in this string. |
||
{
"name": "Uri",
"ancestors": [
"String"
]
}
Numeric Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Numeric (abstract) |
|
|---|---|---|
Description |
Abstract notional parent class of numeric types, which are types which have various arithmetic and comparison operators defined. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
Product by `other'. Actual type of result depends on arithmetic balancing rules. |
|
1..1 |
Sum with `other' (commutative). Actual type of result depends on arithmetic balancing rules. |
|
1..1 |
Result of subtracting `other'. Actual type of result depends on arithmetic balancing rules. |
|
| Numeric (abstract) | |||
|---|---|---|---|
Abstract notional parent class of numeric types, which are types which have various arithmetic and comparison operators defined. |
|||
Inherits: Any |
|||
Functions |
|||
Value equality. |
|||
Reference equality. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|||
Product by `other'. Actual type of result depends on arithmetic balancing rules. |
|||
Sum with `other' (commutative). Actual type of result depends on arithmetic balancing rules. |
|||
Result of subtracting `other'. Actual type of result depends on arithmetic balancing rules. |
|||
{
"name": "Numeric",
"documentation": "Abstract notional parent class of numeric types, which are types which have various arithmetic and comparison operators defined.",
"is_abstract": true,
"ancestors": [
"Any"
],
"functions": {
"infix *": {
"name": "infix *",
"documentation": "Product by `other'. Actual type of result depends on arithmetic balancing rules.",
"is_abstract": true,
"parameters": {
"other": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "other",
"type": "Numeric"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Numeric"
}
},
"infix +": {
"name": "infix +",
"documentation": "Sum with `other' (commutative). Actual type of result depends on arithmetic balancing rules.",
"is_abstract": true,
"parameters": {
"other": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "other",
"type": "Numeric"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Numeric"
}
},
"infix -": {
"name": "infix -",
"documentation": "Result of subtracting `other'. Actual type of result depends on arithmetic balancing rules.",
"is_abstract": true,
"parameters": {
"other": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "other",
"type": "Numeric"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Numeric"
}
}
}
}
Ordered_Numeric Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Ordered_Numeric (abstract) |
|
|---|---|---|
Description |
Abstract notional parent class of ordered, numeric types, which are types with ‘<‘ and arithmetic operators defined. |
|
Inherit |
||
| Ordered_Numeric (abstract) | |||
|---|---|---|---|
Abstract notional parent class of ordered, numeric types, which are types with ‘<‘ and arithmetic operators defined. |
|||
Functions |
|||
Value equality. |
|||
Reference equality. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|||
Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability. |
|||
Product by `other'. Actual type of result depends on arithmetic balancing rules. |
|||
Sum with `other' (commutative). Actual type of result depends on arithmetic balancing rules. |
|||
Result of subtracting `other'. Actual type of result depends on arithmetic balancing rules. |
|||
{
"name": "Ordered_Numeric",
"documentation": "Abstract notional parent class of ordered, numeric types, which are types with ‘<‘ and arithmetic operators defined.",
"is_abstract": true,
"ancestors": [
"Ordered",
"Numeric"
]
}
Integer Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Integer |
|
|---|---|---|
Description |
Class representing minimal interface of standard Integer type. |
|
Inherit |
||
| Integer | |||
|---|---|---|---|
Class representing minimal interface of standard Integer type. |
|||
Inherits: Any, Any, Ordered, Numeric, Ordered_Numeric |
|||
Functions |
|||
Value equality. |
|||
Reference equality. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|||
Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability. |
|||
Product by `other'. Actual type of result depends on arithmetic balancing rules. |
|||
Sum with `other' (commutative). Actual type of result depends on arithmetic balancing rules. |
|||
Result of subtracting `other'. Actual type of result depends on arithmetic balancing rules. |
|||
{
"name": "Integer",
"documentation": "Class representing minimal interface of standard Integer type.",
"ancestors": [
"Ordered_Numeric"
]
}
Integer64 Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Integer64 |
|
|---|---|---|
Description |
Class representing minimal interface of standard Integer64 type. |
|
Inherit |
||
| Integer64 | |||
|---|---|---|---|
Class representing minimal interface of standard Integer64 type. |
|||
Inherits: Any, Any, Ordered, Numeric, Ordered_Numeric |
|||
Functions |
|||
Value equality. |
|||
Reference equality. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|||
Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability. |
|||
Product by `other'. Actual type of result depends on arithmetic balancing rules. |
|||
Sum with `other' (commutative). Actual type of result depends on arithmetic balancing rules. |
|||
Result of subtracting `other'. Actual type of result depends on arithmetic balancing rules. |
|||
{
"name": "Integer64",
"documentation": "Class representing minimal interface of standard Integer64 type.",
"ancestors": [
"Ordered_Numeric"
]
}
Real Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Real |
|
|---|---|---|
Description |
Type used to represent decimal numbers. Corresponds to a single-precision floating point value in most languages. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
floor (): |
Return the greatest integer no greater than the value of this object. |
| Real | |||
|---|---|---|---|
Type used to represent decimal numbers. Corresponds to a single-precision floating point value in most languages. |
|||
Inherits: Any, Any, Ordered, Numeric, Ordered_Numeric |
|||
Functions |
|||
Value equality. |
|||
Reference equality. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|||
Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability. |
|||
Product by `other'. Actual type of result depends on arithmetic balancing rules. |
|||
Sum with `other' (commutative). Actual type of result depends on arithmetic balancing rules. |
|||
Result of subtracting `other'. Actual type of result depends on arithmetic balancing rules. |
|||
floor (): |
Return the greatest integer no greater than the value of this object. |
||
{
"name": "Real",
"documentation": "Type used to represent decimal numbers. Corresponds to a single-precision floating point value in most languages.",
"ancestors": [
"Ordered_Numeric"
],
"functions": {
"floor": {
"name": "floor",
"documentation": "Return the greatest integer no greater than the value of this object.",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Integer"
}
}
}
}
Double Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Double |
|
|---|---|---|
Inherit |
||
| Double | |||
|---|---|---|---|
Inherits: Any, Any, Ordered, Numeric, Ordered_Numeric |
|||
Functions |
|||
Value equality. |
|||
Reference equality. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|||
Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability. |
|||
Product by `other'. Actual type of result depends on arithmetic balancing rules. |
|||
Sum with `other' (commutative). Actual type of result depends on arithmetic balancing rules. |
|||
Result of subtracting `other'. Actual type of result depends on arithmetic balancing rules. |
|||
{
"name": "Double",
"ancestors": [
"Ordered_Numeric"
]
}