The Archetype Package

Overview

The model of an archetype, illustrated in the following figure, is straightforward at an abstract level, mimicking the structure of an archetype document as defined in the openEHR Archetype Definition Language (ADL) document. An archetype is modelled as a particular kind of AUTHORED_RESOURCE, and as such, includes descriptive meta-data, language information and revision history. The ARCHETYPE class adds identifying information, a definition - expressed in terms of constraints on instances of an object model, and an ontology. The archetype definition, the 'main' part of an archetype, is an instance of a C_COMPLEX_OBJECT, which is to say, the root of the constraint structure of an archetype always takes the form of a constraint on a non-primitive object type. The last section of an archetype, the ontology, is represented by its own class, and is what allows the archetypes to be natural language- and terminology-neutral.

AM aom14.archetype
Figure 1. am.aom14.archetype Package

Class Descriptions

ARCHETYPE Class

  • Definition

  • Effective

  • BMM

  • UML

Class

ARCHETYPE

Description

Archetype equivalent to ARCHETYPED class in Common reference model. Defines semantics of identfication, lifecycle, versioning, composition and specialisation.

Inherit

AUTHORED_RESOURCE

Attributes

Signature

Meaning

1..1

definition: C_COMPLEX_OBJECT

Root node of the definition of this archetype.

1..1

ontology: ARCHETYPE_ONTOLOGY

The ontology of the archetype.

0..1

adl_version: String

ADL version if archetype was read in from an ADL sharable archetype.

1..1

archetype_id: ARCHETYPE_ID

Multi-axial identifier of this archetype in archetype space.

0..1
(redefined)

uid: HIER_OBJECT_ID

OID identifier of this archetype.

1..1

concept: String

The normative meaning of the archetype as a whole, expressed as a local archetype code, typically “at0000”.

0..1

parent_archetype_id: ARCHETYPE_ID

Identifier of the specialisation parent of this archetype.

0..1

invariants: List<ASSERTION>

Invariant statements about this object. Statements are expressed in first order predicate logic, and usually refer to at least two attributes.

Functions

Signature

Meaning

1..1

concept_name (
a_lang: String[1]
): String

post-condition: Result.is_equal (definition.node_id)

The concept name of the archetype in language a_lang; corresponds to the term definition of the concept attribute in the archetype ontology.

1..1

physical_paths (): List<String>

Set of language-independent paths extracted from archetype. Paths obey Xpath-like syntax and are formed from alternations of C_OBJECT.node_id and C_ATTRIBUTE.rm_attribute_name values.

1..1

logical_paths (
lang: String[1]
): List<String>

Set of language-dependent paths extracted from archetype. Paths obey the same syntax as physical_paths, but with node_ids replaced by their meanings from the ontology.

1..1

specialisation_depth (): Integer

post-condition: Result = terminology.specialisation_depth

Specialisation depth of this archetype; larger than 0 if this archetype has a parent. Derived from terminology.specialisation_depth.

1..1

is_specialised (): Boolean

post-condition: Result implies parent_archetype_id /= Void

True if this archetype is a specialisation of another.

1..1

is_valid (): Boolean

Post: not (node_ids_valid and internal_references_valid and constraint_references_valid) implies not Result

True if the archetype is valid overall; various tests should be used, including checks on node_ids, internal references, and constraint references.

1..1

node_ids_valid (): Boolean

True if every node_id found on a C_OBJECT node is found in ontology.term_codes.

0..1

previous_version (): String

Version of predecessor archetype of this archetype, if any.

1..1

internal_references_valid (): Boolean

True if every ARCHETYPE_INTERNAL_REF. target_path refers to a legitimate node in the archetype definition.

1..1

constraint_references_valid (): Boolean

True if every CONSTRAINT_REF.reference found on a C_OBJECT node in the archetype definition is found in ontology.constraint_codes.

1..1

short_concept_name (): String

The short concept name of the archetype extracted from the archetype_id.

