Model Access Package

Overview

This package is considered informative within this specification.

The org.openehr.lang.bmm.model_access package provides an interface for the application to load BMM schemas and convert them to BMM model form, and is shown below. In this model, a schema is the serial form of a model or part of a model (i.e. instances of a persistence model like the lang.bmm_persistence model P_XXX classes). One or more schema files are parsed, validated and then converted to create a single BMM_MODEL instance.

LANG bmm.model access
Figure 1. lang.bmm.model_access Package

More than one format for representing serialised BMM models is possible, each having its load, validation and error-reporting logic. The common elements of the load, validate and convert logic are defined by the non format-specific classes in the package, with specific forms of the classes BMM_SCHEMA_DESCRIPTOR and BMM_SCHEMA required for each concrete format. The package above shows the relevant classes for the P_BMM version 2.x format, which is normally saved in .bmm files. Other formats may be saved in files with different extensions.

The singleton class BMM_MODEL_ACCESS acts as the entry point for client software to obtain access to loaded BMM models. Since the latter start as schema files which are typically nested according to an 'include' hierarchy, they must be parsed, validated and merged to create each 'top-level' model. The schemas are accessed via instances of the BMM_SCHEMA_DESCRIPTOR object, one for each schema file. The load() routine of this class loads a BMM schema file by direct deserialisation.

If the file is structurally correct (say ODIN, JSON etc), an in-memory schema instance will result (e.g. P_BMM_SCHEMA in the case of the P_BMM format), and its validate_created method called. If this succeeds, BMM_SCHEMA_DESCRIPTOR.bmm_schema will be set to this instance, of type BMM_SCHEMA. Subsequently, BMM_SCHEMA.merge() will be called repeatedly, which results in each bmm_schema instance being the merged result of its include children and itself. After merging, BMM_SCHEMA_DESCRIPTOR.validate_merged() will be called, and if successful, a call to create_model() will result in BMM_SCHEMA_DESCRIPTOR.model being populated.

Each successfully loaded model is thus instantiated as a BMM_MODEL, and retrievable by calling BMM_MODEL_ACCESS.bmm_model() with a model key, which is a model identifier with full, partial or no version part. In the latter cases, the most recent version model is retrieved for the key. For example, the keys "openEHR_EHR_1.0.4", "openEHR_EHR_1.0", "openEHR_EHR_1", and "openEHR_EHR" will all match the "openEHR_EHR_1.0.4" model, assuming it is the most recent version available. This is convenient for matching models to artefacts (e.g. archetypes) that only mention the model publisher and name, but no version.

The following screenshot shows the BMM schema configuration dialog in the openEHR ADL Workbench, including some meta-data, validation status etc, and also the schema nesting structure. A single hierarchy of schemas corresponds to a single instantiated BMM model.

awb schemas config
Figure 2. BMM schema configuration

The screenshot below shows a number of merged BMM models loaded into the AWB, including some of the packages and classes for the openehr_ehr_extract_1.0.4 model.

awb loaded bmm schemas
Figure 3. BMM schemas loaded

Class Definitions

BMM_MODEL_ACCESS Class

  • Definition

  • Effective

  • BMM

  • UML

Class

BMM_MODEL_ACCESS

Description

Access to BMM models that have been loaded and validated from one or more schema sets.

Attributes

Signature

Meaning

0..1

schema_directories: List <String >

List of directories where all the schemas loaded here are found.

0..1

all_schemas: List <String >

All schemas found and loaded from schema_directory. Keyed by schema_id.

0..1

bmm_models: Hash <String ,BMM_MODEL>

Top-level (root) models in use, keyed by model_id.

0..1

matching_bmm_models: List <String >

Validated models, keyed by model_id() and any shorter forms of id, with some or no versioning information. For example, the keys "openEHR_EHR_1.0.4", "openEHR_EHR_1.0", "openEHR_EHR_1", and "openEHR_EHR" will all match the "openEHR_EHR_1.0.4" model, assuming it is the most recent version available.

Functions

Signature

Meaning

1..1

initialise_with_load_list (
a_schema_dirs: List <String >[1],
a_schema_load_list: List <String >
): void

Initialise with a specific schema load list, usually a sub-set of schemas that will be found in a specified directories a_schema_dirs.

