Structure Types
Overview
The types described in this section are basic data structures assumed to be standardly available in implementation technologies. The following types consititute the minimum set of structure types assumed by openEHR of an implementation environment.
| Type name in openEHR |
Description |
|---|---|
|
physical container of items indexed by number |
|
container of items, implied order, non-unique membership |
|
container of items, no order, unique membership |
|
a table of values of any type V, keyed by values of any |
The following UML diagram illustrates the base.foundation_types.structures package. As with the primitive types, inheritance and abstract classes are used for convenience of the definitions in openEHR models, but are not assumed to exist in exactly the same way within implementation technologies. Hence, in an implementation, various workarounds or equivalences may be needed to obtain the defined semantics.
base.foundation_types.structures packageClass Definitions
Container Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Container<T> (abstract) |
|
|---|---|---|
Description |
Abstract ancestor of container types whose items are addressable in some way. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
has ( |
Test for membership of a value. |
1..1 |
count (): |
Number of items in container. |
1..1 |
is_empty (): |
True if container is empty. |
| Container<T> (abstract) | |||
|---|---|---|---|
Abstract ancestor of container types whose items are addressable in some way. |
|||
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>". |
|||
(abstract) has ( |
Test for membership of a value. |
||
(abstract) count (): |
Number of items in container. |
||
(abstract) is_empty (): |
True if container is empty. |
||
{
"name": "Container",
"documentation": "Abstract ancestor of container types whose items are addressable in some way.",
"is_abstract": true,
"ancestors": [
"Any"
],
"generic_parameter_defs": {
"T": {
"name": "T",
"conforms_to_type": "Any"
}
},
"functions": {
"has": {
"name": "has",
"documentation": "Test for membership of a value.",
"is_abstract": true,
"parameters": {
"v": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER_OPEN",
"name": "v",
"type": "T"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"count": {
"name": "count",
"documentation": "Number of items in container.",
"is_abstract": true,
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Integer"
}
},
"is_empty": {
"name": "is_empty",
"documentation": "True if container is empty.",
"is_abstract": true,
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
}
}
}
List Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
List<T> |
|
|---|---|---|
Description |
Ordered container that may contain duplicates. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
first (): |
Return first element. |
1..1 |
last (): |
Return last element. |
Invariants |
First_validity: |
|
Last_validity: |
||
| List<T> | |||
|---|---|---|---|
Ordered container that may contain duplicates. |
|||
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>". |
|||
(abstract) has ( |
Test for membership of a value. |
||
(abstract) count (): |
Number of items in container. |
||
(abstract) is_empty (): |
True if container is empty. |
||
first (): |
Return first element. |
||
last (): |
Return last element. |
||
Invariants |
|||
First_validity: |
|||
Last_validity: |
|||
{
"name": "List",
"documentation": "Ordered container that may contain duplicates.",
"ancestors": [
"Container"
],
"generic_parameter_defs": {
"T": {
"name": "T",
"conforms_to_type": "Any"
}
},
"functions": {
"first": {
"name": "first",
"documentation": "Return first element.",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "T"
}
},
"last": {
"name": "last",
"documentation": "Return last element.",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "T"
}
}
},
"invariants": {
"First_validity": "not is_empty implies first /= Void",
"Last_validity": "not is_empty implies last /= Void"
}
}
Set Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Set<T> |
|
|---|---|---|
Description |
Unordered container that may not contain duplicates. |
|
Inherit |
||
| Set<T> | |||
|---|---|---|---|
Unordered container that may not contain duplicates. |
|||
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>". |
|||
(abstract) has ( |
Test for membership of a value. |
||
(abstract) count (): |
Number of items in container. |
||
(abstract) is_empty (): |
True if container is empty. |
||
{
"name": "Set",
"documentation": "Unordered container that may not contain duplicates.",
"ancestors": [
"Container"
],
"generic_parameter_defs": {
"T": {
"name": "T",
"conforms_to_type": "Any"
}
}
}
Array Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Array<T> |
|
|---|---|---|
Description |
Container whose storage is assumed to be contiguous. |
|
Inherit |
||
| Array<T> | |||
|---|---|---|---|
Container whose storage is assumed to be contiguous. |
|||
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>". |
|||
(abstract) has ( |
Test for membership of a value. |
||
(abstract) count (): |
Number of items in container. |
||
(abstract) is_empty (): |
True if container is empty. |
||
{
"name": "Array",
"documentation": "Container whose storage is assumed to be contiguous.",
"ancestors": [
"Container"
],
"generic_parameter_defs": {
"T": {
"name": "T",
"conforms_to_type": "Any"
}
}
}
Hash Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Hash<K,V> |
|
|---|---|---|
Description |
Type representing a keyed table of values. V is the value type, and K the type of the keys. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
has_key ( |
Test for membership of a key. |
1..1 |
item ( |
Return item for key a_key'. |
| Hash<K,V> | |||
|---|---|---|---|
Type representing a keyed table of values. V is the value type, and K the type of the keys. |
|||
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>". |
|||
(abstract) has ( |
Test for membership of a value. |
||
(abstract) count (): |
Number of items in container. |
||
(abstract) is_empty (): |
True if container is empty. |
||
has_key ( |
Test for membership of a key. |
||
item ( |
Return item for key a_key'. |
||
{
"name": "Hash",
"documentation": "Type representing a keyed table of values. V is the value type, and K the type of the keys. ",
"ancestors": [
"Container"
],
"generic_parameter_defs": {
"K": {
"name": "K",
"conforms_to_type": "Ordered"
},
"V": {
"name": "V"
}
},
"functions": {
"has_key": {
"name": "has_key",
"documentation": "Test for membership of a key.",
"parameters": {
"a_key": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER_OPEN",
"name": "a_key",
"type": "K"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"item": {
"name": "item",
"documentation": "Return item for key a_key'.",
"parameters": {
"a_key": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER_OPEN",
"name": "a_key",
"type": "K"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "V"
}
}
}
}