1..1

version (): String

Invariants

Inv_concept_valid: ontology.has_term_code (concept_code)

Inv_specialisation_validity: is_specialised implies specialisation_depth > 0

Inv_invariants_valid: invariants /= Void implies not invariants.is_empty

Inv_uid_validity: uid /= Void implies not uid.is_empty

Inv_version_validity: version /= Void and then version.is_equal(archetype_id.version_id)

Inv_description_valid: description /= Void

Inv_original_language_valid: original_language /= void and then language /= Void

ARCHETYPE

Archetype equivalent to ARCHETYPED class in Common reference model. Defines semantics of identfication, lifecycle, versioning, composition and specialisation.

Inherits: AUTHORED_RESOURCE

Attributes

uid: HIER_OBJECT_ID [0..1]

OID identifier of this archetype.

original_language: Terminology_code [1..1]

Language in which this resource was initially authored. Although there is no language primacy of resources overall, the language of original authoring is required to ensure natural language translations can preserve quality. Language is relevant in both the description and ontology sections.
Inherited from AUTHORED_RESOURCE

description: RESOURCE_DESCRIPTION [0..1]

Description and lifecycle information of the resource.
Inherited from AUTHORED_RESOURCE

is_controlled: Boolean [0..1]

True if this resource is under any kind of change control (even file copying), in which case revision history is created.
Inherited from AUTHORED_RESOURCE

annotations: RESOURCE_ANNOTATIONS [0..1]

Annotations on individual items within the resource, keyed by path. The inner table takes the form of a Hash table of String values keyed by String tags.
Inherited from AUTHORED_RESOURCE

translations: Hash<String,TRANSLATION_DETAILS> [0..1]

List of details for each natural translation made of this resource, keyed by language code. For each translation listed here, there must be corresponding sections in all language-dependent parts of the resource. The original_language does not appear in this list.
Inherited from AUTHORED_RESOURCE

definition: C_COMPLEX_OBJECT [1..1]

Root node of the definition of this archetype.

ontology: ARCHETYPE_ONTOLOGY [1..1]

The ontology of the archetype.

adl_version: String [0..1]

ADL version if archetype was read in from an ADL sharable archetype.

archetype_id: ARCHETYPE_ID [1..1]

Multi-axial identifier of this archetype in archetype space.

concept: String [1..1]

The normative meaning of the archetype as a whole, expressed as a local archetype code, typically “at0000”.

parent_archetype_id: ARCHETYPE_ID [0..1]

Identifier of the specialisation parent of this archetype.

invariants: List<ASSERTION> [0..1]

Invariant statements about this object. Statements are expressed in first order predicate logic, and usually refer to at least two attributes.

Functions

current_revision (): String

Post: Result = revision_history.most_recent_version [1..1]

Most recent revision in revision_history if is_controlled else (uncontrolled) .
Inherited from AUTHORED_RESOURCE

languages_available (): List<String> [1..1]

Total list of languages available in this resource, derived from original_language and translations.
Inherited from AUTHORED_RESOURCE

concept_name (
a_lang: String[1]
): String

post-condition: Result.is_equal (definition.node_id) [1..1]

The concept name of the archetype in language a_lang; corresponds to the term definition of the concept attribute in the archetype ontology.

physical_paths (): List<String> [1..1]

Set of language-independent paths extracted from archetype. Paths obey Xpath-like syntax and are formed from alternations of C_OBJECT.node_id and C_ATTRIBUTE.rm_attribute_name values.

logical_paths (
lang: String[1]
): List<String> [1..1]

Set of language-dependent paths extracted from archetype. Paths obey the same syntax as physical_paths, but with node_ids replaced by their meanings from the ontology.

specialisation_depth (): Integer

post-condition: Result = terminology.specialisation_depth [1..1]

Specialisation depth of this archetype; larger than 0 if this archetype has a parent. Derived from terminology.specialisation_depth.