1..1

initialise_all (
a_schema_dirs: List <String >[1]
): void

Load all schemas found in a specified directories a_schema_dirs.

1..1

reload_schemas (): void

Reload BMM schemas.

1..1

bmm_model (
a_model_key: String [1]
): BMM_MODEL

Return model containing the model key which is a model_id or any shorter form e.g. model id minus the version. If a shorter key is used, the BMM_MODEL with the most recent version will be selected. Uses matching_bmm_models table to find matches if partial version information is supplied in key.

1..1

has_bmm_model (
a_model_key: String [1]
): `Boolean `

True if a model for a model_key is available. A model key is a model_id or any shorter form e.g. model id minus the version. If a shorter key is used, the Result s True if a BMM_MODEL with any version exists.

BMM_MODEL_ACCESS

Access to BMM models that have been loaded and validated from one or more schema sets.

Attributes

schema_directories: List <String > [0..1]

List of directories where all the schemas loaded here are found.

all_schemas: List <String > [0..1]

All schemas found and loaded from schema_directory. Keyed by schema_id.

bmm_models: Hash <String ,BMM_MODEL> [0..1]

Top-level (root) models in use, keyed by model_id.

matching_bmm_models: List <String > [0..1]

Validated models, keyed by model_id() and any shorter forms of id, with some or no versioning information. For example, the keys "openEHR_EHR_1.0.4", "openEHR_EHR_1.0", "openEHR_EHR_1", and "openEHR_EHR" will all match the "openEHR_EHR_1.0.4" model, assuming it is the most recent version available.

Functions

initialise_with_load_list (
a_schema_dirs: List <String >[1],
a_schema_load_list: List <String >
): void [1..1]

Initialise with a specific schema load list, usually a sub-set of schemas that will be found in a specified directories a_schema_dirs.

initialise_all (
a_schema_dirs: List <String >[1]
): void [1..1]

Load all schemas found in a specified directories a_schema_dirs.

reload_schemas (): void [1..1]

Reload BMM schemas.

bmm_model (
a_model_key: String [1]
): BMM_MODEL [1..1]

Return model containing the model key which is a model_id or any shorter form e.g. model id minus the version. If a shorter key is used, the BMM_MODEL with the most recent version will be selected. Uses matching_bmm_models table to find matches if partial version information is supplied in key.

has_bmm_model (
a_model_key: String [1]
): `Boolean ` [1..1]

True if a model for a model_key is available. A model key is a model_id or any shorter form e.g. model id minus the version. If a shorter key is used, the Result s True if a BMM_MODEL with any version exists.

