We're updating the issue view to help you get more done.Learn more

Archetype slot regular expressions should cover whole identifier

In archetypes based on the current specifications (1.0.x), archetype slots have often been defined with partial regular expressions, which match only part of an archetype identifier.
Given the Archetype ID is something like :
instead of :
    archetype_id/value matches {/address\.v1/}
we should have (at the very least):
    archetype_id/value matches {/CLUSTER\.address\.v1 /}
or (preferably)
   archetype_id/value matches {/openEHR-EHR-CLUSTER\.address\.v1 /}

The reason for this is that slot regexes are not just used to determine if a given archetype identifier matches the slot (when a partial regex might work, although probably not reliably), but archetype id regexes are also used against a whole library of archetypes to generate lists of archetype_ids that match the slot, and the intended classes and reference model names need to be used to guarantee correct matching.

Note that regex matching on archetype identifiers is syntactic; it does not ensure that archetypes based on subtypes of a mentioned type will match, since matching is a lexical operation. Such matches have to be specified explicitly by a multi-pattern regex (usually using the '|' character).



Thomas Beale


Thomas Beale

Raised By

Adam Flinton

Impact Analysis

There will be minor impact on tools to ensure that this checking is performed, however implementation in the Java project shows that it is easy to implement.


Thomas Beale

Change Description

The following changes are proposed to the ADL sepcification, section - Slots based on Archetype Identifiers and Concepts: There are two ways in which archetype_id regular expressions patterns can be used: * as a pattern against which to test a particular archetype identifier being proposed for that slot; * as a pattern to use against a population of archetypes (e.g. all archetypes in a particular repository) in order to generate a list of all possible archetypes for filling the slot. Due to the second use, it is required that the regular expression pattern always cover a full archetype identifier rather than only sub-parts. As a consequence, a 'meta-pattern' can be defined to check archetype_id regular expressions for validity: ^.+-.+-.+\..*\..+$ The following changes are made to the AOM: A new type EXPR_ARCHETYPE_ID_CONSTRAINT is added to the Assertion package, to represent constraints specifically on archetype identifiers. This enables the meta-pattern ^.+-.+-.+\..*\..+$ to be enforced as a template.

Time estimate



Fix versions

Affects versions

ADL 1.4

Due date