is_specialised (): Boolean

post-condition: Result implies parent_archetype_id /= Void [1..1]

True if this archetype is a specialisation of another.

is_valid (): Boolean

Post: not (node_ids_valid and internal_references_valid and constraint_references_valid) implies not Result [1..1]

True if the archetype is valid overall; various tests should be used, including checks on node_ids, internal references, and constraint references.

node_ids_valid (): Boolean [1..1]

True if every node_id found on a C_OBJECT node is found in ontology.term_codes.

previous_version (): String [0..1]

Version of predecessor archetype of this archetype, if any.

internal_references_valid (): Boolean [1..1]

True if every ARCHETYPE_INTERNAL_REF. target_path refers to a legitimate node in the archetype definition.

constraint_references_valid (): Boolean [1..1]

True if every CONSTRAINT_REF.reference found on a C_OBJECT node in the archetype definition is found in ontology.constraint_codes.

short_concept_name (): String [1..1]

The short concept name of the archetype extracted from the archetype_id.

version (): String [1..1]

Invariants

Original_language_valid: code_set (Code_set_id_languages).has_code (original_language.as_string)
Inherited from AUTHORED_RESOURCE

Current_revision_valid: (current_revision /= Void and not is_controlled) implies current_revision.is_equal ("(uncontrolled)")
Inherited from AUTHORED_RESOURCE

Translations_valid: translations /= Void implies (not translations.is_empty and not translations.has (orginal_language.code_string))
Inherited from AUTHORED_RESOURCE

Description_valid: translations /= Void implies (description.details.for_all (d | translations.has_key (d.language.code_string)))
Inherited from AUTHORED_RESOURCE

Languages_available_valid: languages_available.has (original_language)
Inherited from AUTHORED_RESOURCE

Revision_history_valid: is_controlled xor revision_history = Void
Inherited from AUTHORED_RESOURCE

Inv_concept_valid: ontology.has_term_code (concept_code)

Inv_specialisation_validity: is_specialised implies specialisation_depth > 0

Inv_invariants_valid: invariants /= Void implies not invariants.is_empty

Inv_uid_validity: uid /= Void implies not uid.is_empty

Inv_version_validity: version /= Void and then version.is_equal(archetype_id.version_id)

Inv_description_valid: description /= Void

Inv_original_language_valid: original_language /= void and then language /= Void