{
    "name": "BMM_MODEL_ACCESS",
    "documentation": "Access to BMM models that have been loaded and validated from one or more schema sets.",
    "properties": {
        "schema_directories": {
            "_type": "P_BMM_CONTAINER_PROPERTY",
            "name": "schema_directories",
            "documentation": "List of directories where all the schemas loaded here are found.",
            "type_def": {
                "container_type": "List",
                "type": "String"
            },
            "cardinality": {
                "lower": 0,
                "upper_unbounded": true
            }
        },
        "all_schemas": {
            "_type": "P_BMM_CONTAINER_PROPERTY",
            "name": "all_schemas",
            "documentation": "All schemas found and loaded from `_schema_directory_`. Keyed by `_schema_id_`.",
            "type_def": {
                "container_type": "List",
                "type": "String"
            },
            "cardinality": {
                "lower": 0,
                "upper_unbounded": true
            }
        },
        "bmm_models": {
            "_type": "P_BMM_GENERIC_PROPERTY",
            "name": "bmm_models",
            "documentation": "Top-level (root) models in use, keyed by `_model_id_`.",
            "type_def": {
                "root_type": "Hash",
                "generic_parameters": [
                    "String",
                    "BMM_MODEL"
                ]
            }
        },
        "matching_bmm_models": {
            "_type": "P_BMM_CONTAINER_PROPERTY",
            "name": "matching_bmm_models",
            "documentation": "Validated models, keyed by `_model_id()_` and any shorter forms of id, with some or no versioning information. For example, the keys `\"openEHR_EHR_1.0.4\"`, `\"openEHR_EHR_1.0\"`, `\"openEHR_EHR_1\"`, and `\"openEHR_EHR\"` will all match the `\"openEHR_EHR_1.0.4\"` model, assuming it is the most recent version available.",
            "type_def": {
                "container_type": "List",
                "type": "String"
            },
            "cardinality": {
                "lower": 0,
                "upper_unbounded": true
            }
        }
    },
    "functions": {
        "initialise_with_load_list": {
            "name": "initialise_with_load_list",
            "documentation": "Initialise with a specific schema load list, usually a sub-set of schemas that will be found in a specified directories `_a_schema_dirs_`.",
            "parameters": {
                "a_schema_dirs": {
                    "_type": "P_BMM_CONTAINER_FUNCTION_PARAMETER",
                    "name": "a_schema_dirs",
                    "type_def": {
                        "container_type": "List",
                        "type": "String"
                    },
                    "cardinality": {
                        "lower": 1,
                        "upper_unbounded": true
                    }
                },
                "a_schema_load_list": {
                    "_type": "P_BMM_CONTAINER_FUNCTION_PARAMETER",
                    "name": "a_schema_load_list",
                    "is_nullable": true,
                    "type_def": {
                        "container_type": "List",
                        "type": "String"
                    },
                    "cardinality": {
                        "lower": 0,
                        "upper_unbounded": true
                    }
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "void"
            }
        },
        "initialise_all": {
            "name": "initialise_all",
            "documentation": "Load all schemas found in a specified directories `_a_schema_dirs_`.",
            "parameters": {
                "a_schema_dirs": {
                    "_type": "P_BMM_CONTAINER_FUNCTION_PARAMETER",
                    "name": "a_schema_dirs",
                    "type_def": {
                        "container_type": "List",
                        "type": "String"
                    },
                    "cardinality": {
                        "lower": 1,
                        "upper_unbounded": true
                    }
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "void"
            }
        },
        "reload_schemas": {
            "name": "reload_schemas",
            "documentation": "Reload BMM schemas.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "void"
            }
        },
        "bmm_model": {
            "name": "bmm_model",
            "documentation": "Return model containing the model key which is a `_model_id_` or any shorter form e.g. model id minus the version. If a shorter key is used, the `BMM_MODEL` with the most recent version will be selected. Uses `_matching_bmm_models_` table to find matches if partial version information is supplied in key.",
            "parameters": {
                "a_model_key": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "a_model_key",
                    "type": "String"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "BMM_MODEL"
            }
        },
        "has_bmm_model": {
            "name": "has_bmm_model",
            "documentation": "True if a model for a `_model_key_` is available. A model key is a `_model_id_` or any shorter form e.g. model id minus the version. If a shorter key is used, the Result s True if a `BMM_MODEL` with any version exists.",
            "parameters": {
                "a_model_key": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "a_model_key",
                    "type": "String"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        }
    }
}
bmm model access

BMM_SCHEMA_DESCRIPTOR Class

  • Definition

  • Effective

  • BMM

  • UML

Class

BMM_SCHEMA_DESCRIPTOR (abstract)

Description

Descriptor for a BMM schema. Contains a meta-data table of attributes obtained from a mini-ODIN parse of the schema file.

Attributes

Signature

Meaning

0..1

bmm_schema: BMM_SCHEMA

Persistent form of model.

0..1

bmm_model: BMM_MODEL

Computable form of model.

1..1

schema_id: `String `

Schema id, formed by

{BMM_DEFINITIONS}.create_schema_id( meta_data.item({BMM_DEFINITIONS}.Metadata_model_publisher), meta_data.item({BMM_DEFINITIONS}.Metadata_schema_name), meta_data.item({BMM_DEFINITIONS}.Metadata_model_release)

e.g. openehr_rm_1.0.3, openehr_test_1.0.1, iso_13606_1_2008_2.1.2.

1..1

meta_data: Hash <String ,String >

Table of {key, value} of schema meta-data, keys are string values defined by {BMM_DEFINITIONS}.Metadata_* constants.

0..1

includes: List <String >

Identifiers of schemas included by this schema.

Functions

Signature

Meaning

1..1

is_top_level (): `Boolean `

True if this is a top-level schema, i.e. not included by some other schema.

1..1

is_bmm_compatible (): `Boolean `

True if the BMM version found in the schema (or assumed, if none) is compatible with that in this software.

1..1

load (): void

Load schema into in-memory form, i.e. a P_BMM_SCHEMA instance, if structurally valid. If successful, p_schema will be set.

1..1

validate_merged (): void

Validate loaded schema and report errors.

1..1

validate_includes (
all_schemas_list: List <String >
): void

Validate includes list for this schema, to see if each mentioned schema exists in all_schemas list.

1..1

create_model (): void

Create schema, i.e. the BMM_MODEL from one P_BMM_SCHEMA schema.

BMM_SCHEMA_DESCRIPTOR (abstract)

Descriptor for a BMM schema. Contains a meta-data table of attributes obtained from a mini-ODIN parse of the schema file.

Attributes

bmm_schema: BMM_SCHEMA [0..1]

Persistent form of model.

bmm_model: BMM_MODEL [0..1]

Computable form of model.

schema_id: `String ` [1..1]

Schema id, formed by

{BMM_DEFINITIONS}.create_schema_id( meta_data.item({BMM_DEFINITIONS}.Metadata_model_publisher), meta_data.item({BMM_DEFINITIONS}.Metadata_schema_name), meta_data.item({BMM_DEFINITIONS}.Metadata_model_release)

e.g. openehr_rm_1.0.3, openehr_test_1.0.1, iso_13606_1_2008_2.1.2.

meta_data: Hash <String ,String > [1..1]

Table of {key, value} of schema meta-data, keys are string values defined by {BMM_DEFINITIONS}.Metadata_* constants.

includes: List <String > [0..1]

Identifiers of schemas included by this schema.

Functions

is_top_level (): `Boolean ` [1..1]

True if this is a top-level schema, i.e. not included by some other schema.

is_bmm_compatible (): `Boolean ` [1..1]

True if the BMM version found in the schema (or assumed, if none) is compatible with that in this software.

load (): void [1..1]

Load schema into in-memory form, i.e. a P_BMM_SCHEMA instance, if structurally valid. If successful, p_schema will be set.

validate_merged (): void [1..1]

Validate loaded schema and report errors.

validate_includes (
all_schemas_list: List <String >
): void [1..1]

Validate includes list for this schema, to see if each mentioned schema exists in all_schemas list.

create_model (): void [1..1]

Create schema, i.e. the BMM_MODEL from one P_BMM_SCHEMA schema.

{
    "name": "BMM_SCHEMA_DESCRIPTOR",
    "documentation": "Descriptor for a BMM schema. Contains a meta-data table of attributes obtained from a mini-ODIN parse of the  schema file.",
    "is_abstract": true,
    "properties": {
        "bmm_schema": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "bmm_schema",
            "documentation": "Persistent form of model.",
            "type": "BMM_SCHEMA"
        },
        "bmm_model": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "bmm_model",
            "documentation": "Computable form of model.",
            "type": "BMM_MODEL"
        },
        "schema_id": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "schema_id",
            "documentation": "Schema id, formed by \n\n`{BMM_DEFINITIONS}.create_schema_id(\n  meta_data.item({BMM_DEFINITIONS}.Metadata_model_publisher),\n  meta_data.item({BMM_DEFINITIONS}.Metadata_schema_name),\n  meta_data.item({BMM_DEFINITIONS}.Metadata_model_release)`\n\ne.g. `openehr_rm_1.0.3`, `openehr_test_1.0.1`, `iso_13606_1_2008_2.1.2`.",
            "is_mandatory": true,
            "type": "String"
        },
        "meta_data": {
            "_type": "P_BMM_GENERIC_PROPERTY",
            "name": "meta_data",
            "documentation": "Table of `{key, value}` of schema meta-data, keys are string values defined by `{BMM_DEFINITIONS}.Metadata_*` constants.",
            "is_mandatory": true,
            "type_def": {
                "root_type": "Hash",
                "generic_parameters": [
                    "String",
                    "String"
                ]
            }
        },
        "includes": {
            "_type": "P_BMM_CONTAINER_PROPERTY",
            "name": "includes",
            "documentation": "Identifiers of schemas included by this schema.",
            "type_def": {
                "container_type": "List",
                "type": "String"
            },
            "cardinality": {
                "lower": 0,
                "upper_unbounded": true
            }
        }
    },
    "functions": {
        "is_top_level": {
            "name": "is_top_level",
            "documentation": "True if this is a top-level schema, i.e. not included by some other schema.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_bmm_compatible": {
            "name": "is_bmm_compatible",
            "documentation": "True if the BMM version found in the schema (or assumed, if none) is compatible with that in this software.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "load": {
            "name": "load",
            "documentation": "Load schema into in-memory form, i.e. a `P_BMM_SCHEMA` instance, if structurally valid. If successful, `_p_schema_` will be set.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "void"
            }
        },
        "validate_merged": {
            "name": "validate_merged",
            "documentation": "Validate loaded schema and report errors.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "void"
            }
        },
        "validate_includes": {
            "name": "validate_includes",
            "documentation": "Validate includes list for this schema, to see if each mentioned schema exists in `_all_schemas_` list.",
            "parameters": {
                "all_schemas_list": {
                    "_type": "P_BMM_CONTAINER_FUNCTION_PARAMETER",
                    "name": "all_schemas_list",
                    "is_nullable": true,
                    "type_def": {
                        "container_type": "List",
                        "type": "String"
                    },
                    "cardinality": {
                        "lower": 0,
                        "upper_unbounded": true
                    }
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "void"
            }
        },
        "create_model": {
            "name": "create_model",
            "documentation": "Create `schema`, i.e. the `BMM_MODEL` from one `P_BMM_SCHEMA` schema.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "void"
            }
        }
    }
}
bmm schema descriptor

