Interval
Overview
Another kind of structure commonly needed in rich data is the interval. The definition of the Interval<T> class here is an intensional one, i.e. it states its members by implication from its limits, rather than enumerating them. To support the common need for defining times in models that could be either a fixed point in time or a time interval, the classes Point_interval<T> and Proper_interval<T> are provided. If Interval<X> is defined as the type of feature in a class in an openEHR model, where X is some descendant of Ordered, then at runtime, either a Point_interval or Proper_interval may be attached.
In addition to the generic interval types, the derived types Multiplicity_interval and Cardinality are provided, for use in models to represent multiplicity, optionality, and cardinality.
The following UML diagram illustrates the interval package.
base.foundation_types.interval packageClass Definitions
Interval Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Interval<T> (abstract) |
|
|---|---|---|
Description |
Interval abstraction, featuring upper and lower limits that may be open or closed, included or not included. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
0..1 |
lower: |
Lower bound. |
0..1 |
upper: |
Upper bound. |
1..1 |
lower_unbounded: |
True if |
1..1 |
upper_unbounded: |
True if |
1..1 |
lower_included: |
True if |
1..1 |
upper_included: |
True if |
Functions |
Signature |
Meaning |
1..1 |
has ( |
True if the value |
1..1 |
True if there is any overlap between intervals represented by Current and |
|
1..1 |
True if current interval properly contains |
|
1..1 |
True if current object’s interval is semantically same as |
|
Invariants |
Lower_included_valid: |
|
Upper_included_valid: |
||
Limits_consistent: |
||
Limits_comparable: |
||
| Interval<T> (abstract) | |||
|---|---|---|---|
Interval abstraction, featuring upper and lower limits that may be open or closed, included or not included. |
|||
Inherits: Any |
|||
Attributes |
|||
lower: |
Lower bound. |
||
upper: |
Upper bound. |
||
lower_unbounded: |
True if |
||
upper_unbounded: |
True if |
||
lower_included: |
True if |
||
upper_included: |
True if |
||
Functions |
|||
True if current object’s interval is semantically same as |
|||
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 ( |
True if the value |
||
(abstract) intersects ( |
True if there is any overlap between intervals represented by Current and |
||
True if current interval properly contains |
|||
Invariants |
|||
Lower_included_valid: |
|||
Upper_included_valid: |
|||
Limits_consistent: |
|||
Limits_comparable: |
|||
{
"name": "Interval",
"documentation": "Interval abstraction, featuring upper and lower limits that may be open or closed, included or not included.",
"is_abstract": true,
"ancestors": [
"Any"
],
"generic_parameter_defs": {
"T": {
"name": "T",
"conforms_to_type": "Ordered"
}
},
"properties": {
"lower": {
"_type": "P_BMM_SINGLE_PROPERTY_OPEN",
"name": "lower",
"documentation": "Lower bound.",
"type": "T"
},
"upper": {
"_type": "P_BMM_SINGLE_PROPERTY_OPEN",
"name": "upper",
"documentation": "Upper bound.",
"type": "T"
},
"lower_unbounded": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "lower_unbounded",
"documentation": "True if `_lower_` boundary open (i.e. = `-infinity`).",
"is_mandatory": true,
"type": "Boolean"
},
"upper_unbounded": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "upper_unbounded",
"documentation": "True if `_upper_` boundary open (i.e. = `+infinity`).",
"is_mandatory": true,
"type": "Boolean"
},
"lower_included": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "lower_included",
"documentation": "True if `_lower_` boundary value included in range, if `not _lower_unbounded_`.",
"is_mandatory": true,
"type": "Boolean"
},
"upper_included": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "upper_included",
"documentation": "True if `_upper_` boundary value included in range if `not _upper_unbounded_`.",
"is_mandatory": true,
"type": "Boolean"
}
},
"functions": {
"has": {
"name": "has",
"documentation": "True if the value `e` is properly contained in this Interval.",
"is_abstract": true,
"parameters": {
"e": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER_OPEN",
"name": "e",
"type": "T"
}
},
"post_conditions": {
"Post_result": "Result = (lower_unbounded or lower_included and v >= lower) or v > lower and (upper_unbounded or upper_included and v <= upper or v < upper)"
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"intersects": {
"name": "intersects",
"documentation": "True if there is any overlap between intervals represented by Current and `_other_`. True if at least one limit of `_other_` is strictly inside the limits of this interval.",
"is_abstract": true,
"parameters": {
"other": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "other",
"type": "Interval"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"contains": {
"name": "contains",
"documentation": "True if current interval properly contains `_other_`? True if all points of `_other_` are inside the current interval.",
"is_abstract": true,
"parameters": {
"other": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "other",
"type": "Interval"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"is_equal": {
"name": "is_equal",
"documentation": "True if current object's interval is semantically same as `_other_`.",
"is_abstract": true,
"parameters": {
"other": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "other",
"type": "Any"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
}
},
"invariants": {
"Lower_included_valid": "lower_unbounded implies not lower_included",
"Upper_included_valid": "upper_unbounded implies not upper_included",
"Limits_consistent": "(not upper_unbounded and not lower_unbounded) implies lower <= upper",
"Limits_comparable": "(not upper_unbounded and not lower_unbounded) implies lower.strictly_comparable_to (upper)"
}
}
Point_interval Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Point_interval<T> |
|
|---|---|---|
Description |
Type representing an Interval that happens to be a point value. Provides an efficient representation that is substitutable for |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
lower_unbounded: |
Lower boundary open (i.e. = -infinity). |
1..1 |
upper_unbounded: |
Upper boundary open (i.e. = +infinity). |
1..1 |
lower_included: |
Lower boundary value included in range if not |
1..1 |
upper_included: |
Upper boundary value included in range if not |
Invariants |
Inv_point: |
|
| Point_interval<T> | |||
|---|---|---|---|
Type representing an Interval that happens to be a point value. Provides an efficient representation that is substitutable for |
|||
Attributes |
|||
Interval.lower: |
Lower bound. |
||
Interval.upper: |
Upper bound. |
||
lower_unbounded: |
Lower boundary open (i.e. = -infinity). |
||
upper_unbounded: |
Upper boundary open (i.e. = +infinity). |
||
lower_included: |
Lower boundary value included in range if not |
||
upper_included: |
Upper boundary value included in range if not |
||
Functions |
|||
(abstract) Interval.is_equal ( |
True if current object’s interval is semantically same as |
||
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) Interval.has ( |
True if the value |
||
(abstract) Interval.intersects ( |
True if there is any overlap between intervals represented by Current and |
||
(abstract) Interval.contains ( |
True if current interval properly contains |
||
Invariants |
|||
Interval.Lower_included_valid: |
|||
Interval.Upper_included_valid: |
|||
Interval.Limits_consistent: |
|||
Interval.Limits_comparable: |
|||
Inv_point: |
|||
{
"name": "Point_interval",
"documentation": "Type representing an Interval that happens to be a point value. Provides an efficient representation that is substitutable for `Interval<T>` where needed.",
"ancestors": [
"Interval"
],
"generic_parameter_defs": {
"T": {
"name": "T",
"conforms_to_type": "Ordered"
}
},
"properties": {
"lower_unbounded": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "lower_unbounded",
"documentation": "Lower boundary open (i.e. = -infinity).",
"is_mandatory": true,
"type": "Boolean",
"default": false
},
"upper_unbounded": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "upper_unbounded",
"documentation": "Upper boundary open (i.e. = +infinity).",
"is_mandatory": true,
"type": "Boolean",
"default": false
},
"lower_included": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "lower_included",
"documentation": "Lower boundary value included in range if not `_lower_unbounded_`.",
"is_mandatory": true,
"type": "Boolean",
"default": true
},
"upper_included": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "upper_included",
"documentation": "Upper boundary value included in range if not `_upper_unbounded_`.",
"is_mandatory": true,
"type": "Boolean",
"default": true
}
},
"invariants": {
"Inv_point": "lower = upper"
}
}
Proper_interval Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Proper_interval<T> |
|
|---|---|---|
Description |
Type representing a 'proper' Interval, i.e. any two-sided or one-sided interval. |
|
Inherit |
||
Invariants |
Inv_not_point: |
|
| Proper_interval<T> | |||
|---|---|---|---|
Type representing a 'proper' Interval, i.e. any two-sided or one-sided interval. |
|||
Attributes |
|||
Interval.lower: |
Lower bound. |
||
Interval.upper: |
Upper bound. |
||
True if |
|||
True if |
|||
True if |
|||
True if |
|||
Functions |
|||
(abstract) Interval.is_equal ( |
True if current object’s interval is semantically same as |
||
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) Interval.has ( |
True if the value |
||
(abstract) Interval.intersects ( |
True if there is any overlap between intervals represented by Current and |
||
(abstract) Interval.contains ( |
True if current interval properly contains |
||
Invariants |
|||
Interval.Lower_included_valid: |
|||
Interval.Upper_included_valid: |
|||
Interval.Limits_consistent: |
|||
Interval.Limits_comparable: |
|||
Inv_not_point: |
|||
{
"name": "Proper_interval",
"documentation": "Type representing a 'proper' Interval, i.e. any two-sided or one-sided interval.",
"ancestors": [
"Interval"
],
"generic_parameter_defs": {
"T": {
"name": "T",
"conforms_to_type": "Ordered"
}
},
"invariants": {
"Inv_not_point": "lower /= upper"
}
}
Multiplicity_interval Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Multiplicity_interval |
|
|---|---|---|
Description |
An Interval of Integer, used to represent multiplicity, cardinality and optionality in models. |
|
Inherit |
||
Constants |
Signature |
Meaning |
1..1 |
Multiplicity_range_marker: |
Marker to use in string form of interval between limits. |
1..1 |
Multiplicity_unbounded_marker: |
Symbol to use to indicate upper limit unbounded. |
Functions |
Signature |
Meaning |
1..1 |
is_open (): |
True if this interval imposes no constraints, i.e. is set to |
1..1 |
is_optional (): |
True if this interval expresses optionality, i.e. |
1..1 |
is_mandatory (): |
True if this interval expresses mandation, i.e. |
1..1 |
is_prohibited (): |
True if this interval is set to |
| Multiplicity_interval | |||
|---|---|---|---|
An Interval of Integer, used to represent multiplicity, cardinality and optionality in models. |
|||
Inherits: Any, Interval, Proper_interval |
|||
Constants |
|||
Multiplicity_range_marker: |
Marker to use in string form of interval between limits. |
||
Multiplicity_unbounded_marker: |
Symbol to use to indicate upper limit unbounded. |
||
Attributes |
|||
Interval.lower: |
Lower bound. |
||
Interval.upper: |
Upper bound. |
||
True if |
|||
True if |
|||
True if |
|||
True if |
|||
Functions |
|||
(abstract) Interval.is_equal ( |
True if current object’s interval is semantically same as |
||
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) Interval.has ( |
True if the value |
||
(abstract) Interval.intersects ( |
True if there is any overlap between intervals represented by Current and |
||
(abstract) Interval.contains ( |
True if current interval properly contains |
||
is_open (): |
True if this interval imposes no constraints, i.e. is set to |
||
is_optional (): |
True if this interval expresses optionality, i.e. |
||
is_mandatory (): |
True if this interval expresses mandation, i.e. |
||
is_prohibited (): |
True if this interval is set to |
||
Invariants |
|||
Interval.Lower_included_valid: |
|||
Interval.Upper_included_valid: |
|||
Interval.Limits_consistent: |
|||
Interval.Limits_comparable: |
|||
Proper_interval.Inv_not_point: |
|||
{
"name": "Multiplicity_interval",
"documentation": "An Interval of Integer, used to represent multiplicity, cardinality and optionality in models. ",
"ancestors": [
"Proper_interval"
],
"constants": {
"Multiplicity_range_marker": {
"name": "Multiplicity_range_marker",
"documentation": "Marker to use in string form of interval between limits.",
"type": "String",
"value": "\"..\""
},
"Multiplicity_unbounded_marker": {
"name": "Multiplicity_unbounded_marker",
"documentation": "Symbol to use to indicate upper limit unbounded.",
"type": "Character",
"value": "'*'"
}
},
"functions": {
"is_open": {
"name": "is_open",
"documentation": "True if this interval imposes no constraints, i.e. is set to `0..*`.",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"is_optional": {
"name": "is_optional",
"documentation": "True if this interval expresses optionality, i.e. `0..1`.",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"is_mandatory": {
"name": "is_mandatory",
"documentation": "True if this interval expresses mandation, i.e. `1..1`.",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"is_prohibited": {
"name": "is_prohibited",
"documentation": "True if this interval is set to `0..0`.",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
}
}
}
Cardinality Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
Cardinality |
|
|---|---|---|
Description |
Express constraints on the cardinality of container objects which are the values of multiply-valued attributes, including uniqueness and ordering, providing the means to state that a container acts like a logical list, set or bag. |
|
Attributes |
Signature |
Meaning |
1..1 |
interval: |
The interval of this cardinality. |
1..1 |
is_ordered: |
True if the members of the container attribute to which this cardinality refers are ordered. |
1..1 |
is_unique: |
True if the members of the container attribute to which this cardinality refers are unique. |
Functions |
Signature |
Meaning |
1..1 |
is_bag (): |
True if the semantics of this cardinality represent a bag, i.e. unordered, non-unique membership. |
1..1 |
is_list (): |
True if the semantics of this cardinality represent a list, i.e. ordered, non-unique membership. |
1..1 |
is_set (): |
True if the semantics of this cardinality represent a set, i.e. unordered, unique membership. |
| Cardinality | |
|---|---|
Express constraints on the cardinality of container objects which are the values of multiply-valued attributes, including uniqueness and ordering, providing the means to state that a container acts like a logical list, set or bag. |
|
Attributes |
|
interval: |
The interval of this cardinality. |
is_ordered: |
True if the members of the container attribute to which this cardinality refers are ordered. |
is_unique: |
True if the members of the container attribute to which this cardinality refers are unique. |
Functions |
|
is_bag (): |
True if the semantics of this cardinality represent a bag, i.e. unordered, non-unique membership. |
is_list (): |
True if the semantics of this cardinality represent a list, i.e. ordered, non-unique membership. |
is_set (): |
True if the semantics of this cardinality represent a set, i.e. unordered, unique membership. |
{
"name": "Cardinality",
"documentation": "Express constraints on the cardinality of container objects which are the values of multiply-valued attributes, including uniqueness and ordering, providing the means to state that a container acts like a logical list, set or bag.",
"properties": {
"interval": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "interval",
"documentation": "The interval of this cardinality. ",
"is_mandatory": true,
"type": "Multiplicity_interval"
},
"is_ordered": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "is_ordered",
"documentation": "True if the members of the container attribute to which this cardinality refers are ordered. ",
"is_mandatory": true,
"type": "Boolean"
},
"is_unique": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "is_unique",
"documentation": "True if the members of the container attribute to which this cardinality refers are unique.",
"is_mandatory": true,
"type": "Boolean"
}
},
"functions": {
"is_bag": {
"name": "is_bag",
"documentation": "True if the semantics of this cardinality represent a bag, i.e. unordered, non-unique membership.",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"is_list": {
"name": "is_list",
"documentation": "True if the semantics of this cardinality represent a list, i.e. ordered, non-unique membership.",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"is_set": {
"name": "is_set",
"documentation": "True if the semantics of this cardinality represent a set, i.e. unordered, unique membership.",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
}
}
}