Structure Types
Overview
The types described in this section are basic data structures assumed to be standard available in implementation technologies. The following types constitute 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. |
1..1 |
there_exists alias "there exists", "∃" ( |
Existential quantifier applied to container, taking one agent argument |
1..1 |
for_all alias "for all", "∀" ( |
Universal quantifier applied to container, taking one agent argument |
0..1 |
matching ( |
Return a List all items matching the predicate function |
0..1 |
select ( |
Return first item matching the predicate function |
| Container<T> (abstract) | |||
|---|---|---|---|
Abstract ancestor of container types whose items are addressable in some way. |
|||
Inherits: Any |
|||
Functions |
|||
Value equality: return True if Parameters
|
|||
Reference equality for reference types, value equality for value types. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in |
|||
Any.not_equal alias "!=", "≠" ( |
True if current object not equal to |
||
(abstract) has ( |
Test for membership of a value. |
||
(abstract) count (): |
Number of items in container. |
||
(abstract) is_empty (): |
True if container is empty. |
||
there_exists alias "there exists", "∃" ( |
Existential quantifier applied to container, taking one agent argument |
||
for_all alias "for all", "∀" ( |
Universal quantifier applied to container, taking one agent argument |
||
matching ( |
Return a List all items matching the predicate function |
||
select ( |
Return first item matching the predicate function |
||
{
"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"
}
},
"there_exists": {
"name": "there_exists",
"aliases": [
"there exists",
"∃"
],
"documentation": "Existential quantifier applied to container, taking one agent argument `_test_` whose signature is `(v:T): Boolean`.",
"parameters": {
"test": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "test",
"type": "Operation"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"for_all": {
"name": "for_all",
"aliases": [
"for all",
"∀"
],
"documentation": "Universal quantifier applied to container, taking one agent argument `_test_` whose signature is `(v:T): Boolean`.",
"parameters": {
"test": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "test",
"type": "Operation"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"matching": {
"name": "matching",
"documentation": "Return a List all items matching the predicate function `_test_` which has signature `(v:T): Boolean`. If no matches, an empty List is returned.",
"parameters": {
"test": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "test",
"type": "Operation"
}
},
"result": {
"_type": "P_BMM_CONTAINER_TYPE",
"container_type": "List",
"type": "T"
},
"is_nullable": true
},
"select": {
"name": "select",
"documentation": "Return first item matching the predicate function `_test_` which has signature `(v:T): Boolean`, or Void if no match.",
"parameters": {
"test": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "test",
"type": "Operation"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "T"
},
"is_nullable": true
}
}
}
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: return True if Parameters
|
|||
Reference equality for reference types, value equality for value types. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in |
|||
Any.not_equal alias "!=", "≠" ( |
True if current object not equal to |
||
Test for membership of a value. |
|||
Number of items in container. |
|||
True if container is empty. |
|||
Container.there_exists alias "there exists", "∃" ( |
Existential quantifier applied to container, taking one agent argument |
||
Container.for_all alias "for all", "∀" ( |
Universal quantifier applied to container, taking one agent argument |
||
Return a List all items matching the predicate function |
|||
Container.select ( |
Return first item matching the predicate function |
||
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: return True if Parameters
|
|||
Reference equality for reference types, value equality for value types. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in |
|||
Any.not_equal alias "!=", "≠" ( |
True if current object not equal to |
||
Test for membership of a value. |
|||
Number of items in container. |
|||
True if container is empty. |
|||
Container.there_exists alias "there exists", "∃" ( |
Existential quantifier applied to container, taking one agent argument |
||
Container.for_all alias "for all", "∀" ( |
Universal quantifier applied to container, taking one agent argument |
||
Return a List all items matching the predicate function |
|||
Container.select ( |
Return first item matching the predicate function |
||
{
"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 |
||
Functions |
Signature |
Meaning |
1..1 |
item alias "[]" ( |
Return item for key |
| Array<T> | |||
|---|---|---|---|
Container whose storage is assumed to be contiguous. |
|||
Functions |
|||
Value equality: return True if Parameters
|
|||
Reference equality for reference types, value equality for value types. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in |
|||
Any.not_equal alias "!=", "≠" ( |
True if current object not equal to |
||
Test for membership of a value. |
|||
Number of items in container. |
|||
True if container is empty. |
|||
Container.there_exists alias "there exists", "∃" ( |
Existential quantifier applied to container, taking one agent argument |
||
Container.for_all alias "for all", "∀" ( |
Universal quantifier applied to container, taking one agent argument |
||
Return a List all items matching the predicate function |
|||
Container.select ( |
Return first item matching the predicate function |
||
item alias "[]" ( |
Return item for key |
||
{
"name": "Array",
"documentation": "Container whose storage is assumed to be contiguous.",
"ancestors": [
"Container"
],
"generic_parameter_defs": {
"T": {
"name": "T",
"conforms_to_type": "Any"
}
},
"functions": {
"item": {
"name": "item",
"aliases": [
"[]"
],
"documentation": "Return item for key `_a_key_`.",
"parameters": {
"a_key": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "a_key",
"type": "Integer"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "T"
}
}
}
}
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 presence of |
1..1 |
item alias "[]" ( |
Return item for 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: return True if Parameters
|
|||
Reference equality for reference types, value equality for value types. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in |
|||
Any.not_equal alias "!=", "≠" ( |
True if current object not equal to |
||
Test for membership of a value. |
|||
Number of items in container. |
|||
True if container is empty. |
|||
Container.there_exists alias "there exists", "∃" ( |
Existential quantifier applied to container, taking one agent argument |
||
Container.for_all alias "for all", "∀" ( |
Universal quantifier applied to container, taking one agent argument |
||
Return a List all items matching the predicate function |
|||
Container.select ( |
Return first item matching the predicate function |
||
has_key ( |
Test for presence of |
||
item alias "[]" ( |
Return item for 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 presence 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",
"aliases": [
"[]"
],
"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"
}
}
}
}