BMM_MODEL_METADATA Class

  • Definition

  • Effective

  • BMM

  • UML

Class

BMM_MODEL_METADATA

Description

Core properties of BMM_MODEL, may be used in a serial representation as well, such as P_BMM_SCHEMA.

Attributes

Signature

Meaning

1..1

rm_publisher: `String `

Publisher of model expressed in the schema.

1..1

rm_release: `String `

Release of model expressed in the schema as a 3-part numeric, e.g. "3.1.0" .

BMM_MODEL_METADATA

Core properties of BMM_MODEL, may be used in a serial representation as well, such as P_BMM_SCHEMA.

Attributes

rm_publisher: `String ` [1..1]

Publisher of model expressed in the schema.

rm_release: `String ` [1..1]

Release of model expressed in the schema as a 3-part numeric, e.g. "3.1.0" .

{
    "name": "BMM_MODEL_METADATA",
    "documentation": "Core properties of `BMM_MODEL`, may be used in a serial representation as well, such as `P_BMM_SCHEMA`.",
    "properties": {
        "rm_publisher": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "rm_publisher",
            "documentation": "Publisher of model expressed in the schema.",
            "is_mandatory": true,
            "type": "String"
        },
        "rm_release": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "rm_release",
            "documentation": "Release of model expressed in the schema as a 3-part numeric, e.g. \"3.1.0\" . ",
            "is_mandatory": true,
            "type": "String"
        }
    }
}
bmm model metadata