{
    "name": "ARCHETYPE",
    "documentation": "Archetype equivalent to ARCHETYPED class in Common reference model. Defines semantics of identfication, lifecycle, versioning, composition and specialisation.",
    "ancestors": [
        "AUTHORED_RESOURCE"
    ],
    "properties": {
        "definition": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "definition",
            "documentation": "Root node of the definition of this archetype.",
            "is_mandatory": true,
            "type": "C_COMPLEX_OBJECT"
        },
        "ontology": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "ontology",
            "documentation": "The ontology of the archetype.",
            "is_mandatory": true,
            "type": "ARCHETYPE_ONTOLOGY"
        },
        "adl_version": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "adl_version",
            "documentation": "ADL version if archetype was read in from an ADL sharable archetype.",
            "type": "String"
        },
        "archetype_id": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "archetype_id",
            "documentation": "Multi-axial identifier of this archetype in archetype space.",
            "is_mandatory": true,
            "type": "ARCHETYPE_ID"
        },
        "uid": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "uid",
            "documentation": "OID identifier of this archetype.",
            "type": "HIER_OBJECT_ID"
        },
        "concept": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "concept",
            "documentation": "The normative meaning of the archetype as a whole, expressed as a local archetype code, typically “at0000”.",
            "is_mandatory": true,
            "type": "String"
        },
        "parent_archetype_id": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "parent_archetype_id",
            "documentation": "Identifier of the specialisation parent of this archetype.",
            "type": "ARCHETYPE_ID"
        },
        "invariants": {
            "_type": "P_BMM_CONTAINER_PROPERTY",
            "name": "invariants",
            "documentation": "Invariant statements about this object. Statements are expressed in first order predicate logic, and usually refer to at least two attributes.",
            "type_def": {
                "container_type": "List",
                "type": "ASSERTION"
            },
            "cardinality": {
                "lower": 0,
                "upper_unbounded": true
            }
        }
    },
    "functions": {
        "concept_name": {
            "name": "concept_name",
            "documentation": "The concept name of the archetype in language a_lang; corresponds to the term definition of the concept attribute in the archetype ontology.",
            "parameters": {
                "a_lang": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "a_lang",
                    "type": "String"
                }
            },
            "post_conditions": {
                "post-condition": "Result.is_equal (definition.node_id)"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "String"
            }
        },
        "physical_paths": {
            "name": "physical_paths",
            "documentation": "Set of language-independent paths extracted from archetype. Paths obey Xpath-like syntax and are formed from alternations of C_OBJECT.node_id and C_ATTRIBUTE.rm_attribute_name values. ",
            "result": {
                "_type": "P_BMM_CONTAINER_TYPE",
                "container_type": "List",
                "type": "String"
            }
        },
        "logical_paths": {
            "name": "logical_paths",
            "documentation": "Set of language-dependent paths extracted from archetype. Paths obey the same syntax as physical_paths, but with node_ids replaced by their meanings from the ontology. ",
            "parameters": {
                "lang": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "lang",
                    "type": "String"
                }
            },
            "result": {
                "_type": "P_BMM_CONTAINER_TYPE",
                "container_type": "List",
                "type": "String"
            }
        },
        "specialisation_depth": {
            "name": "specialisation_depth",
            "documentation": "Specialisation depth of this archetype; larger than 0 if this archetype has a parent. Derived from terminology.specialisation_depth.",
            "post_conditions": {
                "post-condition": "Result = terminology.specialisation_depth"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "is_specialised": {
            "name": "is_specialised",
            "documentation": "True if this archetype is a specialisation of another. ",
            "post_conditions": {
                "post-condition": "Result implies parent_archetype_id /= Void"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_valid": {
            "name": "is_valid",
            "documentation": "True if the archetype is valid overall; various tests should be used, including checks on node_ids, internal references, and constraint references.",
            "post_conditions": {
                "Post": "not (node_ids_valid and internal_references_valid and constraint_references_valid) implies not Result"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "node_ids_valid": {
            "name": "node_ids_valid",
            "documentation": "True if every node_id found on a C_OBJECT node is found in ontology.term_codes.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "previous_version": {
            "name": "previous_version",
            "documentation": "Version of predecessor archetype of this archetype, if any.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "String"
            },
            "is_nullable": true
        },
        "internal_references_valid": {
            "name": "internal_references_valid",
            "documentation": "True if every ARCHETYPE_INTERNAL_REF. target_path refers to a legitimate node in the archetype definition.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "constraint_references_valid": {
            "name": "constraint_references_valid",
            "documentation": "True if every CONSTRAINT_REF.reference found on a C_OBJECT node in the archetype definition is found in ontology.constraint_codes.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "short_concept_name": {
            "name": "short_concept_name",
            "documentation": "The short concept name of the archetype extracted from the archetype_id.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "String"
            }
        },
        "version": {
            "name": "version",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "String"
            }
        }
    },
    "invariants": {
        "Inv_concept_valid": "ontology.has_term_code (concept_code)",
        "Inv_specialisation_validity": "is_specialised implies specialisation_depth > 0",
        "Inv_invariants_valid": "invariants /= Void implies not invariants.is_empty",
        "Inv_uid_validity": "uid /= Void implies not uid.is_empty",
        "Inv_version_validity": "version /= Void and then version.is_equal(archetype_id.version_id)",
        "Inv_description_valid": "description /= Void",
        "Inv_original_language_valid": "original_language /= void and then language /= Void"
    }
}
aom14.archetype