BMM_SCHEMA Class

  • Definition

  • Effective

  • BMM

  • UML

Class

BMM_SCHEMA (abstract)

Description

Abstract parent of any persistable form of a BMM model, e.g. P_BMM_SCHEMA.

Inherit

BMM_MODEL_METADATA

Attributes

Signature

Meaning

1..1

bmm_version: `String `

Version of BMM model, enabling schema evolution reasoning. Persisted attribute.

0..1

includes: Hash <String ,BMM_INCLUDE_SPEC>

Inclusion list of any form of BMM model, in the form of a hash of individual include specifications, each of which at least specifies the id of another schema, and may specify a namespace via which types from the included schemas are known in this schema. Persisted attribute.

0..1

bmm_model: BMM_MODEL

Generated by create_bmm_model from persisted elements.

1..1

state: BMM_SCHEMA_STATE

Current processing state.

0..1

model_name: `String `

Name of this model, if this schema is a model root point. Not set for sub-schemas that are not considered models on their own.

1..1

schema_name: `String `

Name of model expressed in schema; a 'schema' usually contains all of the packages of one 'model' of a publisher. A publisher with more than one model can have multiple schemas.

1..1

schema_revision: `String `

Revision of schema.

1..1

schema_lifecycle_state: `String `

Schema development lifecycle state.

1..1

schema_author: `String `

Primary author of schema.

1..1

schema_description: `String `

Description of schema.

0..1

schema_contributors: List <String >

Contributing authors of schema.

Functions

Signature

Meaning

1..1
(abstract)

validate_created (): void

Pre_state: state = State_created

Post_state: passed implies state = State_validated_created

Do some basic validation post initial creation

  • check that package structure is regular:

    • only top-level packages can have qualified names

    • no top-level package name can be a direct parent or child of another (child package must be declared under the parent)

  • check that all classes are mentioned in the package structure

  • check that all models refer to valid packages

1..1
(abstract)

load_finalise (): void

Pre_state: state = State_validated_created

Post_state: state = State_includes_processed or state = State_includes_pending

Finalisation work:

  • convert packages to canonical form, i.e. full hierarchy with no packages with names like aa.bb.cc

  • set up include processing list

1..1
(abstract)

merge (
other: BMM_SCHEMA[1]
): void

Pre_state: state = State_includes_pending
Pre_other_valid: includes_to_process.has (included_schema.schema_id)

Merge in class and package definitions from other, except where the current schema already has a definition for the given type or package.

1..1
(abstract)

validate (): void

Main validation prior to generation of bmm_model.

1..1
(abstract)

create_bmm_model (): void

Pre_state: state = P_BMM_PACKAGE_STATE.State_includes_processed

Populate bmm_model from schema.

1..1

read_to_validate (): Boolean `

Post_state: `state = State_includes_processed

True when validation may be commenced.

1..1

schema_id (): `String `

Identifier of this schema, used for stating inclusions and identifying files. Formed as:

{BMM_DEFINITIONS}.create_schema_id ( rm_publisher, schema_name, rm_release)

E.g. "openehr_rm_ehr_1.0.4".

BMM_SCHEMA (abstract)

Abstract parent of any persistable form of a BMM model, e.g. P_BMM_SCHEMA.

Inherits: BMM_MODEL_METADATA

Attributes

rm_publisher: `String ` [1..1]

Publisher of model expressed in the schema.
Inherited from BMM_MODEL_METADATA

rm_release: `String ` [1..1]

Release of model expressed in the schema as a 3-part numeric, e.g. "3.1.0" .
Inherited from BMM_MODEL_METADATA

bmm_version: `String ` [1..1]

Version of BMM model, enabling schema evolution reasoning. Persisted attribute.

includes: Hash <String ,BMM_INCLUDE_SPEC> [0..1]

Inclusion list of any form of BMM model, in the form of a hash of individual include specifications, each of which at least specifies the id of another schema, and may specify a namespace via which types from the included schemas are known in this schema. Persisted attribute.

bmm_model: BMM_MODEL [0..1]

Generated by create_bmm_model from persisted elements.

state: BMM_SCHEMA_STATE [1..1]

Current processing state.

model_name: `String ` [0..1]

Name of this model, if this schema is a model root point. Not set for sub-schemas that are not considered models on their own.

schema_name: `String ` [1..1]

Name of model expressed in schema; a 'schema' usually contains all of the packages of one 'model' of a publisher. A publisher with more than one model can have multiple schemas.

schema_revision: `String ` [1..1]

Revision of schema.

schema_lifecycle_state: `String ` [1..1]

Schema development lifecycle state.

schema_author: `String ` [1..1]

Primary author of schema.

schema_description: `String ` [1..1]

Description of schema.

schema_contributors: List <String > [0..1]

Contributing authors of schema.

Functions

(abstract) validate_created (): void

Pre_state: state = State_created

Post_state: passed implies state = State_validated_created [1..1]

Do some basic validation post initial creation

  • check that package structure is regular:

    • only top-level packages can have qualified names

    • no top-level package name can be a direct parent or child of another (child package must be declared under the parent)

  • check that all classes are mentioned in the package structure

  • check that all models refer to valid packages

(abstract) load_finalise (): void

Pre_state: state = State_validated_created

Post_state: state = State_includes_processed or state = State_includes_pending [1..1]

Finalisation work:

  • convert packages to canonical form, i.e. full hierarchy with no packages with names like aa.bb.cc

  • set up include processing list

(abstract) merge (
other: BMM_SCHEMA[1]
): void

Pre_state: state = State_includes_pending
Pre_other_valid: includes_to_process.has (included_schema.schema_id) [1..1]

Merge in class and package definitions from other, except where the current schema already has a definition for the given type or package.

(abstract) validate (): void [1..1]

Main validation prior to generation of bmm_model.

(abstract) create_bmm_model (): void

Pre_state: state = P_BMM_PACKAGE_STATE.State_includes_processed [1..1]

Populate bmm_model from schema.

read_to_validate (): Boolean `

Post_state: `state = State_includes_processed
[1..1]

True when validation may be commenced.

schema_id (): `String ` [1..1]

Identifier of this schema, used for stating inclusions and identifying files. Formed as:

{BMM_DEFINITIONS}.create_schema_id ( rm_publisher, schema_name, rm_release)

E.g. "openehr_rm_ehr_1.0.4".

{
    "name": "BMM_SCHEMA",
    "documentation": "Abstract parent of any persistable form of a BMM model, e.g. `P_BMM_SCHEMA`.",
    "is_abstract": true,
    "ancestors": [
        "BMM_MODEL_METADATA"
    ],
    "properties": {
        "bmm_version": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "bmm_version",
            "documentation": "Version of BMM model, enabling schema evolution reasoning. Persisted attribute.",
            "is_mandatory": true,
            "type": "String"
        },
        "includes": {
            "_type": "P_BMM_GENERIC_PROPERTY",
            "name": "includes",
            "documentation": "Inclusion list of any form of BMM model, in the form of a hash of individual include specifications, each of which at least specifies the id of another schema, and may specify a namespace via which types from the included schemas are known in this schema.\nPersisted attribute.",
            "type_def": {
                "root_type": "Hash",
                "generic_parameters": [
                    "String",
                    "BMM_INCLUDE_SPEC"
                ]
            }
        },
        "bmm_model": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "bmm_model",
            "documentation": "Generated by `_create_bmm_model_` from persisted elements.",
            "type": "BMM_MODEL"
        },
        "state": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "state",
            "documentation": "Current processing state.",
            "is_mandatory": true,
            "type": "BMM_SCHEMA_STATE"
        },
        "model_name": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "model_name",
            "documentation": "Name of this model, if this schema is a model root point. Not set for sub-schemas that are not considered models on their own.",
            "type": "String"
        },
        "schema_name": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "schema_name",
            "documentation": "Name of model expressed in schema; a 'schema' usually contains all of the packages of one 'model' of a publisher. A publisher with more than one model can have multiple schemas. ",
            "is_mandatory": true,
            "type": "String"
        },
        "schema_revision": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "schema_revision",
            "documentation": "Revision of schema.",
            "is_mandatory": true,
            "type": "String"
        },
        "schema_lifecycle_state": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "schema_lifecycle_state",
            "documentation": "Schema development lifecycle state. ",
            "is_mandatory": true,
            "type": "String"
        },
        "schema_author": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "schema_author",
            "documentation": "Primary author of schema. ",
            "is_mandatory": true,
            "type": "String"
        },
        "schema_description": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "schema_description",
            "documentation": "Description of schema. ",
            "is_mandatory": true,
            "type": "String"
        },
        "schema_contributors": {
            "_type": "P_BMM_CONTAINER_PROPERTY",
            "name": "schema_contributors",
            "documentation": "Contributing authors of schema. ",
            "type_def": {
                "container_type": "List",
                "type": "String"
            },
            "cardinality": {
                "lower": 0,
                "upper_unbounded": true
            }
        }
    },
    "functions": {
        "validate_created": {
            "name": "validate_created",
            "documentation": "Do some basic validation post initial creation\n\n* check that package structure is regular:\n** only top-level packages can have qualified names\n** no top-level package name can be a direct parent or child of another (child package must be declared under the parent)\n* check that all classes are mentioned in the package structure\n* check that all models refer to valid packages",
            "is_abstract": true,
            "pre_conditions": {
                "Pre_state": "state = State_created"
            },
            "post_conditions": {
                "Post_state": "passed implies state = State_validated_created"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "void"
            }
        },
        "load_finalise": {
            "name": "load_finalise",
            "documentation": "Finalisation work:\n\n* convert packages to canonical form, i.e. full hierarchy with no packages with names like aa.bb.cc\n* set up include processing list",
            "is_abstract": true,
            "pre_conditions": {
                "Pre_state": "state = State_validated_created"
            },
            "post_conditions": {
                "Post_state": "state = State_includes_processed or state = State_includes_pending"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "void"
            }
        },
        "merge": {
            "name": "merge",
            "documentation": "Merge in class and package definitions from `_other_`, except where the current schema already has a definition for the given type or package.",
            "is_abstract": true,
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "BMM_SCHEMA"
                }
            },
            "pre_conditions": {
                "Pre_state": "state = State_includes_pending",
                "Pre_other_valid": "includes_to_process.has (included_schema.schema_id)"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "void"
            }
        },
        "validate": {
            "name": "validate",
            "documentation": "Main validation prior to generation of `_bmm_model_`.",
            "is_abstract": true,
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "void"
            }
        },
        "create_bmm_model": {
            "name": "create_bmm_model",
            "documentation": "Populate `_bmm_model_` from schema.",
            "is_abstract": true,
            "pre_conditions": {
                "Pre_state": "state = P_BMM_PACKAGE_STATE.State_includes_processed"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "void"
            }
        },
        "read_to_validate": {
            "name": "read_to_validate",
            "documentation": "True when validation may be commenced.",
            "post_conditions": {
                "Post_state": "state = State_includes_processed"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "schema_id": {
            "name": "schema_id",
            "documentation": "Identifier of this schema, used for stating inclusions and identifying files. Formed as:\n\n`{BMM_DEFINITIONS}.create_schema_id ( _rm_publisher_,  _schema_name_,   _rm_release_)`\n\nE.g. `\"openehr_rm_ehr_1.0.4\"`.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "String"
            }
        }
    }
}
bmm schema

BMM_SCHEMA_STATE Enumeration

  • Definition

  • Effective

  • BMM

  • UML

Enumeration

BMM_SCHEMA_STATE

Description

Enumeration of processing states of a BMM_SCHEMA used by creation and validation routines in BMM_SCHEMA.

Constants

Signature

Meaning

State_created

Initial state directly after instantiation of schema.

State_validated_created

Initial validation pass after instantiation.

State_includes_pending

State of schema processing if there are still included schemas to process.

State_includes_processed

State when all included schemas have been processed.

BMM_SCHEMA_STATE

Enumeration of processing states of a BMM_SCHEMA used by creation and validation routines in BMM_SCHEMA.

Inherits: String

Constants

State_created

Initial state directly after instantiation of schema.

State_validated_created

Initial validation pass after instantiation.

State_includes_pending

State of schema processing if there are still included schemas to process.

State_includes_processed

State when all included schemas have been processed.

{
    "_type": "P_BMM_ENUMERATION_STRING",
    "name": "BMM_SCHEMA_STATE",
    "documentation": "Enumeration of processing states of a `BMM_SCHEMA` used by creation and validation routines in `BMM_SCHEMA`.",
    "ancestors": [
        "String"
    ],
    "item_names": [
        "State_created",
        "State_validated_created",
        "State_includes_pending",
        "State_includes_processed"
    ],
    "item_documentations": [
        "Initial state directly after instantiation of schema.",
        "Initial validation pass after instantiation.",
        "State of schema processing if there are still included schemas to process.",
        "State when all included schemas have been processed."
    ]
}
bmm schema state

BMM_INCLUDE_SPEC Class

  • Definition

  • Effective

  • BMM

  • UML

Class

BMM_INCLUDE_SPEC

Description

Schema inclusion structure.

Attributes

Signature

Meaning

1..1

id: `String `

Full identifier of the included schema, e.g. "openehr_primitive_types_1.0.2".

BMM_INCLUDE_SPEC

Schema inclusion structure.

Attributes

id: `String ` [1..1]

Full identifier of the included schema, e.g. "openehr_primitive_types_1.0.2".

{
    "name": "BMM_INCLUDE_SPEC",
    "documentation": "Schema inclusion structure.",
    "properties": {
        "id": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "id",
            "documentation": "Full identifier of the included schema, e.g. `\"openehr_primitive_types_1.0.2\"`.",
            "is_mandatory": true,
            "type": "String"
        }
    }
}
bmm include spec