diff --git a/docs/ADL1.4.html b/docs/ADL1.4.html index 0df1411..d913c10 100644 --- a/docs/ADL1.4.html +++ b/docs/ADL1.4.html @@ -4,7 +4,7 @@ - + Archetype Definition Language 1.4 (ADL1.4) @@ -434,7 +434,7 @@

Release: AM latest

+

Release: AM Release-2.3.0

Status: STABLE

@@ -458,7 +458,7 @@

© 2003 - 2023 The openEHR Foundation +© 2003 - 2024 The openEHR Foundation @@ -498,7 +498,7 @@

Amend -

AM Release 2.3.?

+

AM Release 2.3.0

1.4.6

@@ -937,7 +937,7 @@

1.4. Status

Note
-for users requiring the most recent form of ADL and archteype technology in general, the Archetype Definition Language 2 (ADL2) specifications should be used. In particular, the Archetype Technology Overview should be referred to for the most current description of Archetype Technology. +for users requiring the most recent form of ADL and archteype technology in general, the Archetype Definition Language 2 (ADL2) specifications should be used. In particular, the Archetype Technology Overview should be referred to for the most current description of Archetype Technology. @@ -1029,7 +1029,7 @@

2. Overview

2.1. What is ADL?

-

Archetype Definition Language (ADL) is a formal language for expressing archetypes, which are constraint-based models of domain entities, or what some might call 'structured business rules'. The archetype concept is described by Beale (2000), Beale (2002). The openEHR Archetype Object Model 1.4 describes the definitive semantic model of archetypes, in the form of an object model. The ADL syntax is one possible serialisation of an archetype.

+

Archetype Definition Language (ADL) is a formal language for expressing archetypes, which are constraint-based models of domain entities, or what some might call 'structured business rules'. The archetype concept is described by Beale (2000), Beale (2002). The openEHR Archetype Object Model 1.4 describes the definitive semantic model of archetypes, in the form of an object model. The ADL syntax is one possible serialisation of an archetype.

The openEHR archetype framework is described in terms of Archetype Definitions and Principles and an Archetype System. Other semantic formalisms considered in the course of the development of ADL, and some which remain relevant are described in detailed in Appendix A.

@@ -1068,63 +1068,63 @@

2.1.2. An Example

-
archetype (adl_version=1.4)
+
archetype (adl_version=1.4)
     adl-test-instrument.guitar.draft.v1
 
 concept
     [at0000]
 
 language
-    original_language = <[iso_639-1::en]>
+    original_language = <[iso_639-1::en]>
 
 definition
-    INSTRUMENT[at0000] matches {
-        size matches {|60..120|}                            -- size in cm
-        date_of_manufacture matches {yyyy-mm-??}            -- year & month ok
-        parts cardinality matches {0..*} matches {
-            PART[at0001] matches {                          -- neck
-                material matches {[local::at0003, at0004]}  -- timber or nickel alloy
-            }
-            PART[at0002] matches {                          -- body
-                material matches {[local::at0003]}          -- timber
-            }
-        }
-    }
+    INSTRUMENT[at0000] matches {
+        size matches {|60..120|}                            -- size in cm
+        date_of_manufacture matches {yyyy-mm-??}            -- year & month ok
+        parts cardinality matches {0..*} matches {
+            PART[at0001] matches {                          -- neck
+                material matches {[local::at0003, at0004]}  -- timber or nickel alloy
+            }
+            PART[at0002] matches {                          -- body
+                material matches {[local::at0003]}          -- timber
+            }
+        }
+    }
 
 ontology
-    term_definitions = <
-        ["en"] = <
-            items = <
-                ["at0000"] = <
-                    text = <"guitar">;
-                    description = <"stringed instrument">
-                >
-                ["at0001"] = <
-                    text = <"neck">;
-                    description = <"neck of guitar">
-                >
-                ["at0002"] = <
-                    text = <"body">;
-                    description = <"body of guitar">
-                >
-                ["at0003"] = <
-                    text = <"timber">;
-                    description = <"straight, seasoned timber">
-                >
-                ["at0004"] = <
-                    text = <"nickel alloy">;
-                    description = <"frets">
-                >
-            >
-        >
-    >
+ term_definitions = < + ["en"] = < + items = < + ["at0000"] = < + text = <"guitar">; + description = <"stringed instrument"> + > + ["at0001"] = < + text = <"neck">; + description = <"neck of guitar"> + > + ["at0002"] = < + text = <"body">; + description = <"body of guitar"> + > + ["at0003"] = < + text = <"timber">; + description = <"straight, seasoned timber"> + > + ["at0004"] = < + text = <"nickel alloy">; + description = <"frets"> + > + > + > + >

2.1.3. Semantics

-

As a parsable syntax, ADL has a formal relationship with structural models such as those expressed in UML, according to the scheme of the following figure. Here we can see that ADL documents are parsed into a network of objects (often known as a ‘parse tree’) which are themselves defined by a formal, abstract object model (see The openEHR Archetype Object Model 1.4. Such a model can in turn be re-expressed as any number of concrete models, such as in a programming language, XML-schema or OMG IDL.

+

As a parsable syntax, ADL has a formal relationship with structural models such as those expressed in UML, according to the scheme of the following figure. Here we can see that ADL documents are parsed into a network of objects (often known as a ‘parse tree’) which are themselves defined by a formal, abstract object model (see The openEHR Archetype Object Model 1.4. Such a model can in turn be re-expressed as any number of concrete models, such as in a programming language, XML-schema or OMG IDL.

While ADL syntax remains the primary abstract formalism for expressing archetypes, the AOM defines the semantics of an archetype, in particular relationships which must hold true between the parts of an archetype for it to be valid as a whole.

@@ -1448,21 +1448,21 @@

4.1. Overview

-
person = (List<PERSON>) <
-    [01234] = <
-        name = < -- person's name
-            forenames = <"Sherlock">
-            family_name = <"Holmes">
-            salutation = <"Mr">
-        >
-        address = < -- person's address
-            habitation_number = <"221B">
-            street_name = <"Baker St">
-            city = <"London">
-            country = <"England">
-        >
-    >
-    [01235] = < -- etc >
+
person = (List<PERSON>) <
+    [01234] = <
+        name = < -- person's name
+            forenames = <"Sherlock">
+            family_name = <"Holmes">
+            salutation = <"Mr">
+        >
+        address = < -- person's address
+            habitation_number = <"221B">
+            street_name = <"Baker St">
+            city = <"London">
+            country = <"England">
+        >
+    >
+    [01235] = < -- etc >
 >
@@ -1625,12 +1625,12 @@

4.2.6. Semi-col

-
term = <text = <"plan">; description = <"The clinician's advice">>
-term = <text = <"plan"> description = <"The clinician's advice">>
+
term = <text = <"plan">; description = <"The clinician's advice">>
+term = <text = <"plan"> description = <"The clinician's advice">>
 
-term = <
-    text = <"plan">
-    description = <"The clinician's advice">
+term = <
+    text = <"plan">
+    description = <"The clinician's advice">
 >
@@ -1679,19 +1679,19 @@

4.4.1. Genera

-
attr_1 = <
-    attr_2 = <
-        attr_3 = <leaf_value>
-        attr_4 = <leaf_value>
-    >
-    attr_5 = <
-        attr_3 = <
-            attr_6 = <leaf_value>
-        >
-        attr_7 = <leaf_value>
-    >
+
attr_1 = <
+    attr_2 = <
+        attr_3 = <leaf_value>
+        attr_4 = <leaf_value>
+    >
+    attr_5 = <
+        attr_3 = <
+            attr_6 = <leaf_value>
+        >
+        attr_7 = <leaf_value>
+    >
 >
-attr_8 = <...>
+attr_8 = <...>
@@ -1722,15 +1722,15 @@
4.4.1.2. Paths
-
    /attr_1
-    /attr_1/attr_2
-    /attr_1/attr_2/attr_3           -- path to a leaf value
-    /attr_1/attr_2/attr_4           -- path to a leaf value
-    /attr_1/attr_5
-    /attr_1/attr_5/attr_3
-    /attr_1/attr_5/attr_3/attr_6    -- path to a leaf value
-    /attr_1/attr_5/attr_7           -- path to a leaf value
-    /attr_8
+
    /attr_1
+    /attr_1/attr_2
+    /attr_1/attr_2/attr_3           -- path to a leaf value
+    /attr_1/attr_2/attr_4           -- path to a leaf value
+    /attr_1/attr_5
+    /attr_1/attr_5/attr_3
+    /attr_1/attr_5/attr_3/attr_6    -- path to a leaf value
+    /attr_1/attr_5/attr_7           -- path to a leaf value
+    /attr_8
@@ -1745,7 +1745,7 @@

4.4.2. Em

-
    address = <...>    -- person's address
+
    address = <...>    -- person's address
@@ -1774,8 +1774,8 @@

4.4

-
fruits = <"pear", "cumquat", "peach">
-some_primes = <1, 2, 3, 5>
+
fruits = <"pear", "cumquat", "peach">
+some_primes = <1, 2, 3, 5>
@@ -1785,10 +1785,10 @@

4.4
-- WARNING: THIS IS NOT VALID dADL
 
-people = <
-    <name = <...> date_of_birth = <...> sex = <...> interests = <...> >
-    <name = <...> date_of_birth = <...> sex = <...> interests = <...> >
-    -- etc
+people = <
+    <name = <...> date_of_birth = <...> sex = <...> interests = <...> >
+    <name = <...> date_of_birth = <...> sex = <...> interests = <...> >
+    -- etc
 >

@@ -1800,10 +1800,10 @@

4.4
-
people = <
-    [1] = <name = <...> birth_date = <...> interests = <...> >
-    [2] = <name = <...> birth_date = <...> interests = <...> >
-    [3] = <name = <...> birth_date = <...> interests = <...> >
+
people = <
+    [1] = <name = <...> birth_date = <...> interests = <...> >
+    [2] = <name = <...> birth_date = <...> interests = <...> >
+    [3] = <name = <...> birth_date = <...> interests = <...> >
 >
@@ -1812,10 +1812,10 @@

4.4
-
people = <
-    ["akmal:1975-04-22"] = <name = <...> birth_date = <...> interests = <...> >
-    ["akmal:1962-02-11"] = <name = <...> birth_date = <...> interests = <...> >
-    ["gianni:1978-11-30"] = <name = <...> birth_date = <...> interests = <...> >
+
people = <
+    ["akmal:1975-04-22"] = <name = <...> birth_date = <...> interests = <...> >
+    ["akmal:1962-02-11"] = <name = <...> birth_date = <...> interests = <...> >
+    ["gianni:1978-11-30"] = <name = <...> birth_date = <...> interests = <...> >
 >
@@ -1827,35 +1827,35 @@

4.4
-
school_schedule = <
-    lesson_times = <08:30:00, 09:30:00, 10:30:00, ...>
-
-    locations = <
-        [1] = <"under the big plane tree">
-        [2] = <"under the north arch">
-        [3] = <"in a garden">
-    >
-
-    subjects = <
-        ["philosophy:plato"] = < -- note construction of key
-            name = <"philosophy">
-            teacher = <"plato">
-            topics = <"meta-physics", "natural science">
-            weighting = <76%>
-        >
-        ["philosophy:kant"] = <
-            name = <"philosophy">
-            teacher = <"kant">
-            topics = <"meaning and reason", "meta-physics", "ethics">
-            weighting = <80%>
-        >
-        ["art"] = <
-            name = <"art">
-            teacher = <"goya">
-            topics = <"technique", "portraiture", "satire">
-            weighting = <78%>
-        >
-    >
+
school_schedule = <
+    lesson_times = <08:30:00, 09:30:00, 10:30:00, ...>
+
+    locations = <
+        [1] = <"under the big plane tree">
+        [2] = <"under the north arch">
+        [3] = <"in a garden">
+    >
+
+    subjects = <
+        ["philosophy:plato"] = < -- note construction of key
+            name = <"philosophy">
+            teacher = <"plato">
+            topics = <"meta-physics", "natural science">
+            weighting = <76%>
+        >
+        ["philosophy:kant"] = <
+            name = <"philosophy">
+            teacher = <"kant">
+            topics = <"meaning and reason", "meta-physics", "ethics">
+            weighting = <80%>
+        >
+        ["art"] = <
+            name = <"art">
+            teacher = <"goya">
+            topics = <"technique", "portraiture", "satire">
+            weighting = <78%>
+        >
+    >
 >
@@ -1867,17 +1867,17 @@

4.4
-
class SCHEDULE
-    lesson_times: List<Time>
-    locations: List<String>
-    subjects: List<SUBJECT> -- or it could be Hash<SUBJECT>
+
class SCHEDULE
+    lesson_times: List<Time>
+    locations: List<String>
+    subjects: List<SUBJECT> -- or it could be Hash<SUBJECT>
 end
 
-class SUBJECT
-    name: String
-    teacher: String
-    topics: List<String>
-    weighting: Real
+class SUBJECT
+    name: String
+    teacher: String
+    topics: List<String>
+    weighting: Real
 end
@@ -1894,8 +1894,8 @@
4.4.3.1. Paths
-
/school_schedule/locations[1]                   -- path to "under the big..."
-/school_schedule/subjects["philosophy:kant"]    -- path to "kant"
+
/school_schedule/locations[1]                   -- path to "under the big..."
+/school_schedule/subjects["philosophy:kant"]    -- path to "kant"
@@ -1907,19 +1907,19 @@

-
list_of_string_lists = <
-    [1] = <
-        [1] = <"first string in first list">
-        [2] = <"second string in first list">
-    >
-    [2] = <
-        [1] = <"first string in second list">
-        [2] = <"second string in second list">
-        [3] = <"third string in second list">
-    >
-    [3] = <
-        [1] = <"only string in third list">
-    >
+
list_of_string_lists = <
+    [1] = <
+        [1] = <"first string in first list">
+        [2] = <"second string in first list">
+    >
+    [2] = <
+        [1] = <"first string in second list">
+        [2] = <"second string in second list">
+        [3] = <"third string in second list">
+    >
+    [3] = <
+        [1] = <"only string in third list">
+    >
 >
@@ -1945,19 +1945,19 @@

-
destinations = <
-    ["seville"] = (TOURIST_DESTINATION) <
-        profile = (DESTINATION_PROFILE) <...>
-        hotels = <
-            ["gran sevilla"] = (HISTORIC_HOTEL) <...>
-            ["sofitel"] = (LUXURY_HOTEL) <...>
-            ["hotel real"] = (PENSION) <...>
-        >
-        attractions = <
-            ["la corrida"] = (SPORT_VENUE) <...>
-            ["Alcázar"] = (HISTORIC_SITE) <...>
-        >
-    >
+
destinations = <
+    ["seville"] = (TOURIST_DESTINATION) <
+        profile = (DESTINATION_PROFILE) <...>
+        hotels = <
+            ["gran sevilla"] = (HISTORIC_HOTEL) <...>
+            ["sofitel"] = (LUXURY_HOTEL) <...>
+            ["hotel real"] = (PENSION) <...>
+        >
+        attractions = <
+            ["la corrida"] = (SPORT_VENUE) <...>
+            ["Alcázar"] = (HISTORIC_SITE) <...>
+        >
+    >
 >
@@ -1966,8 +1966,8 @@

-
hotels = (List<HOTEL>) <
-    ["gran sevilla"] = (HISTORIC_HOTEL) <>
+
hotels = (List<HOTEL>) <
+    ["gran sevilla"] = (HISTORIC_HOTEL) <>
 >
@@ -1991,26 +1991,26 @@

-
destinations = <
-    ["seville"] = <
-        hotels = <
-            ["gran sevilla"] = </hotels["gran sevilla"]>
-            ["sofitel"] = </hotels["sofitel"]>
-            ["hotel real"] = </hotels["hotel real"]>
-        >
-    >
+
destinations = <
+    ["seville"] = <
+        hotels = <
+            ["gran sevilla"] = </hotels["gran sevilla"]>
+            ["sofitel"] = </hotels["sofitel"]>
+            ["hotel real"] = </hotels["hotel real"]>
+        >
+    >
 >
-bookings = <
-    ["seville:0134"] = <
-        customer_id = <"0134">
-        period = <...>
-        hotel = </hotels["sofitel"]>
-    >
+bookings = <
+    ["seville:0134"] = <
+        customer_id = <"0134">
+        period = <...>
+        hotel = </hotels["sofitel"]>
+    >
 >
-hotels = <
-    ["gran sevilla"] = (HISTORIC_HOTEL) <>
-    ["sofitel"] = (LUXURY_HOTEL) <>
-    ["hotel real"] = (PENSION) <>
+hotels = <
+    ["gran sevilla"] = (HISTORIC_HOTEL) <>
+    ["sofitel"] = (LUXURY_HOTEL) <>
+    ["hotel real"] = (PENSION) <>
 >
@@ -2094,7 +2094,7 @@
4.5.1.2. String
-
text = <"And now the STORM-BLAST came, and he
+
text = <"And now the STORM-BLAST came, and he
         Was tyrannous and strong :
         He struck with his o'ertaking wings,
         And chased us south along.">
@@ -2409,13 +2409,13 @@

<

-
subjects = <
-    ["philosophy:plato"] = <
-        name = <"philosophy">
-    >
-    ["philosophy:kant"] = <
-        name = <"philosophy">
-    >
+
subjects = <
+    ["philosophy:plato"] = <
+        name = <"philosophy">
+    >
+    ["philosophy:kant"] = <
+        name = <"philosophy">
+    >
 >
@@ -2424,15 +2424,15 @@

<

-
<subjects id="philosophy:plato">
-    <name>
-        philosophy
-    </name>
+
<subjects id="philosophy:plato">
+    <name>
+        philosophy
+    </name>
 </subjects>
-<subjects id="philosophy:kant">
-    <name>
-        philosophy
-    </name>
+<subjects id="philosophy:kant">
+    <name>
+        philosophy
+    </name>
 </subjects>
@@ -2447,15 +2447,15 @@

-
countries = <
-    ["spain"] = <
-        ["hotels"] = <...>
-        ["attractions"] = <...>
-    >
-    ["egypt"] = <
-        ["hotels"] = <...>
-        ["attractions"] = <...>
-    >
+
countries = <
+    ["spain"] = <
+        ["hotels"] = <...>
+        ["attractions"] = <...>
+    >
+    ["egypt"] = <
+        ["hotels"] = <...>
+        ["attractions"] = <...>
+    >
 >
@@ -2464,21 +2464,21 @@

-
<countries key="spain">
-    <_items key="hotels">
-        ...
-    </_items>
-    <_items key="attractions">
-        ...
-    </_items>
+
<countries key="spain">
+    <_items key="hotels">
+        ...
+    </_items>
+    <_items key="attractions">
+        ...
+    </_items>
 </countries>
-<countries key="eqypt">
-    <_items id="hotels">
-        ...
-    </_items>
-    <_items key="attractions">
-        ...
-    </_items>
+<countries key="eqypt">
+    <_items id="hotels">
+        ...
+    </_items>
+    <_items key="attractions">
+        ...
+    </_items>
 </countries>
@@ -2493,13 +2493,13 @@

4.7.4. Type Names
-
destinations = <
-    ["seville"] = (TOURIST_DESTINATION) <
-        profile = (DESTINATION_PROFILE) <>
-        hotels = <
-            ["gran sevilla"] = (HISTORIC_HOTEL) <>
-        >
-    >
+
destinations = <
+    ["seville"] = (TOURIST_DESTINATION) <
+        profile = (DESTINATION_PROFILE) <>
+        hotels = <
+            ["gran sevilla"] = (HISTORIC_HOTEL) <>
+        >
+    >
 >
@@ -2508,13 +2508,13 @@

4.7.4. Type Names
-
<destinations id="seville" adl:type="TOURIST_DESTINATION">
-    <profile adl:type="DESTINATION_PROFILE">
-        ...
-    </profile>
-    <hotels id="gran sevilla" adl:type="HISTORIC_HOTEL">
-        ...
-    </hotels>
+
<destinations id="seville" adl:type="TOURIST_DESTINATION">
+    <profile adl:type="DESTINATION_PROFILE">
+        ...
+    </profile>
+    <hotels id="gran sevilla" adl:type="HISTORIC_HOTEL">
+        ...
+    </hotels>
 </destinations>
@@ -2532,314 +2532,314 @@

4.8.1. Grammar

-
input:
-    attr_vals
-    | complex_object_block
-    ;
-
-attr_vals:
-    attr_val
-    | attr_vals attr_val
-    | attr_vals ';' attr_val
-    ;
-
-attr_val:
-    attr_id SYM_EQ object_block
-    ;
-
-attr_id:
-    V_ATTRIBUTE_IDENTIFIER
-    ;
-
-object_block:
-    complex_object_block
-    | primitive_object_block
-    | plugin_object_block
-    ;
-
-plugin_object_block:
-    V_PLUGIN_SYNTAX_TYPE V_PLUGIN_BLOCK
-    ;
-
-complex_object_block:
-    single_attr_object_block
-    | multiple_attr_object_block
-    ;
-
-multiple_attr_object_block:
-    untyped_multiple_attr_object_block
-    | type_identifier untyped_multiple_attr_object_block
-    ;
-
-untyped_multiple_attr_object_block:
-    multiple_attr_object_block_head keyed_objects SYM_END_DBLOCK
-    ;
-
-multiple_attr_object_block_head:
-    SYM_START_DBLOCK
-    ;
-keyed_objects:
-    keyed_object
-    | keyed_objects keyed_object
-    ;
-
-keyed_object:
-    object_key SYM_EQ object_block
-    ;
-
-object_key:
-    '[' simple_value ']'
-    ;
-
-single_attr_object_block:
-    untyped_single_attr_object_block
-    | type_identifier untyped_single_attr_object_block
-    ;
-
-untyped_single_attr_object_block:
-    single_attr_object_complex_head SYM_END_DBLOCK
-    | single_attr_object_complex_head attr_vals SYM_END_DBLOCK
-    ;
-
-single_attr_object_complex_head:
-    SYM_START_DBLOCK
-
-primitive_object_block:
-    untyped_primitive_object_block
-    | type_identifier untyped_primitive_object_block
-    ;
-
-untyped_primitive_object_block:
-    SYM_START_DBLOCK primitive_object_value SYM_END_DBLOCK
-    ;
-
-primitive_object_value:
-    simple_value
-    | simple_list_value
-    | simple_interval_value
-    | term_code
-    | term_code_list_value
-    ;
-
-simple_value:
-    string_value
-    | integer_value
-    | real_value
-    | boolean_value
-    | character_value
-    | date_value
-    | time_value
-    | date_time_value
-    | duration_value
-    | uri_value
-    ;
-
-simple_list_value:
-    string_list_value
-    | integer_list_value
-    | real_list_value
-    | boolean_list_value
-    | character_list_value
-    | date_list_value
-    | time_list_value
-    | date_time_list_value
-    | duration_list_value
-    ;
-
-simple_interval_value:
-    integer_interval_value
-    | real_interval_value
-    | date_interval_value
-    | time_interval_value
-    | date_time_interval_value
-    | duration_interval_value
-    ;
-
-type_identifier:
-    '(' V_TYPE_IDENTIFIER ')'
-    | '(' V_GENERIC_TYPE_IDENTIFIER ')'
-    | V_TYPE_IDENTIFIER
-    | V_GENERIC_TYPE_IDENTIFIER
-    ;
-
-string_value:
-    V_STRING
-    ;
-
-string_list_value:
-    V_STRING ',' V_STRING
-    | string_list_value ',' V_STRING
-    | V_STRING ',' SYM_LIST_CONTINUE
-    ;
-
-integer_value:
-    V_INTEGER
-    | '+' V_INTEGER
-    | '-' V_INTEGER
-    ;
-
-integer_list_value:
-    integer_value ',' integer_value
-    | integer_list_value ',' integer_value
-    | integer_value ',' SYM_LIST_CONTINUE
-    ;
-
-integer_interval_value:
-    SYM_INTERVAL_DELIM integer_value SYM_ELLIPSIS integer_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_ELLIPSIS integer_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM integer_value SYM_ELLIPSIS SYM_LT integer_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_ELLIPSIS SYM_LT integer_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_LT integer_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_LE integer_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GE integer_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM integer_value SYM_INTERVAL_DELIM
-    ;
-
-real_value:
-    V_REAL
-    | '+' V_REAL
-    | '-' V_REAL
-    ;
-
-real_list_value:
-    real_value ',' real_value
-    | real_list_value ',' real_value
-    | real_value ',' SYM_LIST_CONTINUE
-    ;
-
-real_interval_value:
-    SYM_INTERVAL_DELIM real_value SYM_ELLIPSIS real_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT real_value SYM_ELLIPSIS real_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM real_value SYM_ELLIPSIS SYM_LT real_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT real_value SYM_ELLIPSIS SYM_LT real_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_LT real_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_LE real_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT real_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GE real_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM real_value SYM_INTERVAL_DELIM
-    ;
-
-boolean_value:
-    SYM_TRUE
-    | SYM_FALSE
-    ;
-
-boolean_list_value:
-    boolean_value ',' boolean_value
-    | boolean_list_value ',' boolean_value
-    | boolean_value ',' SYM_LIST_CONTINUE
-    ;
-
-character_value:
-    V_CHARACTER
-    ;
-
-character_list_value:
-    character_value ',' character_value
-    | character_list_value ',' character_value
-    | character_value ',' SYM_LIST_CONTINUE
-    ;
-
-date_value:
-    V_ISO8601_EXTENDED_DATE
-    ;
-
-date_list_value:
-    date_value ',' date_value
-    | date_list_value ',' date_value
-    | date_value ',' SYM_LIST_CONTINUE
-    ;
-
-date_interval_value:
-    SYM_INTERVAL_DELIM date_value SYM_ELLIPSIS date_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT date_value SYM_ELLIPSIS date_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM date_value SYM_ELLIPSIS SYM_LT date_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT date_value SYM_ELLIPSIS SYM_LT date_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_LT date_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_LE date_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT date_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GE date_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM date_value SYM_INTERVAL_DELIM
-    ;
-
-time_value:
-    V_ISO8601_EXTENDED_TIME
-
-time_list_value:
-    time_value ',' time_value
-    | time_list_value ',' time_value
-    | time_value ',' SYM_LIST_CONTINUE
-    ;
-
-time_interval_value:
-    SYM_INTERVAL_DELIM time_value SYM_ELLIPSIS time_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT time_value SYM_ELLIPSIS time_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM time_value SYM_ELLIPSIS SYM_LT time_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT time_value SYM_ELLIPSIS SYM_LT time_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_LT time_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_LE time_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT time_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GE time_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM time_value SYM_INTERVAL_DELIM
-    ;
-
-date_time_value:
-    V_ISO8601_EXTENDED_DATE_TIME
-    ;
-
-date_time_list_value:
-    date_time_value ',' date_time_value
-    | date_time_list_value ',' date_time_value
-    | date_time_value ',' SYM_LIST_CONTINUE
-    ;
-
-date_time_interval_value:
-    SYM_INTERVAL_DELIM date_time_value SYM_ELLIPSIS date_time_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_ELLIPSIS date_time_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM date_time_value SYM_ELLIPSIS SYM_LT date_time_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_ELLIPSIS SYM_LT date_time_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_LT date_time_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_LE date_time_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GE date_time_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM date_time_value SYM_INTERVAL_DELIM
-    ;
-
-duration_value:
-    V_ISO8601_DURATION
-    ;
-
-duration_list_value:
-    duration_value ',' duration_value
-    | duration_list_value ',' duration_value
-    | duration_value ',' SYM_LIST_CONTINUE
-    ;
-
-duration_interval_value:
-    SYM_INTERVAL_DELIM duration_value SYM_ELLIPSIS duration_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_ELLIPSIS duration_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM duration_value SYM_ELLIPSIS SYM_LT duration_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_ELLIPSIS SYM_LT duration_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_LT duration_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_LE duration_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM SYM_GE duration_value SYM_INTERVAL_DELIM
-    | SYM_INTERVAL_DELIM duration_value SYM_INTERVAL_DELIM
-    ;
-
-term_code:
-    V_QUALIFIED_TERM_CODE_REF
-
-term_code_list_value:
-    term_code ',' term_code
-    | term_code_list_value ',' term_code
-    | term_code ',' SYM_LIST_CONTINUE
-    ;
-
-uri_value:
-    V_URI
-    ;
+
input:
+    attr_vals
+    | complex_object_block
+    ;
+
+attr_vals:
+    attr_val
+    | attr_vals attr_val
+    | attr_vals ';' attr_val
+    ;
+
+attr_val:
+    attr_id SYM_EQ object_block
+    ;
+
+attr_id:
+    V_ATTRIBUTE_IDENTIFIER
+    ;
+
+object_block:
+    complex_object_block
+    | primitive_object_block
+    | plugin_object_block
+    ;
+
+plugin_object_block:
+    V_PLUGIN_SYNTAX_TYPE V_PLUGIN_BLOCK
+    ;
+
+complex_object_block:
+    single_attr_object_block
+    | multiple_attr_object_block
+    ;
+
+multiple_attr_object_block:
+    untyped_multiple_attr_object_block
+    | type_identifier untyped_multiple_attr_object_block
+    ;
+
+untyped_multiple_attr_object_block:
+    multiple_attr_object_block_head keyed_objects SYM_END_DBLOCK
+    ;
+
+multiple_attr_object_block_head:
+    SYM_START_DBLOCK
+    ;
+keyed_objects:
+    keyed_object
+    | keyed_objects keyed_object
+    ;
+
+keyed_object:
+    object_key SYM_EQ object_block
+    ;
+
+object_key:
+    '[' simple_value ']'
+    ;
+
+single_attr_object_block:
+    untyped_single_attr_object_block
+    | type_identifier untyped_single_attr_object_block
+    ;
+
+untyped_single_attr_object_block:
+    single_attr_object_complex_head SYM_END_DBLOCK
+    | single_attr_object_complex_head attr_vals SYM_END_DBLOCK
+    ;
+
+single_attr_object_complex_head:
+    SYM_START_DBLOCK
+
+primitive_object_block:
+    untyped_primitive_object_block
+    | type_identifier untyped_primitive_object_block
+    ;
+
+untyped_primitive_object_block:
+    SYM_START_DBLOCK primitive_object_value SYM_END_DBLOCK
+    ;
+
+primitive_object_value:
+    simple_value
+    | simple_list_value
+    | simple_interval_value
+    | term_code
+    | term_code_list_value
+    ;
+
+simple_value:
+    string_value
+    | integer_value
+    | real_value
+    | boolean_value
+    | character_value
+    | date_value
+    | time_value
+    | date_time_value
+    | duration_value
+    | uri_value
+    ;
+
+simple_list_value:
+    string_list_value
+    | integer_list_value
+    | real_list_value
+    | boolean_list_value
+    | character_list_value
+    | date_list_value
+    | time_list_value
+    | date_time_list_value
+    | duration_list_value
+    ;
+
+simple_interval_value:
+    integer_interval_value
+    | real_interval_value
+    | date_interval_value
+    | time_interval_value
+    | date_time_interval_value
+    | duration_interval_value
+    ;
+
+type_identifier:
+    '(' V_TYPE_IDENTIFIER ')'
+    | '(' V_GENERIC_TYPE_IDENTIFIER ')'
+    | V_TYPE_IDENTIFIER
+    | V_GENERIC_TYPE_IDENTIFIER
+    ;
+
+string_value:
+    V_STRING
+    ;
+
+string_list_value:
+    V_STRING ',' V_STRING
+    | string_list_value ',' V_STRING
+    | V_STRING ',' SYM_LIST_CONTINUE
+    ;
+
+integer_value:
+    V_INTEGER
+    | '+' V_INTEGER
+    | '-' V_INTEGER
+    ;
+
+integer_list_value:
+    integer_value ',' integer_value
+    | integer_list_value ',' integer_value
+    | integer_value ',' SYM_LIST_CONTINUE
+    ;
+
+integer_interval_value:
+    SYM_INTERVAL_DELIM integer_value SYM_ELLIPSIS integer_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_ELLIPSIS integer_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM integer_value SYM_ELLIPSIS SYM_LT integer_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_ELLIPSIS SYM_LT integer_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_LT integer_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_LE integer_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GE integer_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM integer_value SYM_INTERVAL_DELIM
+    ;
+
+real_value:
+    V_REAL
+    | '+' V_REAL
+    | '-' V_REAL
+    ;
+
+real_list_value:
+    real_value ',' real_value
+    | real_list_value ',' real_value
+    | real_value ',' SYM_LIST_CONTINUE
+    ;
+
+real_interval_value:
+    SYM_INTERVAL_DELIM real_value SYM_ELLIPSIS real_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT real_value SYM_ELLIPSIS real_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM real_value SYM_ELLIPSIS SYM_LT real_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT real_value SYM_ELLIPSIS SYM_LT real_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_LT real_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_LE real_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT real_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GE real_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM real_value SYM_INTERVAL_DELIM
+    ;
+
+boolean_value:
+    SYM_TRUE
+    | SYM_FALSE
+    ;
+
+boolean_list_value:
+    boolean_value ',' boolean_value
+    | boolean_list_value ',' boolean_value
+    | boolean_value ',' SYM_LIST_CONTINUE
+    ;
+
+character_value:
+    V_CHARACTER
+    ;
+
+character_list_value:
+    character_value ',' character_value
+    | character_list_value ',' character_value
+    | character_value ',' SYM_LIST_CONTINUE
+    ;
+
+date_value:
+    V_ISO8601_EXTENDED_DATE
+    ;
+
+date_list_value:
+    date_value ',' date_value
+    | date_list_value ',' date_value
+    | date_value ',' SYM_LIST_CONTINUE
+    ;
+
+date_interval_value:
+    SYM_INTERVAL_DELIM date_value SYM_ELLIPSIS date_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT date_value SYM_ELLIPSIS date_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM date_value SYM_ELLIPSIS SYM_LT date_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT date_value SYM_ELLIPSIS SYM_LT date_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_LT date_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_LE date_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT date_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GE date_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM date_value SYM_INTERVAL_DELIM
+    ;
+
+time_value:
+    V_ISO8601_EXTENDED_TIME
+
+time_list_value:
+    time_value ',' time_value
+    | time_list_value ',' time_value
+    | time_value ',' SYM_LIST_CONTINUE
+    ;
+
+time_interval_value:
+    SYM_INTERVAL_DELIM time_value SYM_ELLIPSIS time_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT time_value SYM_ELLIPSIS time_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM time_value SYM_ELLIPSIS SYM_LT time_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT time_value SYM_ELLIPSIS SYM_LT time_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_LT time_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_LE time_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT time_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GE time_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM time_value SYM_INTERVAL_DELIM
+    ;
+
+date_time_value:
+    V_ISO8601_EXTENDED_DATE_TIME
+    ;
+
+date_time_list_value:
+    date_time_value ',' date_time_value
+    | date_time_list_value ',' date_time_value
+    | date_time_value ',' SYM_LIST_CONTINUE
+    ;
+
+date_time_interval_value:
+    SYM_INTERVAL_DELIM date_time_value SYM_ELLIPSIS date_time_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_ELLIPSIS date_time_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM date_time_value SYM_ELLIPSIS SYM_LT date_time_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_ELLIPSIS SYM_LT date_time_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_LT date_time_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_LE date_time_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GE date_time_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM date_time_value SYM_INTERVAL_DELIM
+    ;
+
+duration_value:
+    V_ISO8601_DURATION
+    ;
+
+duration_list_value:
+    duration_value ',' duration_value
+    | duration_list_value ',' duration_value
+    | duration_value ',' SYM_LIST_CONTINUE
+    ;
+
+duration_interval_value:
+    SYM_INTERVAL_DELIM duration_value SYM_ELLIPSIS duration_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_ELLIPSIS duration_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM duration_value SYM_ELLIPSIS SYM_LT duration_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_ELLIPSIS SYM_LT duration_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_LT duration_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_LE duration_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM SYM_GE duration_value SYM_INTERVAL_DELIM
+    | SYM_INTERVAL_DELIM duration_value SYM_INTERVAL_DELIM
+    ;
+
+term_code:
+    V_QUALIFIED_TERM_CODE_REF
+
+term_code_list_value:
+    term_code ',' term_code
+    | term_code_list_value ',' term_code
+    | term_code ',' SYM_LIST_CONTINUE
+    ;
+
+uri_value:
+    V_URI
+    ;
@@ -3081,16 +3081,16 @@

5.1. Overview

-
    PERSON[at0000] matches {                             -- constraint on a PERSON instance
-        name matches {                                   -- constraint on PERSON.name
-            TEXT matches {/.+/}                          -- any non-empty string
-        }
-        addresses cardinality matches {0..*} matches {   -- constraint on
-            ADDRESS matches {                            -- PERSON.addresses
-                -- etc --
-            }
-        }
-    }
+
    PERSON[at0000] matches {                             -- constraint on a PERSON instance
+        name matches {                                   -- constraint on PERSON.name
+            TEXT matches {/.+/}                          -- any non-empty string
+        }
+        addresses cardinality matches {0..*} matches {   -- constraint on
+            ADDRESS matches {                            -- PERSON.addresses
+                -- etc --
+            }
+        }
+    }
@@ -3098,16 +3098,16 @@

5.1. Overview

-
    PERSON[at0000]  {                         -- constraint on a PERSON instance
-        name  {                               -- constraint on PERSON.name
-            TEXT  {/..*/}                     -- any non-empty string
-        }
-        addresses cardinality  {1..*}  {    -- constraint on
-            ADDRESS  {                        -- PERSON.addresses
-                -- etc --
-            }
-        }
-    }
+
    PERSON[at0000]  {                         -- constraint on a PERSON instance
+        name  {                               -- constraint on PERSON.name
+            TEXT  {/..*/}                     -- any non-empty string
+        }
+        addresses cardinality  {1..*}  {    -- constraint on
+            ADDRESS  {                        -- PERSON.addresses
+                -- etc --
+            }
+        }
+    }
@@ -3188,7 +3188,7 @@

5.2.1. Keywords
-
aaa matches {/.*ion[^\s\n\t]/}      -- the set of english words ending in 'ion'
+
aaa matches {/.*ion[^\s\n\t]/}      -- the set of english words ending in 'ion'
@@ -3196,13 +3196,13 @@

5.2.1. Keywords
-
XXX matches {
-    aaa matches {                   --
-        YYY matches {0..3}          --
-    }                               -- the value space of the
-    bbb matches {                   -- and instance of XXX
-        ZZZ matches {>1992-12-01}   --
-    }                               --
+
XXX matches {
+    aaa matches {                   --
+        YYY matches {0..3}          --
+    }                               -- the value space of the
+    bbb matches {                   -- and instance of XXX
+        ZZZ matches {>1992-12-01}   --
+    }                               --
 }
@@ -3214,9 +3214,9 @@

5.2.1. Keywords
-
aaa ~matches {5}
-aaa ~is_in {5}
-aaa  {5}
+
aaa ~matches {5}
+aaa ~is_in {5}
+aaa  {5}
@@ -3267,25 +3267,25 @@

5.3. Structure<

-
    PERSON[at0001]  {
-        name  {
-            PERSON_NAME[at0002]  {
-                forenames cardinality  {1..*}  {/.+/}
-                family_name  {/.+/}
-                title  {"Dr", "Miss", "Mrs", "Mr"}
-            }
-        }
-        addresses cardinality  {1..*}  {
-            LOCATION_ADDRESS[at0003]  {
-                street_number existence  {0..1}  {/.+/}
-                street_name  {/.+/}
-                locality  {/.+/}
-                post_code  {/.+/}
-                state  {/.+/}
-                country  {/.+/}
-            }
-        }
-    }
+
    PERSON[at0001]  {
+        name  {
+            PERSON_NAME[at0002]  {
+                forenames cardinality  {1..*}  {/.+/}
+                family_name  {/.+/}
+                title  {"Dr", "Miss", "Mrs", "Mr"}
+            }
+        }
+        addresses cardinality  {1..*}  {
+            LOCATION_ADDRESS[at0003]  {
+                street_number existence  {0..1}  {/.+/}
+                street_name  {/.+/}
+                locality  {/.+/}
+                post_code  {/.+/}
+                state  {/.+/}
+                country  {/.+/}
+            }
+        }
+    }
@@ -3322,15 +3322,15 @@

5.3.1.

-
    ELEMENT[at0010] matches {          -- diastolic blood pressure
-        value matches {
-            QUANTITY matches {
-                magnitude matches {|0..1000|}
-                property matches {"pressure"}
-                units matches {"mm[Hg]"}
-            }
-        }
-    }
+
    ELEMENT[at0010] matches {          -- diastolic blood pressure
+        value matches {
+            QUANTITY matches {
+                magnitude matches {|0..1000|}
+                property matches {"pressure"}
+                units matches {"mm[Hg]"}
+            }
+        }
+    }

@@ -3346,9 +3346,9 @@
5.3.2.1. Existence<

-
    QUANTITY matches {
-        units existence matches {0..1} matches {"mm[Hg]"}
-    }
+
    QUANTITY matches {
+        units existence matches {0..1} matches {"mm[Hg]"}
+    }
@@ -3404,14 +3404,14 @@
5.3.4.1. Cardin
-
    HISTORY occurrences  {1}  {
-        periodic  {False}
-        events cardinality  {*}  {
-            EVENT[at0002] occurrences  {0..1}  {    }           -- 1 min sample
-            EVENT[at0003] occurrences  {0..1}  {    }           -- 2 min sample
-            EVENT[at0004] occurrences  {0..1}  {    }           -- 3 min sample
-        }
-    }
+
    HISTORY occurrences  {1}  {
+        periodic  {False}
+        events cardinality  {*}  {
+            EVENT[at0002] occurrences  {0..1}  {    }           -- 1 min sample
+            EVENT[at0003] occurrences  {0..1}  {    }           -- 2 min sample
+            EVENT[at0004] occurrences  {0..1}  {    }           -- 3 min sample
+        }
+    }
@@ -3419,9 +3419,9 @@
5.3.4.1. Cardin
-
    events cardinality  {*; ordered}  {                   -- logical list
-    events cardinality  {*; unordered; unique}  {         -- logical set
-    events cardinality  {*; unordered}  {                 -- logical bag
+
    events cardinality  {*; ordered}  {                   -- logical list
+    events cardinality  {*; unordered; unique}  {         -- logical set
+    events cardinality  {*; unordered}  {                 -- logical bag
@@ -3438,7 +3438,7 @@
5.3.4.1. Cardin
-
    events existence  {0..1} cardinality  {0..*}  {-- etc --}
+
    events existence  {0..1} cardinality  {0..*}  {-- etc --}
@@ -3452,11 +3452,11 @@
5.3.4.2. Occurr
-
    events cardinality  {*}  {
-        EVENT[at0002] occurrences  {1..1}  {    }          -- 1 min sample
-        EVENT[at0003] occurrences  {0..1}  {    }          -- 2 min sample
-        EVENT[at0004] occurrences  {0..1}  {    }          -- 3 min sample
-    }
+
    events cardinality  {*}  {
+        EVENT[at0002] occurrences  {1..1}  {    }          -- 1 min sample
+        EVENT[at0003] occurrences  {0..1}  {    }          -- 2 min sample
+        EVENT[at0004] occurrences  {0..1}  {    }          -- 3 min sample
+    }
@@ -3464,19 +3464,19 @@
5.3.4.2. Occurr
-
    GROUP[iat0103]  {
-        kind  {/tribe|family|club/}
-        members cardinality  {*}  {
-            PERSON[at0104] occurrences  {1}  {
-                title  {"head"}
-                -- etc --
-            }
-            PERSON[at0105] occurrences  {0..*}  {
-                title  {"member"}
-                -- etc --
-            }
-        }
-    }
+
    GROUP[iat0103]  {
+        kind  {/tribe|family|club/}
+        members cardinality  {*}  {
+            PERSON[at0104] occurrences  {1}  {
+                title  {"head"}
+                -- etc --
+            }
+            PERSON[at0105] occurrences  {0..*}  {
+                title  {"member"}
+                -- etc --
+            }
+        }
+    }
@@ -3500,10 +3500,10 @@

5.3.5.

-
    PERSON[at0001]  {
-        name existence  {0..1} matches {*}
-        -- etc --
-    }
+
    PERSON[at0001]  {
+        name existence  {0..1} matches {*}
+        -- etc --
+    }
@@ -3514,11 +3514,11 @@

5.3.5.

-
    ELEMENT[at0004]  {          -- speed limit
-        value  {
-            QUANTITY matches {*}
-        }
-    }
+
    ELEMENT[at0004]  {          -- speed limit
+        value  {
+            QUANTITY matches {*}
+        }
+    }
@@ -3551,13 +3551,13 @@

-
members cardinality  {*}  {
-    PERSON[at0104]  {
-        title  {"head"}
-    }
-    PERSON[at0105] matches {
-        title  {"member"}
-    }
+
members cardinality  {*}  {
+    PERSON[at0104]  {
+        title  {"head"}
+    }
+    PERSON[at0105] matches {
+        title  {"member"}
+    }
 }
@@ -3566,8 +3566,8 @@

-
members[at0104]/title
-members[at0105]/title
+
members[at0104]/title
+members[at0105]/title
@@ -3660,46 +3660,46 @@

-
    PERSON  {
-        identities  {
-            -- etc --
-        }
-        contacts cardinality  {0..*}  {
-            CONTACT[at0002]  {      -- home address
-                purpose  {...}
-                addresses  {...}
-            }
-            CONTACT[at0003]  {      -- postal address
-                purpose  {...}
-                addresses  {...}
-            }
-            CONTACT[at0004]  {      -- home contact
-                purpose  {...}
-                addresses cardinality  {0..*}  {
-                    ADDRESS[at0005]  {                            -- phone
-                        type  {...}
-                        details  {...}
-                    }
-                    ADDRESS[at0006]  {                            -- fax
-                        type  {...}
-                        details  {...}
-                    }
-                    ADDRESS[at0007]  {                            -- email
-                        type  {...}
-                        details  {...}
-                    }
-                }
-            }
-            CONTACT[at0008]  {                                    -- work contact
-                purpose  {...}
-                addresses cardinality  {0..*}  {
-                    use_node ADDRESS /contacts[at0004]/addresses[at0005]   -- phone
-                    use_node ADDRESS /contacts[at0004]/addresses[at0006]   -- fax
-                    use_node ADDRESS /contacts[at0004]/addresses[at0007]   -- email
-                }
-            }
-        }
-    }
+
    PERSON  {
+        identities  {
+            -- etc --
+        }
+        contacts cardinality  {0..*}  {
+            CONTACT[at0002]  {      -- home address
+                purpose  {...}
+                addresses  {...}
+            }
+            CONTACT[at0003]  {      -- postal address
+                purpose  {...}
+                addresses  {...}
+            }
+            CONTACT[at0004]  {      -- home contact
+                purpose  {...}
+                addresses cardinality  {0..*}  {
+                    ADDRESS[at0005]  {                            -- phone
+                        type  {...}
+                        details  {...}
+                    }
+                    ADDRESS[at0006]  {                            -- fax
+                        type  {...}
+                        details  {...}
+                    }
+                    ADDRESS[at0007]  {                            -- email
+                        type  {...}
+                        details  {...}
+                    }
+                }
+            }
+            CONTACT[at0008]  {                                    -- work contact
+                purpose  {...}
+                addresses cardinality  {0..*}  {
+                    use_node ADDRESS /contacts[at0004]/addresses[at0005]   -- phone
+                    use_node ADDRESS /contacts[at0004]/addresses[at0006]   -- fax
+                    use_node ADDRESS /contacts[at0004]/addresses[at0007]   -- email
+                }
+            }
+        }
+    }
@@ -3713,20 +3713,20 @@

-
    PERSON[at0000]  {
-        contacts cardinality  {0..*}  {
-            CONTACT[at0004]  {                                   -- home contact
-                addresses cardinality  {0..*}  {
-                    ADDRESS[at0005] occurrences  {1}  { ...}   -- phone
-                }
-            }
-            CONTACT[at0008]  {                                  -- work contact
-                addresses cardinality  {0..*}  {
-                    use_node ADDRESS[at0009] occurrences  {0..*} /contacts[at0004]/addresses[at0005]      -- phone
-                }
-            }
-        }
-    }
+
    PERSON[at0000]  {
+        contacts cardinality  {0..*}  {
+            CONTACT[at0004]  {                                   -- home contact
+                addresses cardinality  {0..*}  {
+                    ADDRESS[at0005] occurrences  {1}  { ...}   -- phone
+                }
+            }
+            CONTACT[at0008]  {                                  -- work contact
+                addresses cardinality  {0..*}  {
+                    use_node ADDRESS[at0009] occurrences  {0..*} /contacts[at0004]/addresses[at0005]      -- phone
+                }
+            }
+        }
+    }

@@ -3761,7 +3761,7 @@

-
archetype_id  {/.*\.SECTION\..*\..*/} -- match any SECTION archetype
+
archetype_id  {/.*\.SECTION\..*\..*/} -- match any SECTION archetype
@@ -3772,20 +3772,20 @@
-
    SECTION [at2000] occurrences  {0..1}  {                      -- objective
-        items cardinality  {0..*}  {
-            allow_archetype OBSERVATION occurrences  {0..1}  {
-                include
-                    short_concept_name  {/.+/}
-            }
-            allow_archetype SECTION occurrences  {0..*}  {
-                include
-                    archetype_id/value  {/.*/}
-                exclude
-                    archetype_id/value  {/openEHR-EHR-SECTION\.patient_details\..+/}
-            }
-        }
-    }
+
    SECTION [at2000] occurrences  {0..1}  {                      -- objective
+        items cardinality  {0..*}  {
+            allow_archetype OBSERVATION occurrences  {0..1}  {
+                include
+                    short_concept_name  {/.+/}
+            }
+            allow_archetype SECTION occurrences  {0..*}  {
+                include
+                    archetype_id/value  {/.*/}
+                exclude
+                    archetype_id/value  {/openEHR-EHR-SECTION\.patient_details\..+/}
+            }
+        }
+    }
-
    SECTION[at2000]  {
-        items cardinality  {0..*; ordered}  {
-            ENTRY[at2001]  {...}
-            allow_archetype ENTRY[at2002]  {...}
-            use_node ENTRY[at2003] /some_path[at0004]
-            ENTRY[at2004]  {...}
-            use_node ENTRY[at2005] /some_path[at1012]
-            use_node ENTRY[at2006] /some_path[at1052]
-            ENTRY[at2007]  {...}
-        }
-    }
+
    SECTION[at2000]  {
+        items cardinality  {0..*; ordered}  {
+            ENTRY[at2001]  {...}
+            allow_archetype ENTRY[at2002]  {...}
+            use_node ENTRY[at2003] /some_path[at0004]
+            ENTRY[at2004]  {...}
+            use_node ENTRY[at2005] /some_path[at1012]
+            use_node ENTRY[at2006] /some_path[at1052]
+            ENTRY[at2007]  {...}
+        }
+    }
@@ -3912,9 +3912,9 @@
5.4.1.1
-
    species  {"platypus"}
-    species  {"platypus", "kangaroo"}
-    species  {"platypus", "kangaroo", "wombat"}
+
    species  {"platypus"}
+    species  {"platypus", "kangaroo"}
+    species  {"platypus", "kangaroo", "wombat"}
@@ -3928,9 +3928,9 @@
5
-
    string_attr matches {/regular expression/}
-    string_attr matches {=~ /regular expression}
-    string_attr matches {!~ /regular expression}
+
    string_attr matches {/regular expression/}
+    string_attr matches {=~ /regular expression}
+    string_attr matches {!~ /regular expression}
@@ -3938,8 +3938,8 @@
5
-
    units  {/km\/h|mi\/h/}
-    units  {^km/h|mi/h^}
+
    units  {/km\/h|mi\/h/}
+    units  {^km/h|mi/h^}
@@ -4066,8 +4066,8 @@
5.4.2
-
    length matches {1000}       -- fixed value of 1000
-    magnitude matches {0, 5, 8} -- any of 0, 5 or 8
+
    length matches {1000}       -- fixed value of 1000
+    magnitude matches {0, 5, 8} -- any of 0, 5 or 8
@@ -4081,13 +4081,13 @@
-
    length matches {|1000|}                       -- point interval of 1000 (=fixed value)
-    length matches {|950..1050|}                  -- allow 950 - 1050
-    length matches {|0..1000|}                    -- allow 0 - 1000
-    length matches {|0..<1000|}                   -- allow 0>= x <1000
-    length matches {|0>..<1000|}                  -- allow 0> x <1000
-    length matches {|100+/-5|}                    -- allow 100 +/- 5, i.e. 95 - 105
-    rate matches {|0..infinity|}                  -- allow 0 - infinity, i.e. same as >= 0
+
    length matches {|1000|}                       -- point interval of 1000 (=fixed value)
+    length matches {|950..1050|}                  -- allow 950 - 1050
+    length matches {|0..1000|}                    -- allow 0 - 1000
+    length matches {|0..<1000|}                   -- allow 0>= x <1000
+    length matches {|0>..<1000|}                  -- allow 0> x <1000
+    length matches {|100+/-5|}                    -- allow 100 +/- 5, i.e. 95 - 105
+    rate matches {|0..infinity|}                  -- allow 0 - infinity, i.e. same as >= 0
@@ -4095,10 +4095,10 @@
-
    length matches {|<10|}                        -- allow up to 9
-    length matches {|>10|}                        -- allow 11 or more
-    length matches {|<=10|}                       -- allow up to 10
-    length matches {|>=10|}                       -- allow 10 or more
+
    length matches {|<10|}                        -- allow up to 9
+    length matches {|>10|}                        -- allow 11 or more
+    length matches {|<=10|}                       -- allow up to 10
+    length matches {|>=10|}                       -- allow 10 or more
@@ -4110,16 +4110,16 @@

-
    magnitude  {5.5}                             -- list of one (fixed value)
-    magnitude  {|5.5|}                           -- point interval (=fixed value)
-    magnitude  {|5.5..6.0|}                      -- interval
-    magnitude  {5.5, 6.0, 6.5}                   -- list
-    magnitude  {|0.0..<1000.0|}                  -- allow 0>= x <1000.0
-    magnitude  {|<10.0|}                         -- allow anything less than 10.0
-    magnitude  {|>10.0|}                         -- allow greater than 10.0
-    magnitude  {|<=10.0|}                        -- allow up to 10.0
-    magnitude  {|>=10.0|}                        -- allow 10.0 or more
-    magnitude  {|80.0+/-12.0|}                   -- allow 80 +/- 12
+
    magnitude  {5.5}                             -- list of one (fixed value)
+    magnitude  {|5.5|}                           -- point interval (=fixed value)
+    magnitude  {|5.5..6.0|}                      -- interval
+    magnitude  {5.5, 6.0, 6.5}                   -- list
+    magnitude  {|0.0..<1000.0|}                  -- allow 0>= x <1000.0
+    magnitude  {|<10.0|}                         -- allow anything less than 10.0
+    magnitude  {|>10.0|}                         -- allow greater than 10.0
+    magnitude  {|<=10.0|}                        -- allow up to 10.0
+    magnitude  {|>=10.0|}                        -- allow 10.0 or more
+    magnitude  {|80.0+/-12.0|}                   -- allow 80 +/- 12

@@ -4130,9 +4130,9 @@

-
    some_flag matches {True}
-    some_flag matches {False}
-    some_flag matches {True, False}
+
    some_flag matches {True}
+    some_flag matches {False}
+    some_flag matches {True, False}

@@ -4148,8 +4148,8 @@
5
-
    color_name matches {'r'}
-    color_name matches {'r', 'g', 'b'}
+
    color_name matches {'r'}
+    color_name matches {'r', 'g', 'b'}
@@ -4160,8 +4160,8 @@
<
-
    color_name matches {/[rgbcmyk]/}
-    color_name matches {/[^\s\t\n]/}
+
    color_name matches {/[rgbcmyk]/}
+    color_name matches {/[^\s\t\n]/}
-
    |09:30:00|                                    -- exactly 9:30 am
-    |< 09:30:00|                                  -- any time before 9:30 am
-    |<= 09:30:00|                                 -- any time at or before 9:30 am
-    |> 09:30:00|                                  -- any time after 9:30 am
-    |> 09:30:00+0200|                             -- any time after 9:30 am in UTC+0200 timezone
-    |>= 09:30:00|                                 -- any time at or after 9:30 am
-    |2004-05-20..2004-06-02|                      -- a date range
-    |2004-05-20T00:00:00..2005-05-19T23:59:59|    -- a date/time range
-    |>= 09:30:00|;09:30:00                        -- any time at or after 9:30 am; assume 9:30 am
-    |2004-05-20T00:00:00Z..2005-05-19T23:59:59Z|  -- a date/time range in UTC timezone
+
    |09:30:00|                                    -- exactly 9:30 am
+    |< 09:30:00|                                  -- any time before 9:30 am
+    |<= 09:30:00|                                 -- any time at or before 9:30 am
+    |> 09:30:00|                                  -- any time after 9:30 am
+    |> 09:30:00+0200|                             -- any time after 9:30 am in UTC+0200 timezone
+    |>= 09:30:00|                                 -- any time at or after 9:30 am
+    |2004-05-20..2004-06-02|                      -- a date range
+    |2004-05-20T00:00:00..2005-05-19T23:59:59|    -- a date/time range
+    |>= 09:30:00|;09:30:00                        -- any time at or after 9:30 am; assume 9:30 am
+    |2004-05-20T00:00:00Z..2005-05-19T23:59:59Z|  -- a date/time range in UTC timezone
@@ -4422,11 +4422,11 @@
Patterns
-
    Pd            -- a duration containing days only, e.g. P5d
-    Pm            -- a duration containing months only, e.g. P5m
-    PTm           -- a duration containing minutes only, e.g. PT5m
-    Pwd           -- a duration containing weeks and/or days only, e.g. P4w
-    PThm          -- a duration containing hours and/or minutes only, e.g. PT2h30m
+
    Pd            -- a duration containing days only, e.g. P5d
+    Pm            -- a duration containing months only, e.g. P5m
+    PTm           -- a duration containing minutes only, e.g. PT5m
+    Pwd           -- a duration containing weeks and/or days only, e.g. P4w
+    PThm          -- a duration containing hours and/or minutes only, e.g. PT2h30m
@@ -4440,9 +4440,9 @@
-
    PT1m              -- 1 minute
-    P1dT8h            -- 1 day 8 hrs
-    |PT0m..PT1m30s|   -- Reasonable time offset of first apgar sample
+
    PT1m              -- 1 minute
+    P1dT8h            -- 1 day 8 hrs
+    |PT0m..PT1m30s|   -- Reasonable time offset of first apgar sample
@@ -4481,7 +4481,7 @@
-
duration_constraint: duration_pattern '/' duration_interval ;
+
duration_constraint: duration_pattern '/' duration_interval ;
@@ -4494,7 +4494,7 @@

-
    some_attr cardinality  {0..*}  {some_constraint}
+
    some_attr cardinality  {0..*}  {some_constraint}
-
length matches {|0..1000|; 200}             -- allow 0 - 1000, assume 200
-some_flag matches {True, False; True}       -- allow T or F, assume T
-some_date matches {yyyy-mm-dd hh:mm:XX; 1800-01-01T00:00:00}
+
length matches {|0..1000|; 200}             -- allow 0 - 1000, assume 200
+some_flag matches {True, False; True}       -- allow T or F, assume T
+some_date matches {yyyy-mm-dd hh:mm:XX; 1800-01-01T00:00:00}
@@ -4543,252 +4543,252 @@

5.5.1. Grammar

-
input:
-    c_complex_object
-    ;
-
-c_complex_object:
-    c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK
-    ;
-
-c_complex_object_head:
-    c_complex_object_id c_occurrences
-    ;
-
-c_complex_object_id:
-    type_identifier
-    | type_identifier V_LOCAL_TERM_CODE_REF
-    ;
-
-c_complex_object_body:
-    c_any
-    | c_attributes
-    ;
-
-c_object:
-    c_complex_object
-    | archetype_internal_ref
-    | archetype_slot
-    | constraint_ref
-    | c_primitive_object
-    | V_C_DOMAIN_TYPE
-    ;
-
-archetype_internal_ref:
-    SYM_USE_NODE type_identifier c_occurrences object_path
-    ;
-
-archetype_slot:
-    c_archetype_slot_head SYM_MATCHES SYM_START_CBLOCK c_includes c_excludes
-    SYM_END_CBLOCK
-    ;
-
-c_archetype_slot_head:
-    c_archetype_slot_id c_occurrences
-    ;
-
-c_archetype_slot_id:
-    SYM_ALLOW_ARCHETYPE type_identifier
-    | SYM_ALLOW_ARCHETYPE type_identifier V_LOCAL_TERM_CODE_REF
-    ;
-
-c_primitive_object:
-    c_primitive
-    ;
-
-c_primitive:
-    c_integer
-    | c_real
-    | c_date
-    | c_time
-    | c_date_time
-    | c_duration
-    | c_string
-    | c_boolean
-    ;
-
-c_any:
-    '*'
-    ;
-
-c_attributes:
-    c_attribute
-    | c_attributes c_attribute
-    ;
-
-c_attribute:
-    c_attr_head SYM_MATCHES SYM_START_CBLOCK c_attr_values SYM_END_CBLOCK
-    ;
-
-c_attr_head:
-    V_ATTRIBUTE_IDENTIFIER c_existence
-    | V_ATTRIBUTE_IDENTIFIER c_existence c_cardinality
-    ;
-
-c_attr_values:
-    c_object
-    | c_attr_values c_object
-    | c_any
-    ;
-
-c_includes:
-    // nothing OK
-    | SYM_INCLUDE assertions
-    ;
-
-c_excludes:
-    // nothing OK
-    | SYM_EXCLUDE assertions
-    ;
-
-c_existence:
-    // nothing OK
-    | SYM_EXISTENCE SYM_MATCHES SYM_START_CBLOCK existence_spec SYM_END_CBLOCK
-    ;
-
-existence_spec:
-    V_INTEGER
-    | V_INTEGER SYM_ELLIPSIS V_INTEGER
-    ;
-
-c_cardinality:
-    SYM_CARDINALITY SYM_MATCHES SYM_START_CBLOCK cardinality_spec
-    SYM_END_CBLOCK
-    ;
-
-cardinality_spec:
-    occurrence_spec
-    | occurrence_spec ';' SYM_ORDERED
-    | occurrence_spec ';' SYM_UNORDERED
-    | occurrence_spec ';' SYM_UNIQUE
-    | occurrence_spec ';' SYM_ORDERED ';' SYM_UNIQUE
-    | occurrence_spec ';' SYM_UNORDERED ';' SYM_UNIQUE
-    | occurrence_spec ';' SYM_UNIQUE ';' SYM_ORDERED
-    | occurrence_spec ';' SYM_UNIQUE ';' SYM_UNORDERED
-    ;
-
-cardinality_limit_value:
-    integer_value
-    | '*'
-    ;
-
-c_occurrences:
-    // nothing OK
-    | SYM_OCCURRENCES SYM_MATCHES SYM_START_CBLOCK occurrence_spec SYM_END_CBLOCK
-    ;
-
-occurrence_spec:
-    cardinality_limit_value
-    | V_INTEGER SYM_ELLIPSIS cardinality_limit_value
-    ;
-
-c_integer_spec:
-    integer_value
-    | integer_list_value
-    | integer_interval_value
-    | occurrence_spec
-    ;
-
-c_integer:
-    c_integer_spec
-    | c_integer_spec ';' integer_value
-    ;
-
-c_real_spec:
-    real_value
-    | real_list_value
-    | real_interval_value
-    ;
-
-c_real:
-    c_real_spec
-    | c_real_spec ';' real_value
-    ;
-
-c_date_constraint:
-    V_ISO8601_DATE_CONSTRAINT_PATTERN
-    | date_value
-    | date_interval_value
-    ;
-
-c_date:
-    c_date_constraint
-    | c_date_constraint ';' date_value
-    ;
-
-c_time_constraint:
-    V_ISO8601_TIME_CONSTRAINT_PATTERN
-    | time_value
-    | time_interval_value
-    ;
-
-c_time:
-    c_time_constraint
-    | c_time_constraint ';' time_value
-    ;
-
-c_date_time_constraint:
-    V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN
-    | date_time_value
-    | date_time_interval_value
-    ;
-
-c_date_time:
-    c_date_time_constraint
-    | c_date_time_constraint ';' date_time_value
-    ;
-c_duration_constraint:
-    duration_pattern
-    | duration_pattern '/' duration_interval_value
-    | duration_value
-    | duration_interval_value
-    ;
-
-duration_pattern:
-    V_ISO8601_DURATION_CONSTRAINT_PATTERN
-    ;
-
-c_duration:
-    c_duration_constraint
-    | c_duration_constraint ';' duration_value
-    ;
-
-c_string_spec:
-    V_STRING
-    | string_list_value
-    | string_list_value ',' SYM_LIST_CONTINUE
-    | V_REGEXP
-    ;
-
-c_string:
-    c_string_spec
-    | c_string_spec ';' string_value
-    ;
-
-c_boolean_spec:
-    SYM_TRUE
-    | SYM_FALSE
-    | SYM_TRUE ',' SYM_FALSE
-    | SYM_FALSE ',' SYM_TRUE
-    ;
-
-c_boolean:
-    c_boolean_spec
-    | c_boolean_spec ';' boolean_value
-    ;
-
-constraint_ref:
-    V_LOCAL_TERM_CODE_REF
-    ;
-
-any_identifier:
-    type_identifier
-    | V_ATTRIBUTE_IDENTIFIER
-    ;
-
-// for string_value etc, see dADL spec
-// for attribute_path, object_path, call_path, etc, see Path spec
-// for assertions, assertion, see Assertion spec
+
input:
+    c_complex_object
+    ;
+
+c_complex_object:
+    c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK
+    ;
+
+c_complex_object_head:
+    c_complex_object_id c_occurrences
+    ;
+
+c_complex_object_id:
+    type_identifier
+    | type_identifier V_LOCAL_TERM_CODE_REF
+    ;
+
+c_complex_object_body:
+    c_any
+    | c_attributes
+    ;
+
+c_object:
+    c_complex_object
+    | archetype_internal_ref
+    | archetype_slot
+    | constraint_ref
+    | c_primitive_object
+    | V_C_DOMAIN_TYPE
+    ;
+
+archetype_internal_ref:
+    SYM_USE_NODE type_identifier c_occurrences object_path
+    ;
+
+archetype_slot:
+    c_archetype_slot_head SYM_MATCHES SYM_START_CBLOCK c_includes c_excludes
+    SYM_END_CBLOCK
+    ;
+
+c_archetype_slot_head:
+    c_archetype_slot_id c_occurrences
+    ;
+
+c_archetype_slot_id:
+    SYM_ALLOW_ARCHETYPE type_identifier
+    | SYM_ALLOW_ARCHETYPE type_identifier V_LOCAL_TERM_CODE_REF
+    ;
+
+c_primitive_object:
+    c_primitive
+    ;
+
+c_primitive:
+    c_integer
+    | c_real
+    | c_date
+    | c_time
+    | c_date_time
+    | c_duration
+    | c_string
+    | c_boolean
+    ;
+
+c_any:
+    '*'
+    ;
+
+c_attributes:
+    c_attribute
+    | c_attributes c_attribute
+    ;
+
+c_attribute:
+    c_attr_head SYM_MATCHES SYM_START_CBLOCK c_attr_values SYM_END_CBLOCK
+    ;
+
+c_attr_head:
+    V_ATTRIBUTE_IDENTIFIER c_existence
+    | V_ATTRIBUTE_IDENTIFIER c_existence c_cardinality
+    ;
+
+c_attr_values:
+    c_object
+    | c_attr_values c_object
+    | c_any
+    ;
+
+c_includes:
+    // nothing OK
+    | SYM_INCLUDE assertions
+    ;
+
+c_excludes:
+    // nothing OK
+    | SYM_EXCLUDE assertions
+    ;
+
+c_existence:
+    // nothing OK
+    | SYM_EXISTENCE SYM_MATCHES SYM_START_CBLOCK existence_spec SYM_END_CBLOCK
+    ;
+
+existence_spec:
+    V_INTEGER
+    | V_INTEGER SYM_ELLIPSIS V_INTEGER
+    ;
+
+c_cardinality:
+    SYM_CARDINALITY SYM_MATCHES SYM_START_CBLOCK cardinality_spec
+    SYM_END_CBLOCK
+    ;
+
+cardinality_spec:
+    occurrence_spec
+    | occurrence_spec ';' SYM_ORDERED
+    | occurrence_spec ';' SYM_UNORDERED
+    | occurrence_spec ';' SYM_UNIQUE
+    | occurrence_spec ';' SYM_ORDERED ';' SYM_UNIQUE
+    | occurrence_spec ';' SYM_UNORDERED ';' SYM_UNIQUE
+    | occurrence_spec ';' SYM_UNIQUE ';' SYM_ORDERED
+    | occurrence_spec ';' SYM_UNIQUE ';' SYM_UNORDERED
+    ;
+
+cardinality_limit_value:
+    integer_value
+    | '*'
+    ;
+
+c_occurrences:
+    // nothing OK
+    | SYM_OCCURRENCES SYM_MATCHES SYM_START_CBLOCK occurrence_spec SYM_END_CBLOCK
+    ;
+
+occurrence_spec:
+    cardinality_limit_value
+    | V_INTEGER SYM_ELLIPSIS cardinality_limit_value
+    ;
+
+c_integer_spec:
+    integer_value
+    | integer_list_value
+    | integer_interval_value
+    | occurrence_spec
+    ;
+
+c_integer:
+    c_integer_spec
+    | c_integer_spec ';' integer_value
+    ;
+
+c_real_spec:
+    real_value
+    | real_list_value
+    | real_interval_value
+    ;
+
+c_real:
+    c_real_spec
+    | c_real_spec ';' real_value
+    ;
+
+c_date_constraint:
+    V_ISO8601_DATE_CONSTRAINT_PATTERN
+    | date_value
+    | date_interval_value
+    ;
+
+c_date:
+    c_date_constraint
+    | c_date_constraint ';' date_value
+    ;
+
+c_time_constraint:
+    V_ISO8601_TIME_CONSTRAINT_PATTERN
+    | time_value
+    | time_interval_value
+    ;
+
+c_time:
+    c_time_constraint
+    | c_time_constraint ';' time_value
+    ;
+
+c_date_time_constraint:
+    V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN
+    | date_time_value
+    | date_time_interval_value
+    ;
+
+c_date_time:
+    c_date_time_constraint
+    | c_date_time_constraint ';' date_time_value
+    ;
+c_duration_constraint:
+    duration_pattern
+    | duration_pattern '/' duration_interval_value
+    | duration_value
+    | duration_interval_value
+    ;
+
+duration_pattern:
+    V_ISO8601_DURATION_CONSTRAINT_PATTERN
+    ;
+
+c_duration:
+    c_duration_constraint
+    | c_duration_constraint ';' duration_value
+    ;
+
+c_string_spec:
+    V_STRING
+    | string_list_value
+    | string_list_value ',' SYM_LIST_CONTINUE
+    | V_REGEXP
+    ;
+
+c_string:
+    c_string_spec
+    | c_string_spec ';' string_value
+    ;
+
+c_boolean_spec:
+    SYM_TRUE
+    | SYM_FALSE
+    | SYM_TRUE ',' SYM_FALSE
+    | SYM_FALSE ',' SYM_TRUE
+    ;
+
+c_boolean:
+    c_boolean_spec
+    | c_boolean_spec ';' boolean_value
+    ;
+
+constraint_ref:
+    V_LOCAL_TERM_CODE_REF
+    ;
+
+any_identifier:
+    type_identifier
+    | V_ATTRIBUTE_IDENTIFIER
+    ;
+
+// for string_value etc, see dADL spec
+// for attribute_path, object_path, call_path, etc, see Path spec
+// for assertions, assertion, see Assertion spec
@@ -5028,7 +5028,7 @@

6.1. Overview

-

The archetype assertion language is a small language of its own. Formally it is a first-order predicate logic with equality and comparison operators (=, >, etc). It is very nearly a subset of the OMG’s emerging OCL (Object Constraint Language) syntax, and is very similar to the assertion syntax which has been used in the Object Z (Smith, 2000) and the Eiffel (Meyer, 1992) languages and tools for over a decade. (See Sowa (2000), Hein (2002), Kilov & Ross (1994) for an explanation of predicate logic in information modelling.)

+

The archetype assertion language is a small language of its own. Formally it is a first-order predicate logic with equality and comparison operators (=, >, etc). It is very nearly a subset of the OMG’s emerging OCL (Object Constraint Language) syntax, and is very similar to the assertion syntax which has been used in the Object Z (Smith, 2000) and the Eiffel (Meyer, 1992) languages and tools for over a decade. (See Sowa (2000), Hein (2002), Kilov & Ross (1994) for an explanation of predicate logic in information modelling.)

@@ -5343,62 +5343,62 @@

6.7.1. Grammar

-
assertions:
-    assertion
-    | assertions assertion
-    ;
+
assertions:
+    assertion
+    | assertions assertion
+    ;
 
-assertion:
-    any_identifier ':' boolean_expression
-    | boolean_expression
-    ;
+assertion:
+    any_identifier ':' boolean_expression
+    | boolean_expression
+    ;
 
-boolean_expression:
-    boolean_leaf
-    | boolean_node
-    ;
+boolean_expression:
+    boolean_leaf
+    | boolean_node
+    ;
 
-boolean_node:
-    SYM_EXISTS absolute_path
-    | relative_path SYM_MATCHES SYM_START_CBLOCK c_primitive SYM_END_CBLOCK
-    | SYM_NOT boolean_leaf
-    | arithmetic_expression '=' arithmetic_expression
-    | arithmetic_expression SYM_NE arithmetic_expression
-    | arithmetic_expression SYM_LT arithmetic_expression
-    | arithmetic_expression SYM_GT arithmetic_expression
-    | arithmetic_expression SYM_LE arithmetic_expression
-    | arithmetic_expression SYM_GE arithmetic_expression
-    | boolean_expression SYM_AND boolean_expression
-    | boolean_expression SYM_OR boolean_expression
-    | boolean_expression SYM_XOR boolean_expression
-    | boolean_expression SYM_IMPLIES boolean_expression
-    ;
+boolean_node:
+    SYM_EXISTS absolute_path
+    | relative_path SYM_MATCHES SYM_START_CBLOCK c_primitive SYM_END_CBLOCK
+    | SYM_NOT boolean_leaf
+    | arithmetic_expression '=' arithmetic_expression
+    | arithmetic_expression SYM_NE arithmetic_expression
+    | arithmetic_expression SYM_LT arithmetic_expression
+    | arithmetic_expression SYM_GT arithmetic_expression
+    | arithmetic_expression SYM_LE arithmetic_expression
+    | arithmetic_expression SYM_GE arithmetic_expression
+    | boolean_expression SYM_AND boolean_expression
+    | boolean_expression SYM_OR boolean_expression
+    | boolean_expression SYM_XOR boolean_expression
+    | boolean_expression SYM_IMPLIES boolean_expression
+    ;
 
-boolean_leaf:
-    '(' boolean_expression ')'
-    | SYM_TRUE
-    | SYM_FALSE
-    ;
+boolean_leaf:
+    '(' boolean_expression ')'
+    | SYM_TRUE
+    | SYM_FALSE
+    ;
 
-arithmetic_expression:
-    arithmetic_leaf
-    | arithmetic_node
-    ;
+arithmetic_expression:
+    arithmetic_leaf
+    | arithmetic_node
+    ;
 
-arithmetic_node:
-    arithmetic_expression '+' arithmetic_leaf
-    | arithmetic_expression '-' arithmetic_leaf
-    | arithmetic_expression '*' arithmetic_leaf
-    | arithmetic_expression '/' arithmetic_leaf
-    | arithmetic_expression '^' arithmetic_leaf
-    ;
+arithmetic_node:
+    arithmetic_expression '+' arithmetic_leaf
+    | arithmetic_expression '-' arithmetic_leaf
+    | arithmetic_expression '*' arithmetic_leaf
+    | arithmetic_expression '/' arithmetic_leaf
+    | arithmetic_expression '^' arithmetic_leaf
+    ;
 
-arithmetic_leaf:
-    '(' arithmetic_expression ')'
-    | integer_value
-    | real_value
-    | absolute_path
-    ;
+arithmetic_leaf: + '(' arithmetic_expression ')' + | integer_value + | real_value + | absolute_path + ;
@@ -5418,8 +5418,8 @@

7.1. Overview

-
    path: '/'? path_segment ( '/' path_segment )+ ;
-    path_segment: attr_name ( '[' object_id ']' )? ;
+
    path: '/'? path_segment ( '/' path_segment )+ ;
+    path_segment: attr_name ( '[' object_id ']' )? ;
-
input:
-    movable_path
-    | absolute_path
-    | relative_path
-    ;
+
input:
+    movable_path
+    | absolute_path
+    | relative_path
+    ;
 
-movable_path:
-    SYM_MOVABLE_LEADER relative_path
+movable_path:
+    SYM_MOVABLE_LEADER relative_path
 
-absolute_path:
-    '/' relative_path
-    | absolute_path '/' relative_path
-    ;
+absolute_path:
+    '/' relative_path
+    | absolute_path '/' relative_path
+    ;
 
-relative_path:
-    path_segment
-    | relative_path '/' path_segment
-    ;
+relative_path:
+    path_segment
+    | relative_path '/' path_segment
+    ;
 
-path_segment:
-    V_ATTRIBUTE_IDENTIFIER V_LOCAL_TERM_CODE_REF
-    | V_ATTRIBUTE_IDENTIFIER
-    ;
+path_segment: + V_ATTRIBUTE_IDENTIFIER V_LOCAL_TERM_CODE_REF + | V_ATTRIBUTE_IDENTIFIER + ;
@@ -5605,7 +5605,7 @@

8.2.3. Local Constraint Codes

A second kind of local code is used to stand for constraints on textual items in the body of the archetype. Although these could be included in the main archetype body, because they are language- and/or terminology-sensitive, they are defined in the ontology section, and referenced by codes prefixed by ac, e.g. [ac0009]. As for at codes, the convention used in this document is to use 4-digit ac codes, even though any number of digits is acceptable. The use of these codes is described in section -[Constraint_definitions section].

+Section 8.6.4.

@@ -5618,8 +5618,8 @@

8.3
-
archetype (adl_version=1.4)
-    openEHR-EHR-OBSERVATION.haematology.v1
+
archetype (adl_version=1.4)
+    openEHR-EHR-OBSERVATION.haematology.v1
@@ -5633,8 +5633,8 @@

<

-
archetype (adl_version=1.4; controlled)
-    openEHR-EHR-OBSERVATION.haematology.v1
+
archetype (adl_version=1.4; controlled)
+    openEHR-EHR-OBSERVATION.haematology.v1
-
archetype (adl_version=1.4)
-    openEHR-EHR-OBSERVATION.haematology-cbc.v1
+
archetype (adl_version=1.4)
+    openEHR-EHR-OBSERVATION.haematology-cbc.v1
 specialise
-    openEHR-EHR-OBSERVATION.haematology.v1
+ openEHR-EHR-OBSERVATION.haematology.v1
@@ -5739,42 +5739,42 @@

description
-    original_author = <
-        ["name"] = <"Dr J Joyce">
-        ["organisation"] = <"NT Health Service">
-        ["date"] = <2003-08-03>
-    >
-    lifecycle_state =  <"initial">
-    resource_package_uri =  <"http://www.aihw.org.au/data_sets/diabetic_archetypes.html">
-
-    details = <
-        ["en"] = <
-            language = <[iso_639-1::en]>
-            purpose =  <"archetype for diabetic patient review">
-            use = <"used for all hospital or clinic-based diabetic reviews,
-                including first time. Optional sections are removed according to the particular review">
-            misuse = <"not appropriate for pre-diagnosis use">
-            original_resource_uri = <"http://www.healthdata.org.au/data_sets/diabetic_review_data_set_1.html">
-            other_details = <...>
-        >
-        ["de"] = <
-            language = <[iso_639-1::de]>
-            purpose =  <"Archetyp für die Untersuchung von Patienten mit Diabetes">
-            use = <"wird benutzt für alle Diabetes-Untersuchungen im
-                    Krankenhaus, inklusive der ersten Vorstellung. Optionale
-                    Abschnitte werden in Abhängigkeit von der speziellen
-                    Vorstellung entfernt.">
-            misuse = <"nicht geeignet für Benutzung vor Diagnosestellung">
-            original_resource_uri = <"http://www.healthdata.org.au/data_sets/diabetic_review_data_set_1.html">
-            other_details = <...>
-        >
-    >
-
-    other_details = <...>
-
-

-
-

A number of details are worth noting here. Firstly, the free hierarchical structuring capability of dADL is exploited for expressing the 'deep' structure of the details section and its subsections. Secondly, the dADL qualified list form is used to allow multiple translations of the purpose and use to be shown. Lastly, empty items such as misuse (structured if there is data) are shown with just one level of empty brackets. The above example shows meta-data based on the openEHR Archetype Object Model (AOM).

+ original_author = < + ["name"] = <"Dr J Joyce"> + ["organisation"] = <"NT Health Service"> + ["date"] = <2003-08-03> + > + lifecycle_state = <"initial"> + resource_package_uri = <"http://www.aihw.org.au/data_sets/diabetic_archetypes.html"> + + details = < + ["en"] = < + language = <[iso_639-1::en]> + purpose = <"archetype for diabetic patient review"> + use = <"used for all hospital or clinic-based diabetic reviews, + including first time. Optional sections are removed according to the particular review"> + misuse = <"not appropriate for pre-diagnosis use"> + original_resource_uri = <"http://www.healthdata.org.au/data_sets/diabetic_review_data_set_1.html"> + other_details = <...> + > + ["de"] = < + language = <[iso_639-1::de]> + purpose = <"Archetyp für die Untersuchung von Patienten mit Diabetes"> + use = <"wird benutzt für alle Diabetes-Untersuchungen im + Krankenhaus, inklusive der ersten Vorstellung. Optionale + Abschnitte werden in Abhängigkeit von der speziellen + Vorstellung entfernt."> + misuse = <"nicht geeignet für Benutzung vor Diagnosestellung"> + original_resource_uri = <"http://www.healthdata.org.au/data_sets/diabetic_review_data_set_1.html"> + other_details = <...> + > + > + + other_details = <...>
+
+ +
+

A number of details are worth noting here. Firstly, the free hierarchical structuring capability of dADL is exploited for expressing the 'deep' structure of the details section and its subsections. Secondly, the dADL qualified list form is used to allow multiple translations of the purpose and use to be shown. Lastly, empty items such as misuse (structured if there is data) are shown with just one level of empty brackets. The above example shows meta-data based on the openEHR Archetype Object Model (AOM).

The description section is technically optional according to the AOM, but in any realistic use of ADL for archetypes, it will be required. A minimal description section satisfying to the AOM is as follows:

@@ -5782,18 +5782,18 @@

description
-    original_author = <
-        ["name"] = <"Dr J Joyce">
-        ["organisation"] = <"NT Health Service">
-        ["date"] = <2003-08-03>
-    >
-    lifecycle_state = <"initial">
-    details = <
-        ["en"] = <
-            language = <[iso_639-1::en]>
-            purpose = <"archetype for diabetic patient review">
-        >
-    >
+ original_author = < + ["name"] = <"Dr J Joyce"> + ["organisation"] = <"NT Health Service"> + ["date"] = <2003-08-03> + > + lifecycle_state = <"initial"> + details = < + ["en"] = < + language = <[iso_639-1::en]> + purpose = <"archetype for diabetic patient review"> + > + >

@@ -5815,63 +5815,63 @@

8
definition
-    OBSERVATION[at0000]  {                                              -- blood pressure measurement
-        name  {                                                         -- any synonym of BP
-            CODED_TEXT  {
-                defining_code  {
-                    CODE_PHRASE  {[ac0001]}
-                }
-            }
-        }
-        data  {
-            HISTORY[at9001]  {                                           -- history
-                events cardinality  {1..*}  {
-                    EVENT[at9002] occurrences  {0..1}  {               -- baseline
-                        name  {
-                            CODED_TEXT  {
-                                defining_code  {
-                                    CODE_PHRASE  {[ac0002]}
-                                }
-                            }
-                        }
-                        data  {
-                            ITEM_LIST[at1000]  {                           -- systemic arterial BP
-                                items cardinality  {2..*}  {
-                                    ELEMENT[at1100]  {                     -- systolic BP
-                                        name  {                            -- any synonym of 'systolic'
-                                            CODED_TEXT  {
-                                                defining_code  {
-                                                    CODE_PHRASE  {[ac0002]}
-                                                }
-                                            }
-                                        }
-                                        value  {
-                                            QUANTITY  {
-                                                magnitude  {|0..1000|}
-                                                property  {[properties::944]}  -- "pressure"
-                                                units  {[units::387]}          -- "mm[Hg]"
-                                            }
-                                        }
-                                    }
-                                    ELEMENT[at1200]  {                          -- diastolic BP
-                                        name  {                                 -- any synonym of 'diastolic'
-                                            CODED_TEXT  {
-                                                defining_code  {
-                                                    CODE_PHRASE  {[ac0003]}
-                                                }
-                                            }
-                                        }
-                                        value  {
-                                            QUANTITY  {
-                                                magnitude  {|0..1000|}
-                                                property  {[properties::944]}   -- "pressure"
-                                                units  {[units::387]}           -- "mm[Hg]"
-                                            }
-                                        }
-                                    }
-                                    ELEMENT[at9000] occurrences  {0..*}  {*}    -- unknown new item
-                                }
-                            ...
+ OBSERVATION[at0000] { -- blood pressure measurement + name { -- any synonym of BP + CODED_TEXT { + defining_code { + CODE_PHRASE {[ac0001]} + } + } + } + data { + HISTORY[at9001] { -- history + events cardinality {1..*} { + EVENT[at9002] occurrences {0..1} { -- baseline + name { + CODED_TEXT { + defining_code { + CODE_PHRASE {[ac0002]} + } + } + } + data { + ITEM_LIST[at1000] { -- systemic arterial BP + items cardinality {2..*} { + ELEMENT[at1100] { -- systolic BP + name { -- any synonym of 'systolic' + CODED_TEXT { + defining_code { + CODE_PHRASE {[ac0002]} + } + } + } + value { + QUANTITY { + magnitude {|0..1000|} + property {[properties::944]} -- "pressure" + units {[units::387]} -- "mm[Hg]" + } + } + } + ELEMENT[at1200] { -- diastolic BP + name { -- any synonym of 'diastolic' + CODED_TEXT { + defining_code { + CODE_PHRASE {[ac0003]} + } + } + } + value { + QUANTITY { + magnitude {|0..1000|} + property {[properties::944]} -- "pressure" + units {[units::387]} -- "mm[Hg]" + } + } + } + ELEMENT[at9000] occurrences {0..*} {*} -- unknown new item + } + ...
@@ -5929,36 +5929,36 @@

8.6.1. Overview
ontology
-    terminologies_available = <"snomed_ct", ...>
-
-    term_definitions = <
-        ["en"] = <
-            items = <...>
-        >
-        ["de"] = <
-            items = <...>
-        >
-    >
-    constraint_definitions = <
-        ["en"] = <
-            items = <...>
-        >
-        ["de"] = <
-            items = <...>
-        >
-    >
-    term_bindings = <
-        ["snomed_ct"] = <
-            items = <...>
-            ...
-        >
-    >
-    constraint_bindings = <
-        ["snomed_ct"] = <
-            items = <...>
-            ...
-        >
-    >
+ terminologies_available = <"snomed_ct", ...> + + term_definitions = < + ["en"] = < + items = <...> + > + ["de"] = < + items = <...> + > + > + constraint_definitions = < + ["en"] = < + items = <...> + > + ["de"] = < + items = <...> + > + > + term_bindings = < + ["snomed_ct"] = < + items = <...> + ... + > + > + constraint_bindings = < + ["snomed_ct"] = < + items = <...> + ... + > + >

@@ -5990,41 +5990,41 @@

-
    term_definitions = <
-        ["en"] = <
-            items = <
-                ["at0000"] = <
-                    text = <"problem">
-                    description = <"The problem experienced by the subject of care to which the contained information relates">
-                >
-                ["at0001"] = <
-                    text = <"problem/SOAP headings">
-                    description = <"SOAP heading structure for multiple problems">
-                >
-                ...
-                ["at4000"] = <
-                    text = <"plan">
-                    description = <"The clinician's professional advice">
-                >
-            >
-        >
-        ["de"] = <
-            items = <
-                ["at0000"] = <
-                    text = <"klinisches Problem">
-                    description = <"Das Problem des Patienten worauf sich diese Informationen beziehen">
-                >
-                ["at0001"] = <
-                    text = <"Problem/SOAP Schema">
-                    description = <"SOAP-Schlagwort-Gruppierungsschema fuer mehrfache Probleme">
-                >
-                ["at4000"] = <
-                    text = <"Plan">
-                    description = <"Klinisch-professionelle Beratung des Pflegenden">
-                >
-            >
-        >
-    >
+
    term_definitions = <
+        ["en"] = <
+            items = <
+                ["at0000"] = <
+                    text = <"problem">
+                    description = <"The problem experienced by the subject of care to which the contained information relates">
+                >
+                ["at0001"] = <
+                    text = <"problem/SOAP headings">
+                    description = <"SOAP heading structure for multiple problems">
+                >
+                ...
+                ["at4000"] = <
+                    text = <"plan">
+                    description = <"The clinician's professional advice">
+                >
+            >
+        >
+        ["de"] = <
+            items = <
+                ["at0000"] = <
+                    text = <"klinisches Problem">
+                    description = <"Das Problem des Patienten worauf sich diese Informationen beziehen">
+                >
+                ["at0001"] = <
+                    text = <"Problem/SOAP Schema">
+                    description = <"SOAP-Schlagwort-Gruppierungsschema fuer mehrfache Probleme">
+                >
+                ["at4000"] = <
+                    text = <"Plan">
+                    description = <"Klinisch-professionelle Beratung des Pflegenden">
+                >
+            >
+        >
+    >

@@ -6086,22 +6086,22 @@
<

-
term_bindings = <
-    ["umls"] = <
-        items =<
-            ["at0000"] = <[umls::C124305]> -- apgar result
-            ["at0002"] = <[umls::0000000]> -- 1-minute event
-            ["at0004"] = <[umls::C234305]> -- cardiac score
-            ["at0005"] = <[umls::C232405]> -- respiratory score
-            ["at0006"] = <[umls::C254305]> -- muscle tone score
-            ["at0007"] = <[umls::C987305]> -- reflex response score
-            ["at0008"] = <[umls::C189305]> -- color score
-            ["at0009"] = <[umls::C187305]> -- apgar score
-            ["at0010"] = <[umls::C325305]> -- 2-minute apgar
-            ["at0011"] = <[umls::C725354]> -- 5-minute apgar
-            ["at0012"] = <[umls::C224305]> -- 10-minute apgar
-        >
-    >
+
term_bindings = <
+    ["umls"] = <
+        items =<
+            ["at0000"] = <[umls::C124305]> -- apgar result
+            ["at0002"] = <[umls::0000000]> -- 1-minute event
+            ["at0004"] = <[umls::C234305]> -- cardiac score
+            ["at0005"] = <[umls::C232405]> -- respiratory score
+            ["at0006"] = <[umls::C254305]> -- muscle tone score
+            ["at0007"] = <[umls::C987305]> -- reflex response score
+            ["at0008"] = <[umls::C189305]> -- color score
+            ["at0009"] = <[umls::C187305]> -- apgar score
+            ["at0010"] = <[umls::C325305]> -- 2-minute apgar
+            ["at0011"] = <[umls::C725354]> -- 5-minute apgar
+            ["at0012"] = <[umls::C224305]> -- 10-minute apgar
+        >
+    >
 >
@@ -6116,17 +6116,17 @@
-
["LNC205"] = <
-    items = <
-        ["/data[at0002]/events[at0003]/data[at0001]/item[at0004]"] = <[LNC205::8310-5]>
-        ["/data[at0002]/events[at0005]/data[at0001]/item[at0004]"] = <[LNC205::8321-2]>
-        ["/data[at0002]/events[at0006]/data[at0001]/item[at0004]"] = <[LNC205::8311-3]>
-        ["/data[at0002]/events[at0007]/data[at0001]/item[at0004]"] = <[LNC205::8316-2]>
-        ["/data[at0002]/events[at0008]/data[at0001]/item[at0004]"] = <[LNC205::8332-0]>
-        ["/data[at0002]/events[at0009]/data[at0001]/item[at0004]"] = <[LNC205::8312-1]>
-        ["/data[at0002]/events[at0017]/data[at0001]/item[at0004]"] = <[LNC205::8325-3]>
-        ["/data[at0002]/events[at0019]/data[at0001]/item[at0004]"] = <[LNC205::8320-4]>
-    >
+
["LNC205"] = <
+    items = <
+        ["/data[at0002]/events[at0003]/data[at0001]/item[at0004]"] = <[LNC205::8310-5]>
+        ["/data[at0002]/events[at0005]/data[at0001]/item[at0004]"] = <[LNC205::8321-2]>
+        ["/data[at0002]/events[at0006]/data[at0001]/item[at0004]"] = <[LNC205::8311-3]>
+        ["/data[at0002]/events[at0007]/data[at0001]/item[at0004]"] = <[LNC205::8316-2]>
+        ["/data[at0002]/events[at0008]/data[at0001]/item[at0004]"] = <[LNC205::8332-0]>
+        ["/data[at0002]/events[at0009]/data[at0001]/item[at0004]"] = <[LNC205::8312-1]>
+        ["/data[at0002]/events[at0017]/data[at0001]/item[at0004]"] = <[LNC205::8325-3]>
+        ["/data[at0002]/events[at0019]/data[at0001]/item[at0004]"] = <[LNC205::8320-4]>
+    >
 >
@@ -6139,13 +6139,13 @@

-
constraint_bindings = <
-    ["snomed_ct"] = <
-        items = <
-            ["ac0001"] = <http://terminology.org?query_id=12345>
-            ["ac0002"] = <http://terminology.org?query_id=678910>
-        >
-    >
+
constraint_bindings = <
+    ["snomed_ct"] = <
+        items = <
+            ["ac0001"] = <http://terminology.org?query_id=12345>
+            ["ac0002"] = <http://terminology.org?query_id=678910>
+        >
+    >
 >
@@ -6162,33 +6162,33 @@

revision_history
-    revision_history = <
-        ["1.57"] = <
-            committer = <"Miriam Hanoosh">
-            committer_organisation = <"AIHW.org.au">
-            time_committed = <2004-11-02 09:31:04+1000>
-            revision = <"1.2">
-            reason = <"Added social history section">
-            change_type = <"Modification">
-        >
-        -- etc
-        ["1.1"] = <
-            committer = <"Enrico Barrios">
-            committer_organisation = <"AIHW.org.au">
-            time_committed = <2004-09-24 11:57:00+1000>
-            revision = <"1.1">
-            reason = <"Updated HbA1C test result reference">
-            change_type = <"Modification">
-        >
-        ["1.0"] = <
-            committer = <"Enrico Barrios">
-            committer_organisation = <"AIHW.org.au">
-            time_committed = <2004-09-14 16:05:00+1000>
-            revision = <"1.0">
-            reason = <"Initial Writing">
-            change_type = <"Creation">
-        >
-    >
+ revision_history = < + ["1.57"] = < + committer = <"Miriam Hanoosh"> + committer_organisation = <"AIHW.org.au"> + time_committed = <2004-11-02 09:31:04+1000> + revision = <"1.2"> + reason = <"Added social history section"> + change_type = <"Modification"> + > + -- etc + ["1.1"] = < + committer = <"Enrico Barrios"> + committer_organisation = <"AIHW.org.au"> + time_committed = <2004-09-24 11:57:00+1000> + revision = <"1.1"> + reason = <"Updated HbA1C test result reference"> + change_type = <"Modification"> + > + ["1.0"] = < + committer = <"Enrico Barrios"> + committer_organisation = <"AIHW.org.au"> + time_committed = <2004-09-14 16:05:00+1000> + revision = <"1.0"> + reason = <"Initial Writing"> + change_type = <"Creation"> + > + >
@@ -6258,71 +6258,71 @@

8.9.1. Grammar

-
archetype:
-    arch_identification
-    arch_specialisation
-    arch_concept
-    arch_language
-    arch_description
-    arch_definition
-    arch_invariant
-    arch_ontology
-    ;
+
archetype:
+    arch_identification
+    arch_specialisation
+    arch_concept
+    arch_language
+    arch_description
+    arch_definition
+    arch_invariant
+    arch_ontology
+    ;
 
-arch_identification:
-    arch_head V_ARCHETYPE_ID
-    ;
+arch_identification:
+    arch_head V_ARCHETYPE_ID
+    ;
 
-arch_head:
-    SYM_ARCHETYPE
-    | SYM_ARCHETYPE arch_meta_data
-    ;
+arch_head:
+    SYM_ARCHETYPE
+    | SYM_ARCHETYPE arch_meta_data
+    ;
 
-arch_meta_data:
-    '(' arch_meta_data_items ')'
-    ;
+arch_meta_data:
+    '(' arch_meta_data_items ')'
+    ;
 
-arch_meta_data_items:
-    arch_meta_data_item
-    | arch_meta_data_items ';' arch_meta_data_item
-    ;
+arch_meta_data_items:
+    arch_meta_data_item
+    | arch_meta_data_items ';' arch_meta_data_item
+    ;
 
-arch_meta_data_item:
-    SYM_ADL_VERSION '=' V_VERSION_STRING
-    | SYM_IS_CONTROLLED
-    ;
+arch_meta_data_item:
+    SYM_ADL_VERSION '=' V_VERSION_STRING
+    | SYM_IS_CONTROLLED
+    ;
 
-arch_specialisation:
-    // empty OK
-    | SYM_SPECIALIZE V_ARCHETYPE_ID
-    ;
+arch_specialisation:
+    // empty OK
+    | SYM_SPECIALIZE V_ARCHETYPE_ID
+    ;
 
-arch_concept:
-    SYM_CONCEPT V_LOCAL_TERM_CODE_REF
-    | SYM_CONCEPT error
-    ;
+arch_concept:
+    SYM_CONCEPT V_LOCAL_TERM_CODE_REF
+    | SYM_CONCEPT error
+    ;
 
-arch_language:
-    // empty OK
-    | SYM_LANGUAGE V_DADL_TEXT
-    ;
+arch_language:
+    // empty OK
+    | SYM_LANGUAGE V_DADL_TEXT
+    ;
 
-arch_description:
-    // empty OK
-    | SYM_DESCRIPTION V_DADL_TEXT
-    ;
+arch_description:
+    // empty OK
+    | SYM_DESCRIPTION V_DADL_TEXT
+    ;
 
-arch_definition:
-    SYM_DEFINITION V_CADL_TEXT
-    ;
+arch_definition:
+    SYM_DEFINITION V_CADL_TEXT
+    ;
 
-arch_invariant:
-    // empty OK
-    | SYM_INVARIANT V_ASSERTION_TEXT
+arch_invariant:
+    // empty OK
+    | SYM_INVARIANT V_ASSERTION_TEXT
 
-arch_ontology:
-    SYM_ONTOLOGY V_DADL_TEXT
-    ;
+arch_ontology: + SYM_ONTOLOGY V_DADL_TEXT + ;
@@ -6451,17 +6451,17 @@

9.1. Intr
-
age matches {
-    QTY matches {
-        property matches {"time"}
-        units matches {"yr"}
-        magnitude matches {|0.0..200.0|}
-    }
-    QTY matches {
-        property matches {"time"}
-        units matches {"mth"}
-        magnitude matches {|3.0..12.0|}
-    }
+
age matches {
+    QTY matches {
+        property matches {"time"}
+        units matches {"yr"}
+        magnitude matches {|0.0..200.0|}
+    }
+    QTY matches {
+        property matches {"time"}
+        units matches {"mth"}
+        magnitude matches {|3.0..12.0|}
+    }
 }
@@ -6537,15 +6537,15 @@

9.1.1. Cust
-
defining_code matches {
-    CODE_PHRASE matches {
-        terminology_id matches {"local"}
-        code_string matches {"at0039"} -- lying
-    }
-    CODE_PHRASE matches {
-        terminology_id matches {"local"}
-        code_string matches {"at0040"} -- sitting
-    }
+
defining_code matches {
+    CODE_PHRASE matches {
+        terminology_id matches {"local"}
+        code_string matches {"at0039"} -- lying
+    }
+    CODE_PHRASE matches {
+        terminology_id matches {"local"}
+        code_string matches {"at0040"} -- sitting
+    }
 }
@@ -6563,16 +6563,16 @@

9.1.1. Cust
-
defining_code matches {
-    C_CODE_PHRASE <
-        terminology_id = <
-            value = <"local">
-        >
-        code_list = <
-            ["1"] = <"at0039">
-            ["2"] = <"at0040">
-        >
-    >
+
defining_code matches {
+    C_CODE_PHRASE <
+        terminology_id = <
+            value = <"local">
+        >
+        code_list = <
+            ["1"] = <"at0039">
+            ["2"] = <"at0040">
+        >
+    >
 }
@@ -6581,10 +6581,10 @@

9.1.1. Cust
-
defining_code matches {
-    [local::
-    at0039,
-    at0040]
+
defining_code matches {
+    [local::
+    at0039,
+    at0040]
 }
@@ -6609,7 +6609,7 @@

A.2.1. OMG OCL (Object Constraint Language)

-

The OMG’s Object Constraint Language (OCL) appears at first glance to be an obvious contender for writing archetypes. However, its designed use is to write constraints on object models, rather than on data, which is what archetypes are about. As a concrete example, OCL can be used to make statements about the actors attribute of a class Company - e.g. that actors must exist and contain the Actor who is the lead of Company. However, if used in the normal way to write constraints on a class model, it cannot describe the notion that for a particular kind of (acting) company, such as 'itinerant jugglers', there must be at least four actors, each of whom have among their capabilities 'advanced juggling', plus an Actor who has skill 'musician'. This is because doing so would constrain all instances of the class Company to conform to the specific configuration of instances corresponding to actors and jugglers, when what is intended is to allow a myriad of possibilities. ADL provides the ability to create numerous archetypes, each describing in detail a concrete configuration of instances of type Company. OCL’s constraint types include function pre- and post-conditions, and class invariants. There is no structural character to the syntax - all statements are essentially first-order predicate logic statements about elements in models expressed in UML, and are related to parts of a model by 'context' statements. This makes it impossible to use OCL to express an archetype in a structural way which is natural to domain experts. OCL also has some flaws, described in (Beale, 2003). However, OCL is in fact relevant to ADL. ADL archetypes include invariants (and one day, might include pre- and post-conditions). Currently these are expressed in a syntax very similar to OCL, with minor differences. The exact definition of the ADL invariant syntax in the future will depend somewhat on the progress of OCL through the OMG standards process.

+

The OMG’s Object Constraint Language (OCL) appears at first glance to be an obvious contender for writing archetypes. However, its designed use is to write constraints on object models, rather than on data, which is what archetypes are about. As a concrete example, OCL can be used to make statements about the actors attribute of a class Company - e.g. that actors must exist and contain the Actor who is the lead of Company. However, if used in the normal way to write constraints on a class model, it cannot describe the notion that for a particular kind of (acting) company, such as 'itinerant jugglers', there must be at least four actors, each of whom have among their capabilities 'advanced juggling', plus an Actor who has skill 'musician'. This is because doing so would constrain all instances of the class Company to conform to the specific configuration of instances corresponding to actors and jugglers, when what is intended is to allow a myriad of possibilities. ADL provides the ability to create numerous archetypes, each describing in detail a concrete configuration of instances of type Company. OCL’s constraint types include function pre- and post-conditions, and class invariants. There is no structural character to the syntax - all statements are essentially first-order predicate logic statements about elements in models expressed in UML, and are related to parts of a model by 'context' statements. This makes it impossible to use OCL to express an archetype in a structural way which is natural to domain experts. OCL also has some flaws, described in (Beale, 2003). However, OCL is in fact relevant to ADL. ADL archetypes include invariants (and one day, might include pre- and post-conditions). Currently these are expressed in a syntax very similar to OCL, with minor differences. The exact definition of the ADL invariant syntax in the future will depend somewhat on the progress of OCL through the OMG standards process.

@@ -6693,38 +6693,38 @@

A.3.2. KIF (Knowledge Interchange Format)

-

The Knowledge Interchange Format (KIF) is a knowledge representation language whose goal is to be able to describe formal semantics which would be sharable among software entities, such as information systems in an airline and a travel agency. An example of KIF (taken from (Genesereth, Fikes, & Gruber, 1992)) used to describe the simple concept of 'units' in a class is as follows:

+

The Knowledge Interchange Format (KIF) is a knowledge representation language whose goal is to be able to describe formal semantics which would be sharable among software entities, such as information systems in an airline and a travel agency. An example of KIF (taken from (Genesereth, Fikes, & Gruber, 1992)) used to describe the simple concept of 'units' in a class is as follows:

-
(defrelation BASIC-UNIT
-    (=> (BASIC-UNIT ?u) ; basic units are distinguished units of measure
-        (unit-of-measure ?u)))
+
(defrelation BASIC-UNIT
+    (=> (BASIC-UNIT ?u) ; basic units are distinguished units of measure
+        (unit-of-measure ?u)))
 
-(deffunction UNIT*
-        ; Unit* maps all pairs of units to units
-    (=> (and (unit-of-measure ?u1) (unit-of-measure ?u2))
-        (and (defined (UNIT* ?u1 ?u2)) (unit-of-measure (UNIT* ?u1 ?u2))))
+(deffunction UNIT*
+        ; Unit* maps all pairs of units to units
+    (=> (and (unit-of-measure ?u1) (unit-of-measure ?u2))
+        (and (defined (UNIT* ?u1 ?u2)) (unit-of-measure (UNIT* ?u1 ?u2))))
 
-        ; It is commutative
-    (= (UNIT* ?u1 ?u2) (UNIT* ?u2 ?u1))
+        ; It is commutative
+    (= (UNIT* ?u1 ?u2) (UNIT* ?u2 ?u1))
 
-        ; It is associative
-    (= (UNIT* ?u1 (UNIT* ?u2 ?u3))
-        (UNIT* (UNIT* ?u1 ?u2) ?u3))
+        ; It is associative
+    (= (UNIT* ?u1 (UNIT* ?u2 ?u3))
+        (UNIT* (UNIT* ?u1 ?u2) ?u3))
 )
 
-(deffunction UNIT^
-        ; Unit^ maps all units and reals to units
-    (=> (and (unit-of-measure ?u)
-        (real-number ?r))
-        (and (defined (UNIT^ ?u ?r)) (unit-of-measure (UNIT^ ?u ?r))))
-
-        ; It has the algebraic properties of exponentiation
-    (= (UNIT^ ?u 1) ?u)
-    (= (unit* (UNIT^ ?u ?r1) (UNIT^ ?u ?r2)) (UNIT^ ?u (+ ?r1 ?r2)))
-    (= (UNIT^ (unit* ?u1 ?u2) ?r)
-    (unit* (UNIT^ ?u1 ?r) (UNIT^ ?u2 ?r)))
+(deffunction UNIT^
+        ; Unit^ maps all units and reals to units
+    (=> (and (unit-of-measure ?u)
+        (real-number ?r))
+        (and (defined (UNIT^ ?u ?r)) (unit-of-measure (UNIT^ ?u ?r))))
+
+        ; It has the algebraic properties of exponentiation
+    (= (UNIT^ ?u 1) ?u)
+    (= (unit* (UNIT^ ?u ?r1) (UNIT^ ?u ?r2)) (UNIT^ ?u (+ ?r1 ?r2)))
+    (= (UNIT^ (unit* ?u1 ?u2) ?r)
+    (unit* (UNIT^ ?u1 ?r) (UNIT^ ?u2 ?r)))
 )
@@ -6732,7 +6732,7 @@

-

It should also be realised that KIF is intended as a knowledge exchange format, rather than a knowledge representation format, which is to say that it can (in theory) represent the semantics of any other knowledge representation language, such as OWL. This distinction today seems fine, since Web-enabled languages like OWL probably don’t need an exchange format other than their XML equivalents to be shared. The relationship and relative strengths and deficiencies is explored by e.g. Martin (2003).

+

It should also be realised that KIF is intended as a knowledge exchange format, rather than a knowledge representation format, which is to say that it can (in theory) represent the semantics of any other knowledge representation language, such as OWL. This distinction today seems fine, since Web-enabled languages like OWL probably don’t need an exchange format other than their XML equivalents to be shared. The relationship and relative strengths and deficiencies is explored by e.g. Martin (2003).

@@ -6741,7 +6741,7 @@

<

A.4.1. XML-schema

-

Previously, archetypes have been expressed as XML instance documents conforming to W3C XML schemas, for example in the Good Electronic Health Record project (see (Beale & Heard, 2000)). The schemas used in those projects correspond technically to the XML expressions of information model-dependent object models shown in The Archetypes: Technical Overview specification. XML archetypes are accordingly equivalent to serialised instances of the parse tree, i.e. particular ADL archetypes serialised from objects into XML instance.

+

Previously, archetypes have been expressed as XML instance documents conforming to W3C XML schemas, for example in the Good Electronic Health Record project (see (Beale & Heard, 2000)). The schemas used in those projects correspond technically to the XML expressions of information model-dependent object models shown in The Archetypes: Technical Overview specification. XML archetypes are accordingly equivalent to serialised instances of the parse tree, i.e. particular ADL archetypes serialised from objects into XML instance.

@@ -6780,33 +6780,33 @@

B

revision

-

extended version string

+

extended version string

Full version identifier to compensate for only major version numbering in ADL 1.4 identifiers.

build_uid

Guid string

-

Changed every save. See AOM2 spec, Machine Identifiers section

+

Changed every save. See AOM2 spec, Machine Identifiers section

original_namespace

reverse domain name

-

See AOM2 spec, Governance Meta-data section.

+

See AOM2 spec, Governance Meta-data section.

original_publisher

org name with optional trailing <> section containing a domain name or email address

-

See AOM2 spec, Governance Meta-data section

+

See AOM2 spec, Governance Meta-data section

custodian_organisation

org name with optional trailing <> section containing a domain name or email address

-

See AOM2 spec, Governance Meta-data section

+

See AOM2 spec, Governance Meta-data section

custodian_namespace

reverse domain name

-

See AOM2 spec, Governance Meta-data section

+

See AOM2 spec, Governance Meta-data section

licence

@@ -6830,19 +6830,19 @@

B
-
other_details = <
-    ["licence"] = <"This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/.">
-    ["original_namespace"] = <"au.gov.nehta">
-    ["original_publisher"] = <"NEHTA CTI Team, National E-Health Transition Authority <clinicalinfo@nehta.gov.au>">
-    ["custodian_organisation"] = <"openEHR Foundation <http://www.openEHR.org>">
-    ["custodian_namespace"] = <"org.openehr">
-    ["build_uid"] = <"3076af96-e1dd-4f9b-abf2-23913fcf52b1">
-    ["revision"] = <"0.0.1-alpha">
-    ["references"] = <"
+
other_details = <
+    ["licence"] = <"This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/.">
+    ["original_namespace"] = <"au.gov.nehta">
+    ["original_publisher"] = <"NEHTA CTI Team, National E-Health Transition Authority <clinicalinfo@nehta.gov.au>">
+    ["custodian_organisation"] = <"openEHR Foundation <http://www.openEHR.org>">
+    ["custodian_namespace"] = <"org.openehr">
+    ["build_uid"] = <"3076af96-e1dd-4f9b-abf2-23913fcf52b1">
+    ["revision"] = <"0.0.1-alpha">
+    ["references"] = <"
         O'Brien E, Asmar R, Beilin L, et al. European Society of Hypertension recommendations for conventional, ambulatory and home blood pressure measurement. Journal of Hypertension. 2003; 21(5):821-848. Available from: http://www.ncbi.nlm.nih.gov/pubmed/12714851
         Perloff D, Grim C, Flack J, Frohlich ED, Hill M, McDonald M, Morgenstern BZ. Human blood pressure determination by sphygmomanometry. Circulation. 1993; 88(5):2460. Available from: http://circ.ahajournals.org/cgi/reprint/88/5/2460
     ">
-    ["ip_acknowledgements"] = <"
+    ["ip_acknowledgements"] = <"
         Content from LOINC® is copyright © 1995 Regenstrief Institute, Inc. and the LOINC Committee, and available at no cost under the license at http://loinc.org/terms-of-use.
         Content from SNOMED CT® is copyright © 2007 IHTSDO <ihtsdo.org>.
     ">
@@ -6896,11 +6896,11 @@ 

B.2. Other Item

-
other_details = <
-    ["review_date"] = <"2014-06-10">
-    ["current_contact"] = <"Ian McNicoll, freshEHR Clinical Informatics Ltd <ian.mcnicoll@freshehr.com>">
-    ["responsible_organisation"] = <"Nehta">
-    ["MD5-CAM-1.0.1"] = <"C5016B71B55DBDCBCAA8531CC1A982E3">
+
other_details = <
+    ["review_date"] = <"2014-06-10">
+    ["current_contact"] = <"Ian McNicoll, freshEHR Clinical Informatics Ltd <ian.mcnicoll@freshehr.com>">
+    ["responsible_organisation"] = <"Nehta">
+    ["MD5-CAM-1.0.1"] = <"C5016B71B55DBDCBCAA8531CC1A982E3">
 >
@@ -6920,90 +6920,90 @@

C.1.

-
//
-//  description: Antlr4 grammar for Archetype Definition Language (ADL2)
-//  author:      Thomas Beale <thomas.beale@openehr.org>
-//  contributors:Pieter Bos <pieter.bos@nedap.com>
-//  support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
-//  copyright:   Copyright (c) 2015- openEHR Foundation <http://www.openEHR.org>
-//  license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
-//
+
//
+//  description: Antlr4 grammar for Archetype Definition Language (ADL2)
+//  author:      Thomas Beale <thomas.beale@openehr.org>
+//  contributors:Pieter Bos <pieter.bos@nedap.com>
+//  support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
+//  copyright:   Copyright (c) 2015- openEHR Foundation <http://www.openEHR.org>
+//  license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
+//
 
-grammar adl14;
-import cadl14, odin;
+grammar adl14;
+import cadl14, odin;
 
-//
-//  ============== Parser rules ==============
-//
+//
+//  ============== Parser rules ==============
+//
 
-adl14_archetype: ( archetype) EOF ;
+adl14_archetype: ( archetype) EOF ;
 
 archetype: 
-    SYM_ARCHETYPE meta_data?
-    ARCHETYPE_HRID
-    specialization_section?
-    concept_section
-    language_section
-    description_section
-    definition_section
-    invariant_section?
-    ontology_section
-    ;
-
-
-specialization_section : SYM_SPECIALIZE ARCHETYPE_REF ;
-language_section       : SYM_LANGUAGE odin_text ;
-description_section    : SYM_DESCRIPTION odin_text ;
-definition_section     : SYM_DEFINITION c_complex_object ;
-invariant_section      : SYM_INVARIANT ( statement (';')?)+ ;
-ontology_section       : SYM_ONTOLOGY odin_text ;
-
-concept_section:
- 'concept' '[' AT_CODE ']';
-
-meta_data: '(' meta_data_item  (';' meta_data_item )* ')' ;
-
-meta_data_item:
-      meta_data_tag_adl_version '=' VERSION_ID
-    | meta_data_tag_uid '=' GUID
-    | meta_data_tag_build_uid '=' GUID
-    | meta_data_tag_rm_release '=' VERSION_ID
-    | meta_data_tag_is_controlled
-    | meta_data_tag_is_generated
-    | ALPHANUM_ID ( '=' meta_data_value )?
-    ;
-
-meta_data_value:
-      primitive_value
-    | GUID
-    | VERSION_ID
-    ;
-
-meta_data_tag_adl_version   : 'adl_version' ;
-meta_data_tag_uid           : 'uid' ;
-meta_data_tag_build_uid     : 'build_uid' ;
-meta_data_tag_rm_release    : 'rm_release' ;
-meta_data_tag_is_controlled : 'controlled' ;
-meta_data_tag_is_generated  : 'generated' ;
-
-
-//
-// ------------------ lexical patterns -----------------
-//
-
-SYM_ARCHETYPE   : [Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee] ;
-
-SYM_SPECIALIZE  : '\n'[Ss][Pp][Ee][Cc][Ii][Aa][Ll][Ii][SsZz][Ee] ;
-SYM_LANGUAGE    : '\n'[Ll][Aa][Nn][Gg][Uu][Aa][Gg][Ee] ;
-SYM_DESCRIPTION : '\n'[Dd][Ee][Ss][Cc][Rr][Ii][Pp][Tt][Ii][Oo][Nn] ;
-SYM_DEFINITION  : '\n'[Dd][Ee][Ff][Ii][Nn][Ii][Tt][Ii][Oo][Nn] ;
-SYM_INVARIANT   : '\n'[Ii][Nn][Vv][Aa][Rr][Ii][Aa][Nn][Tt] ;
-SYM_ONTOLOGY    : '\n'[Oo][Nn][Tt][Oo][Ll][Oo][Gg][Yy] ;
-SYM_ANNOTATIONS : '\n'[Aa][Nn][Nn][Oo][Tt][Aa][Tt][Ii][Oo][Nn][Ss] ;
-
-// ---------------- meta-data keywords and symbols ---------------
-SYM_EQ         : '=' ;
-ALPHANUM_ID : [a-zA-Z0-9][a-zA-Z0-9_]* ;
+ SYM_ARCHETYPE meta_data? + ARCHETYPE_HRID + specialization_section? + concept_section + language_section + description_section + definition_section + invariant_section? + ontology_section + ; + + +specialization_section : SYM_SPECIALIZE ARCHETYPE_REF ; +language_section : SYM_LANGUAGE odin_text ; +description_section : SYM_DESCRIPTION odin_text ; +definition_section : SYM_DEFINITION c_complex_object ; +invariant_section : SYM_INVARIANT ( statement (';')?)+ ; +ontology_section : SYM_ONTOLOGY odin_text ; + +concept_section: + 'concept' '[' AT_CODE ']'; + +meta_data: '(' meta_data_item (';' meta_data_item )* ')' ; + +meta_data_item: + meta_data_tag_adl_version '=' VERSION_ID + | meta_data_tag_uid '=' GUID + | meta_data_tag_build_uid '=' GUID + | meta_data_tag_rm_release '=' VERSION_ID + | meta_data_tag_is_controlled + | meta_data_tag_is_generated + | ALPHANUM_ID ( '=' meta_data_value )? + ; + +meta_data_value: + primitive_value + | GUID + | VERSION_ID + ; + +meta_data_tag_adl_version : 'adl_version' ; +meta_data_tag_uid : 'uid' ; +meta_data_tag_build_uid : 'build_uid' ; +meta_data_tag_rm_release : 'rm_release' ; +meta_data_tag_is_controlled : 'controlled' ; +meta_data_tag_is_generated : 'generated' ; + + +// +// ------------------ lexical patterns ----------------- +// + +SYM_ARCHETYPE : [Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee] ; + +SYM_SPECIALIZE : '\n'[Ss][Pp][Ee][Cc][Ii][Aa][Ll][Ii][SsZz][Ee] ; +SYM_LANGUAGE : '\n'[Ll][Aa][Nn][Gg][Uu][Aa][Gg][Ee] ; +SYM_DESCRIPTION : '\n'[Dd][Ee][Ss][Cc][Rr][Ii][Pp][Tt][Ii][Oo][Nn] ; +SYM_DEFINITION : '\n'[Dd][Ee][Ff][Ii][Nn][Ii][Tt][Ii][Oo][Nn] ; +SYM_INVARIANT : '\n'[Ii][Nn][Vv][Aa][Rr][Ii][Aa][Nn][Tt] ; +SYM_ONTOLOGY : '\n'[Oo][Nn][Tt][Oo][Ll][Oo][Gg][Yy] ; +SYM_ANNOTATIONS : '\n'[Aa][Nn][Nn][Oo][Tt][Aa][Tt][Ii][Oo][Nn][Ss] ; + +// ---------------- meta-data keywords and symbols --------------- +SYM_EQ : '=' ; +ALPHANUM_ID : [a-zA-Z0-9][a-zA-Z0-9_]* ;
@@ -7014,95 +7014,95 @@

C.2. cADL Synta
-
//
-// description: Antlr4 grammar for cADL non-primitves sub-syntax of Archetype Definition Language (ADL2)
-//  author:      Thomas Beale <thomas.beale@openehr.org>
-//  contributors:Pieter Bos <pieter.bos@nedap.com>
-//  support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
-//  copyright:   Copyright (c) 2015- openEHR Foundation <http://www.openEHR.org>
-// license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
-//
+
//
+// description: Antlr4 grammar for cADL non-primitves sub-syntax of Archetype Definition Language (ADL2)
+//  author:      Thomas Beale <thomas.beale@openehr.org>
+//  contributors:Pieter Bos <pieter.bos@nedap.com>
+//  support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
+//  copyright:   Copyright (c) 2015- openEHR Foundation <http://www.openEHR.org>
+// license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
+//
 
-grammar cadl14;
-import cadl14_primitives, odin, base_expressions;
+grammar cadl14;
+import cadl14_primitives, odin, base_expressions;
 
-//
-//  ======================= Top-level Objects ========================
-//
+//
+//  ======================= Top-level Objects ========================
+//
 
-c_complex_object: rm_type_id (at_type_id)? c_occurrences? ( SYM_MATCHES '{' (c_attribute+ | '*') '}' )? ;
+c_complex_object: rm_type_id (at_type_id)? c_occurrences? ( SYM_MATCHES '{' (c_attribute+ | '*') '}' )? ;
 
-at_type_id: '[' ( AT_CODE ) ']';
+at_type_id: '[' ( AT_CODE ) ']';
 
-// ======================== Components =======================
+// ======================== Components =======================
 
-c_objects: c_non_primitive_object_ordered+ | c_primitive_object ;
+c_objects: c_non_primitive_object_ordered+ | c_primitive_object ;
 
-c_non_primitive_object_ordered: c_non_primitive_object ;
+c_non_primitive_object_ordered: c_non_primitive_object ;
 
-c_non_primitive_object:
-      c_complex_object
-    | domain_specific_extension
-    | c_archetype_root
-    | c_complex_object_proxy
-    | archetype_slot
-    | c_ordinal
-    ;
+c_non_primitive_object:
+      c_complex_object
+    | domain_specific_extension
+    | c_archetype_root
+    | c_complex_object_proxy
+    | archetype_slot
+    | c_ordinal
+    ;
 
-domain_specific_extension: rm_type_id '<' odin_text? '>';
+domain_specific_extension: rm_type_id '<' odin_text? '>';
 
-c_ordinal: ordinal_term  (',' ordinal_term)* (';' assumed_ordinal_value)?;
+c_ordinal: ordinal_term  (',' ordinal_term)* (';' assumed_ordinal_value)?;
 
-assumed_ordinal_value: INTEGER | REAL;
+assumed_ordinal_value: INTEGER | REAL;
 
-ordinal_term: (integer_value | real_value) '|' c_terminology_code;
+ordinal_term: (integer_value | real_value) '|' c_terminology_code;
 
-c_archetype_root: SYM_USE_ARCHETYPE rm_type_id '[' AT_CODE (',' ARCHETYPE_REF)? ']' c_occurrences? ( SYM_MATCHES '{' c_attribute+ '}' )? ;
+c_archetype_root: SYM_USE_ARCHETYPE rm_type_id '[' AT_CODE (',' ARCHETYPE_REF)? ']' c_occurrences? ( SYM_MATCHES '{' c_attribute+ '}' )? ;
 
-c_complex_object_proxy: SYM_USE_NODE rm_type_id ('[' AT_CODE ']')? c_occurrences? ADL_PATH ;
+c_complex_object_proxy: SYM_USE_NODE rm_type_id ('[' AT_CODE ']')? c_occurrences? ADL_PATH ;
 
-archetype_slot:
-      c_archetype_slot_head SYM_MATCHES '{' c_includes? c_excludes? '}'
-    | c_archetype_slot_head
-    ;
+archetype_slot:
+      c_archetype_slot_head SYM_MATCHES '{' c_includes? c_excludes? '}'
+    | c_archetype_slot_head
+    ;
 
-c_archetype_slot_head: c_archetype_slot_id c_occurrences? ;
+c_archetype_slot_head: c_archetype_slot_id c_occurrences? ;
 
-c_archetype_slot_id: SYM_ALLOW_ARCHETYPE rm_type_id ('[' AT_CODE ']')? ;
+c_archetype_slot_id: SYM_ALLOW_ARCHETYPE rm_type_id ('[' AT_CODE ']')? ;
 
-c_attribute: rm_attribute_id c_existence? c_cardinality? ( SYM_MATCHES '{' (c_objects | '*') '}' )? ;
+c_attribute: rm_attribute_id c_existence? c_cardinality? ( SYM_MATCHES '{' (c_objects | '*') '}' )? ;
 
-c_includes : SYM_INCLUDE assertion+ ;
-c_excludes : SYM_EXCLUDE assertion+ ;
+c_includes : SYM_INCLUDE assertion+ ;
+c_excludes : SYM_EXCLUDE assertion+ ;
 
-c_existence: SYM_EXISTENCE SYM_MATCHES '{' existence '}' ;
-existence: INTEGER | INTEGER '..' INTEGER ;
+c_existence: SYM_EXISTENCE SYM_MATCHES '{' existence '}' ;
+existence: INTEGER | INTEGER '..' INTEGER ;
 
-c_cardinality    : SYM_CARDINALITY SYM_MATCHES '{' cardinality '}' ;
-cardinality      : multiplicity ( multiplicity_mod multiplicity_mod? )? ; // max of two
-ordering_mod     : ';' ( SYM_ORDERED | SYM_UNORDERED ) ;
-unique_mod       : ';' SYM_UNIQUE ;
-multiplicity_mod : ordering_mod | unique_mod ;
+c_cardinality    : SYM_CARDINALITY SYM_MATCHES '{' cardinality '}' ;
+cardinality      : multiplicity ( multiplicity_mod multiplicity_mod? )? ; // max of two
+ordering_mod     : ';' ( SYM_ORDERED | SYM_UNORDERED ) ;
+unique_mod       : ';' SYM_UNIQUE ;
+multiplicity_mod : ordering_mod | unique_mod ;
 
-c_occurrences : SYM_OCCURRENCES SYM_MATCHES '{' multiplicity '}' ;
-multiplicity  : INTEGER | '*' | INTEGER '..' ( INTEGER | '*' ) ;
+c_occurrences : SYM_OCCURRENCES SYM_MATCHES '{' multiplicity '}' ;
+multiplicity  : INTEGER | '*' | INTEGER '..' ( INTEGER | '*' ) ;
 
-//
-// ---------- Lexer patterns -----------------
-//
+//
+// ---------- Lexer patterns -----------------
+//
 
-// CADL keywords
-SYM_EXISTENCE   : [Ee][Xx][Ii][Ss][Tt][Ee][Nn][Cc][Ee] ;
-SYM_OCCURRENCES : [Oo][Cc][Cc][Uu][Rr][Rr][Ee][Nn][Cc][Ee][Ss] ;
-SYM_CARDINALITY : [Cc][Aa][Rr][Dd][Ii][Nn][Aa][Ll][Ii][Tt][Yy] ;
-SYM_ORDERED     : [Oo][Rr][Dd][Ee][Rr][Ee][Dd] ;
-SYM_UNORDERED   : [Uu][Nn][Oo][Rr][Dd][Ee][Rr][Ee][Dd] ;
-SYM_UNIQUE      : [Uu][Nn][Ii][Qq][Uu][Ee] ;
-SYM_USE_NODE    : [Uu][Ss][Ee][_][Nn][Oo][Dd][Ee] ;
-SYM_USE_ARCHETYPE : [Uu][Ss][Ee][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee] ;
-SYM_ALLOW_ARCHETYPE : [Aa][Ll][Ll][Oo][Ww][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee] ;
-SYM_INCLUDE     : [Ii][Nn][Cc][Ll][Uu][Dd][Ee] ;
-SYM_EXCLUDE     : [Ee][Xx][Cc][Ll][Uu][Dd][Ee] ;
+// CADL keywords +SYM_EXISTENCE : [Ee][Xx][Ii][Ss][Tt][Ee][Nn][Cc][Ee] ; +SYM_OCCURRENCES : [Oo][Cc][Cc][Uu][Rr][Rr][Ee][Nn][Cc][Ee][Ss] ; +SYM_CARDINALITY : [Cc][Aa][Rr][Dd][Ii][Nn][Aa][Ll][Ii][Tt][Yy] ; +SYM_ORDERED : [Oo][Rr][Dd][Ee][Rr][Ee][Dd] ; +SYM_UNORDERED : [Uu][Nn][Oo][Rr][Dd][Ee][Rr][Ee][Dd] ; +SYM_UNIQUE : [Uu][Nn][Ii][Qq][Uu][Ee] ; +SYM_USE_NODE : [Uu][Ss][Ee][_][Nn][Oo][Dd][Ee] ; +SYM_USE_ARCHETYPE : [Uu][Ss][Ee][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee] ; +SYM_ALLOW_ARCHETYPE : [Aa][Ll][Ll][Oo][Ww][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee] ; +SYM_INCLUDE : [Ii][Nn][Cc][Ll][Uu][Dd][Ee] ; +SYM_EXCLUDE : [Ee][Xx][Cc][Ll][Uu][Dd][Ee] ;
@@ -7113,104 +7113,104 @@

-
//
-// description: Antlr4 grammar for cADL primitives sub-syntax of Archetype Definition Language (ADL2)
-//  author:      Thomas Beale <thomas.beale@openehr.org>
-//  contributors:Pieter Bos <pieter.bos@nedap.com>
-//  support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
-//  copyright:   Copyright (c) 2015- openEHR Foundation <http://www.openEHR.org>
-// license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
-//
+
//
+// description: Antlr4 grammar for cADL primitives sub-syntax of Archetype Definition Language (ADL2)
+//  author:      Thomas Beale <thomas.beale@openehr.org>
+//  contributors:Pieter Bos <pieter.bos@nedap.com>
+//  support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
+//  copyright:   Copyright (c) 2015- openEHR Foundation <http://www.openEHR.org>
+// license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
+//
 
-grammar cadl14_primitives;
-import odin_values;
+grammar cadl14_primitives;
+import odin_values;
 
-//
-//  ======================= Parser rules ========================
-//
+//
+//  ======================= Parser rules ========================
+//
 
-c_primitive_object:
-      c_integer
-    | c_real
-    | c_date
-    | c_time
-    | c_date_time
-    | c_duration
-    | c_string
-    | c_terminology_code
-    | c_boolean
-    ;
+c_primitive_object:
+      c_integer
+    | c_real
+    | c_date
+    | c_time
+    | c_date_time
+    | c_duration
+    | c_string
+    | c_terminology_code
+    | c_boolean
+    ;
 
-c_integer: ( integer_value | integer_list_value | integer_interval_value | integer_interval_list_value ) assumed_integer_value? ;
-assumed_integer_value: ';' integer_value ;
+c_integer: ( integer_value | integer_list_value | integer_interval_value | integer_interval_list_value ) assumed_integer_value? ;
+assumed_integer_value: ';' integer_value ;
 
-c_real: ( real_value | real_list_value | real_interval_value | real_interval_list_value ) assumed_real_value? ;
-assumed_real_value: ';' real_value ;
+c_real: ( real_value | real_list_value | real_interval_value | real_interval_list_value ) assumed_real_value? ;
+assumed_real_value: ';' real_value ;
 
-c_date_time: ( DATE_TIME_CONSTRAINT_PATTERN | date_time_value | date_time_list_value | date_time_interval_value | date_time_interval_list_value ) assumed_date_time_value? ;
-assumed_date_time_value: ';' date_time_value ;
+c_date_time: ( DATE_TIME_CONSTRAINT_PATTERN | date_time_value | date_time_list_value | date_time_interval_value | date_time_interval_list_value ) assumed_date_time_value? ;
+assumed_date_time_value: ';' date_time_value ;
 
-c_date: ( DATE_CONSTRAINT_PATTERN | date_value | date_list_value | date_interval_value | date_interval_list_value ) assumed_date_value? ;
-assumed_date_value: ';' date_value ;
+c_date: ( DATE_CONSTRAINT_PATTERN | date_value | date_list_value | date_interval_value | date_interval_list_value ) assumed_date_value? ;
+assumed_date_value: ';' date_value ;
 
-c_time: ( TIME_CONSTRAINT_PATTERN | time_value | time_list_value | time_interval_value | time_interval_list_value ) assumed_time_value? ;
-assumed_time_value: ';' time_value ;
+c_time: ( TIME_CONSTRAINT_PATTERN | time_value | time_list_value | time_interval_value | time_interval_list_value ) assumed_time_value? ;
+assumed_time_value: ';' time_value ;
 
-c_duration: (
-      DURATION_CONSTRAINT_PATTERN ( ( duration_interval_value | duration_value ))?
-    | duration_value | duration_list_value | duration_interval_value | duration_interval_list_value ) assumed_duration_value?
-    ;
-assumed_duration_value: ';' duration_value ;
+c_duration: (
+      DURATION_CONSTRAINT_PATTERN ( ( duration_interval_value | duration_value ))?
+    | duration_value | duration_list_value | duration_interval_value | duration_interval_list_value ) assumed_duration_value?
+    ;
+assumed_duration_value: ';' duration_value ;
 
-c_string: ( string_value | string_list_value | regex_constraint ) assumed_string_value? ;
-regex_constraint: SLASH_REGEX | CARET_REGEX ;
-assumed_string_value: ';' string_value ;
+c_string: ( string_value | string_list_value | regex_constraint ) assumed_string_value? ;
+regex_constraint: SLASH_REGEX | CARET_REGEX ;
+assumed_string_value: ';' string_value ;
 
 
-c_terminology_code: c_local_term_code | c_qualified_term_code;
+c_terminology_code: c_local_term_code | c_qualified_term_code;
 
-c_local_term_code: '[' ( ( AC_CODE ( ';' AT_CODE )? ) | AT_CODE ) ']' ;
+c_local_term_code: '[' ( ( AC_CODE ( ';' AT_CODE )? ) | AT_CODE ) ']' ;
 
-//TERM_CODE_REF clashes a lot and is needed from within odin, unfortunately. Switching lexer modes might be better
-c_qualified_term_code: '[' terminology_id '::' ( (terminology_code ( ',' terminology_code )* ';' terminology_code) )? ']' | TERM_CODE_REF;
-terminology_id: ALPHA_LC_ID | ALPHA_UC_ID ;
-terminology_code: AT_CODE | AC_CODE | ALPHA_LC_ID | ALPHA_UC_ID | INTEGER ;
+//TERM_CODE_REF clashes a lot and is needed from within odin, unfortunately. Switching lexer modes might be better
+c_qualified_term_code: '[' terminology_id '::' ( (terminology_code ( ',' terminology_code )* ';' terminology_code) )? ']' | TERM_CODE_REF;
+terminology_id: ALPHA_LC_ID | ALPHA_UC_ID ;
+terminology_code: AT_CODE | AC_CODE | ALPHA_LC_ID | ALPHA_UC_ID | INTEGER ;
 
-c_boolean: ( boolean_value | boolean_list_value ) assumed_boolean_value? ;
-assumed_boolean_value: ';' boolean_value ;
+c_boolean: ( boolean_value | boolean_list_value ) assumed_boolean_value? ;
+assumed_boolean_value: ';' boolean_value ;
 
-//
-//  ======================= Lexical rules ========================
-//
+//
+//  ======================= Lexical rules ========================
+//
 
 
-// ---------- ISO8601-based date/time/duration constraint patterns
+// ---------- ISO8601-based date/time/duration constraint patterns
 
-DATE_CONSTRAINT_PATTERN      : YEAR_PATTERN '-' MONTH_PATTERN '-' DAY_PATTERN ;
-TIME_CONSTRAINT_PATTERN      : HOUR_PATTERN ':' MINUTE_PATTERN ':' SECOND_PATTERN ;
-DATE_TIME_CONSTRAINT_PATTERN : DATE_CONSTRAINT_PATTERN 'T' TIME_CONSTRAINT_PATTERN ;
-DURATION_CONSTRAINT_PATTERN  : 'P' [yY]?[mM]?[Ww]?[dD]? ( 'T' [hH]?[mM]?[sS]? )? ('/')?;
+DATE_CONSTRAINT_PATTERN      : YEAR_PATTERN '-' MONTH_PATTERN '-' DAY_PATTERN ;
+TIME_CONSTRAINT_PATTERN      : HOUR_PATTERN ':' MINUTE_PATTERN ':' SECOND_PATTERN ;
+DATE_TIME_CONSTRAINT_PATTERN : DATE_CONSTRAINT_PATTERN 'T' TIME_CONSTRAINT_PATTERN ;
+DURATION_CONSTRAINT_PATTERN  : 'P' [yY]?[mM]?[Ww]?[dD]? ( 'T' [hH]?[mM]?[sS]? )? ('/')?;
 
-// date time pattern
-fragment YEAR_PATTERN   : ( 'yyy' 'y'? ) | ( 'YYY' 'Y'? ) ;
-fragment MONTH_PATTERN  : 'mm' | 'MM' | '??' | 'XX' | 'xx' ;
-fragment DAY_PATTERN    : 'dd' | 'DD' | '??' | 'XX' | 'xx'  ;
-fragment HOUR_PATTERN   : 'hh' | 'HH' | '??' | 'XX' | 'xx'  ;
-fragment MINUTE_PATTERN : 'mm' | 'MM' | '??' | 'XX' | 'xx'  ;
-fragment SECOND_PATTERN : 'ss' | 'SS' | '??' | 'XX' | 'xx'  ;
+// date time pattern
+fragment YEAR_PATTERN   : ( 'yyy' 'y'? ) | ( 'YYY' 'Y'? ) ;
+fragment MONTH_PATTERN  : 'mm' | 'MM' | '??' | 'XX' | 'xx' ;
+fragment DAY_PATTERN    : 'dd' | 'DD' | '??' | 'XX' | 'xx'  ;
+fragment HOUR_PATTERN   : 'hh' | 'HH' | '??' | 'XX' | 'xx'  ;
+fragment MINUTE_PATTERN : 'mm' | 'MM' | '??' | 'XX' | 'xx'  ;
+fragment SECOND_PATTERN : 'ss' | 'SS' | '??' | 'XX' | 'xx'  ;
 
 
-// ---------- Delimited Regex matcher ------------
-// In ADL, a regexp can only exist between {}.
-// allows for '/' or '^' delimiters
-// logical form - REGEX: '/' ( '\\/' | ~'/' )+ '/' | '^' ( '\\^' | ~'^' )+ '^';
-// The following is used to ensure REGEXes don't get mixed up with paths, which use '/' chars
+// ---------- Delimited Regex matcher ------------
+// In ADL, a regexp can only exist between {}.
+// allows for '/' or '^' delimiters
+// logical form - REGEX: '/' ( '\\/' | ~'/' )+ '/' | '^' ( '\\^' | ~'^' )+ '^';
+// The following is used to ensure REGEXes don't get mixed up with paths, which use '/' chars
 
-SLASH_REGEX: '/' SLASH_REGEX_CHAR+ '/';
-fragment SLASH_REGEX_CHAR: ~[/\n\r] | ESCAPE_SEQ | '\\/';
+SLASH_REGEX: '/' SLASH_REGEX_CHAR+ '/';
+fragment SLASH_REGEX_CHAR: ~[/\n\r] | ESCAPE_SEQ | '\\/';
 
-CARET_REGEX: '^' CARET_REGEX_CHAR+ '^';
-fragment CARET_REGEX_CHAR: ~[^\n\r] | ESCAPE_SEQ | '\\^';
+CARET_REGEX: '^' CARET_REGEX_CHAR+ '^'; +fragment CARET_REGEX_CHAR: ~[^\n\r] | ESCAPE_SEQ | '\\^';
@@ -7221,188 +7221,188 @@

C.4. Rules Sy
-
//
-//  description: Antlr4 grammar for openEHR Rules core syntax.
-//  author:      Thomas Beale <thomas.beale@openehr.org>
-//  contributors:Pieter Bos <pieter.bos@nedap.com>
-//  support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
-//  copyright:   Copyright (c) 2016- openEHR Foundation <http://www.openEHR.org>
-//  license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
-//
-
-grammar base_expressions;
-import cadl2_primitives, odin_values;
-
-//
-//  ======================= Top-level _objects ========================
-//
-
-statement_block: statement+ ;
-
-// ------------------------- statements ---------------------------
-statement: declaration | assignment | assertion;
-
-declaration:
-      variable_declaration
-    | constant_declaration
-    ;
-
-variable_declaration: local_variable ':' type_id ( SYM_ASSIGNMENT expression )? ;
-
-constant_declaration: constant_name ':' type_id  ( SYM_EQ primitive_object )? ;
-
-assignment:
-      binding
-    | local_assignment
-    ;
-
-//
-// The following is the means of binding a data context path to a local variable
-// TODO: remove this rule when proper external bindings are supported
-binding: local_variable SYM_ASSIGNMENT bound_path ;
-
-local_assignment: local_variable SYM_ASSIGNMENT expression ;
-
-assertion: ( ( ALPHA_LC_ID | ALPHA_UC_ID ) ':' )? boolean_expr ;
-
-//
-// -------------------------- _expressions --------------------------
-//
-expression:
-      boolean_expr
-    | arithmetic_expr
-    ;
-
-//
-// _expressions evaluating to boolean values, using standard precedence
-// The equality_binop ones are not strictly necessary, but allow the use
-// of boolean_leaf = true, which some people like
-//
-boolean_expr:
-      SYM_NOT boolean_expr
-    | boolean_expr SYM_AND boolean_expr
-    | boolean_expr SYM_XOR boolean_expr
-    | boolean_expr SYM_OR boolean_expr
-    | boolean_expr SYM_IMPLIES boolean_expr
-    | boolean_leaf equality_binop boolean_leaf
-    | boolean_leaf
-    ;
-
-//
-// Atomic Boolean-valued expression elements
-// TODO: SYM_EXISTS alternative to be replaced by defined() predicate
-boolean_leaf:
-      boolean_literal
-    | for_all_expr
-    | there_exists_expr
-    | SYM_EXISTS ( bound_path | sub_path_local_variable )
-    | '(' boolean_expr ')'
-    | relational_expr
-    | equality_expr
-    | constraint_expr
-    | value_ref
-    ;
-
-boolean_literal:
-      SYM_TRUE
-    | SYM_FALSE
-    ;
-
-//
-//  Universal and existential quantifier
-// TODO: 'in' probably isn't needed in the long term
-for_all_expr: SYM_FOR_ALL VARIABLE_ID ( ':' | 'in' ) value_ref '|'? boolean_expr ;
-
-there_exists_expr: SYM_THERE_EXISTS VARIABLE_ID ( ':' | 'in' ) value_ref '|'? boolean_expr ;
-
-// Constraint expressions
-// This provides a way of using one operator (matches) to compare a
-// value (LHS) with a value range (RHS). As per ADL, the value range
-// for ordered types like Integer, Date etc may be a single value,
-// a list of values, or a list of intervals, and in future, potentially
-// other comparators, including functions (e.g. divisible_by_N).
-//
-// For non-ordered types like String and Terminology_code, the RHS
-// is in other forms, e.g. regex for Strings.
-//
-// The matches operator can be used to generate a Boolean value that
-// may be used within an expression like any other Boolean (hence it
-// is a booleanLeaf).
-// TODO: non-primitive objects might be supported on the RHS in future.
-constraint_expr: ( arithmetic_expr | value_ref ) SYM_MATCHES  ( '{' c_inline_primitive_object '}' | CONTAINED_REGEXP );
-
-//
-// _expressions evaluating to arithmetic values, using standard precedence
-//
-arithmetic_expr:
-      <assoc=right> arithmetic_expr '^' arithmetic_expr
-    | arithmetic_expr ( '/' | '*' | '%' ) arithmetic_expr
-    | arithmetic_expr ( '+' | '-' ) arithmetic_expr
-    | arithmetic_leaf
-    ;
-
-arithmetic_leaf:
-      integer_value
-    | real_value
-    | date_value
-    | date_time_value
-    | time_value
-    | duration_value
-    | value_ref
-    | '(' arithmetic_expr ')'
-    ;
-
-//
-// Equality expression between any arithmetic value; precedence is
-// lowest, so only needed between leaves, since () will be needed for
-// larger expressions anyway
-//
-equality_expr: arithmetic_expr equality_binop arithmetic_expr ;
-
-equality_binop:
-      SYM_EQ
-    | SYM_NE
-    ;
-
-//
-// Relational expressions of arithmetic operands generating Boolean values
-//
-relational_expr: arithmetic_expr relational_binop arithmetic_expr ;
-
-relational_binop:
-      SYM_GT
-    | SYM_LT
-    | SYM_LE
-    | SYM_GE
-    ;
-
-//
-// instances references: data references, variables, and function calls.
-// TODO: Remove bound_path from this rule when external binding supported
-//
-value_ref:
-      function_call
-    | bound_path
-    | sub_path_local_variable
-    | local_variable
-    | constant_name
-    ;
-
-local_variable: VARIABLE_ID ;
-
-// TODO: change to [] form, e.g.     book_list [{title.contains("Quixote")}]
-sub_path_local_variable: VARIABLE_WITH_PATH;
-
-// TODO: Remove this rule when external binding supported
-bound_path: ADL_PATH ;
-
-constant_name: ALPHA_UC_ID ;
-
-function_call: ALPHA_LC_ID '(' function_args? ')' ;
-
-function_args: expression ( ',' expression )* ;
-
-type_id: ALPHA_UC_ID ( '<' type_id ( ',' type_id )* '>' )? ;
+
//
+//  description: Antlr4 grammar for openEHR Rules core syntax.
+//  author:      Thomas Beale <thomas.beale@openehr.org>
+//  contributors:Pieter Bos <pieter.bos@nedap.com>
+//  support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
+//  copyright:   Copyright (c) 2016- openEHR Foundation <http://www.openEHR.org>
+//  license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
+//
+
+grammar base_expressions;
+import cadl2_primitives, odin_values;
+
+//
+//  ======================= Top-level _objects ========================
+//
+
+statement_block: statement+ ;
+
+// ------------------------- statements ---------------------------
+statement: declaration | assignment | assertion;
+
+declaration:
+      variable_declaration
+    | constant_declaration
+    ;
+
+variable_declaration: local_variable ':' type_id ( SYM_ASSIGNMENT expression )? ;
+
+constant_declaration: constant_name ':' type_id  ( SYM_EQ primitive_object )? ;
+
+assignment:
+      binding
+    | local_assignment
+    ;
+
+//
+// The following is the means of binding a data context path to a local variable
+// TODO: remove this rule when proper external bindings are supported
+binding: local_variable SYM_ASSIGNMENT bound_path ;
+
+local_assignment: local_variable SYM_ASSIGNMENT expression ;
+
+assertion: ( ( ALPHA_LC_ID | ALPHA_UC_ID ) ':' )? boolean_expr ;
+
+//
+// -------------------------- _expressions --------------------------
+//
+expression:
+      boolean_expr
+    | arithmetic_expr
+    ;
+
+//
+// _expressions evaluating to boolean values, using standard precedence
+// The equality_binop ones are not strictly necessary, but allow the use
+// of boolean_leaf = true, which some people like
+//
+boolean_expr:
+      SYM_NOT boolean_expr
+    | boolean_expr SYM_AND boolean_expr
+    | boolean_expr SYM_XOR boolean_expr
+    | boolean_expr SYM_OR boolean_expr
+    | boolean_expr SYM_IMPLIES boolean_expr
+    | boolean_leaf equality_binop boolean_leaf
+    | boolean_leaf
+    ;
+
+//
+// Atomic Boolean-valued expression elements
+// TODO: SYM_EXISTS alternative to be replaced by defined() predicate
+boolean_leaf:
+      boolean_literal
+    | for_all_expr
+    | there_exists_expr
+    | SYM_EXISTS ( bound_path | sub_path_local_variable )
+    | '(' boolean_expr ')'
+    | relational_expr
+    | equality_expr
+    | constraint_expr
+    | value_ref
+    ;
+
+boolean_literal:
+      SYM_TRUE
+    | SYM_FALSE
+    ;
+
+//
+//  Universal and existential quantifier
+// TODO: 'in' probably isn't needed in the long term
+for_all_expr: SYM_FOR_ALL VARIABLE_ID ( ':' | 'in' ) value_ref '|'? boolean_expr ;
+
+there_exists_expr: SYM_THERE_EXISTS VARIABLE_ID ( ':' | 'in' ) value_ref '|'? boolean_expr ;
+
+// Constraint expressions
+// This provides a way of using one operator (matches) to compare a
+// value (LHS) with a value range (RHS). As per ADL, the value range
+// for ordered types like Integer, Date etc may be a single value,
+// a list of values, or a list of intervals, and in future, potentially
+// other comparators, including functions (e.g. divisible_by_N).
+//
+// For non-ordered types like String and Terminology_code, the RHS
+// is in other forms, e.g. regex for Strings.
+//
+// The matches operator can be used to generate a Boolean value that
+// may be used within an expression like any other Boolean (hence it
+// is a booleanLeaf).
+// TODO: non-primitive objects might be supported on the RHS in future.
+constraint_expr: ( arithmetic_expr | value_ref ) SYM_MATCHES  ( '{' c_inline_primitive_object '}' | CONTAINED_REGEXP );
+
+//
+// _expressions evaluating to arithmetic values, using standard precedence
+//
+arithmetic_expr:
+      <assoc=right> arithmetic_expr '^' arithmetic_expr
+    | arithmetic_expr ( '/' | '*' | '%' ) arithmetic_expr
+    | arithmetic_expr ( '+' | '-' ) arithmetic_expr
+    | arithmetic_leaf
+    ;
+
+arithmetic_leaf:
+      integer_value
+    | real_value
+    | date_value
+    | date_time_value
+    | time_value
+    | duration_value
+    | value_ref
+    | '(' arithmetic_expr ')'
+    ;
+
+//
+// Equality expression between any arithmetic value; precedence is
+// lowest, so only needed between leaves, since () will be needed for
+// larger expressions anyway
+//
+equality_expr: arithmetic_expr equality_binop arithmetic_expr ;
+
+equality_binop:
+      SYM_EQ
+    | SYM_NE
+    ;
+
+//
+// Relational expressions of arithmetic operands generating Boolean values
+//
+relational_expr: arithmetic_expr relational_binop arithmetic_expr ;
+
+relational_binop:
+      SYM_GT
+    | SYM_LT
+    | SYM_LE
+    | SYM_GE
+    ;
+
+//
+// instances references: data references, variables, and function calls.
+// TODO: Remove bound_path from this rule when external binding supported
+//
+value_ref:
+      function_call
+    | bound_path
+    | sub_path_local_variable
+    | local_variable
+    | constant_name
+    ;
+
+local_variable: VARIABLE_ID ;
+
+// TODO: change to [] form, e.g.     book_list [{title.contains("Quixote")}]
+sub_path_local_variable: VARIABLE_WITH_PATH;
+
+// TODO: Remove this rule when external binding supported
+bound_path: ADL_PATH ;
+
+constant_name: ALPHA_UC_ID ;
+
+function_call: ALPHA_LC_ID '(' function_args? ')' ;
+
+function_args: expression ( ',' expression )* ;
+
+type_id: ALPHA_UC_ID ( '<' type_id ( ',' type_id )* '>' )? ;
@@ -7413,57 +7413,57 @@

C.5. OD
-
//
-// description: Antlr4 grammar for Object Data Instance Notation (ODIN)
-// author:      Thomas Beale <thomas.beale@openehr.org>
-// contributors:Pieter Bos <pieter.bos@nedap.com>
-// support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
-// copyright:   Copyright (c) 2015- openEHR Foundation <http://www.openEHR.org>
-// license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
-//
+
//
+// description: Antlr4 grammar for Object Data Instance Notation (ODIN)
+// author:      Thomas Beale <thomas.beale@openehr.org>
+// contributors:Pieter Bos <pieter.bos@nedap.com>
+// support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
+// copyright:   Copyright (c) 2015- openEHR Foundation <http://www.openEHR.org>
+// license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
+//
 
-grammar odin;
-import odin_values;
+grammar odin;
+import odin_values;
 
-//
-// -------------------------- Parse Rules --------------------------
-//
+//
+// -------------------------- Parse Rules --------------------------
+//
 
-odin_text :
-      attr_vals
-    | object_value_block
-	;
+odin_text :
+      attr_vals
+    | object_value_block
+	;
 
-attr_vals : ( attr_val ';'? )+ ;
+attr_vals : ( attr_val ';'? )+ ;
 
-attr_val : odin_object_key '=' object_block ;
+attr_val : odin_object_key '=' object_block ;
 
-odin_object_key : ALPHA_UC_ID | ALPHA_UNDERSCORE_ID | rm_attribute_id ;
+odin_object_key : ALPHA_UC_ID | ALPHA_UNDERSCORE_ID | rm_attribute_id ;
 
-object_block :
-      object_value_block
-    | object_reference_block
-    ;
+object_block :
+      object_value_block
+    | object_reference_block
+    ;
 
-object_value_block : ( '(' rm_type_id ')' )? '<' ( primitive_object | attr_vals? | keyed_object* ) '>' | EMBEDDED_URI;
+object_value_block : ( '(' rm_type_id ')' )? '<' ( primitive_object | attr_vals? | keyed_object* ) '>' | EMBEDDED_URI;
 
-keyed_object : '[' key_id ']' '=' object_block ;
+keyed_object : '[' key_id ']' '=' object_block ;
 
-key_id :
-      string_value
-    | integer_value
-    | date_value
-    | time_value
-    | date_time_value
-    ;
+key_id :
+      string_value
+    | integer_value
+    | date_value
+    | time_value
+    | date_time_value
+    ;
 
-object_reference_block : '<' odin_path_list '>' ;
+object_reference_block : '<' odin_path_list '>' ;
 
-odin_path_list  : odin_path ( ( ',' odin_path )+ | SYM_LIST_CONTINUE )? ;
-odin_path       : '/' | ADL_PATH ;
+odin_path_list  : odin_path ( ( ',' odin_path )+ | SYM_LIST_CONTINUE )? ;
+odin_path       : '/' | ADL_PATH ;
 
-rm_type_id      : ALPHA_UC_ID ( '<' rm_type_id ( ',' rm_type_id )* '>' )? ;
-rm_attribute_id : ALPHA_LC_ID ;
+rm_type_id : ALPHA_UC_ID ( '<' rm_type_id ( ',' rm_type_id )* '>' )? ; +rm_attribute_id : ALPHA_LC_ID ;
@@ -7474,128 +7474,128 @@

C.6.
-
//
-// grammar defining ODIN terminal value types, including atoms, lists and intervals
-// author:      Pieter Bos <pieter.bos@nedap.com>
-// support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
-// copyright:   Copyright (c) 2018- openEHR Foundation <http://www.openEHR.org>
-//
-
-grammar odin_values;
-import base_lexer;
-
-//
-// ========================= Parser ============================
-//
-
-primitive_object :
-      primitive_value
-    | primitive_list_value
-    | primitive_interval_value
-    ;
-
-primitive_value :
-      string_value
-    | integer_value
-    | real_value
-    | boolean_value
-    | character_value
-    | term_code_value
-    | date_value
-    | time_value
-    | date_time_value
-    | duration_value
-    ;
-
-primitive_list_value :
-      string_list_value
-    | integer_list_value
-    | real_list_value
-    | boolean_list_value
-    | character_list_value
-    | term_code_list_value
-    | date_list_value
-    | time_list_value
-    | date_time_list_value
-    | duration_list_value
-    ;
-
-primitive_interval_value :
-      integer_interval_value
-    | real_interval_value
-    | date_interval_value
-    | time_interval_value
-    | date_time_interval_value
-    | duration_interval_value
-    ;
-
-string_value : STRING ;
-string_list_value : string_value ( ( ',' string_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-integer_value : ( '+' | '-' )? INTEGER ;
-integer_list_value : integer_value ( ( ',' integer_value )+ | ',' SYM_LIST_CONTINUE ) ;
-integer_interval_value :
-      '|' SYM_GT? integer_value '..' SYM_LT? integer_value '|'
-    | '|' relop? integer_value '|'
-    | '|' integer_value SYM_PLUS_OR_MINUS integer_value '|'
-    ;
-integer_interval_list_value : integer_interval_value ( ( ',' integer_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-real_value : ( '+' | '-' )? REAL ;
-real_list_value : real_value ( ( ',' real_value )+ | ',' SYM_LIST_CONTINUE ) ;
-real_interval_value :
-      '|' SYM_GT? real_value '..' SYM_LT? real_value '|'
-    | '|' relop? real_value '|'
-    | '|' real_value SYM_PLUS_OR_MINUS real_value '|'
-    ;
-real_interval_list_value : real_interval_value ( ( ',' real_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-boolean_value : SYM_TRUE | SYM_FALSE ;
-boolean_list_value : boolean_value ( ( ',' boolean_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-character_value : CHARACTER ;
-character_list_value : character_value ( ( ',' character_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-date_value : ISO8601_DATE ;
-date_list_value : date_value ( ( ',' date_value )+ | ',' SYM_LIST_CONTINUE ) ;
-date_interval_value :
-      '|' SYM_GT? date_value '..' SYM_LT? date_value '|'
-    | '|' relop? date_value '|'
-    | '|' date_value SYM_PLUS_OR_MINUS duration_value '|'
-    ;
-date_interval_list_value : date_interval_value ( ( ',' date_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-time_value : ISO8601_TIME ;
-time_list_value : time_value ( ( ',' time_value )+ | ',' SYM_LIST_CONTINUE ) ;
-time_interval_value :
-      '|' SYM_GT? time_value '..' SYM_LT? time_value '|'
-    | '|' relop? time_value '|'
-    | '|' time_value SYM_PLUS_OR_MINUS duration_value '|'
-    ;
-time_interval_list_value : time_interval_value ( ( ',' time_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-date_time_value : ISO8601_DATE_TIME ;
-date_time_list_value : date_time_value ( ( ',' date_time_value )+ | ',' SYM_LIST_CONTINUE ) ;
-date_time_interval_value :
-      '|' SYM_GT? date_time_value '..' SYM_LT? date_time_value '|'
-    | '|' relop? date_time_value '|'
-    | '|' date_time_value SYM_PLUS_OR_MINUS duration_value '|'
-    ;
-date_time_interval_list_value : date_time_interval_value ( ( ',' date_time_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-duration_value : ISO8601_DURATION ;
-duration_list_value : duration_value ( ( ',' duration_value )+ | ',' SYM_LIST_CONTINUE ) ;
-duration_interval_value :
-      '|' SYM_GT? duration_value '..' SYM_LT? duration_value '|'
-    | '|' relop? duration_value '|'
-    | '|' duration_value SYM_PLUS_OR_MINUS duration_value '|'
-    ;
-duration_interval_list_value : duration_interval_value ( ( ',' duration_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-term_code_value : TERM_CODE_REF ;
-term_code_list_value : term_code_value ( ( ',' term_code_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-relop : SYM_GT | SYM_LT | SYM_LE | SYM_GE ;
+
//
+// grammar defining ODIN terminal value types, including atoms, lists and intervals
+// author:      Pieter Bos <pieter.bos@nedap.com>
+// support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
+// copyright:   Copyright (c) 2018- openEHR Foundation <http://www.openEHR.org>
+//
+
+grammar odin_values;
+import base_lexer;
+
+//
+// ========================= Parser ============================
+//
+
+primitive_object :
+      primitive_value
+    | primitive_list_value
+    | primitive_interval_value
+    ;
+
+primitive_value :
+      string_value
+    | integer_value
+    | real_value
+    | boolean_value
+    | character_value
+    | term_code_value
+    | date_value
+    | time_value
+    | date_time_value
+    | duration_value
+    ;
+
+primitive_list_value :
+      string_list_value
+    | integer_list_value
+    | real_list_value
+    | boolean_list_value
+    | character_list_value
+    | term_code_list_value
+    | date_list_value
+    | time_list_value
+    | date_time_list_value
+    | duration_list_value
+    ;
+
+primitive_interval_value :
+      integer_interval_value
+    | real_interval_value
+    | date_interval_value
+    | time_interval_value
+    | date_time_interval_value
+    | duration_interval_value
+    ;
+
+string_value : STRING ;
+string_list_value : string_value ( ( ',' string_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+integer_value : ( '+' | '-' )? INTEGER ;
+integer_list_value : integer_value ( ( ',' integer_value )+ | ',' SYM_LIST_CONTINUE ) ;
+integer_interval_value :
+      '|' SYM_GT? integer_value '..' SYM_LT? integer_value '|'
+    | '|' relop? integer_value '|'
+    | '|' integer_value SYM_PLUS_OR_MINUS integer_value '|'
+    ;
+integer_interval_list_value : integer_interval_value ( ( ',' integer_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+real_value : ( '+' | '-' )? REAL ;
+real_list_value : real_value ( ( ',' real_value )+ | ',' SYM_LIST_CONTINUE ) ;
+real_interval_value :
+      '|' SYM_GT? real_value '..' SYM_LT? real_value '|'
+    | '|' relop? real_value '|'
+    | '|' real_value SYM_PLUS_OR_MINUS real_value '|'
+    ;
+real_interval_list_value : real_interval_value ( ( ',' real_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+boolean_value : SYM_TRUE | SYM_FALSE ;
+boolean_list_value : boolean_value ( ( ',' boolean_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+character_value : CHARACTER ;
+character_list_value : character_value ( ( ',' character_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+date_value : ISO8601_DATE ;
+date_list_value : date_value ( ( ',' date_value )+ | ',' SYM_LIST_CONTINUE ) ;
+date_interval_value :
+      '|' SYM_GT? date_value '..' SYM_LT? date_value '|'
+    | '|' relop? date_value '|'
+    | '|' date_value SYM_PLUS_OR_MINUS duration_value '|'
+    ;
+date_interval_list_value : date_interval_value ( ( ',' date_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+time_value : ISO8601_TIME ;
+time_list_value : time_value ( ( ',' time_value )+ | ',' SYM_LIST_CONTINUE ) ;
+time_interval_value :
+      '|' SYM_GT? time_value '..' SYM_LT? time_value '|'
+    | '|' relop? time_value '|'
+    | '|' time_value SYM_PLUS_OR_MINUS duration_value '|'
+    ;
+time_interval_list_value : time_interval_value ( ( ',' time_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+date_time_value : ISO8601_DATE_TIME ;
+date_time_list_value : date_time_value ( ( ',' date_time_value )+ | ',' SYM_LIST_CONTINUE ) ;
+date_time_interval_value :
+      '|' SYM_GT? date_time_value '..' SYM_LT? date_time_value '|'
+    | '|' relop? date_time_value '|'
+    | '|' date_time_value SYM_PLUS_OR_MINUS duration_value '|'
+    ;
+date_time_interval_list_value : date_time_interval_value ( ( ',' date_time_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+duration_value : ISO8601_DURATION ;
+duration_list_value : duration_value ( ( ',' duration_value )+ | ',' SYM_LIST_CONTINUE ) ;
+duration_interval_value :
+      '|' SYM_GT? duration_value '..' SYM_LT? duration_value '|'
+    | '|' relop? duration_value '|'
+    | '|' duration_value SYM_PLUS_OR_MINUS duration_value '|'
+    ;
+duration_interval_list_value : duration_interval_value ( ( ',' duration_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+term_code_value : TERM_CODE_REF ;
+term_code_list_value : term_code_value ( ( ',' term_code_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+relop : SYM_GT | SYM_LT | SYM_LE | SYM_GE ;
@@ -7606,235 +7606,234 @@

C.7. Base Lexer
-
//
-//  General purpose patterns used in all openEHR parser and lexer tools
-//  author:      Pieter Bos <pieter.bos@nedap.com>
-//  support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
-//  copyright:   Copyright (c) 2018- openEHR Foundation <http://www.openEHR.org>
-//
+
//
+//  General purpose patterns used in all openEHR parser and lexer tools
+//  author:      Pieter Bos <pieter.bos@nedap.com>
+//  support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
+//  copyright:   Copyright (c) 2018- openEHR Foundation <http://www.openEHR.org>
+//
 
-lexer grammar base_lexer;
+lexer grammar base_lexer;
 
-// ---------- whitespace & comments ----------
+// ---------- whitespace & comments ----------
 
-WS         : [ \t\r]+    -> channel(HIDDEN) ;
-LINE       : '\r'? EOL  -> channel(HIDDEN) ;  // increment line count
-CMT_LINE   : '--' .*? '\r'? EOL  -> skip ;   // (increment line count)
-fragment EOL : '\n' ;
+WS         : [ \t\r]+    -> channel(HIDDEN) ;
+LINE       : '\r'? EOL  -> channel(HIDDEN) ;  // increment line count
+CMT_LINE   : '--' .*? '\r'? EOL  -> skip ;   // (increment line count)
+fragment EOL : '\n' ;
 
 
-// -------------- template overlay cannot be handled in a more simple way because it includes the comment line
-SYM_TEMPLATE_OVERLAY : H_CMT_LINE (WS|LINE)* SYM_TEMPLATE_OVERLAY_ONLY;
-fragment H_CMT_LINE : '--------' '-'*? ('\n'|'\r''\n'|'\r')  ;  // special type of comment for splitting template overlays
-fragment SYM_TEMPLATE_OVERLAY_ONLY     : [Tt][Ee][Mm][Pp][Ll][Aa][Tt][Ee]'_'[Oo][Vv][Ee][Rr][Ll][Aa][Yy] ;
+// -------------- template overlay cannot be handled in a more simple way because it includes the comment line
+SYM_TEMPLATE_OVERLAY : H_CMT_LINE (WS|LINE)* SYM_TEMPLATE_OVERLAY_ONLY;
+fragment H_CMT_LINE : '--------' '-'*? ('\n'|'\r''\n'|'\r')  ;  // special type of comment for splitting template overlays
+fragment SYM_TEMPLATE_OVERLAY_ONLY     : [Tt][Ee][Mm][Pp][Ll][Aa][Tt][Ee]'_'[Oo][Vv][Ee][Rr][Ll][Aa][Yy] ;
 
-// ---------- path patterns -----------
+// ---------- path patterns -----------
 
-ADL_PATH : ADL_ABSOLUTE_PATH | ADL_RELATIVE_PATH;
-fragment ADL_ABSOLUTE_PATH : ('/' ADL_PATH_SEGMENT)+;
-fragment ADL_RELATIVE_PATH : ADL_PATH_SEGMENT ('/' ADL_PATH_SEGMENT)+;
+ADL_PATH : ADL_ABSOLUTE_PATH | ADL_RELATIVE_PATH;
+fragment ADL_ABSOLUTE_PATH : ('/' ADL_PATH_SEGMENT)+;
+fragment ADL_RELATIVE_PATH : ADL_PATH_SEGMENT ('/' ADL_PATH_SEGMENT)+;
 
-fragment ADL_PATH_SEGMENT      : ALPHA_LC_ID ('[' ADL_PATH_ATTRIBUTE ']')?;
-fragment ADL_PATH_ATTRIBUTE    : ID_CODE | STRING | INTEGER | ARCHETYPE_REF | ARCHETYPE_HRID;
+fragment ADL_PATH_SEGMENT      : ALPHA_LC_ID ('[' ADL_PATH_ATTRIBUTE ']')?;
+fragment ADL_PATH_ATTRIBUTE    : ID_CODE | STRING | INTEGER | ARCHETYPE_REF | ARCHETYPE_HRID;
 
 
-// ---------- ISO8601-based date/time/duration constraint patterns
+// ---------- ISO8601-based date/time/duration constraint patterns
 
-DATE_CONSTRAINT_PATTERN      : YEAR_PATTERN '-' MONTH_PATTERN '-' DAY_PATTERN ;
-TIME_CONSTRAINT_PATTERN      : HOUR_PATTERN ':' MINUTE_PATTERN ':' SECOND_PATTERN TZ_PATTERN? ;
-DATE_TIME_CONSTRAINT_PATTERN : DATE_CONSTRAINT_PATTERN 'T' TIME_CONSTRAINT_PATTERN ;
+DATE_CONSTRAINT_PATTERN      : YEAR_PATTERN '-' MONTH_PATTERN '-' DAY_PATTERN ;
+TIME_CONSTRAINT_PATTERN      : HOUR_PATTERN ':' MINUTE_PATTERN ':' SECOND_PATTERN ;
+DATE_TIME_CONSTRAINT_PATTERN : DATE_CONSTRAINT_PATTERN 'T' TIME_CONSTRAINT_PATTERN ;
+DURATION_CONSTRAINT_PATTERN  : 'P' [yY]?[mM]?[Ww]?[dD]? ( 'T' [hH]?[mM]?[sS]? )? ;
 
-fragment YEAR_PATTERN   : 'yyyy' | 'YYYY' | 'yyy' | 'YYY' ;
-fragment MONTH_PATTERN  : 'mm' | 'MM' | '??' | 'XX' | 'xx' ;
-fragment DAY_PATTERN    : 'dd' | 'DD' | '??' | 'XX' | 'xx'  ;
-fragment HOUR_PATTERN   : 'hh' | 'HH' | '??' | 'XX' | 'xx'  ;
-fragment MINUTE_PATTERN : 'mm' | 'MM' | '??' | 'XX' | 'xx'  ;
-fragment SECOND_PATTERN : 'ss' | 'SS' | '??' | 'XX' | 'xx'  ;
-fragment TZ_PATTERN     : '±' ('hh' | 'HH') (':'? ('mm' | 'MM'))? | 'Z' ;
+// date time pattern
+fragment YEAR_PATTERN   : ( 'yyy' 'y'? ) | ( 'YYY' 'Y'? ) ;
+fragment MONTH_PATTERN  : 'mm' | 'MM' | '??' | 'XX' | 'xx' ;
+fragment DAY_PATTERN    : 'dd' | 'DD' | '??' | 'XX' | 'xx'  ;
+fragment HOUR_PATTERN   : 'hh' | 'HH' | '??' | 'XX' | 'xx'  ;
+fragment MINUTE_PATTERN : 'mm' | 'MM' | '??' | 'XX' | 'xx'  ;
+fragment SECOND_PATTERN : 'ss' | 'SS' | '??' | 'XX' | 'xx'  ;
 
-DURATION_CONSTRAINT_PATTERN  : 'P' [yY]?[mM]?[Ww]?[dD]? ( 'T' [hH]?[mM]?[sS]? )? ;
+// ---------- Delimited Regex matcher ------------
+// In ADL, a regexp can only exist between {}.
+// allows for '/' or '^' delimiters
+// logical form - REGEX: '/' ( '\\/' | ~'/' )+ '/' | '^' ( '\\^' | ~'^' )+ '^';
+// The following is used to ensure REGEXes don't get mixed up with paths, which use '/' chars
 
-// ---------- Delimited Regex matcher ------------
-// In ADL, a regexp can only exist between {}.
-// allows for '/' or '^' delimiters
-// logical form - REGEX: '/' ( '\\/' | ~'/' )+ '/' | '^' ( '\\^' | ~'^' )+ '^';
-// The following is used to ensure REGEXes don't get mixed up with paths, which use '/' chars
+//a
+// regexp can only exist between {}. It can optionally have an assumed value, by adding ;"value"
+CONTAINED_REGEXP: '{'WS* (SLASH_REGEXP | CARET_REGEXP) WS* (';' WS* STRING)? WS* '}';
+fragment SLASH_REGEXP: '/' SLASH_REGEXP_CHAR+ '/';
+fragment SLASH_REGEXP_CHAR: ~[/\n\r] | ESCAPE_SEQ | '\\/';
 
-//a
-// regexp can only exist between {}. It can optionally have an assumed value, by adding ;"value"
-CONTAINED_REGEXP: '{'WS* (SLASH_REGEXP | CARET_REGEXP) WS* (';' WS* STRING)? WS* '}';
-fragment SLASH_REGEXP: '/' SLASH_REGEXP_CHAR+ '/';
-fragment SLASH_REGEXP_CHAR: ~[/\n\r] | ESCAPE_SEQ | '\\/';
-
-fragment CARET_REGEXP: '^' CARET_REGEXP_CHAR+ '^';
-fragment CARET_REGEXP_CHAR: ~[^\n\r] | ESCAPE_SEQ | '\\^';
+fragment CARET_REGEXP: '^' CARET_REGEXP_CHAR+ '^';
+fragment CARET_REGEXP_CHAR: ~[^\n\r] | ESCAPE_SEQ | '\\^';
 
 // ---------- various ADL2 codes -------
 
-ROOT_ID_CODE : 'id1' '.1'* ;
-ID_CODE      : 'id' CODE_STR ;
-AT_CODE      : 'at' CODE_STR ;
-AC_CODE      : 'ac' CODE_STR ;
-fragment CODE_STR : ('0' | [1-9][0-9]*) ( '.' ('0' | [1-9][0-9]* ))* ;
+ROOT_ID_CODE : 'id1' '.1'* ;
+ID_CODE      : 'id' CODE_STR ;
+AT_CODE      : 'at' CODE_STR ;
+AC_CODE      : 'ac' CODE_STR ;
+fragment CODE_STR : ('0' | [1-9][0-9]*) ( '.' ('0' | [1-9][0-9]* ))* ;
 
 // ---------- ISO8601 Date/Time values ----------
 
-ISO8601_DATE      : YEAR '-' MONTH ( '-' DAY )? | YEAR '-' MONTH '-' UNKNOWN_DT | YEAR '-' UNKNOWN_DT '-' UNKNOWN_DT ;
-ISO8601_TIME      : ( HOUR ':' MINUTE ( ':' SECOND ( SECOND_DEC_SEP DIGIT+ )?)? | HOUR ':' MINUTE ':' UNKNOWN_DT | HOUR ':' UNKNOWN_DT ':' UNKNOWN_DT ) TIMEZONE? ;
-ISO8601_DATE_TIME : ( YEAR '-' MONTH '-' DAY 'T' HOUR (':' MINUTE (':' SECOND ( SECOND_DEC_SEP DIGIT+ )?)?)? | YEAR '-' MONTH '-' DAY 'T' HOUR ':' MINUTE ':' UNKNOWN_DT | YEAR '-' MONTH '-' DAY 'T' HOUR ':' UNKNOWN_DT ':' UNKNOWN_DT ) TIMEZONE? ;
-fragment TIMEZONE : 'Z' | ('+'|'-') HOUR_MIN ;   // hour offset, e.g. `+0930`, or else literal `Z` indicating +0000.
-fragment YEAR     : [0-9][0-9][0-9][0-9] ;		   // Year in ISO8601:2004 is 4 digits with 0-filling as needed
-fragment MONTH    : ( [0][1-9] | [1][0-2] ) ;    // month in year
-fragment DAY      : ( [0][1-9] | [12][0-9] | [3][0-1] ) ;  // day in month
-fragment HOUR     : ( [01]?[0-9] | [2][0-3] ) ;  // hour in 24 hour clock
-fragment MINUTE   : [0-5][0-9] ;                 // minutes
-fragment HOUR_MIN : ( [01]?[0-9] | [2][0-3] ) [0-5][0-9] ;  // hour / minutes quad digit pattern
-fragment SECOND   : [0-5][0-9] ;                 // seconds
-fragment SECOND_DEC_SEP : '.' | ',' ;
-fragment UNKNOWN_DT  : '??' ;                    // any unknown date/time value, except years.
+ISO8601_DATE      : YEAR '-' MONTH ( '-' DAY )? | YEAR '-' MONTH '-' UNKNOWN_DT | YEAR '-' UNKNOWN_DT '-' UNKNOWN_DT ;
+ISO8601_TIME      : ( HOUR ':' MINUTE ( ':' SECOND ( SECOND_DEC_SEP DIGIT+ )?)? | HOUR ':' MINUTE ':' UNKNOWN_DT | HOUR ':' UNKNOWN_DT ':' UNKNOWN_DT ) TIMEZONE? ;
+ISO8601_DATE_TIME : ( YEAR '-' MONTH '-' DAY 'T' HOUR (':' MINUTE (':' SECOND ( SECOND_DEC_SEP DIGIT+ )?)?)? | YEAR '-' MONTH '-' DAY 'T' HOUR ':' MINUTE ':' UNKNOWN_DT | YEAR '-' MONTH '-' DAY 'T' HOUR ':' UNKNOWN_DT ':' UNKNOWN_DT ) TIMEZONE? ;
+fragment TIMEZONE : 'Z' | ('+'|'-') HOUR_MIN ;   // hour offset, e.g. `+0930`, or else literal `Z` indicating +0000.
+fragment YEAR     : [0-9][0-9][0-9][0-9] ;		   // Year in ISO8601:2004 is 4 digits with 0-filling as needed
+fragment MONTH    : ( [0][1-9] | [1][0-2] ) ;    // month in year
+fragment DAY      : ( [0][1-9] | [12][0-9] | [3][0-1] ) ;  // day in month
+fragment HOUR     : ( [01]?[0-9] | [2][0-3] ) ;  // hour in 24 hour clock
+fragment MINUTE   : [0-5][0-9] ;                 // minutes
+fragment HOUR_MIN : ( [01]?[0-9] | [2][0-3] ) [0-5][0-9] ;  // hour / minutes quad digit pattern
+fragment SECOND   : [0-5][0-9] ;                 // seconds
+fragment SECOND_DEC_SEP : '.' | ',' ;
+fragment UNKNOWN_DT  : '??' ;                    // any unknown date/time value, except years.
 
 // ISO8601 DURATION PnYnMnWnDTnnHnnMnn.nnnS 
 // here we allow a deviation from the standard to allow weeks to be // mixed in with the rest since this commonly occurs in medicine
 // TODO: the following will incorrectly match just 'P'
-ISO8601_DURATION : '-'?'P' (DIGIT+ [yY])? (DIGIT+ [mM])? (DIGIT+ [wW])? (DIGIT+[dD])? ('T' (DIGIT+[hH])? (DIGIT+[mM])? (DIGIT+ (SECOND_DEC_SEP DIGIT+)?[sS])?)? ;
+ISO8601_DURATION : '-'?'P' (DIGIT+ [yY])? (DIGIT+ [mM])? (DIGIT+ [wW])? (DIGIT+[dD])? ('T' (DIGIT+[hH])? (DIGIT+[mM])? (DIGIT+ (SECOND_DEC_SEP DIGIT+)?[sS])?)? ;
 
 // ------------------- special word symbols --------------
-SYM_TRUE  : [Tt][Rr][Uu][Ee] ;
-SYM_FALSE : [Ff][Aa][Ll][Ss][Ee] ;
+SYM_TRUE  : [Tt][Rr][Uu][Ee] ;
+SYM_FALSE : [Ff][Aa][Ll][Ss][Ee] ;
 
 // ---------------------- Identifiers ---------------------
 
-ARCHETYPE_HRID      : ARCHETYPE_HRID_ROOT '.v' ARCHETYPE_VERSION_ID ;
-ARCHETYPE_REF       : ARCHETYPE_HRID_ROOT '.v' INTEGER ( '.' DIGIT+ )* ;
-fragment ARCHETYPE_HRID_ROOT : (NAMESPACE '::')? IDENTIFIER '-' IDENTIFIER '-' IDENTIFIER '.' LABEL ;
-fragment ARCHETYPE_VERSION_ID: DIGIT+ ('.' DIGIT+ ('.' DIGIT+ ( ( '-rc' | '-alpha' ) ( '.' DIGIT+ )? )?)?)? ;
-VERSION_ID          : DIGIT+ '.' DIGIT+ '.' DIGIT+ ( ( '-rc' | '-alpha' ) ( '.' DIGIT+ )? )? ;
-fragment IDENTIFIER : ALPHA_CHAR WORD_CHAR* ;
+ARCHETYPE_HRID      : ARCHETYPE_HRID_ROOT '.v' ARCHETYPE_VERSION_ID ;
+ARCHETYPE_REF       : ARCHETYPE_HRID_ROOT '.v' INTEGER ( '.' DIGIT+ )* ;
+fragment ARCHETYPE_HRID_ROOT : (NAMESPACE '::')? IDENTIFIER '-' IDENTIFIER '-' IDENTIFIER '.' LABEL ;
+fragment ARCHETYPE_VERSION_ID: DIGIT+ ('.' DIGIT+ ('.' DIGIT+ ( ( '-rc' | '-alpha' ) ( '.' DIGIT+ )? )?)?)? ;
+VERSION_ID          : DIGIT+ '.' DIGIT+ '.' DIGIT+ ( ( '-rc' | '-alpha' ) ( '.' DIGIT+ )? )? ;
+fragment IDENTIFIER : ALPHA_CHAR WORD_CHAR* ;
 
 // --------------------- composed primitive types -------------------
 
 // e.g. [ICD10AM(1998)::F23]; [ISO_639-1::en]
-TERM_CODE_REF : '[' TERM_CODE_CHAR+ ( '(' TERM_CODE_CHAR+ ')' )? '::' TERM_CODE_CHAR+ ']' ;
-fragment TERM_CODE_CHAR: NAME_CHAR | '.';
+TERM_CODE_REF : '[' TERM_CODE_CHAR+ ( '(' TERM_CODE_CHAR+ ')' )? '::' TERM_CODE_CHAR+ ']' ;
+fragment TERM_CODE_CHAR: NAME_CHAR | '.';
 
 // --------------------- URIs --------------------
 
 // URI recogniser based on https://tools.ietf.org/html/rfc3986 and
 // http://www.w3.org/Addressing/URL/5_URI_BNF.html
-EMBEDDED_URI: '<' ([ \t\r\n]|CMT_LINE)* URI ([ \t\r\n]|CMT_LINE)* '>';
+EMBEDDED_URI: '<' ([ \t\r\n]|CMT_LINE)* URI ([ \t\r\n]|CMT_LINE)* '>';
 
-fragment URI : URI_SCHEME ':' URI_HIER_PART ( '?' URI_QUERY )? ('#' URI_FRAGMENT)? ;
+fragment URI : URI_SCHEME ':' URI_HIER_PART ( '?' URI_QUERY )? ('#' URI_FRAGMENT)? ;
 
-fragment URI_HIER_PART : ( '//' URI_AUTHORITY ) URI_PATH_ABEMPTY
-    | URI_PATH_ABSOLUTE
-    | URI_PATH_ROOTLESS
-    | URI_PATH_EMPTY;
+fragment URI_HIER_PART : ( '//' URI_AUTHORITY ) URI_PATH_ABEMPTY
+    | URI_PATH_ABSOLUTE
+    | URI_PATH_ROOTLESS
+    | URI_PATH_EMPTY;
 
-fragment URI_SCHEME : ALPHA_CHAR ( ALPHA_CHAR | DIGIT | '+' | '-' | '.')* ;
+fragment URI_SCHEME : ALPHA_CHAR ( ALPHA_CHAR | DIGIT | '+' | '-' | '.')* ;
 
-fragment URI_AUTHORITY : ( URI_USERINFO '@' )? URI_HOST ( ':' URI_PORT )? ;
-fragment URI_USERINFO: (URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS | ':' )* ;
-fragment URI_HOST : URI_IP_LITERAL | URI_IPV4_ADDRESS | URI_REG_NAME ; //TODO: ipv6
-fragment URI_PORT: DIGIT*;
+fragment URI_AUTHORITY : ( URI_USERINFO '@' )? URI_HOST ( ':' URI_PORT )? ;
+fragment URI_USERINFO: (URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS | ':' )* ;
+fragment URI_HOST : URI_IP_LITERAL | URI_IPV4_ADDRESS | URI_REG_NAME ; //TODO: ipv6
+fragment URI_PORT: DIGIT*;
 
-fragment URI_IP_LITERAL   : '[' URI_IPV6_LITERAL ']'; //TODO, if needed: IPvFuture
-fragment URI_IPV4_ADDRESS : URI_DEC_OCTET '.' URI_DEC_OCTET '.' URI_DEC_OCTET '.' URI_DEC_OCTET ;
-fragment URI_IPV6_LITERAL : HEX_QUAD (':' HEX_QUAD )* ':' ':' HEX_QUAD (':' HEX_QUAD )* ;
+fragment URI_IP_LITERAL   : '[' URI_IPV6_LITERAL ']'; //TODO, if needed: IPvFuture
+fragment URI_IPV4_ADDRESS : URI_DEC_OCTET '.' URI_DEC_OCTET '.' URI_DEC_OCTET '.' URI_DEC_OCTET ;
+fragment URI_IPV6_LITERAL : HEX_QUAD (':' HEX_QUAD )* ':' ':' HEX_QUAD (':' HEX_QUAD )* ;
 
-fragment URI_DEC_OCTET  : DIGIT | [1-9] DIGIT | '1' DIGIT DIGIT | '2' [0-4] DIGIT | '25' [0-5];
-fragment URI_REG_NAME: (URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS)*;
-fragment HEX_QUAD : HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT ;
+fragment URI_DEC_OCTET  : DIGIT | [1-9] DIGIT | '1' DIGIT DIGIT | '2' [0-4] DIGIT | '25' [0-5];
+fragment URI_REG_NAME: (URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS)*;
+fragment HEX_QUAD : HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT ;
 
-fragment URI_PATH_ABEMPTY: ('/' URI_SEGMENT ) *;
-fragment URI_PATH_ABSOLUTE: '/' ( URI_SEGMENT_NZ ( '/' URI_SEGMENT )* )?;
-fragment URI_PATH_NOSCHEME: URI_SEGMENT_NZ_NC ( '/' URI_SEGMENT )*;
-fragment URI_PATH_ROOTLESS: URI_SEGMENT_NZ ( '/' URI_SEGMENT )*;
-fragment URI_PATH_EMPTY: ;
+fragment URI_PATH_ABEMPTY: ('/' URI_SEGMENT ) *;
+fragment URI_PATH_ABSOLUTE: '/' ( URI_SEGMENT_NZ ( '/' URI_SEGMENT )* )?;
+fragment URI_PATH_NOSCHEME: URI_SEGMENT_NZ_NC ( '/' URI_SEGMENT )*;
+fragment URI_PATH_ROOTLESS: URI_SEGMENT_NZ ( '/' URI_SEGMENT )*;
+fragment URI_PATH_EMPTY: ;
 
-fragment URI_SEGMENT: URI_PCHAR*;
-fragment URI_SEGMENT_NZ: URI_PCHAR+;
-fragment URI_SEGMENT_NZ_NC: ( URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS | '@' )+; //non-zero-length segment without any colon ":"
+fragment URI_SEGMENT: URI_PCHAR*;
+fragment URI_SEGMENT_NZ: URI_PCHAR+;
+fragment URI_SEGMENT_NZ_NC: ( URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS | '@' )+; //non-zero-length segment without any colon ":"
 
-fragment URI_PCHAR: URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS | ':' | '@';
+fragment URI_PCHAR: URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS | ':' | '@';
 
 //fragment URI_PATH   : '/' | ( '/' URI_XPALPHA+ )+ ('/')?;
-fragment URI_QUERY : (URI_PCHAR | '/' | '?')*;
-fragment URI_FRAGMENT  : (URI_PCHAR | '/' | '?')*;
+fragment URI_QUERY : (URI_PCHAR | '/' | '?')*;
+fragment URI_FRAGMENT  : (URI_PCHAR | '/' | '?')*;
 
-fragment URI_PCT_ENCODED : '%' HEX_DIGIT HEX_DIGIT ;
+fragment URI_PCT_ENCODED : '%' HEX_DIGIT HEX_DIGIT ;
 
-fragment URI_UNRESERVED: ALPHA_CHAR | DIGIT | '-' | '.' | '_' | '~';
-fragment URI_RESERVED: URI_GEN_DELIMS | URI_SUB_DELIMS;
-fragment URI_GEN_DELIMS: ':' | '/' | '?' | '#' | '[' | ']' | '@'; //TODO: migrate to [/?#...] notation
-fragment URI_SUB_DELIMS: '!' | '$' | '&' | '\'' | '(' | ')'
-                         | '*' | '+' | ',' | ';' | '=';
+fragment URI_UNRESERVED: ALPHA_CHAR | DIGIT | '-' | '.' | '_' | '~';
+fragment URI_RESERVED: URI_GEN_DELIMS | URI_SUB_DELIMS;
+fragment URI_GEN_DELIMS: ':' | '/' | '?' | '#' | '[' | ']' | '@'; //TODO: migrate to [/?#...] notation
+fragment URI_SUB_DELIMS: '!' | '$' | '&' | '\'' | '(' | ')'
+                         | '*' | '+' | ',' | ';' | '=';
 
 // According to IETF http://tools.ietf.org/html/rfc1034[RFC 1034] and http://tools.ietf.org/html/rfc1035[RFC 1035],
 // as clarified by http://tools.ietf.org/html/rfc2181[RFC 2181] (section 11)
-fragment NAMESPACE : LABEL ('.' LABEL)* ;
-fragment LABEL : ALPHA_CHAR (NAME_CHAR|URI_PCT_ENCODED)* ;
+fragment NAMESPACE : LABEL ('.' LABEL)* ;
+fragment LABEL : ALPHA_CHAR (NAME_CHAR|URI_PCT_ENCODED)* ;
 
 
-GUID : HEX_DIGIT+ '-' HEX_DIGIT+ '-' HEX_DIGIT+ '-' HEX_DIGIT+ '-' HEX_DIGIT+ ;
+GUID : HEX_DIGIT+ '-' HEX_DIGIT+ '-' HEX_DIGIT+ '-' HEX_DIGIT+ '-' HEX_DIGIT+ ;
 
-ALPHA_UC_ID :   ALPHA_UCHAR WORD_CHAR* ;   // used for type ids
-ALPHA_LC_ID :   ALPHA_LCHAR WORD_CHAR* ;   // used for attribute / method ids
-ALPHA_UNDERSCORE_ID : '_' WORD_CHAR* ;     // usually used for meta-model ids
+ALPHA_UC_ID :   ALPHA_UCHAR WORD_CHAR* ;   // used for type ids
+ALPHA_LC_ID :   ALPHA_LCHAR WORD_CHAR* ;   // used for attribute / method ids
+ALPHA_UNDERSCORE_ID : '_' WORD_CHAR* ;     // usually used for meta-model ids
 
 // --------------------- atomic primitive types -------------------
 
-INTEGER : DIGIT+ E_SUFFIX? ;
-REAL :    DIGIT+ '.' DIGIT+ E_SUFFIX? ;
-fragment E_SUFFIX : [eE][+-]? DIGIT+ ;
+INTEGER : DIGIT+ E_SUFFIX? ;
+REAL :    DIGIT+ '.' DIGIT+ E_SUFFIX? ;
+fragment E_SUFFIX : [eE][+-]? DIGIT+ ;
 
-STRING : '"' STRING_CHAR*? '"' ;
-fragment STRING_CHAR : ~["\\] | ESCAPE_SEQ | UTF8CHAR ; // strings can be multi-line
+STRING : '"' STRING_CHAR*? '"' ;
+fragment STRING_CHAR : ~["\\] | ESCAPE_SEQ | UTF8CHAR ; // strings can be multi-line
 
 CHARACTER : '\'' CHAR '\'' ;
 fragment CHAR : ~['\\\r\n] | ESCAPE_SEQ | UTF8CHAR  ;
 
-fragment ESCAPE_SEQ: '\\' ['"?abfnrtv\\] ;
+fragment ESCAPE_SEQ: '\\' ['"?abfnrtv\\] ;
 
 // ------------------- character fragments ------------------
 
-fragment NAME_CHAR     : WORD_CHAR | '-' ;
-fragment WORD_CHAR     : ALPHANUM_CHAR | '_' ;
-fragment ALPHANUM_CHAR : ALPHA_CHAR | DIGIT ;
+fragment NAME_CHAR     : WORD_CHAR | '-' ;
+fragment WORD_CHAR     : ALPHANUM_CHAR | '_' ;
+fragment ALPHANUM_CHAR : ALPHA_CHAR | DIGIT ;
 
-fragment ALPHA_CHAR  : [a-zA-Z] ;
-fragment ALPHA_UCHAR : [A-Z] ;
-fragment ALPHA_LCHAR : [a-z] ;
-fragment UTF8CHAR    : '\\u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT ;
+fragment ALPHA_CHAR  : [a-zA-Z] ;
+fragment ALPHA_UCHAR : [A-Z] ;
+fragment ALPHA_LCHAR : [a-z] ;
+fragment UTF8CHAR    : '\\u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT ;
 
-fragment DIGIT     : [0-9] ;
-fragment HEX_DIGIT : [0-9a-fA-F] ;
+fragment DIGIT     : [0-9] ;
+fragment HEX_DIGIT : [0-9a-fA-F] ;
 
 // -------------------- common symbols ---------------------
 
-SYM_COMMA: ',' ;
-SYM_SEMI_COLON : ';' ;
+SYM_COMMA: ',' ;
+SYM_SEMI_COLON : ';' ;
 
-SYM_LPAREN   : '(';
-SYM_RPAREN   : ')';
-SYM_LBRACKET : '[';
-SYM_RBRACKET : ']';
-SYM_LCURLY   : '{' ;
-SYM_RCURLY   : '}' ;
+SYM_LPAREN   : '(';
+SYM_RPAREN   : ')';
+SYM_LBRACKET : '[';
+SYM_RBRACKET : ']';
+SYM_LCURLY   : '{' ;
+SYM_RCURLY   : '}' ;
 
 // --------- symbols ----------
-SYM_ASSIGNMENT: ':=' | '::=' ;
+SYM_ASSIGNMENT: ':=' | '::=' ;
 
-SYM_NE : '/=' | '!=' | '≠' ;
-SYM_EQ : '=' ;
-SYM_GT : '>' ;
-SYM_LT : '<' ;
-SYM_LE : '<=' | '≤' ;
-SYM_GE : '>=' | '≥' ;
+SYM_NE : '/=' | '!=' | '≠' ;
+SYM_EQ : '=' ;
+SYM_GT : '>' ;
+SYM_LT : '<' ;
+SYM_LE : '<=' | '≤' ;
+SYM_GE : '>=' | '≥' ;
 
 // TODO: remove when [] path predicates supported
-VARIABLE_WITH_PATH: VARIABLE_ID ADL_ABSOLUTE_PATH ;
+VARIABLE_WITH_PATH: VARIABLE_ID ADL_ABSOLUTE_PATH ;
 
-VARIABLE_ID: '$' ALPHA_LC_ID ;
+VARIABLE_ID: '$' ALPHA_LC_ID ;
 
 
 //
@@ -7842,18 +7841,18 @@ 

C.7. Base Lexer// // -------------------- symbols for lists ------------------------ -SYM_LIST_CONTINUE: '...' ; +SYM_LIST_CONTINUE: '...' ; // ------------------ symbols for intervals ---------------------- -SYM_PLUS : '+' ; -SYM_MINUS : '-' ; -SYM_PLUS_OR_MINUS : '+/-' | '±' ; -SYM_PERCENT : '%' ; -SYM_CARAT: '^' ; +SYM_PLUS : '+' ; +SYM_MINUS : '-' ; +SYM_PLUS_OR_MINUS : '+/-' | '±' ; +SYM_PERCENT : '%' ; +SYM_CARAT: '^' ; -SYM_IVL_DELIM: '|' ; -SYM_IVL_SEP : '..' ;

+SYM_IVL_DELIM: '|' ; +SYM_IVL_SEP : '..' ;
@@ -7900,7 +7899,7 @@

References

diff --git a/docs/ADL2.html b/docs/ADL2.html index 413690a..c9f1a59 100644 --- a/docs/ADL2.html +++ b/docs/ADL2.html @@ -4,7 +4,7 @@ - + Archetype Definition Language 2 (ADL2) @@ -463,7 +463,7 @@

-

Release: AM latest

+

Release: AM Release-2.3.0

Status: STABLE

@@ -487,7 +487,7 @@

-© 2003 - 2023 The openEHR Foundation +© 2003 - 2024 The openEHR Foundation @@ -527,7 +527,7 @@

Amend -

AM Release 2.3.?

+

AM Release 2.3.0

2.3.0

@@ -1325,7 +1325,7 @@

2.1. An Example
-
archetype (adl_version=2.0.5; rm_release=1.1.5)
-    adl-test-instrument.guitar.v1.0.4
+
archetype (adl_version=2.0.5; rm_release=1.1.5)
+    adl-test-instrument.guitar.v1.0.4
 
 language
-    original_language = <[iso_639-1::en]>
+    original_language = <[iso_639-1::en]>
 
 definition
-    INSTRUMENT[id1] matches {
-        size matches {|60..120|}                    -- size in cm
-        date_of_manufacture matches {yyyy-mm-??}    -- year & month ok
-        parts matches {
-            PART[id2] matches {                     -- neck
-                material matches {[ac1]}            -- timber or nickel alloy
-            }
-            PART[id3] matches {                     -- body
-                material matches {[at3]}            -- timber
-            }
-        }
-    }
+    INSTRUMENT[id1] matches {
+        size matches {|60..120|}                    -- size in cm
+        date_of_manufacture matches {yyyy-mm-??}    -- year & month ok
+        parts matches {
+            PART[id2] matches {                     -- neck
+                material matches {[ac1]}            -- timber or nickel alloy
+            }
+            PART[id3] matches {                     -- body
+                material matches {[at3]}            -- timber
+            }
+        }
+    }
 
 terminology
-    term_definitions = <
-        ["en"] = <
-            ["id1"] = <
-                text = <"guitar">;
-                description = <"stringed instrument">
-            >
-            ["id2"] = <
-                text = <"neck">;
-                description = <"neck of guitar">
-            >
-            ["id3"] = <
-                text = <"body">;
-                description = <"body of guitar">
-            >
-            ["at3"] = <
-                text = <"timber">;
-                description = <"straight, seasoned timber">
-            >
-            ["at4"] = <
-                text = <"nickel alloy">;
-                description = <"frets">
-            >
-        >
-    >
-
-    value_sets = <
-        ["ac1"] = <
-            id = <"ac1">
-                members = <"at3", "at4">
-            >
-        >
-    >
+ term_definitions = < + ["en"] = < + ["id1"] = < + text = <"guitar">; + description = <"stringed instrument"> + > + ["id2"] = < + text = <"neck">; + description = <"neck of guitar"> + > + ["id3"] = < + text = <"body">; + description = <"body of guitar"> + > + ["at3"] = < + text = <"timber">; + description = <"straight, seasoned timber"> + > + ["at4"] = < + text = <"nickel alloy">; + description = <"frets"> + > + > + > + + value_sets = < + ["ac1"] = < + id = <"ac1"> + members = <"at3", "at4"> + > + > + >
@@ -1848,16 +1848,16 @@

4.1. Overview

-
    PERSON[id1] matches {                                -- constraint on a PERSON instance
-        name matches {                                   -- constraint on PERSON.name
-            TEXT[id2] matches {/.+/}                     -- any non-empty string
-        }
-        addresses cardinality matches {1..*} matches {   -- constraint on
-            ADDRESS[id3] matches {                       -- PERSON.addresses
-                -- etc --
-            }
-        }
-    }
+
    PERSON[id1] matches {                                -- constraint on a PERSON instance
+        name matches {                                   -- constraint on PERSON.name
+            TEXT[id2] matches {/.+/}                     -- any non-empty string
+        }
+        addresses cardinality matches {1..*} matches {   -- constraint on
+            ADDRESS[id3] matches {                       -- PERSON.addresses
+                -- etc --
+            }
+        }
+    }
@@ -1865,16 +1865,16 @@

4.1. Overview

-
    PERSON[id1]  {                            -- constraint on a PERSON instance
-        name  {                               -- constraint on PERSON.name
-            TEXT[id2]  {/..*/}                -- any non-empty string
-        }
-        addresses cardinality  {1..*}  {     -- constraint on
-            ADDRESS[id3]  {                   -- PERSON.addresses
-                -- etc --
-            }
-        }
-    }
+
    PERSON[id1]  {                            -- constraint on a PERSON instance
+        name  {                               -- constraint on PERSON.name
+            TEXT[id2]  {/..*/}                -- any non-empty string
+        }
+        addresses cardinality  {1..*}  {     -- constraint on
+            ADDRESS[id3]  {                   -- PERSON.addresses
+                -- etc --
+            }
+        }
+    }
@@ -1957,25 +1957,25 @@

<

-
    PERSON[id1]  {
-        name  {
-            PERSON_NAME[id2]  {
-                forenames cardinality  {1..*}  {/.+/}
-                family_name  {/.+/}
-                title  {"Dr", "Miss", "Mrs", "Mr"}
-            }
-        }
-        addresses cardinality  {1..*}  {
-            LOCATION_ADDRESS[id3]  {
-                street_number existence  {0..1}  {/.+/}
-                street_name  {/.+/}
-                locality  {/.+/}
-                post_code  {/.+/}
-                state  {/.+/}
-                country  {/.+/}
-            }
-        }
-    }
+
    PERSON[id1]  {
+        name  {
+            PERSON_NAME[id2]  {
+                forenames cardinality  {1..*}  {/.+/}
+                family_name  {/.+/}
+                title  {"Dr", "Miss", "Mrs", "Mr"}
+            }
+        }
+        addresses cardinality  {1..*}  {
+            LOCATION_ADDRESS[id3]  {
+                street_number existence  {0..1}  {/.+/}
+                street_name  {/.+/}
+                locality  {/.+/}
+                post_code  {/.+/}
+                state  {/.+/}
+                country  {/.+/}
+            }
+        }
+    }
-
    PERSON[id1]  {                     -- OBJECT block 1 ------------+
-        name  {                            -- attribute block A ---+ |
-            PERSON_NAME[id2]  { ... }          -- OBJECT block 2   + |
-        }                                   -------------------------+ |
-    }                                   -------------------------------+
+
    PERSON[id1]  {                     -- OBJECT block 1 ------------+
+        name  {                            -- attribute block A ---+ |
+            PERSON_NAME[id2]  { ... }          -- OBJECT block 2   + |
+        }                                   -------------------------+ |
+    }                                   -------------------------------+
-
    aaa matches {/\w*ion[\s\n\t ]/} -- the set of words ending in 'ion'  
+
    aaa matches {/\w*ion[\s\n\t ]/} -- the set of words ending in 'ion'  
-
    XXX[id2] matches {
-        xxx_attr1 matches {
-            YYY[id3] matches {
-                yyy_attr1 matches {0..3}
-            }
-        }
-        xxx_attr2 matches {
-            ZZZ[id4] matches {
-                zzz_attr1 matches {>1992-12-01}
-            }
-        }
-    }
+
    XXX[id2] matches {
+        xxx_attr1 matches {
+            YYY[id3] matches {
+                yyy_attr1 matches {0..3}
+            }
+        }
+        xxx_attr2 matches {
+            ZZZ[id4] matches {
+                zzz_attr1 matches {>1992-12-01}
+            }
+        }
+    }
-
    aaa ~matches {5}
-    aaa ~is_in {5}
-    aaa  {5}
+
    aaa ~matches {5}
+    aaa ~is_in {5}
+    aaa  {5}
@@ -2137,11 +2137,11 @@
4.3.1.1. Existence<
-
    OBSERVATION[id1] matches {
-        protocol existence matches {1..1} matches {
-            -- details
-        }
-    }
+
    OBSERVATION[id1] matches {
+        protocol existence matches {1..1} matches {
+            -- details
+        }
+    }
-
    HISTORY[id2] occurrences  {1}  {
-        periodic  {False}
-        events cardinality  {*}  {
-            EVENT[id3] occurrences  {0..1}  {    }           -- 1 min sample
-            EVENT[id4] occurrences  {0..1}  {    }           -- 2 min sample
-            EVENT[id5] occurrences  {0..1}  {    }           -- 3 min sample
-        }
-    }
+
    HISTORY[id2] occurrences  {1}  {
+        periodic  {False}
+        events cardinality  {*}  {
+            EVENT[id3] occurrences  {0..1}  {    }           -- 1 min sample
+            EVENT[id4] occurrences  {0..1}  {    }           -- 2 min sample
+            EVENT[id5] occurrences  {0..1}  {    }           -- 3 min sample
+        }
+    }
@@ -2221,9 +2221,9 @@
4.3.3.1. Cardin
-
    events cardinality  {*; ordered}  {                   -- logical list
-    events cardinality  {*; unordered; unique}  {         -- logical set
-    events cardinality  {*; unordered}  {                 -- logical bag
+
    events cardinality  {*; ordered}  {                   -- logical list
+    events cardinality  {*; unordered; unique}  {         -- logical set
+    events cardinality  {*; unordered}  {                 -- logical bag
@@ -2231,7 +2231,7 @@
4.3.3.1. Cardin
-
    events cardinality  { -- indicates 'events' is a container
+
    events cardinality  { -- indicates 'events' is a container
@@ -2251,7 +2251,7 @@
4.3.3.1. Cardin
-
    events existence  {0..1} cardinality  {0..*}  {-- etc --}
+
    events existence  {0..1} cardinality  {0..*}  {-- etc --}
@@ -2305,11 +2305,11 @@

4.3.4.2. Occurr
-
    events cardinality  {*}  {
-        EVENT[id2] occurrences  {1..1}  {    }          -- 1 minute sample
-        EVENT[id3] occurrences  {0..1}  {    }          -- 2 minute sample
-        EVENT[id4] occurrences  {0..1}  {    }          -- 3 minute sample
-    }
+
    events cardinality  {*}  {
+        EVENT[id2] occurrences  {1..1}  {    }          -- 1 minute sample
+        EVENT[id3] occurrences  {0..1}  {    }          -- 2 minute sample
+        EVENT[id4] occurrences  {0..1}  {    }          -- 3 minute sample
+    }
@@ -2317,19 +2317,19 @@
4.3.4.2. Occurr
-
    GROUP[id103]  {
-        kind  {/tribe|family|club/}
-        members cardinality  {*}  {
-            PERSON[id104] occurrences  {1}  {
-                title  {"head"}
-                -- etc --
-            }
-            PERSON[id105] occurrences  {0..*}  {
-                title  {"member"}
-                -- etc --
-            }
-        }
-    }
+
    GROUP[id103]  {
+        kind  {/tribe|family|club/}
+        members cardinality  {*}  {
+            PERSON[id104] occurrences  {1}  {
+                title  {"head"}
+                -- etc --
+            }
+            PERSON[id105] occurrences  {0..*}  {
+                title  {"member"}
+                -- etc --
+            }
+        }
+    }
@@ -2370,10 +2370,10 @@

4.3.5.

-
    PERSON[id2]  {
-        name existence  {1}
-        -- etc --
-    }
+
    PERSON[id2]  {
+        name existence  {1}
+        -- etc --
+    }
@@ -2384,11 +2384,11 @@

4.3.5.

-
    ELEMENT[id4]  {          -- speed limit
-        value  {
-            DV_QUANTITY[id5]  -- type was 'DATA_VALUE' in RM
-        }
-    }
+
    ELEMENT[id4]  {          -- speed limit
+        value  {
+            DV_QUANTITY[id5]  -- type was 'DATA_VALUE' in RM
+        }
+    }
@@ -2419,7 +2419,7 @@

-

The precise specification of RM type matching is given in the section Rm_type_name and reference model type matching of the AOM2 specification.

+

The precise specification of RM type matching is given in the section Rm_type_name and reference model type matching of the AOM2 specification.

@@ -2509,11 +2509,11 @@
-
    manager  {
-        PERSON[id104]  {
-            title  {"head of finance", "head of engineering"}
-        }
-    }
+
    manager  {
+        PERSON[id104]  {
+            title  {"head of finance", "head of engineering"}
+        }
+    }
-
    items cardinality matches {*} matches {
-        ELEMENT[id4] matches {  -- speed limit
-            value matches {
-                DV_QUANTITY[id22] matches {                       -- miles per hour
-                    magnitude matches {|0..55|}
-                    property matches {"velocity"}
-                    units matches {"mph"}
-                }
-                DV_QUANTITY[id23] matches {                       -- km per hour
-                    magnitude matches {|0..100|}
-                    property matches {"velocity"}
-                    units matches {"km/h"}
-                }
-            }
-        }
-    }
+
    items cardinality matches {*} matches {
+        ELEMENT[id4] matches {  -- speed limit
+            value matches {
+                DV_QUANTITY[id22] matches {                       -- miles per hour
+                    magnitude matches {|0..55|}
+                    property matches {"velocity"}
+                    units matches {"mph"}
+                }
+                DV_QUANTITY[id23] matches {                       -- km per hour
+                    magnitude matches {|0..100|}
+                    property matches {"velocity"}
+                    units matches {"km/h"}
+                }
+            }
+        }
+    }
@@ -2639,7 +2639,7 @@
4.3.7.3. Ru
-
    items[id4]/value[id22]
+
    items[id4]/value[id22]
     items[id4]/value[id23]
@@ -2648,7 +2648,7 @@
4.3.7.3. Ru
-
    items[id4]/value               -- since there is only one DV_QUANTITY in the data
+
    items[id4]/value               -- since there is only one DV_QUANTITY in the data
@@ -2691,46 +2691,46 @@

-
    PERSON[id1]  {
-        identities  {
-            -- etc --
-        }
-        contacts cardinality  {0..*}  {
-            CONTACT[id2]  {      -- home address
-                purpose  {...}
-                addresses  {...}
-            }
-            CONTACT[id3]  {      -- postal address
-                purpose  {...}
-                addresses  {...}
-            }
-            CONTACT[id4]  {      -- home contact
-                purpose  {...}
-                addresses cardinality  {0..*}  {
-                    ADDRESS[id5]  {                            -- phone
-                        type  {...}
-                        details  {...}
-                    }
-                    ADDRESS[id6]  {                            -- fax
-                        type  {...}
-                        details  {...}
-                    }
-                    ADDRESS[id7]  {                            -- email
-                        type  {...}
-                        details  {...}
-                    }
-                }
-            }
-            CONTACT[id8]  {                                    -- work contact
-                purpose  {...}
-                addresses cardinality  {0..*}  {
-                    use_node ADDRESS[id9] /contacts[id4]/addresses[id5]    -- phone
-                    use_node ADDRESS[id10] /contacts[id4]/addresses[id6]   -- fax
-                    use_node ADDRESS[id11] /contacts[id4]/addresses[id7]   -- email
-                }
-            }
-        }
-    }
+
    PERSON[id1]  {
+        identities  {
+            -- etc --
+        }
+        contacts cardinality  {0..*}  {
+            CONTACT[id2]  {      -- home address
+                purpose  {...}
+                addresses  {...}
+            }
+            CONTACT[id3]  {      -- postal address
+                purpose  {...}
+                addresses  {...}
+            }
+            CONTACT[id4]  {      -- home contact
+                purpose  {...}
+                addresses cardinality  {0..*}  {
+                    ADDRESS[id5]  {                            -- phone
+                        type  {...}
+                        details  {...}
+                    }
+                    ADDRESS[id6]  {                            -- fax
+                        type  {...}
+                        details  {...}
+                    }
+                    ADDRESS[id7]  {                            -- email
+                        type  {...}
+                        details  {...}
+                    }
+                }
+            }
+            CONTACT[id8]  {                                    -- work contact
+                purpose  {...}
+                addresses cardinality  {0..*}  {
+                    use_node ADDRESS[id9] /contacts[id4]/addresses[id5]    -- phone
+                    use_node ADDRESS[id10] /contacts[id4]/addresses[id6]   -- fax
+                    use_node ADDRESS[id11] /contacts[id4]/addresses[id7]   -- email
+                }
+            }
+        }
+    }

@@ -2795,16 +2795,16 @@

-
    INSTRUCTION[id1]  {                                       -- Medication order
-        activities cardinality  {0..*; unordered}  {
-            ACTIVITY[id2]  {                                  -- Medication activity
-                action_archetype_id  {/openEHR-EHR-ACTION\.medication\.v1/}
-                description  {
-                    use_archetype ITEM_TREE[id3, openEHR-EHR-ITEM_TREE.medication.v1]
-                }
-            }
-        }
-    }
+
    INSTRUCTION[id1]  {                                       -- Medication order
+        activities cardinality  {0..*; unordered}  {
+            ACTIVITY[id2]  {                                  -- Medication activity
+                action_archetype_id  {/openEHR-EHR-ACTION\.medication\.v1/}
+                description  {
+                    use_archetype ITEM_TREE[id3, openEHR-EHR-ITEM_TREE.medication.v1]
+                }
+            }
+        }
+    }
@@ -2812,15 +2812,15 @@

-
    ACTION[id1]  {                          -- Medication action
-        ism_transition  {
-            ISM_TRANSITION[id2]  { ... }
-            -- ...
-        }
-        description  {
-            use_archetype ITEM_TREE[id3, openEHR-EHR-ITEM_TREE.medication.v1]
-        }
-    }
+
    ACTION[id1]  {                          -- Medication action
+        ism_transition  {
+            ISM_TRANSITION[id2]  { ... }
+            -- ...
+        }
+        description  {
+            use_archetype ITEM_TREE[id3, openEHR-EHR-ITEM_TREE.medication.v1]
+        }
+    }
@@ -2831,9 +2831,9 @@

-
    description  {
-        use_archetype ITEM_TREE[id3.1, openEHR-EHR-ITEM_TREE.vaccine.v1]
-    }
+
    description  {
+        use_archetype ITEM_TREE[id3.1, openEHR-EHR-ITEM_TREE.vaccine.v1]
+    }
@@ -2852,7 +2852,7 @@
4.3.9.1. Paths
-
    /activities[id2]/description[id3]
+
    /activities[id2]/description[id3]
     /description[id2]
@@ -2861,8 +2861,8 @@
4.3.9.1. Paths

-
    /activities[id2]/description[openEHR-EHR-ITEM_TREE.medication.v1]/...
-    /description[openEHR-EHR-ITEM_TREE.medication.v1]/...
+
    /activities[id2]/description[openEHR-EHR-ITEM_TREE.medication.v1]/...
+    /description[openEHR-EHR-ITEM_TREE.medication.v1]/...

@@ -2880,12 +2880,12 @@

4.3.10.

-
    allow_archetype SECTION[id5] occurrences  {0..*}  {
-        include
-            -- constraints for inclusion
-        exclude
-            -- constraints for exclusion
-    }
+
    allow_archetype SECTION[id5] occurrences  {0..*}  {
+        include
+            -- constraints for inclusion
+        exclude
+            -- constraints for exclusion
+    }
@@ -3025,12 +3025,12 @@
-
    allow_archetype EVALUATION[id2] occurrences  {0..*} matches {
-        include
-            archetype_id  {/openEHR-EHR-EVALUATION.family_history.v1/}
-                  /subject/relationship/defining_code ->
-                 ( [openehr::0]  /subject/relationship/defining_code) -- self
-    }
+
    allow_archetype EVALUATION[id2] occurrences  {0..*} matches {
+        include
+            archetype_id  {/openEHR-EHR-EVALUATION.family_history.v1/}
+                  /subject/relationship/defining_code ->
+                 ( [openehr::0]  /subject/relationship/defining_code) -- self
+    }
-
    SECTION[id1]  {    -- Past history
-        /items  {
-            use_archetype EVALUATION[id2, org.openehr::openEHR-EHR-EVALUATION.problem.v1]
-            use_archetype EVALUATION[id2, org.openehr::openEHR-EHR-EVALUATION.clin_synopsis.v1]
-        }
-    }
+
    SECTION[id1]  {    -- Past history
+        /items  {
+            use_archetype EVALUATION[id2, org.openehr::openEHR-EHR-EVALUATION.problem.v1]
+            use_archetype EVALUATION[id2, org.openehr::openEHR-EHR-EVALUATION.clin_synopsis.v1]
+        }
+    }
@@ -3087,17 +3087,17 @@

4.3.1

-
    SECTION[id2000]  {
-        items cardinality  {0..*; ordered}  {
-            ENTRY[id2001]  {...}
-            allow_archetype ENTRY[id2002]  {...}
-            use_node ENTRY[id2003] /some_path[id4]
-            ENTRY[id2004]  {...}
-            use_node ENTRY[id2005] /some_path[id1012]
-            use_node ENTRY[id2006] /some_path[id1052]
-            ENTRY[id2007]  {...}
-        }
-    }
+
    SECTION[id2000]  {
+        items cardinality  {0..*; ordered}  {
+            ENTRY[id2001]  {...}
+            allow_archetype ENTRY[id2002]  {...}
+            use_node ENTRY[id2003] /some_path[id4]
+            ENTRY[id2004]  {...}
+            use_node ENTRY[id2005] /some_path[id1012]
+            use_node ENTRY[id2006] /some_path[id1052]
+            ENTRY[id2007]  {...}
+        }
+    }
@@ -3114,21 +3114,21 @@

4.4

-
    --
-    -- basic form of constraint on a Quantity type, allowing unintended combinations
-    --
-    value  {
-        DV_QUANTITY [id14]  {
-            property  {[openehr::151|temperature|]}
-            units  {"deg F"}
-            magnitude  {|32.0..212.0|}
-        }
-        DV_QUANTITY [id15]  {
-            property  {[openehr::151|temperature|]}
-            units  {"deg C"}
-            magnitude  {|0.0..100.0|}
-        }
-    }
+
    --
+    -- basic form of constraint on a Quantity type, allowing unintended combinations
+    --
+    value  {
+        DV_QUANTITY [id14]  {
+            property  {[openehr::151|temperature|]}
+            units  {"deg F"}
+            magnitude  {|32.0..212.0|}
+        }
+        DV_QUANTITY [id15]  {
+            property  {[openehr::151|temperature|]}
+            units  {"deg C"}
+            magnitude  {|0.0..100.0|}
+        }
+    }
@@ -3139,8 +3139,8 @@

4.4

-
    .../value/units = "deg F" -> magnitude  {|32.0..212.0|}
-    .../value/units = "deg C" -> magnitude  {|0.0..100.0|}
+
    .../value/units = "deg F" -> magnitude  {|32.0..212.0|}
+    .../value/units = "deg C" -> magnitude  {|0.0..100.0|}
@@ -3151,18 +3151,18 @@

4.4

-
    --
-    -- Tuple form of constraint on a Quantity type
-    --
-    value  {
-        DV_QUANTITY[id14]  {
-            property  {[openehr::151|temperature|]}
-            [units, magnitude]  {
-                [{"deg F"}, {|32.0..212.0|}] ,
-                [{"deg C"}, {|0.0..100.0|}]
-            }
-        }
-    }
+
    --
+    -- Tuple form of constraint on a Quantity type
+    --
+    value  {
+        DV_QUANTITY[id14]  {
+            property  {[openehr::151|temperature|]}
+            [units, magnitude]  {
+                [{"deg F"}, {|32.0..212.0|}] ,
+                [{"deg C"}, {|0.0..100.0|}]
+            }
+        }
+    }
@@ -3179,16 +3179,16 @@

4.4

-
    --
-    -- List form of constraint on a Quantity type, also allowing unintended combinations
-    --
-    value  {
-        DV_QUANTITY[id14]  {
-            property  {[openehr::151|temperature|]}
-            units  {"deg F", "deg C"}
-            magnitude  {|32.0..212.0|, |0.0..100.0|}
-        }
-    }
+
    --
+    -- List form of constraint on a Quantity type, also allowing unintended combinations
+    --
+    value  {
+        DV_QUANTITY[id14]  {
+            property  {[openehr::151|temperature|]}
+            units  {"deg F", "deg C"}
+            magnitude  {|32.0..212.0|, |0.0..100.0|}
+        }
+    }
@@ -3202,37 +3202,37 @@

4.4

-
    --
-    -- Basic form of constraint on an Ordinal type, allowing unintended combinations
-    --
-    ordinal_attr  {
-        DV_ORDINAL[id3]  {
-            value  {0}
-            symbol  {
-                DV_CODED_TEXT[id4]  {
-                    code  {"at1"}          -- +
-                }
-            }
-        }
-        DV_ORDINAL[id5]  {
-            value  {1}
-            symbol  {
-                DV_CODED_TEXT[id6]  {
-                    code  {"at2"}          -- ++
-                        }
-                    }
-                }
-            }
-        }
-        DV_ORDINAL[id7]  {
-            value  {2}
-            symbol  {
-                DV_CODED_TEXT[id8]  {
-                    code  {"at3"}         -- +++
-                }
-            }
-        }
-    }
+
    --
+    -- Basic form of constraint on an Ordinal type, allowing unintended combinations
+    --
+    ordinal_attr  {
+        DV_ORDINAL[id3]  {
+            value  {0}
+            symbol  {
+                DV_CODED_TEXT[id4]  {
+                    code  {"at1"}          -- +
+                }
+            }
+        }
+        DV_ORDINAL[id5]  {
+            value  {1}
+            symbol  {
+                DV_CODED_TEXT[id6]  {
+                    code  {"at2"}          -- ++
+                        }
+                    }
+                }
+            }
+        }
+        DV_ORDINAL[id7]  {
+            value  {2}
+            symbol  {
+                DV_CODED_TEXT[id8]  {
+                    code  {"at3"}         -- +++
+                }
+            }
+        }
+    }
@@ -3240,18 +3240,18 @@

4.4

-
    --
-    -- Tuple form of constraint on an Ordinal type
-    --
-    ordinal_attr  {
-        DV_ORDINAL[id3]  {
-            [value, symbol]  {
-                [{0}, {[at1]}],           -- +
-                [{1}, {[at2]}],           -- ++
-                [{2}, {[at3]}]            -- +++
-            }
-        }
-    }
+
    --
+    -- Tuple form of constraint on an Ordinal type
+    --
+    ordinal_attr  {
+        DV_ORDINAL[id3]  {
+            [value, symbol]  {
+                [{0}, {[at1]}],           -- +
+                [{1}, {[at2]}],           -- ++
+                [{2}, {[at3]}]            -- +++
+            }
+        }
+    }
@@ -3299,19 +3299,19 @@

4.4

-
    ITEM_TREE[id1]  {
-        items matches {
-            ELEMENT[id2] occurrences  {1}  {...}              -- Investigation type
-            ELEMENT[id3] occurrences  {0..1}  {...}           -- reason
-            group cardinality  {1} occurrences  {0..1}  {   -- Methodology
-                ELEMENT[id6] occurrences  {0..1}  {...}       -- as Text
-                ELEMENT[id7] occurrences  {0..1}  {...}       -- Coded
-                CLUSTER[id8] occurrences  {0..1}  {...}       -- structured
-            }
-            ELEMENT[id11] occurrences  {0..1}  {...}          -- (other details)
-            CLUSTER[id12] occurrences  {0..1}  {...}          -- (other details)
-        }
-    }
+
    ITEM_TREE[id1]  {
+        items matches {
+            ELEMENT[id2] occurrences  {1}  {...}              -- Investigation type
+            ELEMENT[id3] occurrences  {0..1}  {...}           -- reason
+            group cardinality  {1} occurrences  {0..1}  {   -- Methodology
+                ELEMENT[id6] occurrences  {0..1}  {...}       -- as Text
+                ELEMENT[id7] occurrences  {0..1}  {...}       -- Coded
+                CLUSTER[id8] occurrences  {0..1}  {...}       -- structured
+            }
+            ELEMENT[id11] occurrences  {0..1}  {...}          -- (other details)
+            CLUSTER[id12] occurrences  {0..1}  {...}          -- (other details)
+        }
+    }
@@ -3397,21 +3397,21 @@

4.4

-
    items  {
-        ELEMENT[id2] occurrences  {1}  {...}                -- Investigation type
-        ELEMENT[id3] occurrences  {0..1}  {...}             -- Investigation reason
-        group cardinality  {2} occurrences  {*}  {         -- pick any 2 & repeat
-            ELEMENT[id6] occurrences  {0..1}  {...}
-            ELEMENT[id7] occurrences  {0..1}  {...}
-            CLUSTER[id8] occurrences  {0..1}  {...}
-            group cardinality  {1} occurrences  {0..1}  {  -- at least one
-                ELEMENT[id9] occurrences  {0..1}  {...}
-                CLUSTER[id10] occurrences  {0..1}  {...}
-            }
-        }
-        ELEMENT[id11] occurrences  {0..1}  {...}            -- (other details)
-        CLUSTER[id12] occurrences  {0..1}  {...}            -- (other details)
-    }
+
    items  {
+        ELEMENT[id2] occurrences  {1}  {...}                -- Investigation type
+        ELEMENT[id3] occurrences  {0..1}  {...}             -- Investigation reason
+        group cardinality  {2} occurrences  {*}  {         -- pick any 2 & repeat
+            ELEMENT[id6] occurrences  {0..1}  {...}
+            ELEMENT[id7] occurrences  {0..1}  {...}
+            CLUSTER[id8] occurrences  {0..1}  {...}
+            group cardinality  {1} occurrences  {0..1}  {  -- at least one
+                ELEMENT[id9] occurrences  {0..1}  {...}
+                CLUSTER[id10] occurrences  {0..1}  {...}
+            }
+        }
+        ELEMENT[id11] occurrences  {0..1}  {...}            -- (other details)
+        CLUSTER[id12] occurrences  {0..1}  {...}            -- (other details)
+    }
@@ -3419,17 +3419,17 @@

4.4

-
    group cardinality  {3} occurrences  {*}  {         -- pick any 3 from id6-id11 & repeat
-        ELEMENT[id6] occurrences  {0..1}  {...}
-        ELEMENT[id7] occurrences  {0..1}  {...}
-        CLUSTER[id8] occurrences  {0..1}  {...}
-            group cardinality  {1} occurrences  {1..2}  {  -- pick 1-2 from id9 - id11
-                ELEMENT[id9] occurrences  {0..1}  {...}
-                CLUSTER[id10] occurrences  {0..1}  {...}
-                ELEMENT[id11] occurrences  {0..1}  {...}
-            }
-        }
-    }
+
    group cardinality  {3} occurrences  {*}  {         -- pick any 3 from id6-id11 & repeat
+        ELEMENT[id6] occurrences  {0..1}  {...}
+        ELEMENT[id7] occurrences  {0..1}  {...}
+        CLUSTER[id8] occurrences  {0..1}  {...}
+            group cardinality  {1} occurrences  {1..2}  {  -- pick 1-2 from id9 - id11
+                ELEMENT[id9] occurrences  {0..1}  {...}
+                CLUSTER[id10] occurrences  {0..1}  {...}
+                ELEMENT[id11] occurrences  {0..1}  {...}
+            }
+        }
+    }
@@ -3467,26 +3467,26 @@
4
-
    SECTION[id2] occurrences  {0..1}  {                           -- Subjective
-        items cardinality  {0..*; ordered}  {
-            allow_archetype EVALUATION[id6] occurrences  {*}  {   -- Problem
-                include
-                    archetype_id/value  {/openEHR-EHR-EVALUATION\.problem\.v*/}
-            }
-            allow_archetype EVALUATION[id7] occurrences  {*}  {   -- Diagnosis
-                include
-                    archetype_id/value  {/openEHR-EHR-EVALUATION\.problem-diagnosis\.v*/}
-            }
-            allow_archetype EVALUATION[id8] occurrences  {1}  {   -- Plan
-                include
-                    archetype_id/value  {/openEHR-EHR-EVALUATION\.plan\.v*/}
-            }
-            allow_archetype INSTRUCTION[id9] occurrences  {1..*}  {  -- Intervention
-                include
-                    archetype_id/value  {/openEHR-EHR-INSTRUCTION\.(medication_order|therapy)\.v*/}
-            }
-        }
-    }
+
    SECTION[id2] occurrences  {0..1}  {                           -- Subjective
+        items cardinality  {0..*; ordered}  {
+            allow_archetype EVALUATION[id6] occurrences  {*}  {   -- Problem
+                include
+                    archetype_id/value  {/openEHR-EHR-EVALUATION\.problem\.v*/}
+            }
+            allow_archetype EVALUATION[id7] occurrences  {*}  {   -- Diagnosis
+                include
+                    archetype_id/value  {/openEHR-EHR-EVALUATION\.problem-diagnosis\.v*/}
+            }
+            allow_archetype EVALUATION[id8] occurrences  {1}  {   -- Plan
+                include
+                    archetype_id/value  {/openEHR-EHR-EVALUATION\.plan\.v*/}
+            }
+            allow_archetype INSTRUCTION[id9] occurrences  {1..*}  {  -- Intervention
+                include
+                    archetype_id/value  {/openEHR-EHR-INSTRUCTION\.(medication_order|therapy)\.v*/}
+            }
+        }
+    }
@@ -3494,29 +3494,29 @@
4
-
    SECTION[id2] occurrences  {0..1}  {                             -- Subjective
-        items cardinality  {0..*; ordered}  {
-            group cardinality  {0..1} occurrences  {0..*}  {
-                                    -- sub-group of any number of problems & diagnoses
-                allow_archetype EVALUATION[id6] occurrences  {1}  {  --Problem
-                    include
-                      archetype_id/value  {/openEHR-EHR-EVALUATION\.problem\.v*/}
-                }
-                allow_archetype EVALUATION[id7] occurrences  {1}  {  -- Diagnosis
-                    include
-                      archetype_id/value  {/openEHR-EHR-EVALUATION\.diagnosis\.v*/}
-                }
-            }
-            allow_archetype EVALUATION[id8] occurrences  {1}  {      -- Plan
-                include
-                    archetype_id/value  {/openEHR-EHR-EVALUATION\.plan\.v*/}
-            }
-            allow_archetype INSTRUCTION[id9] occurrences  {1..*}  {     -- Intervention
-                include
-                    archetype_id/value  {/openEHR-EHR-INSTRUCTION\.(medication_order|therapy)\.v*/}
-            }
-        }
-    }
+
    SECTION[id2] occurrences  {0..1}  {                             -- Subjective
+        items cardinality  {0..*; ordered}  {
+            group cardinality  {0..1} occurrences  {0..*}  {
+                                    -- sub-group of any number of problems & diagnoses
+                allow_archetype EVALUATION[id6] occurrences  {1}  {  --Problem
+                    include
+                      archetype_id/value  {/openEHR-EHR-EVALUATION\.problem\.v*/}
+                }
+                allow_archetype EVALUATION[id7] occurrences  {1}  {  -- Diagnosis
+                    include
+                      archetype_id/value  {/openEHR-EHR-EVALUATION\.diagnosis\.v*/}
+                }
+            }
+            allow_archetype EVALUATION[id8] occurrences  {1}  {      -- Plan
+                include
+                    archetype_id/value  {/openEHR-EHR-EVALUATION\.plan\.v*/}
+            }
+            allow_archetype INSTRUCTION[id9] occurrences  {1..*}  {     -- Intervention
+                include
+                    archetype_id/value  {/openEHR-EHR-INSTRUCTION\.(medication_order|therapy)\.v*/}
+            }
+        }
+    }
@@ -3565,7 +3565,7 @@

4.5

-
    some_attr matches {<some_pattern>}
+
    some_attr matches {<some_pattern>}
@@ -3573,22 +3573,22 @@

4.5

-
    some_attr matches {
-        PRIMITIVE_TYPE[id3] matches {<some_pattern>}
-    }
+
    some_attr matches {
+        PRIMITIVE_TYPE[id3] matches {<some_pattern>}
+    }
-

This is possible because the syntax patterns of all primitive type constraints are mutually distinguishable, i.e. the type can always be inferred from the syntax alone. Since all leaf attributes of all object models are of primitive types, or lists or sets of them, cADL archetypes using the brief form for primitive types are significantly less verbose overall, as well as being more directly comprehensible to human readers. Because the brief form omits an id-code, the id-code for primitive object nodes is automatically set to a fixed value, defined in the AOM specification as Primitive_node_id.

+

This is possible because the syntax patterns of all primitive type constraints are mutually distinguishable, i.e. the type can always be inferred from the syntax alone. Since all leaf attributes of all object models are of primitive types, or lists or sets of them, cADL archetypes using the brief form for primitive types are significantly less verbose overall, as well as being more directly comprehensible to human readers. Because the brief form omits an id-code, the id-code for primitive object nodes is automatically set to a fixed value, defined in the AOM specification as Primitive_node_id.

Although for the majority of primitive type constraints, the shortened form is the most convenient, there is one circumstance in which the regular syntax form is needed, which is when only the type is to be constrained, but not the value. This leads to a constraint of the following form:

-
    some_attr matches {
-        PRIMITIVE_TYPE[id3]
-    }
+
    some_attr matches {
+        PRIMITIVE_TYPE[id3]
+    }
@@ -3596,15 +3596,15 @@

4.5

-
    -- in parent archetype
-    some_attr matches {
-        String[id3]
-    }
+
    -- in parent archetype
+    some_attr matches {
+        String[id3]
+    }
 
-    -- in specialisation child
-    some_attr matches {
-        String[id3] matches {"match me"}
-    }
+ -- in specialisation child + some_attr matches { + String[id3] matches {"match me"} + }
@@ -3612,13 +3612,13 @@

4.5

-
    -- in parent archetype
-    some_attr matches {
-        String[id9999]
-    }
+
    -- in parent archetype
+    some_attr matches {
+        String[id9999]
+    }
 
-    -- in specialisation child
-    some_attr matches {"match me"}
+ -- in specialisation child + some_attr matches {"match me"}
@@ -3641,10 +3641,10 @@

-
    some_flag matches {True}
-    some_flag matches {False}
-    some_flag matches {True, False}
-    some_flag matches {True, False; False}         -- with assumed value
+
    some_flag matches {True}
+    some_flag matches {False}
+    some_flag matches {True, False}
+    some_flag matches {True, False; False}         -- with assumed value
@@ -3660,8 +3660,8 @@
4
-
    color_name matches {'r'}
-    color_name matches {'r', 'g', 'b'}
+
    color_name matches {'r'}
+    color_name matches {'r', 'g', 'b'}
@@ -3672,8 +3672,8 @@
4
-
    color_name matches {/[rgbcmyk]/}
-    color_name matches {/[^\s\t\n]/}
+
    color_name matches {/[rgbcmyk]/}
+    color_name matches {/[^\s\t\n]/}
@@ -3709,9 +3709,9 @@
4.5.5.1
-
    species  {"platypus"}
-    species  {"platypus", "kangaroo"}
-    species  {"platypus", "kangaroo", "wombat"}
+
    species  {"platypus"}
+    species  {"platypus", "kangaroo"}
+    species  {"platypus", "kangaroo", "wombat"}
@@ -3725,8 +3725,8 @@
<
-
    string_attr matches {/regular expression/}
-    string_attr matches {^regular expression^}
+
    string_attr matches {/regular expression/}
+    string_attr matches {^regular expression^}
-
    units  {/km\/h|mi\/h/}
-    units  {^km/h|mi/h^}
+
    units  {/km\/h|mi\/h/}
+    units  {^km/h|mi/h^}
-
    length matches {1000}       -- fixed value of 1000
-    magnitude matches {0, 5, 8} -- any of 0, 5 or 8
+
    length matches {1000}       -- fixed value of 1000
+    magnitude matches {0, 5, 8} -- any of 0, 5 or 8
@@ -3902,7 +3902,7 @@
4.5.7
-
    magnitude matches {0} -- matches 0
+
    magnitude matches {0} -- matches 0
@@ -3913,12 +3913,12 @@
-
    length matches {|1000|}                       -- point interval of 1000 (=fixed value)
-    length matches {|950..1050|}                  -- allow 950 - 1050
-    length matches {|0..1000|}                    -- allow 0 - 1000
-    length matches {|0..<1000|}                   -- allow 0>= x <1000
-    length matches {|>0..<1000|}                  -- allow 0> x <1000
-    length matches {|100+/-5|}                    -- allow 100 +/- 5, i.e. 95 - 105
+
    length matches {|1000|}                       -- point interval of 1000 (=fixed value)
+    length matches {|950..1050|}                  -- allow 950 - 1050
+    length matches {|0..1000|}                    -- allow 0 - 1000
+    length matches {|0..<1000|}                   -- allow 0>= x <1000
+    length matches {|>0..<1000|}                  -- allow 0> x <1000
+    length matches {|100+/-5|}                    -- allow 100 +/- 5, i.e. 95 - 105
@@ -3926,11 +3926,11 @@
-
    length matches {|<10|}                        -- allow up to 9
-    length matches {|>10|}                        -- allow 11 or more
-    length matches {|<=10|}                       -- allow up to 10
-    length matches {|>=10|}                       -- allow 10 or more
-    length matches {|>=10|;5}                     -- allow 10 or more; assumed value = 5
+
    length matches {|<10|}                        -- allow up to 9
+    length matches {|>10|}                        -- allow 11 or more
+    length matches {|<=10|}                       -- allow up to 10
+    length matches {|>=10|}                       -- allow 10 or more
+    length matches {|>=10|;5}                     -- allow 10 or more; assumed value = 5
@@ -3941,7 +3941,7 @@
-
    length matches {5, |10..100|, 150, |200..400|, 1000}
+
    length matches {5, |10..100|, 150, |200..400|, 1000}
@@ -3956,16 +3956,16 @@

-
    magnitude  {5.5}                             -- list of one (fixed value)
-    magnitude  {|5.5|}                           -- point interval (=fixed value)
-    magnitude  {|5.5..6.0|}                      -- interval
-    magnitude  {5.5, 6.0, 6.5}                   -- list
-    magnitude  {|0.0..<1000.0|}                  -- allow 0>= x <1000.0
-    magnitude  {|<10.0|}                         -- allow anything less than 10.0
-    magnitude  {|>10.0|}                         -- allow greater than 10.0
-    magnitude  {|<=10.0|}                        -- allow up to 10.0
-    magnitude  {|>=10.0|}                        -- allow 10.0 or more
-    magnitude  {|80.0+/-12.0|}                   -- allow 80 +/- 12
+
    magnitude  {5.5}                             -- list of one (fixed value)
+    magnitude  {|5.5|}                           -- point interval (=fixed value)
+    magnitude  {|5.5..6.0|}                      -- interval
+    magnitude  {5.5, 6.0, 6.5}                   -- list
+    magnitude  {|0.0..<1000.0|}                  -- allow 0>= x <1000.0
+    magnitude  {|<10.0|}                         -- allow anything less than 10.0
+    magnitude  {|>10.0|}                         -- allow greater than 10.0
+    magnitude  {|<=10.0|}                        -- allow up to 10.0
+    magnitude  {|>=10.0|}                        -- allow 10.0 or more
+    magnitude  {|80.0+/-12.0|}                   -- allow 80 +/- 12

@@ -4181,16 +4181,16 @@
Intervals
-
    |09:30:00|                                     -- exactly 9:30 am
-    |< 09:30:00|                                   -- any time before 9:30 am
-    |<= 09:30:00|                                  -- any time at or before 9:30 am
-    |> 09:30:00|                                   -- any time after 9:30 am
-    |> 09:30:00+0200|                              -- any time after 9:30 am in UTC+0200 timezone
-    |>= 09:30:00|                                  -- any time at or after 9:30 am
-    |2004-05-20..2004-06-02|                       -- a date range
-    |2004-05-20T00:00:00..2005-05-19T23:59:59|     -- a date/time range
-    |>= 09:30:00|;09:30:00                         -- any time at or after 9:30 am; assume 9:30 am
-    |2004-05-20T00:00:00Z..2005-05-19T23:59:59Z|   -- a date/time range with UTC timezone
+
    |09:30:00|                                     -- exactly 9:30 am
+    |< 09:30:00|                                   -- any time before 9:30 am
+    |<= 09:30:00|                                  -- any time at or before 9:30 am
+    |> 09:30:00|                                   -- any time after 9:30 am
+    |> 09:30:00+0200|                              -- any time after 9:30 am in UTC+0200 timezone
+    |>= 09:30:00|                                  -- any time at or after 9:30 am
+    |2004-05-20..2004-06-02|                       -- a date range
+    |2004-05-20T00:00:00..2005-05-19T23:59:59|     -- a date/time range
+    |>= 09:30:00|;09:30:00                         -- any time at or after 9:30 am; assume 9:30 am
+    |2004-05-20T00:00:00Z..2005-05-19T23:59:59Z|   -- a date/time range with UTC timezone
@@ -4222,11 +4222,11 @@
Patterns
-
    Pd            -- a duration containing days only, e.g. P5d
-    Pm            -- a duration containing months only, e.g. P5m
-    PTm           -- a duration containing minutes only, e.g. PT5m
-    Pwd           -- a duration containing weeks and/or days only, e.g. P4w
-    PThm          -- a duration containing hours and/or minutes only, e.g. PT2h30m
+
    Pd            -- a duration containing days only, e.g. P5d
+    Pm            -- a duration containing months only, e.g. P5m
+    PTm           -- a duration containing minutes only, e.g. PT5m
+    Pwd           -- a duration containing weeks and/or days only, e.g. P4w
+    PThm          -- a duration containing hours and/or minutes only, e.g. PT2h30m
@@ -4252,10 +4252,10 @@
-
    PT1m              -- 1 minute
-    P1dT8h            -- 1 day 8 hrs
-    |PT0m..PT1m30s|   -- Reasonable time offset of first apgar sample
-    |-P5M..P1Y|       -- Possible range of infant gestational ages
+
    PT1m              -- 1 minute
+    P1dT8h            -- 1 day 8 hrs
+    |PT0m..PT1m30s|   -- Reasonable time offset of first apgar sample
+    |-P5M..P1Y|       -- Possible range of infant gestational ages
@@ -4294,7 +4294,7 @@

-
duration_constraint: duration_pattern '/' duration_interval ;
+
duration_constraint: duration_pattern '/' duration_interval ;
@@ -4324,32 +4324,32 @@
-
    --
-    -- fragment of openEHR-EHR-EVALUATION.term_constraint_variations.v0.0.1
-    --
-
-    items matches {
-        ELEMENT[id11] occurrences matches {0..1} matches {
-            name matches {
-                DV_CODED_TEXT[id8] matches {
-                    defining_code matches {[at5]}		-- set name to 'Substance'
-                }
-            }
-            value matches {
-                DV_CODED_TEXT[id55] matches {
-                    defining_code matches {[ac1]}		-- Type of Substance/Agent
-                }
-            }
-        }
-        ELEMENT[id22] occurrences matches {0..1} matches {	-- Certainty
-            value matches {
-                DV_CODED_TEXT[id58] matches {
-                    defining_code matches {[ac2; at23]}
-                }
-            }
-        }
-        ...
-    }
+
    --
+    -- fragment of openEHR-EHR-EVALUATION.term_constraint_variations.v0.0.1
+    --
+
+    items matches {
+        ELEMENT[id11] occurrences matches {0..1} matches {
+            name matches {
+                DV_CODED_TEXT[id8] matches {
+                    defining_code matches {[at5]}		-- set name to 'Substance'
+                }
+            }
+            value matches {
+                DV_CODED_TEXT[id55] matches {
+                    defining_code matches {[ac1]}		-- Type of Substance/Agent
+                }
+            }
+        }
+        ELEMENT[id22] occurrences matches {0..1} matches {	-- Certainty
+            value matches {
+                DV_CODED_TEXT[id58] matches {
+                    defining_code matches {[ac2; at23]}
+                }
+            }
+        }
+        ...
+    }
@@ -4454,14 +4454,14 @@
-
    --
-    -- extract of an operational template based on openEHR-EHR-EVALUATION.term_constraint_variations.v0.0.1
-    --
-    value matches {
-        DV_CODED_TEXT[id55] matches {
-            defining_code matches {[ac1@snomed_ct]}        -- use snomed_ct binding for value from ac1 at runtime
-        }
-    }
+
    --
+    -- extract of an operational template based on openEHR-EHR-EVALUATION.term_constraint_variations.v0.0.1
+    --
+    value matches {
+        DV_CODED_TEXT[id55] matches {
+            defining_code matches {[ac1@snomed_ct]}        -- use snomed_ct binding for value from ac1 at runtime
+        }
+    }
@@ -4496,7 +4496,7 @@

-
    speed_range  {|0..60|, |60..90|, |90..110|, |110..130|, |>130|}
+
    speed_range  {|0..60|, |60..90|, |90..110|, |110..130|, |>130|}
@@ -4550,58 +4550,58 @@

-
syntax_errors = <
-    ["SUNK"] = <"Syntax error (unknown cause)">
-    ["SARID"] = <"Syntax error in artefact identification clause; expecting archetype id (format = model_issuer-package-class.concept.version)">
-     
-    ["SASID"] = <"Syntax error in 'specialise' clause; expecting parent archetype id (model_issuer-ref_model-model_class.concept.version)">
-     
-    ["SACO"] = <"Syntax error in 'concept' clause; expecting TERM_CODE reference">
-    ["SALA"] = <"Syntax error in language section">
-    ["SALAN"] = <"Syntax error no language section found">
-    ["SADS"] = <"Syntax error in description section">
-    ["SADF"] = <"Syntax error in definition section">
-    ["SAIV"] = <"Syntax error in invariant section">
-    ["SAON"] = <"Syntax error in terminology section">
-    ["SAAN"] = <"Syntax error in annotations section">
-     
-    ["SDSF"] = <"Syntax error: differential syntax not allowed in top-level archetype">
-    ["SDINV"] = <"Syntax error: invalid ODIN section; error: $1">
-    ["SCCOG"] = <"Syntax error: expecting a new node definition, primitive node definition, 'use' path, or 'archetype' reference">
-    ["SUAID"] = <"Syntax error: expecting [archetype_id] in use_archetype statement">
-    ["SUAIDI"] = <"Syntax error: invalid archetype id $1">
-    ["SOCCF"] = <"Syntax error: expecting an 'occurrences expression', e.g. 'occurrences matches {n..m}'">
-    ["SUNPA"] = <"Syntax error: expecting absolute path in use_node statement">
-    ["SCOAT"] = <"Syntax error: expecting attribute definition(s)">
-    ["SUAS"] = <"Syntax error: error after 'use_archetype' keyword; expecting Object node definition">
-    ["SCAS"] = <"Syntax error: expecting a 'any' node, 'leaf' node, or new node definition">
-    ["SINVS"] = <"Syntax error: illegal invariant expression at identifier $1">
-    ["SEXPT"] = <"Syntax error: expecting absolute path after exists keyword">
-    ["SEXLSG"] = <"Syntax error: existence single value must be 0 or 1">
-    ["SEXLU1"] = <"Syntax error: existence upper limit must be 0 or 1 when lower limit is 0">
-    ["SEXLU2"] = <"Syntax error: existence upper limit must be 1 when lower limit is 1">
-    ["SEXLMG"] = <"Syntax error: existence must be one of 0..0, 0..1, or 1..1">
-     
-    ["SCIAV"] = <"Syntax error: invalid assumed value; must be an integer">
-    ["SCRAV"] = <"Syntax error: invalid assumed value; must be a real number">
-    ["SCDAV"] = <"Syntax error: invalid assumed value; must be an ISO8601 date">
-    ["SCTAV"] = <"Syntax error: invalid assumed value; must be an ISO8601 time">
-    ["SCDTAV"] = <"Syntax error: invalid assumed value; must be an ISO8601 date/time">
-    ["SCDUAV"] = <"Syntax error: invalid assumed value; must be an ISO8601 duration">
-    ["SCSAV"] = <"Syntax error: invalid assumed value; must be a string">
-    ["SCBAV"] = <"Syntax error: invalid assumed value; must be a 'True' or 'False'">
-    ["SCOAV"] = <"Syntax error: invalid assumed value; must be an ordinal integer value">
-     
-    ["SCDPT"] = <"Syntax error: invalid date constraint pattern '$1'; allowed patterns: $2">
-    ["SCTPT"] = <"Syntax error: invalid time constraint pattern '$1'; allowed patterns: $2">
-    ["SCDTPT"] = <"Syntax error: invalid date/time constraint pattern '$1'; allowed patterns: $2">
-    ["SCDUPT"] = <"Syntax error: invalid duration constraint pattern '$1'; legal pattern: P[Y|y][M|m][W|w][D|d][T[H|h][M|m][S|s]] or P[W|w] [/duration_interval]">
-     
-    ["SCSRE"] = <"Syntax error: regular expression compile error '$1' is not a valid regular expression">
-    ["STCCP"] = <"Syntax error: invalid term code constraint pattern '$1': $2">
-    ["STCDC"] = <"Syntax error: duplicate code(s) found in code list">
-    ["STCAC"] = <"Syntax error: assumed value code $1 not found in code list">
-    ["STCNT"] = <"Syntax error: terminology not specified">
+
syntax_errors = <
+    ["SUNK"] = <"Syntax error (unknown cause)">
+    ["SARID"] = <"Syntax error in artefact identification clause; expecting archetype id (format = model_issuer-package-class.concept.version)">
+     
+    ["SASID"] = <"Syntax error in 'specialise' clause; expecting parent archetype id (model_issuer-ref_model-model_class.concept.version)">
+     
+    ["SACO"] = <"Syntax error in 'concept' clause; expecting TERM_CODE reference">
+    ["SALA"] = <"Syntax error in language section">
+    ["SALAN"] = <"Syntax error no language section found">
+    ["SADS"] = <"Syntax error in description section">
+    ["SADF"] = <"Syntax error in definition section">
+    ["SAIV"] = <"Syntax error in invariant section">
+    ["SAON"] = <"Syntax error in terminology section">
+    ["SAAN"] = <"Syntax error in annotations section">
+     
+    ["SDSF"] = <"Syntax error: differential syntax not allowed in top-level archetype">
+    ["SDINV"] = <"Syntax error: invalid ODIN section; error: $1">
+    ["SCCOG"] = <"Syntax error: expecting a new node definition, primitive node definition, 'use' path, or 'archetype' reference">
+    ["SUAID"] = <"Syntax error: expecting [archetype_id] in use_archetype statement">
+    ["SUAIDI"] = <"Syntax error: invalid archetype id $1">
+    ["SOCCF"] = <"Syntax error: expecting an 'occurrences expression', e.g. 'occurrences matches {n..m}'">
+    ["SUNPA"] = <"Syntax error: expecting absolute path in use_node statement">
+    ["SCOAT"] = <"Syntax error: expecting attribute definition(s)">
+    ["SUAS"] = <"Syntax error: error after 'use_archetype' keyword; expecting Object node definition">
+    ["SCAS"] = <"Syntax error: expecting a 'any' node, 'leaf' node, or new node definition">
+    ["SINVS"] = <"Syntax error: illegal invariant expression at identifier $1">
+    ["SEXPT"] = <"Syntax error: expecting absolute path after exists keyword">
+    ["SEXLSG"] = <"Syntax error: existence single value must be 0 or 1">
+    ["SEXLU1"] = <"Syntax error: existence upper limit must be 0 or 1 when lower limit is 0">
+    ["SEXLU2"] = <"Syntax error: existence upper limit must be 1 when lower limit is 1">
+    ["SEXLMG"] = <"Syntax error: existence must be one of 0..0, 0..1, or 1..1">
+     
+    ["SCIAV"] = <"Syntax error: invalid assumed value; must be an integer">
+    ["SCRAV"] = <"Syntax error: invalid assumed value; must be a real number">
+    ["SCDAV"] = <"Syntax error: invalid assumed value; must be an ISO8601 date">
+    ["SCTAV"] = <"Syntax error: invalid assumed value; must be an ISO8601 time">
+    ["SCDTAV"] = <"Syntax error: invalid assumed value; must be an ISO8601 date/time">
+    ["SCDUAV"] = <"Syntax error: invalid assumed value; must be an ISO8601 duration">
+    ["SCSAV"] = <"Syntax error: invalid assumed value; must be a string">
+    ["SCBAV"] = <"Syntax error: invalid assumed value; must be a 'True' or 'False'">
+    ["SCOAV"] = <"Syntax error: invalid assumed value; must be an ordinal integer value">
+     
+    ["SCDPT"] = <"Syntax error: invalid date constraint pattern '$1'; allowed patterns: $2">
+    ["SCTPT"] = <"Syntax error: invalid time constraint pattern '$1'; allowed patterns: $2">
+    ["SCDTPT"] = <"Syntax error: invalid date/time constraint pattern '$1'; allowed patterns: $2">
+    ["SCDUPT"] = <"Syntax error: invalid duration constraint pattern '$1'; legal pattern: P[Y|y][M|m][W|w][D|d][T[H|h][M|m][S|s]] or P[W|w] [/duration_interval]">
+     
+    ["SCSRE"] = <"Syntax error: regular expression compile error '$1' is not a valid regular expression">
+    ["STCCP"] = <"Syntax error: invalid term code constraint pattern '$1': $2">
+    ["STCDC"] = <"Syntax error: duplicate code(s) found in code list">
+    ["STCAC"] = <"Syntax error: assumed value code $1 not found in code list">
+    ["STCNT"] = <"Syntax error: terminology not specified">
 >
@@ -4621,8 +4621,8 @@

5.1. Overview

-
    path: '/'? path_segment ( '/' path_segment )+ ;
-    path_segment: attr_name ( '[' object_id ']' )? ;
+
    path: '/'? path_segment ( '/' path_segment )+ ;
+    path_segment: attr_name ( '[' object_id ']' )? ;
-
    --
-    -- ODIN embedded in ADL
-    --
-    /path[idN].../value  {
-        TYPE  {
-            _default = (TYPE) <
-                attribute_1 = <value_1>
-                attribute_2 = <value_2>
-                ...
-                attribute_N = <value_N>
-            >
-        }
-    }
+
    --
+    -- ODIN embedded in ADL
+    --
+    /path[idN].../value  {
+        TYPE  {
+            _default = (TYPE) <
+                attribute_1 = <value_1>
+                attribute_2 = <value_2>
+                ...
+                attribute_N = <value_N>
+            >
+        }
+    }
@@ -4712,22 +4712,22 @@

6.1. Syntax

-
    --
-    -- JSON embedded in ADL
-    --
-    /path[idN].../value  {
-        TYPE  {
-            _default = (json) <#
-                {
-                    "_type": "TYPE",
-                    "attribute_1": value_1,
-                    "attribute_2": value_2,
-                    ...
-                    "attribute_N": value_N
-                }
-            #>
-        }
-    }
+
    --
+    -- JSON embedded in ADL
+    --
+    /path[idN].../value  {
+        TYPE  {
+            _default = (json) <#
+                {
+                    "_type": "TYPE",
+                    "attribute_1": value_1,
+                    "attribute_2": value_2,
+                    ...
+                    "attribute_N": value_N
+                }
+            #>
+        }
+    }
@@ -4741,13 +4741,13 @@

6.2. Examples

-
    /data[id2]/events[id6]/state[id7]/items[id8]/value  {
-        DV_CODED_TEXT  {
-            _default = (DV_CODED_TEXT) <
-                defining_code = <[snomed_ct::163033001|lying BP|]>
-            >
-        }
-    }
+
    /data[id2]/events[id6]/state[id7]/items[id8]/value  {
+        DV_CODED_TEXT  {
+            _default = (DV_CODED_TEXT) <
+                defining_code = <[snomed_ct::163033001|lying BP|]>
+            >
+        }
+    }
@@ -4755,17 +4755,17 @@

6.2. Examples

-
    /data[id2]/events[id6]/state[id7]/items[id8]/value  {
-        DV_CODED_TEXT  {
-            defining_code  {
-                [snomed_ct::163035008|sitting BP|],
-                [snomed_ct::163033001|lying BP|]
-            }
-            _default = (DV_CODED_TEXT) <
-                defining_code = <[snomed_ct::163033001|lying BP|]>
-            >
-        }
-    }
+
    /data[id2]/events[id6]/state[id7]/items[id8]/value  {
+        DV_CODED_TEXT  {
+            defining_code  {
+                [snomed_ct::163035008|sitting BP|],
+                [snomed_ct::163033001|lying BP|]
+            }
+            _default = (DV_CODED_TEXT) <
+                defining_code = <[snomed_ct::163033001|lying BP|]>
+            >
+        }
+    }
@@ -4773,20 +4773,20 @@

6.2. Examples

-
    /data[id2]/events[id6]/state[id7]/items[id8]/value  {
-        DV_CODED_TEXT  {
-            _default = (json) <#
-                {
-                    "_type": "DV_CODED_TEXT",
-                    "defining_code": {
-                        "terminology_id": "snomed_ct",
-                        "code_string":    "163033001",
-                        "value":          "lying BP"
-                    }
-                }
-            #>
-        }
-    }
+
    /data[id2]/events[id6]/state[id7]/items[id8]/value  {
+        DV_CODED_TEXT  {
+            _default = (json) <#
+                {
+                    "_type": "DV_CODED_TEXT",
+                    "defining_code": {
+                        "terminology_id": "snomed_ct",
+                        "code_string":    "163033001",
+                        "value":          "lying BP"
+                    }
+                }
+            #>
+        }
+    }

@@ -4808,33 +4808,33 @@

7.1. Introduc

-
adl_artefact: artefact_type meta_data?
-        ARCHETYPE_HRID
-    ('specialize'
-        ARCHETYPE_REF)?
-    'language'
-        odin_text
-    'description'
-        odin_text
-    'definition'
-        c_complex_object
-    ('rules'
-        el_text)?
-    ('rm_overlay'
-        odin_text)?
-    'terminology'
-        odin_text
-    ('annotations'
-        odin_text)?
-    ;
+
adl_artefact: artefact_type meta_data?
+        ARCHETYPE_HRID
+    ('specialize'
+        ARCHETYPE_REF)?
+    'language'
+        odin_text
+    'description'
+        odin_text
+    'definition'
+        c_complex_object
+    ('rules'
+        el_text)?
+    ('rm_overlay'
+        odin_text)?
+    'terminology'
+        odin_text
+    ('annotations'
+        odin_text)?
+    ;
 
-artefact_type: 'archetype' | 'template' | 'template_overlay' | 'operational_template' ;
+artefact_type: 'archetype' | 'template' | 'template_overlay' | 'operational_template' ;
 
-meta_data: '(' meta_data_item  (';' meta_data_item )* ')' ;
+meta_data: '(' meta_data_item (';' meta_data_item )* ')' ;
-

The syntax for meta_data_item, ARCHETYPE_HRID and ARCHETYPE_REF can be found below in [_base_patterns].

+

The syntax for meta_data_item, ARCHETYPE_HRID and ARCHETYPE_REF can be found below in Appendix B.

The 'archetype' artefact type can have any or all of the above sections. The other artefact types are more specific in their form.

@@ -4844,25 +4844,25 @@

7.1. Introduc

-
adl_template: 'template' meta_data?
-        ARCHETYPE_HRID
-    'specialize'
-        ARCHETYPE_REF
-    'language'
-        odin_text
-    'description'
-        odin_text
-    'definition'
-        c_complex_object
-    ('rules'
-        el_text)?
-    ('rm_overlay'
-        odin_text)?
-    'terminology'
-        odin_text
-    ('annotations'
-        odin_text)?
-    ;
+
adl_template: 'template' meta_data?
+        ARCHETYPE_HRID
+    'specialize'
+        ARCHETYPE_REF
+    'language'
+        odin_text
+    'description'
+        odin_text
+    'definition'
+        c_complex_object
+    ('rules'
+        el_text)?
+    ('rm_overlay'
+        odin_text)?
+    'terminology'
+        odin_text
+    ('annotations'
+        odin_text)?
+    ;
@@ -4870,19 +4870,19 @@

7.1. Introduc

-
adl_template_overlay: 'template_overlay'
-        ARCHETYPE_HRID
-    'specialize'
-        ARCHETYPE_REF
-    'definition'
-        c_complex_object
-    ('rules'
-        el_text)?
-    ('rm_overlay'
-        odin_text)?
-    'terminology'
-        odin_text
-    ;
+
adl_template_overlay: 'template_overlay'
+        ARCHETYPE_HRID
+    'specialize'
+        ARCHETYPE_REF
+    'definition'
+        c_complex_object
+    ('rules'
+        el_text)?
+    ('rm_overlay'
+        odin_text)?
+    'terminology'
+        odin_text
+    ;
@@ -4890,25 +4890,25 @@

7.1. Introduc

-
adl_operational_template: 'operational_template' meta_data?
-        ARCHETYPE_HRID
-    'language'
-        odin_text
-    'description'
-        odin_text
-    'definition'
-        c_complex_object
-    ('rules'
-        el_text)?
-    ('rm_overlay'
-        odin_text)?
-    'terminology'
-        odin_text
-    ('annotations'
-        odin_text)?
-    'component_terminologies'
-        odin_text
-    ;
+
adl_operational_template: 'operational_template' meta_data?
+        ARCHETYPE_HRID
+    'language'
+        odin_text
+    'description'
+        odin_text
+    'definition'
+        c_complex_object
+    ('rules'
+        el_text)?
+    ('rm_overlay'
+        odin_text)?
+    'terminology'
+        odin_text
+    ('annotations'
+        odin_text)?
+    'component_terminologies'
+        odin_text
+    ;
@@ -5037,8 +5037,8 @@

-
archetype (adl_version=2.0.5; rm_release=1.0.3; provenance_id=15E82D77-7DB7-4F70-8D8E-EED6FF241B2D; build_uid=E163E472-3E90-409C-9803-0668A7DA48CE; generated; controlled)
-    openEHR-EHR-OBSERVATION.haematology_result.v0.1.9
+
archetype (adl_version=2.0.5; rm_release=1.0.3; provenance_id=15E82D77-7DB7-4F70-8D8E-EED6FF241B2D; build_uid=E163E472-3E90-409C-9803-0668A7DA48CE; generated; controlled)
+    openEHR-EHR-OBSERVATION.haematology_result.v0.1.9
@@ -5060,7 +5060,7 @@

-
archetype (adl_version=2.0.5; rm_release=1.0.3; uid=15E82D77-7DB7-4F70-8D8E-EED6FF241B2D)
+
archetype (adl_version=2.0.5; rm_release=1.0.3; uid=15E82D77-7DB7-4F70-8D8E-EED6FF241B2D)
@@ -5077,14 +5077,14 @@

7.5.4. Namespaces

-
archetype (adl_version=2.0.5; rm_release=1.0.2)
-    br.gov.saude::openEHR-EHR-OBSERVATION.haematology_result.v1.0.0
+
archetype (adl_version=2.0.5; rm_release=1.0.2)
+    br.gov.saude::openEHR-EHR-OBSERVATION.haematology_result.v1.0.0
 
-template (adl_version=2.0.5; rm_release=1.0.2)
-    uk.org.primary_care::openEHR-EHR-OBSERVATION.haematology_result.v1.2.15
+template (adl_version=2.0.5; rm_release=1.0.2)
+    uk.org.primary_care::openEHR-EHR-OBSERVATION.haematology_result.v1.2.15
 
-archetype (adl_version=2.0.5; rm_release=1.0.2)
-    org.openehr::openEHR-EHR-OBSERVATION.haematology_result.v3.22.125-rc.7
+archetype (adl_version=2.0.5; rm_release=1.0.2) + org.openehr::openEHR-EHR-OBSERVATION.haematology_result.v3.22.125-rc.7

Deprecated: In ADL 1.4 and transitional forms of ADL 1.5, archetype identifiers included only a single version number, and this typically started at 1. Tools that deal with older archetypes should accept these identifiers, and convert the version part to 'v1.0.0' or any other appropriate identifier, obeying the openEHR Artefact Knowledge Identification specification.

-

The multi-axial archetype identifier identifies archetypes in a global concept space within a given namespace. It is also known as an 'ontological' identifier, since the concept space can be understood as an ontology of informational concepts on which the archetypes are based. The syntax of the identifier is described in the openEHR Identification Specification. The structure of the concept space is essentially two-level, with the first level being a reference model class (e.g. openEHR OBSERVATION class) and the second being a domain concept (e.g. 'haematology result').

+

The multi-axial archetype identifier identifies archetypes in a global concept space within a given namespace. It is also known as an 'ontological' identifier, since the concept space can be understood as an ontology of informational concepts on which the archetypes are based. The syntax of the identifier is described in the openEHR Identification Specification. The structure of the concept space is essentially two-level, with the first level being a reference model class (e.g. openEHR OBSERVATION class) and the second being a domain concept (e.g. 'haematology result').

Because namespaces are usually treated hierarchically, higher level namespaces (e.g. '.org' domains) are assumed to be includable by more local namespaces, with the result that the concept definition space is inherited as well.

@@ -5134,9 +5134,9 @@

-
    br.ms::openEHR-EHR-OBSERVATION.haematology_result.v1.0.0
-    br.ms::openEHR-EHR-OBSERVATION.haematology_result.v1.2.15-alpha.45
-    br.ms::openEHR-EHR-OBSERVATION.haematology_result.v3.22.125-rc.7
+
    br.ms::openEHR-EHR-OBSERVATION.haematology_result.v1.0.0
+    br.ms::openEHR-EHR-OBSERVATION.haematology_result.v1.2.15-alpha.45
+    br.ms::openEHR-EHR-OBSERVATION.haematology_result.v3.22.125-rc.7
@@ -5172,8 +5172,8 @@

-
archetype (adl_version=2.0.5; rm_release=1.0.2; generated)
-    org.openehr::openEHR-EHR-OBSERVATION.haematology.v1.2.0
+
archetype (adl_version=2.0.5; rm_release=1.0.2; generated)
+    org.openehr::openEHR-EHR-OBSERVATION.haematology.v1.2.0
@@ -5187,8 +5187,8 @@

<

-
archetype (adl_version=2.0.5; rm_release=1.0.2; controlled)
-    org.openehr::openEHR-EHR-OBSERVATION.haematology.v1.2.0
+
archetype (adl_version=2.0.5; rm_release=1.0.2; controlled)
+    org.openehr::openEHR-EHR-OBSERVATION.haematology.v1.2.0
-
archetype (adl_version=2.0.5; rm_release=1.0.2)
-    openEHR-EHR-OBSERVATION.cbc.v1.0.0
+
archetype (adl_version=2.0.5; rm_release=1.0.2)
+    openEHR-EHR-OBSERVATION.cbc.v1.0.0
 specialise
-    openEHR-EHR-OBSERVATION.haematology.v1
+ openEHR-EHR-OBSERVATION.haematology.v1
@@ -5230,26 +5230,26 @@

7.7.
language
-    original_language = <[iso_639-1::en]>
-    translations = <
-        ["de"] = <
-            language = <[iso_639-1::de]>
-            author = <
-                ["name"] = <"Frederik Tyler">
-                ["email"] = <"freddy@something.somewhere.co.uk">
-            >
-            accreditation = <"British Medical Translator id 00400595">
-        >
-        ["ru"] = <
-            language = <[iso_639-1::ru]>
-            author = <
-                ["name"] = <"Nina Alexandrovna">
-                ["organisation"] = <"Dostoevsky Media Services">
-                ["email"] = <"nina@translation.dms.ru">
-            >
-            accreditation = <"Russian Translator id 892230-3A">
-        >
-    >
+ original_language = <[iso_639-1::en]> + translations = < + ["de"] = < + language = <[iso_639-1::de]> + author = < + ["name"] = <"Frederik Tyler"> + ["email"] = <"freddy@something.somewhere.co.uk"> + > + accreditation = <"British Medical Translator id 00400595"> + > + ["ru"] = < + language = <[iso_639-1::ru]> + author = < + ["name"] = <"Nina Alexandrovna"> + ["organisation"] = <"Dostoevsky Media Services"> + ["email"] = <"nina@translation.dms.ru"> + > + accreditation = <"Russian Translator id 892230-3A"> + > + >
@@ -5276,40 +5276,40 @@

description
-    original_author = <
-        ["name"] = <"Dr J Joyce">
-        ["organisation"] = <"NT Health Service">
-        ["date"] = <2003-08-03>
-    >
-    lifecycle_state =  <"initial">
-    resource_package_uri =  <"http://www.aihw.org.au/data_sets/diabetic_archetypes.html">
-
-    details = <
-        ["en"] = <
-            language = <[iso_639-1::en]>
-            purpose =  <"archetype for diabetic patient review">
-            use = <"used for all hospital or clinic-based diabetic reviews,
-                including first time. Optional sections are removed according to the particular review">
-            misuse = <"not appropriate for pre-diagnosis use">
-            original_resource_uri = <"http://www.healthdata.org.au/data_sets/diabetic_review_data_set_1.html">
-            other_details = <...>
-        >
-        ["de"] = <
-            language = <[iso_639-1::de]>
-            purpose =  <"Archetyp für die Untersuchung von Patienten mit Diabetes">
-            use = <"wird benutzt für alle Diabetes-Untersuchungen im
-                    Krankenhaus, inklusive der ersten Vorstellung. Optionale
-                    Abschnitte werden in Abhängigkeit von der speziellen
-                    Vorstellung entfernt.">
-            misuse = <"nicht geeignet für Benutzung vor Diagnosestellung">
-            original_resource_uri = <"http://www.healthdata.org.au/data_sets/diabetic_review_data_set_1.html">
-            other_details = <...>
-        >
-    >
-
-

-
-

A number of details are worth noting here. Firstly, the free hierarchical structuring capability of ODIN is exploited for expressing the 'deep' structure of the details section and its subsections. Secondly, the ODIN qualified list form is used to allow multiple translations of the purpose and use to be shown. Lastly, empty items such as misuse (structured if there is data) are shown with just one level of empty brackets. The above example shows meta-data based on the openEHR Archetype Object Model (AOM).

+ original_author = < + ["name"] = <"Dr J Joyce"> + ["organisation"] = <"NT Health Service"> + ["date"] = <2003-08-03> + > + lifecycle_state = <"initial"> + resource_package_uri = <"http://www.aihw.org.au/data_sets/diabetic_archetypes.html"> + + details = < + ["en"] = < + language = <[iso_639-1::en]> + purpose = <"archetype for diabetic patient review"> + use = <"used for all hospital or clinic-based diabetic reviews, + including first time. Optional sections are removed according to the particular review"> + misuse = <"not appropriate for pre-diagnosis use"> + original_resource_uri = <"http://www.healthdata.org.au/data_sets/diabetic_review_data_set_1.html"> + other_details = <...> + > + ["de"] = < + language = <[iso_639-1::de]> + purpose = <"Archetyp für die Untersuchung von Patienten mit Diabetes"> + use = <"wird benutzt für alle Diabetes-Untersuchungen im + Krankenhaus, inklusive der ersten Vorstellung. Optionale + Abschnitte werden in Abhängigkeit von der speziellen + Vorstellung entfernt."> + misuse = <"nicht geeignet für Benutzung vor Diagnosestellung"> + original_resource_uri = <"http://www.healthdata.org.au/data_sets/diabetic_review_data_set_1.html"> + other_details = <...> + > + >
+
+

+
+

A number of details are worth noting here. Firstly, the free hierarchical structuring capability of ODIN is exploited for expressing the 'deep' structure of the details section and its subsections. Secondly, the ODIN qualified list form is used to allow multiple translations of the purpose and use to be shown. Lastly, empty items such as misuse (structured if there is data) are shown with just one level of empty brackets. The above example shows meta-data based on the openEHR Archetype Object Model (AOM).

The description section is technically optional according to the AOM, but in any realistic use of ADL for archetypes, it will be required. A minimal description section satisfying to the AOM is as follows:

@@ -5317,18 +5317,18 @@

description
-    original_author = <
-        ["name"] = <"Dr J Joyce">
-        ["organisation"] = <"NT Health Service">
-        ["date"] = <2003-08-03>
-    >
-    lifecycle_state = <"initial">
-    details = <
-        ["en"] = <
-            language = <[iso_639-1::en]>
-            purpose = <"archetype for diabetic patient review">
-        >
-    >
+ original_author = < + ["name"] = <"Dr J Joyce"> + ["organisation"] = <"NT Health Service"> + ["date"] = <2003-08-03> + > + lifecycle_state = <"initial"> + details = < + ["en"] = < + language = <[iso_639-1::en]> + purpose = <"archetype for diabetic patient review"> + > + >

@@ -5366,63 +5366,63 @@

7
definition
-    OBSERVATION[id1]  {                                                 -- blood pressure measurement
-        name  {                                                         -- any synonym of BP
-            DV_CODED_TEXT[id2]  {
-                defining_code  {
-                    CODE_PHRASE[id3]  {[ac1]}
-                }
-            }
-        }
-        data  {
-            HISTORY[id4]  {                                              -- history
-                events cardinality  {1..*}  {
-                    POINT_EVENT[id5] occurrences  {0..1}  {            -- baseline
-                        name  {
-                            DV_CODED_TEXT[id6]  {
-                                defining_code  {
-                                    CODE_PHRASE[id7]  {[ac2]}
-                                }
-                            }
-                        }
-                        data  {
-                            ITEM_LIST[id8]  {                              -- systemic arterial BP
-                                items cardinality  {2..*}  {
-                                    ELEMENT[id9]  {                        -- systolic BP
-                                        name  {                            -- any synonym of 'systolic'
-                                            DV_CODED_TEXT[id10]  {
-                                                defining_code  {
-                                                    CODE_PHRASE[id11]  {[ac2]}
-                                                }
-                                            }
-                                        }
-                                        value  {
-                                            DV_QUANTITY[id12]  {
-                                                magnitude  {|0..1000|}
-                                                property  {[properties::944]}  -- "pressure"
-                                                units  {[units::387]}          -- "mm[Hg]"
-                                            }
-                                        }
-                                    }
-                                    ELEMENT[id79]  {                            -- diastolic BP
-                                        name  {                                 -- any synonym of 'diastolic'
-                                            DV_CODED_TEXT[id14]  {
-                                                defining_code  {
-                                                    CODE_PHRASE[id15]  {[ac3]}
-                                                }
-                                            }
-                                        }
-                                        value  {
-                                            DV_QUANTITY[id16]  {
-                                                magnitude  {|0..1000|}
-                                                property  {[properties::944]}   -- "pressure"
-                                                units  {[units::387]}           -- "mm[Hg]"
-                                            }
-                                        }
-                                    }
-                                    ELEMENT[id17] occurrences  {0..*}  {*}    -- unknown new item
-                                }
-                            ...
+ OBSERVATION[id1] { -- blood pressure measurement + name { -- any synonym of BP + DV_CODED_TEXT[id2] { + defining_code { + CODE_PHRASE[id3] {[ac1]} + } + } + } + data { + HISTORY[id4] { -- history + events cardinality {1..*} { + POINT_EVENT[id5] occurrences {0..1} { -- baseline + name { + DV_CODED_TEXT[id6] { + defining_code { + CODE_PHRASE[id7] {[ac2]} + } + } + } + data { + ITEM_LIST[id8] { -- systemic arterial BP + items cardinality {2..*} { + ELEMENT[id9] { -- systolic BP + name { -- any synonym of 'systolic' + DV_CODED_TEXT[id10] { + defining_code { + CODE_PHRASE[id11] {[ac2]} + } + } + } + value { + DV_QUANTITY[id12] { + magnitude {|0..1000|} + property {[properties::944]} -- "pressure" + units {[units::387]} -- "mm[Hg]" + } + } + } + ELEMENT[id79] { -- diastolic BP + name { -- any synonym of 'diastolic' + DV_CODED_TEXT[id14] { + defining_code { + CODE_PHRASE[id15] {[ac3]} + } + } + } + value { + DV_QUANTITY[id16] { + magnitude {|0..1000|} + property {[properties::944]} -- "pressure" + units {[units::387]} -- "mm[Hg]" + } + } + } + ELEMENT[id17] occurrences {0..*} {*} -- unknown new item + } + ...
-

In the above, the node identifier [id1] is assigned a meaning such as "clinical problem" in the archetype terminology section. The subsequent lines express a constraint on the runtime name attribute, using the internal code [ac1] . The constraint [ac1] is also defined in the archetype terminology section with a formal statement meaning "any clinical problem type", which could clearly evaluate to thousands of possible values, such as "diabetes", "arthritis" and so on. As a result, in the runtime data, the node identifier corresponding to "clinical problem" and the actual problem type chosen at runtime by a user, e.g. "diabetes", can both be found. This enables querying to find all nodes with meaning "problem", or all nodes describing the problem "diabetes". Internal [acN] codes are described in [Local Constraint Codes].

+

In the above, the node identifier [id1] is assigned a meaning such as "clinical problem" in the archetype terminology section. The subsequent lines express a constraint on the runtime name attribute, using the internal code [ac1] . The constraint [ac1] is also defined in the archetype terminology section with a formal statement meaning "any clinical problem type", which could clearly evaluate to thousands of possible values, such as "diabetes", "arthritis" and so on. As a result, in the runtime data, the node identifier corresponding to "clinical problem" and the actual problem type chosen at runtime by a user, e.g. "diabetes", can both be found. This enables querying to find all nodes with meaning "problem", or all nodes describing the problem "diabetes". Internal [acN] codes are described in Section 7.4.5.

@@ -5615,33 +5615,33 @@

7.12.1. RM
rm_overlay
-    rm_visibility = <
-        ["/path/to[id4]/archetype/node[id213]/path/to/rm/attribute"] = <
-            visibility = <"show">
-            alias = <[local::at12]>
-        >
-        ["/path/to[id5]/archetype/node[id64]/path/to/rm/attribute"] = <
-            visibility = <"hide">
-        >
-    >
+    rm_visibility = <
+        ["/path/to[id4]/archetype/node[id213]/path/to/rm/attribute"] = <
+            visibility = <"show">
+            alias = <[local::at12]>
+        >
+        ["/path/to[id5]/archetype/node[id64]/path/to/rm/attribute"] = <
+            visibility = <"hide">
+        >
+    >
 
 terminology
-    term_definitions = <
-        ["en"] = <
-            ["at12"] = <
-                text = <"name in English">
-                description = <"description in English">
-            >
-            ...
-        >
-        ["de"] = <
-            ["at12"] = <
-                text = <"name in German">
-                description = <"description in German">
-            >
-            ...
-        >
-    >
+ term_definitions = < + ["en"] = < + ["at12"] = < + text = <"name in English"> + description = <"description in English"> + > + ... + > + ["de"] = < + ["at12"] = < + text = <"name in German"> + description = <"description in German"> + > + ... + > + >
@@ -5659,31 +5659,31 @@

7.13.1. Overview<
terminology
-    term_definitions = <
-        ["en"] = <
-            ["id1"] = <...>
-            ["at1"] = <...>
-            ["ac1"] = <...>
-        >
-        ["de"] = <
-            ["id1"] = <...>
-            ["at1"] = <...>
-            ["ac1"] = <...>
-        >
-    >
-    value_sets = <
-        ["ac1"] = <
-            id = <"ac1">
-            members = <"at1", "at2", "at3", ...>
-        >
-    >
-    term_bindings = <
-        ["snomed_ct"] = <
-            ["id4"] = <...>
-            ["ac1"] = <...>
-            ...
-        >
-    >
+ term_definitions = < + ["en"] = < + ["id1"] = <...> + ["at1"] = <...> + ["ac1"] = <...> + > + ["de"] = < + ["id1"] = <...> + ["at1"] = <...> + ["ac1"] = <...> + > + > + value_sets = < + ["ac1"] = < + id = <"ac1"> + members = <"at1", "at2", "at3", ...> + > + > + term_bindings = < + ["snomed_ct"] = < + ["id4"] = <...> + ["ac1"] = <...> + ... + > + >
@@ -5710,37 +5710,37 @@

-
    term_definitions = <
-        ["en"] = <
-            ["id1"] = <
-                text = <"problem">
-                description = <"The problem experienced by the subject of care to which the contained information relates">
-            >
-            ["id2"] = <
-                text = <"problem/SOAP headings">
-                description = <"SOAP heading structure for multiple problems">
-            >
-            ...
-            ["id3"] = <
-                text = <"plan">
-                description = <"The clinician's professional advice">
-            >
-        >
-        ["de"] = <
-            ["id1"] = <
-                    text = <"klinisches Problem">
-                    description = <"Das Problem des Patienten worauf sich diese Informationen beziehen">
-            >
-            ["id2"] = <
-                    text = <"Problem/SOAP Schema">
-                    description = <"SOAP-Schlagwort-Gruppierungsschema fuer mehrfache Probleme">
-            >
-            ["id3"] = <
-                    text = <"Plan">
-                    description = <"Klinisch-professionelle Beratung des Pflegenden">
-            >
-        >
-    >
+
    term_definitions = <
+        ["en"] = <
+            ["id1"] = <
+                text = <"problem">
+                description = <"The problem experienced by the subject of care to which the contained information relates">
+            >
+            ["id2"] = <
+                text = <"problem/SOAP headings">
+                description = <"SOAP heading structure for multiple problems">
+            >
+            ...
+            ["id3"] = <
+                text = <"plan">
+                description = <"The clinician's professional advice">
+            >
+        >
+        ["de"] = <
+            ["id1"] = <
+                    text = <"klinisches Problem">
+                    description = <"Das Problem des Patienten worauf sich diese Informationen beziehen">
+            >
+            ["id2"] = <
+                    text = <"Problem/SOAP Schema">
+                    description = <"SOAP-Schlagwort-Gruppierungsschema fuer mehrfache Probleme">
+            >
+            ["id3"] = <
+                    text = <"Plan">
+                    description = <"Klinisch-professionelle Beratung des Pflegenden">
+            >
+        >
+    >
@@ -5802,20 +5802,20 @@

terminology
-    term_definitions = <
-        ["en"] = <
-            ["ac1"] = <...>
-            ["at1"] = <...>
-            ["at2"] = <...>
-            ["at3"] = <...>
-        >
-    >
-    value_sets = <
-        ["ac1"] = <
-            id = <"ac1">
-            members = <"at1", "at2", "at3", ...>
-        >
-    >
+ term_definitions = < + ["en"] = < + ["ac1"] = <...> + ["at1"] = <...> + ["at2"] = <...> + ["at3"] = <...> + > + > + value_sets = < + ["ac1"] = < + id = <"ac1"> + members = <"at1", "at2", "at3", ...> + > + >
@@ -5861,52 +5861,52 @@

-
    --
-    -- Derived from openEHR-EHR-OBSERVATION.term_bindings_paths_use_refs.v1.adls
-    --
-    term_definitions = <
-        ["en"] = <
-            ["id1"] = <
-                text = <"Apgar score">
-                description = <"Clinical score derived from assessment of respiratory effort, heart rate, reflex irritability, muscle_tone tone and skin skin_colour.">
-            >
-            ["id4"] = <
-                text = <"1 minute">
-                description = <"Apgar score 1 minute after birth.">
-            >
-            ["id6"] = <
-                text = <"Heart Rate">
-                description = <"Recording of the infant's heart rate.">
-            >
-            ["id26"] = <
-                text = <"Total">
-                description = <"The sum of the 5 ordinal scores for each component parameter.">
-            >
-            ...
-            ["at7"] = <
-                text = <"Absent">
-                description = <"No heart beat is seen, felt or heard.">
-            >
-            ...
-        >
-    >
-
-    term_bindings = <
-        ["snomed_ct"] = <
-            ["/data[id3]/events[id4]/data[id2]/items[id26]"] = <http://snomedct.info/id/169895004> -- Apgar score at 1 minute
-            ["id26"] = <http://snomedct.info/id/249228009> -- Total Apgar score (observable entity)
-        >
-        ["loinc"] = <
-            ["/data[id3]/events[id4]"] = <http://loinc.org/id/48334-7>   -- 1-minute Apgar panel
-            ["/data[id3]/events[id4]/data[id2]/items[id6]"] = <http://loinc.org/id/32407-9> -- 1 minute Apgar Heart rate
-            ["at7"] = <http://loinc.org/id/LA6716-0>  -- No heart rate
-            ...
-        >
-        ["umls"] = <
-            ["id1"] = <http://umls.nlm.edu/id/C124305> -- apgar result
-            ["id6"] = <http://umls.nlm.edu/id/C234305> -- cardiac score
-        >
-    >
+
    --
+    -- Derived from openEHR-EHR-OBSERVATION.term_bindings_paths_use_refs.v1.adls
+    --
+    term_definitions = <
+        ["en"] = <
+            ["id1"] = <
+                text = <"Apgar score">
+                description = <"Clinical score derived from assessment of respiratory effort, heart rate, reflex irritability, muscle_tone tone and skin skin_colour.">
+            >
+            ["id4"] = <
+                text = <"1 minute">
+                description = <"Apgar score 1 minute after birth.">
+            >
+            ["id6"] = <
+                text = <"Heart Rate">
+                description = <"Recording of the infant's heart rate.">
+            >
+            ["id26"] = <
+                text = <"Total">
+                description = <"The sum of the 5 ordinal scores for each component parameter.">
+            >
+            ...
+            ["at7"] = <
+                text = <"Absent">
+                description = <"No heart beat is seen, felt or heard.">
+            >
+            ...
+        >
+    >
+
+    term_bindings = <
+        ["snomed_ct"] = <
+            ["/data[id3]/events[id4]/data[id2]/items[id26]"] = <http://snomedct.info/id/169895004> -- Apgar score at 1 minute
+            ["id26"] = <http://snomedct.info/id/249228009> -- Total Apgar score (observable entity)
+        >
+        ["loinc"] = <
+            ["/data[id3]/events[id4]"] = <http://loinc.org/id/48334-7>   -- 1-minute Apgar panel
+            ["/data[id3]/events[id4]/data[id2]/items[id6]"] = <http://loinc.org/id/32407-9> -- 1 minute Apgar Heart rate
+            ["at7"] = <http://loinc.org/id/LA6716-0>  -- No heart rate
+            ...
+        >
+        ["umls"] = <
+            ["id1"] = <http://umls.nlm.edu/id/C124305> -- apgar result
+            ["id6"] = <http://umls.nlm.edu/id/C234305> -- cardiac score
+        >
+    >
@@ -6027,44 +6027,44 @@

-- Extract from test archetype openEHR-EHR-EVALUATION.annotations_1st_child.v1.0.0 -- definition - EVALUATION[id1.1] matches { -- Exclusion statement - Adverse Reaction - /data[id2]/items matches { - ... - ELEMENT[id0.8] occurrences matches {0..1} matches { -- No known allergic reaction to - value matches { - DV_TEXT[id0.6] - } - } - ... - ELEMENT[id0.10] occurrences matches {0..1} matches { -- No known intolerance to - value matches { - DV_TEXT[id0.8] -- No known allergic reaction to - } - } - } - } + EVALUATION[id1.1] matches { -- Exclusion statement - Adverse Reaction + /data[id2]/items matches { + ... + ELEMENT[id0.8] occurrences matches {0..1} matches { -- No known allergic reaction to + value matches { + DV_TEXT[id0.6] + } + } + ... + ELEMENT[id0.10] occurrences matches {0..1} matches { -- No known intolerance to + value matches { + DV_TEXT[id0.8] -- No known allergic reaction to + } + } + } + } terminology - ... + ... annotations - documentation = < - ["en"] = < - ["/subject"] = < - ["design note"] = <"xxxxxx"> - > - ["/data[id2]/items[id0.8]"] = < - ["design note"] = <"this is a design note on allergic reaction"> - ["requirements note"] = <"this is a requirements note on allergic reaction"> - ["medline ref"] = <"this is a medline ref on allergic reaction"> - > - ["/data[id2]/items[id0.10]"] = < - ["design note"] = <"this is a design note on intelerance"> - ["requirements note"] = <"this is a requirements note on intolerance"> - ["national data dictionary"] = <"NDD ref for intolerance"> - > - > - > + documentation = < + ["en"] = < + ["/subject"] = < + ["design note"] = <"xxxxxx"> + > + ["/data[id2]/items[id0.8]"] = < + ["design note"] = <"this is a design note on allergic reaction"> + ["requirements note"] = <"this is a requirements note on allergic reaction"> + ["medline ref"] = <"this is a medline ref on allergic reaction"> + > + ["/data[id2]/items[id0.10]"] = < + ["design note"] = <"this is a design note on intelerance"> + ["requirements note"] = <"this is a requirements note on intolerance"> + ["national data dictionary"] = <"NDD ref for intolerance"> + > + > + >
@@ -6158,61 +6158,61 @@

-- extract of openehr-ehr-EVALUATION.term_constraint_variations.v0.0.1 -- definition - ... - items matches { - ELEMENT[id11] occurrences matches {0..1} matches { - name matches { - DV_CODED_TEXT[id8] matches { - defining_code matches {[at5]} -- set name to 'Substance' - } - } - value matches { - DV_CODED_TEXT[id55] matches { - defining_code matches {[ac1]} -- Type of Substance/Agent - } - } - } - ... - } - ... + ... + items matches { + ELEMENT[id11] occurrences matches {0..1} matches { + name matches { + DV_CODED_TEXT[id8] matches { + defining_code matches {[at5]} -- set name to 'Substance' + } + } + value matches { + DV_CODED_TEXT[id55] matches { + defining_code matches {[ac1]} -- Type of Substance/Agent + } + } + } + ... + } + ... terminology - term_definitions = < - ["en"] = < - ["id11"] = < - text = <"Specific Substance/Agent"> - description = <"Specific identification of the actual Substance/Agent considered to be responsible for the Adverse Reaction event."> - > - ["at5"] = < - text = <"Substance"> - description = <"Physical substance."> - > - ["ac1"] = < - text = <"Type of substance"> - description = <"Type of substance that was the cause of the Adverse Reaction"> - > - ["at10"] = < - text = <"Pollen"> - description = <"Pollen"> - > - ["at11"] = < - text = <"Insect allergen"> - description = <"Insect allergen"> - > - ["at12"] = < - text = <"Animal protein"> - description = <"Animal protein."> - > - ["at13"] = < - text = <"Plant material"> - description = <"Plant material."> - > - ["at14"] = < - text = <"Dust"> - description = <"Dust."> - > - > - > + term_definitions = < + ["en"] = < + ["id11"] = < + text = <"Specific Substance/Agent"> + description = <"Specific identification of the actual Substance/Agent considered to be responsible for the Adverse Reaction event."> + > + ["at5"] = < + text = <"Substance"> + description = <"Physical substance."> + > + ["ac1"] = < + text = <"Type of substance"> + description = <"Type of substance that was the cause of the Adverse Reaction"> + > + ["at10"] = < + text = <"Pollen"> + description = <"Pollen"> + > + ["at11"] = < + text = <"Insect allergen"> + description = <"Insect allergen"> + > + ["at12"] = < + text = <"Animal protein"> + description = <"Animal protein."> + > + ["at13"] = < + text = <"Plant material"> + description = <"Plant material."> + > + ["at14"] = < + text = <"Dust"> + description = <"Dust."> + > + > + >

@@ -6296,29 +6296,29 @@

terminology
-    term_definitions = <
-         ...
-    >
-
-    --
-    -- alternative #3: add a binding for the value set itself
-    --
-    value_sets = <
-        ["ac1"] = <
-            id = <"ac1">
-            members = <"at10", "at11", "at12", "at13", "at14">
-        >
-    >
-    term_bindings = <
-        ["snomed_ct"] = <
-            ["ac1"] = <http://snomed.info/id/900000000000123456> -- value set binding
-            ["at10"] = <http://snomed.info/id/406464007> -- Pollen allergen (substance)
-            ["at11"] = <http://snomed.info/id/406470001> -- Insect allergen (substance)
-            ["at12"] = <http://snomed.info/id/406472009> -- Animal protein and epidermal allergen (substance)
-            ["at13"] = <http://snomed.info/id/410981007> -- Plant extract and epidermal allergen (substance)
-            ["at14"] = <http://snomed.info/id/410980008> -- Dust allergen (substance)
-        >
-    >
+ term_definitions = < + ... + > + + -- + -- alternative #3: add a binding for the value set itself + -- + value_sets = < + ["ac1"] = < + id = <"ac1"> + members = <"at10", "at11", "at12", "at13", "at14"> + > + > + term_bindings = < + ["snomed_ct"] = < + ["ac1"] = <http://snomed.info/id/900000000000123456> -- value set binding + ["at10"] = <http://snomed.info/id/406464007> -- Pollen allergen (substance) + ["at11"] = <http://snomed.info/id/406470001> -- Insect allergen (substance) + ["at12"] = <http://snomed.info/id/406472009> -- Animal protein and epidermal allergen (substance) + ["at13"] = <http://snomed.info/id/410981007> -- Plant extract and epidermal allergen (substance) + ["at14"] = <http://snomed.info/id/410980008> -- Dust allergen (substance) + > + >

@@ -6395,21 +6395,21 @@

-
    --
-    -- extract of operational template based on openehr-ehr-EVALUATION.term_constraint_variations.v0.0.1
-    --
-    ELEMENT[id11] occurrences matches {0..1} matches {
-        name matches {
-            DV_CODED_TEXT[id8] matches {
-                defining_code matches {[at5@snomed_ct]}        -- set name to 'Substance'
-            }
-        }
-        value matches {
-            DV_CODED_TEXT[id55] matches {
-                defining_code matches {[ac1@snomed_ct]}        -- Type of Substance/Agent
-            }
-        }
-    }
+
    --
+    -- extract of operational template based on openehr-ehr-EVALUATION.term_constraint_variations.v0.0.1
+    --
+    ELEMENT[id11] occurrences matches {0..1} matches {
+        name matches {
+            DV_CODED_TEXT[id8] matches {
+                defining_code matches {[at5@snomed_ct]}        -- set name to 'Substance'
+            }
+        }
+        value matches {
+            DV_CODED_TEXT[id55] matches {
+                defining_code matches {[ac1@snomed_ct]}        -- Type of Substance/Agent
+            }
+        }
+    }
@@ -6524,18 +6524,18 @@

<
-
    OBSERVATION[id1.1]  {                                   -- Thyroid function tests
-        /data[id2]/events[id3]/data[id4]/items  {
-                ELEMENT[id79.2] occurrences  {0..1}  {    -- TSH
-                    value  {
-                        DV_QUANTITY[id0.7]  { ... }
-                    }
-                }
-                ELEMENT[id79.7] occurrences  {0..1}  {...} -- Free T3
-                ...
-            }
-        }
-    }
+
    OBSERVATION[id1.1]  {                                   -- Thyroid function tests
+        /data[id2]/events[id3]/data[id4]/items  {
+                ELEMENT[id79.2] occurrences  {0..1}  {    -- TSH
+                    value  {
+                        DV_QUANTITY[id0.7]  { ... }
+                    }
+                }
+                ELEMENT[id79.7] occurrences  {0..1}  {...} -- Free T3
+                ...
+            }
+        }
+    }
-
    /data[id2]/items[id3]/value
+
    /data[id2]/items[id3]/value
@@ -6573,7 +6573,7 @@

9.2.4.

-
    /data[id2]/items[id3.1]/value
+
    /data[id2]/items[id3.1]/value
-

The rules for redefinition of occurrences on object nodes is formally defined in the VSONCO validity rule in the AOM2 specification.

+

The rules for redefinition of occurrences on object nodes is formally defined in the VSONCO validity rule in the AOM2 specification.

Object constraints can be specialised under both types of attributes by redefinition, refinement and exclusion. Addition can also be used under either kind of attribute: in both cases, it corresponds to an alternative. The actual semantics are described in terms of object node identification, type redefinition, and structural constraints (existence, cardinality and occurrences), and are the same for objects under single- and multiply-valued attributes. The following sections describe the details.

@@ -6692,29 +6692,29 @@

-
    -- openEHR-EHR-EVALUATION.problem.v1 --
+
    -- openEHR-EHR-EVALUATION.problem.v1 --
 
-    EVALUATION[id1]  {                                              -- Problem
-        data  {
-            ITEM_TREE[id2]  {
-                items cardinality  {0..*; ordered}  {
-                    ELEMENT[id3] occurrences  {1}  {
-                        value  {
-                            DV_TEXT[id4]                             -- *** NODE A
-                        }
-                    }
-                    ELEMENT[id5] occurrences  {0..1}  {...}       -- Date of initial onset
-                    ELEMENT[id6] occurrences  {0..1}  {...}       -- Age at initial onset
-                    ELEMENT[id7] occurrences  {0..1}  {...}       -- Severity
-                    ELEMENT[id8] occurrences  {0..1}  {...}       -- Clinical description
-                    ELEMENT[id10] occurrences  {0..1}  {...}      -- Date clinically received
-                    CLUSTER[id11] occurrences  {0..1}  {...}      -- Location
-                    CLUSTER[id14] occurrences  {0..1}  {...}      -- Aetiology
-                    -- etc
-                }
-            }
-        }
-    }
+ EVALUATION[id1] { -- Problem + data { + ITEM_TREE[id2] { + items cardinality {0..*; ordered} { + ELEMENT[id3] occurrences {1} { + value { + DV_TEXT[id4] -- *** NODE A + } + } + ELEMENT[id5] occurrences {0..1} {...} -- Date of initial onset + ELEMENT[id6] occurrences {0..1} {...} -- Age at initial onset + ELEMENT[id7] occurrences {0..1} {...} -- Severity + ELEMENT[id8] occurrences {0..1} {...} -- Clinical description + ELEMENT[id10] occurrences {0..1} {...} -- Date clinically received + CLUSTER[id11] occurrences {0..1} {...} -- Location + CLUSTER[id14] occurrences {0..1} {...} -- Aetiology + -- etc + } + } + } + }

@@ -6722,30 +6722,30 @@

-
    -- openEHR-EHR-EVALUATION.problem-diagnosis.v1 --   -- specialises openEHR-EHR-EVALUATION.problem.v1
+
    -- openEHR-EHR-EVALUATION.problem-diagnosis.v1 --   -- specialises openEHR-EHR-EVALUATION.problem.v1
 
-    EVALUATION[id1.1]  {                               -- Recording of diagnosis
-        /data[id2.1]/items[id3]/value  {               -- redefine id2 to id2.1 (in terminology section)
-            DV_CODED_TEXT[id4]  {                      -- << This node redefines 'NODE A' above
-                defining_code  {[ac0.1]}
-            }
-        }
-        /data[id2.1]/items cardinality  {0..*; ordered}  {
-            before [id5]
-            ELEMENT[id0.32] occurrences  {0..1}  {    -- Status    ++ This node added
-                value  {
-                    DV_CODED_TEXT[id0.33]  {
-                        defining_code  {
-                            [local::at0.33, at0.34]      -- provisional
-                        }
-                    }
-                }
-            }
-            after [id31]
-            CLUSTER[id0.35] occurrences  {0..1}  {...}  -- Diag. criteria  ++ This node added
-            CLUSTER[id0.37] occurrences  {0..1}  {...}  -- Clin. staging   ++ This node added
-        }
-    }
+ EVALUATION[id1.1] { -- Recording of diagnosis + /data[id2.1]/items[id3]/value { -- redefine id2 to id2.1 (in terminology section) + DV_CODED_TEXT[id4] { -- << This node redefines 'NODE A' above + defining_code {[ac0.1]} + } + } + /data[id2.1]/items cardinality {0..*; ordered} { + before [id5] + ELEMENT[id0.32] occurrences {0..1} { -- Status ++ This node added + value { + DV_CODED_TEXT[id0.33] { + defining_code { + [local::at0.33, at0.34] -- provisional + } + } + } + } + after [id31] + CLUSTER[id0.35] occurrences {0..1} {...} -- Diag. criteria ++ This node added + CLUSTER[id0.37] occurrences {0..1} {...} -- Clin. staging ++ This node added + } + }

@@ -6756,30 +6756,30 @@

-
    ------ openEHR-EHR-OBSERVATION.laboratory.v1 ------
-    OBSERVATION[id1]  {                                                       -- Laboratory Result
-        data  {
-            HISTORY[id2]  {
-                events  {
-                    EVENT[id3]  {                                             -- Any event
-                        data  {
-                            ITEM_TREE[id4]  {
-                                items cardinality  {0..*; unordered}  {
-                                    CLUSTER[id5] occurrences  {1}  {...}      -- Specimen
-                                    ELEMENT[id8] occurrences  {0..1}  {...}   -- Diagnostic services
-                                    CLUSTER[id11] occurrences  {0..*}  {...}  -- level 1
-                                    ELEMENT[id79] occurrences  {0..*}          -- panel item
-                                    ELEMENT[id17] occurrences  {0..1}  {...}  -- Overall Comment
-                                    CLUSTER[id18] occurrences  {0..1}  {...}  -- Quality
-                                    ELEMENT[id37] occurrences  {0..1}  {...}  -- Multimedia rep.
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
+
    ------ openEHR-EHR-OBSERVATION.laboratory.v1 ------
+    OBSERVATION[id1]  {                                                       -- Laboratory Result
+        data  {
+            HISTORY[id2]  {
+                events  {
+                    EVENT[id3]  {                                             -- Any event
+                        data  {
+                            ITEM_TREE[id4]  {
+                                items cardinality  {0..*; unordered}  {
+                                    CLUSTER[id5] occurrences  {1}  {...}      -- Specimen
+                                    ELEMENT[id8] occurrences  {0..1}  {...}   -- Diagnostic services
+                                    CLUSTER[id11] occurrences  {0..*}  {...}  -- level 1
+                                    ELEMENT[id79] occurrences  {0..*}          -- panel item
+                                    ELEMENT[id17] occurrences  {0..1}  {...}  -- Overall Comment
+                                    CLUSTER[id18] occurrences  {0..1}  {...}  -- Quality
+                                    ELEMENT[id37] occurrences  {0..1}  {...}  -- Multimedia rep.
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
@@ -6787,27 +6787,27 @@

-
    ------ openEHR-EHR-OBSERVATION.laboratory-thyroid.v1 ------
-    OBSERVATION[id1.1] -- Thyroid function tests
-        /data[id2]/events[id3]/data[id4]/items  {
-            ELEMENT[id79.1] occurrences  {0..1}  {        -- TSH
-                value  {
-                    DV_QUANTITY[id0.7]  {
-                        property  {[at15]}
-                        magnitude  {|0.0..100.0|}
-                        units  {"mIU/l"}
-                    }
-                }
-            }
-            ELEMENT[id79.2] occurrences  {0..1}  {...}    -- Free Triiodothyronine (Free T3)
-            ELEMENT[id79.3] occurrences  {0..1}  {...}    -- Total Triiodothyronine (Total T3)
-            ELEMENT[id79.4] occurrences  {0..1}  {...}    -- Free thyroxine (Free T4)
-            ELEMENT[id79.5] occurrences  {0..1}  {...}    -- Total Thyroxine (Total T4)
-            ELEMENT[id79.6] occurrences  {0..1}  {...}    -- T4 loaded uptake
-            ELEMENT[id79.7] occurrences  {0..1}  {...}    -- Free Triiodothyronine index (Free T3 index)
-            ELEMENT[id79.8] occurrences  {0..1}  {...}    -- Free thyroxine index (FTI)
-        }
-    }
+
    ------ openEHR-EHR-OBSERVATION.laboratory-thyroid.v1 ------
+    OBSERVATION[id1.1] -- Thyroid function tests
+        /data[id2]/events[id3]/data[id4]/items  {
+            ELEMENT[id79.1] occurrences  {0..1}  {        -- TSH
+                value  {
+                    DV_QUANTITY[id0.7]  {
+                        property  {[at15]}
+                        magnitude  {|0.0..100.0|}
+                        units  {"mIU/l"}
+                    }
+                }
+            }
+            ELEMENT[id79.2] occurrences  {0..1}  {...}    -- Free Triiodothyronine (Free T3)
+            ELEMENT[id79.3] occurrences  {0..1}  {...}    -- Total Triiodothyronine (Total T3)
+            ELEMENT[id79.4] occurrences  {0..1}  {...}    -- Free thyroxine (Free T4)
+            ELEMENT[id79.5] occurrences  {0..1}  {...}    -- Total Thyroxine (Total T4)
+            ELEMENT[id79.6] occurrences  {0..1}  {...}    -- T4 loaded uptake
+            ELEMENT[id79.7] occurrences  {0..1}  {...}    -- Free Triiodothyronine index (Free T3 index)
+            ELEMENT[id79.8] occurrences  {0..1}  {...}    -- Free thyroxine index (FTI)
+        }
+    }

@@ -6887,52 +6887,52 @@
-
    CLUSTER[id1.1]  {    -- Lipid studies panel
-        /items  {
-            CLUSTER[id3.1]  {    -- LDL Cholesterol Result
-                items  {
-                    ELEMENT[id2.1]  {    -- LDL Cholesterol
-                        value  {
-                            DV_QUANTITY[id0.1]  {
-                                property  {[at0.1]}
-                                magnitude  {|>=0.0|}
-                                units  {"mmol/l"}
-                            }
-                        }
-                    }
-                }
-            }
-            CLUSTER[id3.2]  {    -- HDL Cholesterol Result
-                items  {
-                    ELEMENT[id2.2]  {    -- HDL Cholesterol
-                        value  {
-                            DV_QUANTITY[id0.2]  {
-                                property  {[at0.1]}
-                                magnitude  {|>=0.0|}
-                                units  {"mmol/l"}
-                            }
-                        }
-                    }
-                }
-            }
-            CLUSTER[id3.3]  {...}    -- Ratio Result
-            CLUSTER[id3.4]  {...}    -- Triglyceride Result
-            CLUSTER[id3.5]  {        -- Total Result
-                items  {
-                    ELEMENT[id2.5]  {    -- Total cholesterol
-                        value  {
-                            DV_QUANTITY[id0.5]  {
-                                property  {[at0.1]}
-                                magnitude  {|>=0.0|}
-                                units  {"mosmol/l"}
-                            }
-                        }
-                    }
-                }
-            }
-            CLUSTER[id3.6]     -- ! - Laboratory Result
-        }
-    }
+
    CLUSTER[id1.1]  {    -- Lipid studies panel
+        /items  {
+            CLUSTER[id3.1]  {    -- LDL Cholesterol Result
+                items  {
+                    ELEMENT[id2.1]  {    -- LDL Cholesterol
+                        value  {
+                            DV_QUANTITY[id0.1]  {
+                                property  {[at0.1]}
+                                magnitude  {|>=0.0|}
+                                units  {"mmol/l"}
+                            }
+                        }
+                    }
+                }
+            }
+            CLUSTER[id3.2]  {    -- HDL Cholesterol Result
+                items  {
+                    ELEMENT[id2.2]  {    -- HDL Cholesterol
+                        value  {
+                            DV_QUANTITY[id0.2]  {
+                                property  {[at0.1]}
+                                magnitude  {|>=0.0|}
+                                units  {"mmol/l"}
+                            }
+                        }
+                    }
+                }
+            }
+            CLUSTER[id3.3]  {...}    -- Ratio Result
+            CLUSTER[id3.4]  {...}    -- Triglyceride Result
+            CLUSTER[id3.5]  {        -- Total Result
+                items  {
+                    ELEMENT[id2.5]  {    -- Total cholesterol
+                        value  {
+                            DV_QUANTITY[id0.5]  {
+                                property  {[at0.1]}
+                                magnitude  {|>=0.0|}
+                                units  {"mosmol/l"}
+                            }
+                        }
+                    }
+                }
+            }
+            CLUSTER[id3.6]     -- ! - Laboratory Result
+        }
+    }
@@ -6965,11 +6965,11 @@

-
    OBSERVATION[id1]  {                -- blood pressure measurement
-        protocol  {                    -- existence not changed from reference model
-            -- etc
-        }
-    }
+
    OBSERVATION[id1]  {                -- blood pressure measurement
+        protocol  {                    -- existence not changed from reference model
+            -- etc
+        }
+    }
@@ -6977,11 +6977,11 @@

-
    OBSERVATION[id1.1]  {              -- paediatric blood pressure measurement
-        /protocol existence  {1}  {
-            -- etc
-        }
-    }
+
    OBSERVATION[id1.1]  {              -- paediatric blood pressure measurement
+        /protocol existence  {1}  {
+            -- etc
+        }
+    }
@@ -6989,9 +6989,9 @@

-
   OBSERVATION[id1]  {                -- paediatric blood pressure measurement
-        /protocol existence  {0}
-    }
+
   OBSERVATION[id1]  {                -- paediatric blood pressure measurement
+        /protocol existence  {0}
+    }
-

As long as the relationship between the enclosing attribute’s cardinality constraint and the occurrences constraints defined on all the contained items (including those inherited unchanged, and therefore not mentioned in the specialised archetype) is respected (see VACMCU, VACMCO validity rules, AOM2 specification), any of the above specialisations can occur.

+

As long as the relationship between the enclosing attribute’s cardinality constraint and the occurrences constraints defined on all the contained items (including those inherited unchanged, and therefore not mentioned in the specialised archetype) is respected (see VACMCU, VACMCO validity rules, AOM2 specification), any of the above specialisations can occur.

The following provides an example of cardinality redefinition.

@@ -7036,11 +7036,11 @@
9.4.2.1. Ca
-
    ITEM_LIST[id3]  {                                      -- general check list
-        items cardinality  {0..*}  {                      -- any number of items
-            ELEMENT[id12] occurrences  {0..*}  {...}      -- generic checklist item
-        }
-    }
+
    ITEM_LIST[id3]  {                                      -- general check list
+        items cardinality  {0..*}  {                      -- any number of items
+            ELEMENT[id12] occurrences  {0..*}  {...}      -- generic checklist item
+        }
+    }
@@ -7048,16 +7048,16 @@
9.4.2.1. Ca
-
    ITEM_LIST[id3]  {                                      -- pre-operative check list
-        /items cardinality  {3..10}  {                    -- at least 3 mandatory items
-            ELEMENT[id12.1] occurrences  {1}  {...}       -- item #1
-            ELEMENT[id12.2] occurrences  {1}  {...}       -- item #2
-            ELEMENT[id12.3] occurrences  {1}  {...}       -- item #3
-            ELEMENT[id12.4] occurrences  {0..1}  {...}    -- item #4
-            ...
-            ELEMENT[id12.10] occurrences  {0..1}  {...}   -- item #10
-        }
-    }
+
    ITEM_LIST[id3]  {                                      -- pre-operative check list
+        /items cardinality  {3..10}  {                    -- at least 3 mandatory items
+            ELEMENT[id12.1] occurrences  {1}  {...}       -- item #1
+            ELEMENT[id12.2] occurrences  {1}  {...}       -- item #2
+            ELEMENT[id12.3] occurrences  {1}  {...}       -- item #3
+            ELEMENT[id12.4] occurrences  {0..1}  {...}    -- item #4
+            ...
+            ELEMENT[id12.10] occurrences  {0..1}  {...}   -- item #10
+        }
+    }

@@ -7068,20 +7068,20 @@

-
    items cardinality  {0..*; ordered}  {
-        ELEMENT[id2] occurrences  {1}  {...}               -- Problem
-        ELEMENT[id3] occurrences  {0..1}  {...}            -- Date of initial onset
-        ELEMENT[id4] occurrences  {0..1}  {...}            -- Age at initial onset
-        ELEMENT[id5] occurrences  {0..1}  {...}            -- Severity
-        ELEMENT[id9] occurrences  {0..1}  {...}            -- Clinical description
-        ELEMENT[id10] occurrences  {0..1}  {...}           -- Date clinically received
-        CLUSTER[id11] occurrences  {0..*}  {...}           -- Location
-        CLUSTER[id14] occurrences  {0..1}  {...}           -- Aetiology
-        CLUSTER[id18] occurrences  {0..1}  {...}           -- Occurrences or exacerb'ns
-        CLUSTER[id26] occurrences  {0..1}  {...}           -- Related problems
-        ELEMENT[id30] occurrences  {0..1}  {...}           -- Date of resolution
-        ELEMENT[id31] occurrences  {0..1}  {...}           -- Age at resolution
-    }
+
    items cardinality  {0..*; ordered}  {
+        ELEMENT[id2] occurrences  {1}  {...}               -- Problem
+        ELEMENT[id3] occurrences  {0..1}  {...}            -- Date of initial onset
+        ELEMENT[id4] occurrences  {0..1}  {...}            -- Age at initial onset
+        ELEMENT[id5] occurrences  {0..1}  {...}            -- Severity
+        ELEMENT[id9] occurrences  {0..1}  {...}            -- Clinical description
+        ELEMENT[id10] occurrences  {0..1}  {...}           -- Date clinically received
+        CLUSTER[id11] occurrences  {0..*}  {...}           -- Location
+        CLUSTER[id14] occurrences  {0..1}  {...}           -- Aetiology
+        CLUSTER[id18] occurrences  {0..1}  {...}           -- Occurrences or exacerb'ns
+        CLUSTER[id26] occurrences  {0..1}  {...}           -- Related problems
+        ELEMENT[id30] occurrences  {0..1}  {...}           -- Date of resolution
+        ELEMENT[id31] occurrences  {0..1}  {...}           -- Age at resolution
+    }
-
    EVALUATION[id1]  {                                      -- Medical Certificate
-        data  {
-            ITEM_TREE[id2]  {
-                items  {
-                    ELEMENT[id5] occurrences  {0..1}  {   -- Description
-                        value  {
-                            DV_TEXT[id7]
-                        }
-                    }
-                }
-            }
-        }
-    }
+
    EVALUATION[id1]  {                                      -- Medical Certificate
+        data  {
+            ITEM_TREE[id2]  {
+                items  {
+                    ELEMENT[id5] occurrences  {0..1}  {   -- Description
+                        value  {
+                            DV_TEXT[id7]
+                        }
+                    }
+                }
+            }
+        }
+    }
@@ -7196,11 +7196,11 @@

9

-
    EVALUATION[id1.1]  {                              -- Singapore Medical Certificate
-        /data[id2]/items  {
-            ELEMENT[id5.1]                             -- Summary
-        }
-    }
+
    EVALUATION[id1.1]  {                              -- Singapore Medical Certificate
+        /data[id2]/items  {
+            ELEMENT[id5.1]                             -- Summary
+        }
+    }
@@ -7308,7 +7308,7 @@

Section 9.3.2 in which node id79|panel item| in the parent archetype is specialised into multiple nodes id79.1, id79.2 etc, illustrates the standard pattern. When a parent object (the id79 node in the parent archetype) has multiple occurrences, it defines a potential multiplicity of data objects that may conform to it. When such a node is redefined into multiple specialised child nodes in a child archetype (each typically having its own occurrences constraint), the latter specialisation set acts as a more precise restatement of the original multiplicity of objects. For this reason, the collective occurrences of the specialised children is used to determine their validity, rather than any individual comparison of the occurrences of one specialised child to that of the parent.

-

The formal definition of validity for occurrences in both cases is given by the VSONCO rule in the openEHR AOM2 specification.

+

The formal definition of validity for occurrences in both cases is given by the VSONCO rule in the openEHR AOM2 specification.

9.5.2.1. Mandation
@@ -7320,17 +7320,17 @@
9.5.2.1. Mandation<
-
    EVALUATION[id1]  { -- Problem
-        data  {
-            ITEM_TREE[id2]  {
-                items cardinality  {0..*; ordered}  {
-                    ELEMENT[id3] occurrences  {1}  {...}       -- Problem
-                    ELEMENT[id4] occurrences  {0..1}  {...}    -- Date of initial onset
-                    -- etc
-                }
-            }
-        }
-    }
+
    EVALUATION[id1]  { -- Problem
+        data  {
+            ITEM_TREE[id2]  {
+                items cardinality  {0..*; ordered}  {
+                    ELEMENT[id3] occurrences  {1}  {...}       -- Problem
+                    ELEMENT[id4] occurrences  {0..1}  {...}    -- Date of initial onset
+                    -- etc
+                }
+            }
+        }
+    }
@@ -7338,9 +7338,9 @@
9.5.2.1. Mandation<
-
    /data[id2]/items  {
-        ELEMENT[id4] occurrences  {1}  -- Date of initial onset
-    }
+
    /data[id2]/items  {
+        ELEMENT[id4] occurrences  {1}  -- Date of initial onset
+    }
@@ -7354,14 +7354,14 @@
9.5.2.2. Exclusion<
-
    ELEMENT[id3]  {
-        value  {
-            DV_QUANTITY[id4]  {...}
-            DV_INTERVAL<DV_QUANTITY>[id5]  {...}
-            DV_COUNT[id6]  {...}
-            DV_INTERVAL<DV_COUNT>[id7]  {...}
-        }
-    }
+
    ELEMENT[id3]  {
+        value  {
+            DV_QUANTITY[id4]  {...}
+            DV_INTERVAL<DV_QUANTITY>[id5]  {...}
+            DV_COUNT[id6]  {...}
+            DV_INTERVAL<DV_COUNT>[id7]  {...}
+        }
+    }
@@ -7369,12 +7369,12 @@
9.5.2.2. Exclusion<
-
    ELEMENT[id3]  {
-        value  {
-            DV_INTERVAL<DV_QUANTITY>[id4] occurrences  {0}
-            DV_INTERVAL<DV_COUNT>[id7] occurrences  {0}
-        }
-    }
+
    ELEMENT[id3]  {
+        value  {
+            DV_INTERVAL<DV_QUANTITY>[id4] occurrences  {0}
+            DV_INTERVAL<DV_COUNT>[id7] occurrences  {0}
+        }
+    }
@@ -7382,10 +7382,10 @@
9.5.2.2. Exclusion<
-
    /data[id2]/items  {
-        CLUSTER[id26] occurrences  {0}     -- remove 'Related problems'
-        ELEMENT[id31] occurrences  {0}     -- remove 'Age at resolution'
-    }
+
    /data[id2]/items  {
+        CLUSTER[id26] occurrences  {0}     -- remove 'Related problems'
+        ELEMENT[id31] occurrences  {0}     -- remove 'Age at resolution'
+    }
@@ -7408,7 +7408,7 @@

-

The first case corresponds to the situation where the 'effective occurrences' of any child of an attribute can be inferred to be maximum 1, i.e. either the attribute is single-valued, or it is a container with a cardinality constraint with maximum 1. The second is where the object in the child archetype has an explicit occurrences constraint of max 1. In the above, the effective_occurrences function is defined in the AOM2 specification.

+

The first case corresponds to the situation where the 'effective occurrences' of any child of an attribute can be inferred to be maximum 1, i.e. either the attribute is single-valued, or it is a container with a cardinality constraint with maximum 1. The second is where the object in the child archetype has an explicit occurrences constraint of max 1. In the above, the effective_occurrences function is defined in the AOM2 specification.

@@ -7882,12 +7882,12 @@

-
    value  {
-        DV_QUANTITY[id3]  {
-            magnitude  {|2.0..10.0|}
-            units  {"mmol/ml"}
-        }
-    }
+
    value  {
+        DV_QUANTITY[id3]  {
+            magnitude  {|2.0..10.0|}
+            units  {"mmol/ml"}
+        }
+    }
@@ -7915,9 +7915,9 @@
-
    /data[id2]/events[id3]/data[id4]/items[id22]/value  {  -- cuff size
-        DV_CODED_TEXT[id14]  -- force a term of some kind
-    }
+
    /data[id2]/events[id3]/data[id4]/items[id22]/value  {  -- cuff size
+        DV_CODED_TEXT[id14]  -- force a term of some kind
+    }
@@ -7942,33 +7942,33 @@
definition
-    ...
-        ELEMENT[id7] occurrences  {0..*}  {   -- System
-            name  {
-                DV_CODED_TEXT[id14]  {
-                    defining_code  {[ac1]}
-                }
-            }
-        }
-    ...
+    ...
+        ELEMENT[id7] occurrences  {0..*}  {   -- System
+            name  {
+                DV_CODED_TEXT[id14]  {
+                    defining_code  {[ac1]}
+                }
+            }
+        }
+    ...
 
 terminology
-    ...
-    value_sets = <
-        ["ac1"] = <
-            id = <"ac1">
-            members = <
-                "at8",    -- Cardiovascular system
-                "at9",    -- Respiratory system
-                "at10",   -- Gastro-intestinal system
-                "at11",   -- Reticulo-Endothelial system
-                "at12",   -- Genito-urinary system
-                "at13",   -- Endocrine System
-                "at14",   -- Central nervous system
-                "at15"    -- Musculoskeletal system
-            >
-        >
-    >
+ ... + value_sets = < + ["ac1"] = < + id = <"ac1"> + members = < + "at8", -- Cardiovascular system + "at9", -- Respiratory system + "at10", -- Gastro-intestinal system + "at11", -- Reticulo-Endothelial system + "at12", -- Genito-urinary system + "at13", -- Endocrine System + "at14", -- Central nervous system + "at15" -- Musculoskeletal system + > + > + >
@@ -8004,20 +8004,20 @@
definition
-    ELEMENT [id79]  { -- cuff size
-        value  {
-            DV_CODED_TEXT[id4]  {
-                defining_code  {[ac1]}
-            }
-        }
-    }
+    ELEMENT [id79]  { -- cuff size
+        value  {
+            DV_CODED_TEXT[id4]  {
+                defining_code  {[ac1]}
+            }
+        }
+    }
 
 terminology
-    term_bindings = <
-        ["snomed_ct"]    = <
-            ["ac1"] = <http://terminology.org/id/12000001>
-        >
-    >
+ term_bindings = < + ["snomed_ct"] = < + ["ac1"] = <http://terminology.org/id/12000001> + > + >
@@ -8149,13 +8149,13 @@

9
-
    DV_QUANTITY[id42]  {
-        property  {[at29]}
-        [magnitude, units]  {
-            [{|>=50.0|}, {"mm[Hg]"}],
-            [{|>=68.0|}, {"cm[H20]"}]
-        }
-    }
+
    DV_QUANTITY[id42]  {
+        property  {[at29]}
+        [magnitude, units]  {
+            [{|>=50.0|}, {"mm[Hg]"}],
+            [{|>=68.0|}, {"cm[H20]"}]
+        }
+    }
@@ -8163,12 +8163,12 @@

9

-
    DV_QUANTITY[id42]  {
-        property  {[at29]}
-        [magnitude, units]  {
-            [{|>=50.0|}, {"mm[Hg]"}]
-        }
-    }
+
    DV_QUANTITY[id42]  {
+        property  {[at29]}
+        [magnitude, units]  {
+            [{|>=50.0|}, {"mm[Hg]"}]
+        }
+    }
@@ -8229,72 +8229,72 @@

-
archetype (adl_version=2.0.0; generated)
-    openEHR-EHR-EVALUATION.code_list_parent.v1.0.0
+
archetype (adl_version=2.0.0; generated)
+    openEHR-EHR-EVALUATION.code_list_parent.v1.0.0
 
 language
-    original_language = <[ISO_639-1::en]>
+    original_language = <[ISO_639-1::en]>
 
 description
-    ...
+    ...
 
 definition
-    EVALUATION[id1] matches {   -- General statement of exclusions or states
-        data matches {
-            ITEM_TREE[id2] matches {
-                items cardinality matches {1..*; unordered} matches {
-                    ELEMENT[id3] occurrences matches {1..*} matches {   -- Statement
-                        value matches {
-                            DV_CODED_TEXT[id4] matches {
-                                defining_code matches {[ac1]}       -- Statement
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
+    EVALUATION[id1] matches {   -- General statement of exclusions or states
+        data matches {
+            ITEM_TREE[id2] matches {
+                items cardinality matches {1..*; unordered} matches {
+                    ELEMENT[id3] occurrences matches {1..*} matches {   -- Statement
+                        value matches {
+                            DV_CODED_TEXT[id4] matches {
+                                defining_code matches {[ac1]}       -- Statement
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
 
 terminology
-    term_definitions = <
-        ["en"] = <
-            ["id1"] = <
-                text = <"General statement of exclusions or states">
-                description = <"A category of ... have been excluded">
-            >
-            ["id3"] = <
-                text = <"Statement">
-                description = <"The statement about what is excluded">
-            >
-            ["at4"] = <
-                text = <"No significant illness">
-                description = <"The person ... condition">
-            >
-            ["at5"] = <
-                text = <"No significant past history">
-                description = <"The person has no ... history">
-            >
-            ...
-            ["at13"] = <
-                text = <"No relevant family history">
-                description = <"No family history ... situation">
-            >
-            ["at14"] = <
-                text = <"No known allergies">
-                description = <"No allergies known to any ... or substances">
-            >
-            ["ac1"] = <
-                text = <"Statement">
-                description = <"The statement about what is excluded">
-            >
-        >
-    >
-    value_sets = <
-        ["ac1"] = <
-            id = <"ac1">
-            members = <"at4", "at5", "at6", "at7", "at10", "at13", "at14", "at11", "at12", "at8", "at9">
-        >
-    >
+ term_definitions = < + ["en"] = < + ["id1"] = < + text = <"General statement of exclusions or states"> + description = <"A category of ... have been excluded"> + > + ["id3"] = < + text = <"Statement"> + description = <"The statement about what is excluded"> + > + ["at4"] = < + text = <"No significant illness"> + description = <"The person ... condition"> + > + ["at5"] = < + text = <"No significant past history"> + description = <"The person has no ... history"> + > + ... + ["at13"] = < + text = <"No relevant family history"> + description = <"No family history ... situation"> + > + ["at14"] = < + text = <"No known allergies"> + description = <"No allergies known to any ... or substances"> + > + ["ac1"] = < + text = <"Statement"> + description = <"The statement about what is excluded"> + > + > + > + value_sets = < + ["ac1"] = < + id = <"ac1"> + members = <"at4", "at5", "at6", "at7", "at10", "at13", "at14", "at11", "at12", "at8", "at9"> + > + >
@@ -8302,47 +8302,47 @@

-
archetype (adl_version=2.0.0; generated)
-    openEHR-EHR-EVALUATION.code_list_constrained.v1.0.0
+
archetype (adl_version=2.0.0; generated)
+    openEHR-EHR-EVALUATION.code_list_constrained.v1.0.0
 
-    -- ...
+    -- ...
 
 terminology
-    term_definitions = <
-        ["en"] = <
-            ["id1"] = <
-                text = <"General statement of exclusions or states">
-                description = <"A category of ...have been excluded">
-            >
-            ["id3"] = <
-                text = <"Statement">
-                description = <"The statement about what is excluded">
-            >
-            ...
-            ["at13"] = <
-                text = <"No relevant family history">
-                description = <"No family history relevant .. situation">
-            >
-            ["ac1"] = <
-                text = <"Statement">
-                description = <"The statement about what is excluded">
-            >
-            ["ac1.1"] = <
-                text = <"(added by post-parse processor)">
-                description = <"(added by post-parse processor)">
-            >
-            ["id1.1"] = <
-                text = <"Adverse reaction exclusions">
-                description = <"A category of ... of adverse reaction">
-            >
-        >
-    >
-    value_sets = <
-        ["ac1.1"] = <
-            id = <"ac1.1">
-            members = <"at6", "at7", "at10", "at13">
-        >
-    >
+ term_definitions = < + ["en"] = < + ["id1"] = < + text = <"General statement of exclusions or states"> + description = <"A category of ...have been excluded"> + > + ["id3"] = < + text = <"Statement"> + description = <"The statement about what is excluded"> + > + ... + ["at13"] = < + text = <"No relevant family history"> + description = <"No family history relevant .. situation"> + > + ["ac1"] = < + text = <"Statement"> + description = <"The statement about what is excluded"> + > + ["ac1.1"] = < + text = <"(added by post-parse processor)"> + description = <"(added by post-parse processor)"> + > + ["id1.1"] = < + text = <"Adverse reaction exclusions"> + description = <"A category of ... of adverse reaction"> + > + > + > + value_sets = < + ["ac1.1"] = < + id = <"ac1.1"> + members = <"at6", "at7", "at10", "at13"> + > + >
-
archetype (adl_version=2.0.5; rm_release=1.0.2)
-    openEHR-EHR-COMPOSITION.discharge.v1.0.0
+
archetype (adl_version=2.0.5; rm_release=1.0.2)
+    openEHR-EHR-COMPOSITION.discharge.v1.0.0
 
 language
-    original_language = <[ISO_639-1::en]>
+    original_language = <[ISO_639-1::en]>
 
 description
-    lifecycle_state = <"unmanaged">
-    original_author = <
-        ["name"] = <"Heather Leslie">
-        ["organisation"] = <"Ocean Informatics">
-        ["email"] = <"heather.leslie@oceaninformatics.com">
-        ["date"] = <"14/11/2007">
-    >
-    details = <
-        ["en"] = <
-            language = <[ISO_639-1::en]>
-            purpose = <"For communication at the time of discharge from an episode of care or an institution.">
-        >
-    >
+    lifecycle_state = <"unmanaged">
+    original_author = <
+        ["name"] = <"Heather Leslie">
+        ["organisation"] = <"Ocean Informatics">
+        ["email"] = <"heather.leslie@oceaninformatics.com">
+        ["date"] = <"14/11/2007">
+    >
+    details = <
+        ["en"] = <
+            language = <[ISO_639-1::en]>
+            purpose = <"For communication at the time of discharge from an episode of care or an institution.">
+        >
+    >
 
 definition
-    COMPOSITION[id1] matches {    -- Discharge
-        category matches {
-            DV_CODED_TEXT[id29] matches {
-                defining_code matches {[at10]}
-            }
-        }
-        content matches {
-            allow_archetype CONTENT_ITEM[id2] matches {
-                include
-                    archetype_id/value  {/openEHR-EHR-(SECTION|EVALUATION)/}
-            }
-        }
-        context matches {
-            EVENT_CONTEXT[id30] matches {
-                other_context matches {
-                    ...
-                }
-            }
-        }
-    }
+    COMPOSITION[id1] matches {    -- Discharge
+        category matches {
+            DV_CODED_TEXT[id29] matches {
+                defining_code matches {[at10]}
+            }
+        }
+        content matches {
+            allow_archetype CONTENT_ITEM[id2] matches {
+                include
+                    archetype_id/value  {/openEHR-EHR-(SECTION|EVALUATION)/}
+            }
+        }
+        context matches {
+            EVENT_CONTEXT[id30] matches {
+                other_context matches {
+                    ...
+                }
+            }
+        }
+    }
 
 terminology
-    term_definitions = <
-        ["en"] = <
-            ["id1"] = <
-                text = <"Discharge">
-                description = <"A summarising communication about at the time of discharge from an institution or an episode of care">
-            >
-            ["id2"] = <
-                text = <"Cinical discharge notes">
-                description = <"*">
-            >
-        >
-    >
+ term_definitions = < + ["en"] = < + ["id1"] = < + text = <"Discharge"> + description = <"A summarising communication about at the time of discharge from an institution or an episode of care"> + > + ["id2"] = < + text = <"Cinical discharge notes"> + description = <"*"> + > + > + >
@@ -8457,139 +8457,139 @@

10.2. Example

-
template (adl_version=2.0.5; rm_release=1.0.2)
-    openEHR-EHR-COMPOSITION.t_clinical_info_ds_sf.v1.0.0
+
template (adl_version=2.0.5; rm_release=1.0.2)
+    openEHR-EHR-COMPOSITION.t_clinical_info_ds_sf.v1.0.0
 
 specialize
-    openEHR-EHR-COMPOSITION.discharge.v1
+    openEHR-EHR-COMPOSITION.discharge.v1
 
 language
-    original_language = <[ISO_639-1::en]>
+    original_language = <[ISO_639-1::en]>
 
 description
-    lifecycle_state = <"unmanaged">
-    original_author = <
-        ["name"] = <"Ian McNicoll">
-        ["organisation"] = <"openEHR Foundation">
-        ["email"] = <"ian.mcnicoll@openehr.org">
-        ["date"] = <"01/04/2011">
-    >
-    copyright = <"copyright (c) 2011 openEHR Foundation">
-    details = <
-        ["en"] = <
-            language = <[ISO_639-1::en]>
-            purpose = <"Templated clinical COMPOSITION for Simple discharge summary">
-        >
-    >
+    lifecycle_state = <"unmanaged">
+    original_author = <
+        ["name"] = <"Ian McNicoll">
+        ["organisation"] = <"openEHR Foundation">
+        ["email"] = <"ian.mcnicoll@openehr.org">
+        ["date"] = <"01/04/2011">
+    >
+    copyright = <"copyright (c) 2011 openEHR Foundation">
+    details = <
+        ["en"] = <
+            language = <[ISO_639-1::en]>
+            purpose = <"Templated clinical COMPOSITION for Simple discharge summary">
+        >
+    >
 
 definition
-    COMPOSITION[id1.1]  {    -- Clinical detail
-        context existence  {0}
-        content  {
-            use_archetype SECTION[id0.1, openEHR-EHR-SECTION.t_patient_event_info_ds_sf.v1] occurrences  {1}
-            use_archetype EVALUATION[id0.2, openEHR-EHR-EVALUATION.t_clinical_info_ds_sf-1.v1] occurrences  {0..1}
-            use_archetype EVALUATION[id0.3, openEHR-EHR-EVALUATION.t_clinical_info_ds_sf-2.v1]
-            use_archetype EVALUATION[id0.5, openEHR-EHR-EVALUATION.t_clinical_info_ds_sf-4.v1] occurrences  {1..*}
-            use_archetype EVALUATION[id0.6, openEHR-EHR-EVALUATION.t_clinical_info_ds_sf-5.v1] occurrences  {0..1}
-            use_archetype EVALUATION[id0.8, openEHR-EHR-EVALUATION.t_clinical_info_ds_sf-7.v1] occurrences  {0..*}
-            use_archetype EVALUATION[id0.9, openEHR-EHR-EVALUATION.t_clinical_info_ds_sf-8.v1]
-        }
-    }
+    COMPOSITION[id1.1]  {    -- Clinical detail
+        context existence  {0}
+        content  {
+            use_archetype SECTION[id0.1, openEHR-EHR-SECTION.t_patient_event_info_ds_sf.v1] occurrences  {1}
+            use_archetype EVALUATION[id0.2, openEHR-EHR-EVALUATION.t_clinical_info_ds_sf-1.v1] occurrences  {0..1}
+            use_archetype EVALUATION[id0.3, openEHR-EHR-EVALUATION.t_clinical_info_ds_sf-2.v1]
+            use_archetype EVALUATION[id0.5, openEHR-EHR-EVALUATION.t_clinical_info_ds_sf-4.v1] occurrences  {1..*}
+            use_archetype EVALUATION[id0.6, openEHR-EHR-EVALUATION.t_clinical_info_ds_sf-5.v1] occurrences  {0..1}
+            use_archetype EVALUATION[id0.8, openEHR-EHR-EVALUATION.t_clinical_info_ds_sf-7.v1] occurrences  {0..*}
+            use_archetype EVALUATION[id0.9, openEHR-EHR-EVALUATION.t_clinical_info_ds_sf-8.v1]
+        }
+    }
 
 terminology
-    term_definitions = <
-        ["en"] = <
-            ["id1.1"] = <
-                text = <"Clinical detail">
-                description = <"Clinical detail of Simple discharge summary">
-            >
-            ["id0.1"] = <
-                text = <"Event data">
-                description = <"Event data">
-            >
-            ["id0.2"] = <
-                text = <"Allergies & adverse reactions">
-                description = <"Allergies & adverse reactions">
-            >
-            ["id0.3"] = <
-                text = <"Alerts">
-                description = <"Alerts">
-            >
-            ["id0.5"] = <
-                text = <"Diagnosis">
-                description = <"Diagnosis">
-            >
-            ["id0.6"] = <
-                text = <"Investigations">
-                description = <"Investigations">
-            >
-            ["id0.8"] = <
-                text = <"Procedures">
-                description = <"Procedures">
-            >
-            ["id0.9"] = <
-                text = <"Medical certificate">
-                description = <"Medical certificate">
-            >
-        >
-    >
+    term_definitions = <
+        ["en"] = <
+            ["id1.1"] = <
+                text = <"Clinical detail">
+                description = <"Clinical detail of Simple discharge summary">
+            >
+            ["id0.1"] = <
+                text = <"Event data">
+                description = <"Event data">
+            >
+            ["id0.2"] = <
+                text = <"Allergies & adverse reactions">
+                description = <"Allergies & adverse reactions">
+            >
+            ["id0.3"] = <
+                text = <"Alerts">
+                description = <"Alerts">
+            >
+            ["id0.5"] = <
+                text = <"Diagnosis">
+                description = <"Diagnosis">
+            >
+            ["id0.6"] = <
+                text = <"Investigations">
+                description = <"Investigations">
+            >
+            ["id0.8"] = <
+                text = <"Procedures">
+                description = <"Procedures">
+            >
+            ["id0.9"] = <
+                text = <"Medical certificate">
+                description = <"Medical certificate">
+            >
+        >
+    >
 -------------------------------------------------------------
 template_overlay
-    openEHR-EHR-EVALUATION.t_clinical_info_ds_sf-1.v1.0.0
+    openEHR-EHR-EVALUATION.t_clinical_info_ds_sf-1.v1.0.0
 
 specialize
-    openEHR-EHR-EVALUATION.adverse.v1
+    openEHR-EHR-EVALUATION.adverse.v1
 
 definition
-    EVALUATION[id1.1]  {    -- Adverse reaction details for episode of care
-        /data[id3]/items  {
-            ELEMENT[id11] occurrences  {0}
-        }
-        /data[id3]/items[id20]/items  {
-            ELEMENT[id33] occurrences  {0}
-            ELEMENT[id16] occurrences  {0}
-            ELEMENT[id5] occurrences  {0}
-            ELEMENT[id21] occurrences  {0}
-        }
-    }
+    EVALUATION[id1.1]  {    -- Adverse reaction details for episode of care
+        /data[id3]/items  {
+            ELEMENT[id11] occurrences  {0}
+        }
+        /data[id3]/items[id20]/items  {
+            ELEMENT[id33] occurrences  {0}
+            ELEMENT[id16] occurrences  {0}
+            ELEMENT[id5] occurrences  {0}
+            ELEMENT[id21] occurrences  {0}
+        }
+    }
 
 terminology
-    term_definitions = <
-        ["en"] = <
-            ["id1.1"] = <
-                text = <"Adverse reaction details for episode of care">
-                description = <"Adverse reaction details for episode of care">
-            >
-        >
-    >
+    term_definitions = <
+        ["en"] = <
+            ["id1.1"] = <
+                text = <"Adverse reaction details for episode of care">
+                description = <"Adverse reaction details for episode of care">
+            >
+        >
+    >
 -------------- etc ------------------------------------------
 
 -------------------------------------------------------------
 template_overlay
-    openEHR-EHR-EVALUATION.t_clinical_info_ds_sf-8.v1.0.0
+    openEHR-EHR-EVALUATION.t_clinical_info_ds_sf-8.v1.0.0
 
 specialize
-    openEHR-EHR-EVALUATION.medical_certificate.v1
+    openEHR-EHR-EVALUATION.medical_certificate.v1
 
 
 definition
-    EVALUATION[id1.1]  {    -- Simple Discharge Summary Medical Certificate
-        /data[id2]/items  {
-            ELEMENT[id3] occurrences  {0}
-            ELEMENT[id4] occurrences  {0}
-            ELEMENT[id5] occurrences  {0}
-        }
-    }
+    EVALUATION[id1.1]  {    -- Simple Discharge Summary Medical Certificate
+        /data[id2]/items  {
+            ELEMENT[id3] occurrences  {0}
+            ELEMENT[id4] occurrences  {0}
+            ELEMENT[id5] occurrences  {0}
+        }
+    }
 
 terminology
-    term_definitions = <
-        ["en"] = <
-            ["id1.1"] = <
-                text = <"Simple Discharge Summary Medical Certificate">
-                description = <"Only used for Discharge Summary Document">
-            >
-        >
-    >
+ term_definitions = < + ["en"] = < + ["id1.1"] = < + text = <"Simple Discharge Summary Medical Certificate"> + description = <"Only used for Discharge Summary Document"> + > + > + >
@@ -8597,101 +8597,101 @@

10.2. Example

-
operational_template (adl_version=2.0.6; rm_release=1.0.2; generated)
-	openEHR-EHR-COMPOSITION.t_clinical_info_ds_sf.v1.0.0
+
operational_template (adl_version=2.0.6; rm_release=1.0.2; generated)
+	openEHR-EHR-COMPOSITION.t_clinical_info_ds_sf.v1.0.0
 
 specialize
-	openEHR-EHR-COMPOSITION.discharge.v1
+	openEHR-EHR-COMPOSITION.discharge.v1
 
 language
-	original_language = <[ISO_639-1::en]>
+	original_language = <[ISO_639-1::en]>
 
 description
-	lifecycle_state = <"unmanaged">
-	original_author = <
-		["name"] = <"Ian McNicoll">
-		["organisation"] = <"Ocean Informatics">
-		["email"] = <"ian.mcnicoll@oceaninformatics.com">
-		["date"] = <"01/04/2011">
-	>
-	copyright = <"copyright (c) 2011 openEHR Foundation">
-	details = <
-		["en"] = <
-			language = <[ISO_639-1::en]>
-			purpose = <"Templated clinical COMPOSITION for Simple discharge summary">
-		>
-	>
+	lifecycle_state = <"unmanaged">
+	original_author = <
+		["name"] = <"Ian McNicoll">
+		["organisation"] = <"Ocean Informatics">
+		["email"] = <"ian.mcnicoll@oceaninformatics.com">
+		["date"] = <"01/04/2011">
+	>
+	copyright = <"copyright (c) 2011 openEHR Foundation">
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"Templated clinical COMPOSITION for Simple discharge summary">
+		>
+	>
 
 definition
-	COMPOSITION[id1.1] matches {	-- Clinical detail
-		category matches {
-			DV_CODED_TEXT[id29] matches {
-				defining_code matches {[at10]}
-			}
-		}
-		context existence matches {0}
-		content matches {
-			SECTION[id0.1, openEHR-EHR-SECTION.t_patient_event_info_ds_sf.v1.0.0] occurrences matches {1} matches {	-- Event start
-				items matches {
-					ADMIN_ENTRY[id0.1, openEHR-EHR-ADMIN_ENTRY.t_patient_event_info_ds_sf-1.v1.0.0] occurrences matches {1} matches {
-						other_participations existence matches {0}
-                    }
-                    --- etc ---
-                }
-            }
-            --- etc ---
-        }
-    }
+	COMPOSITION[id1.1] matches {	-- Clinical detail
+		category matches {
+			DV_CODED_TEXT[id29] matches {
+				defining_code matches {[at10]}
+			}
+		}
+		context existence matches {0}
+		content matches {
+			SECTION[id0.1, openEHR-EHR-SECTION.t_patient_event_info_ds_sf.v1.0.0] occurrences matches {1} matches {	-- Event start
+				items matches {
+					ADMIN_ENTRY[id0.1, openEHR-EHR-ADMIN_ENTRY.t_patient_event_info_ds_sf-1.v1.0.0] occurrences matches {1} matches {
+						other_participations existence matches {0}
+                    }
+                    --- etc ---
+                }
+            }
+            --- etc ---
+        }
+    }
 
 terminology
-	term_definitions = <
-		["en"] = <
-			["id1"] = <
-				text = <"Discharge">
-				description = <"A summarising communication about at the time of discharge from an institution or an episode of care">
-			>
-			["id4"] = <
-				text = <"Report identifier">
-				description = <"Identification information about the report">
-			>
-            ------- etc ---------
-        >
-    >
-	term_bindings = <
-		["openehr"] = <
-			["at10"] = <http://openehr.org/id/433>
-		>
-	>
-	value_sets = <
-		["ac1"] = <
-			id = <"ac1">
-			members = <"at6", "at7", "at8", "at9">
-		>
-	>
+	term_definitions = <
+		["en"] = <
+			["id1"] = <
+				text = <"Discharge">
+				description = <"A summarising communication about at the time of discharge from an institution or an episode of care">
+			>
+			["id4"] = <
+				text = <"Report identifier">
+				description = <"Identification information about the report">
+			>
+            ------- etc ---------
+        >
+    >
+	term_bindings = <
+		["openehr"] = <
+			["at10"] = <http://openehr.org/id/433>
+		>
+	>
+	value_sets = <
+		["ac1"] = <
+			id = <"ac1">
+			members = <"at6", "at7", "at8", "at9">
+		>
+	>
 
 component_terminologies
-	["openEHR-EHR-SECTION.t_patient_event_info_ds_sf.v1.0.0"] = <
-		term_definitions = <
-			["en"] = <
-				["id1"] = <
-					text = <"Adhoc heading">
-					description = <"A generic section header.">
-				>
-                ------- etc ---------
-			>
-		>
-	>
-	["openEHR-EHR-ADMIN_ENTRY.t_patient_event_info_ds_sf-1.v1.0.0"] = <
-		term_definitions = <
-			["en"] = <
-				["id1"] = <
-					text = <"Admission Short Singapore">
-					description = <"Administrative information for the admission of a patient to the care of a hospital/institution">
-				>
-                ------- etc ---------
-			>
-		>
-	>
+ ["openEHR-EHR-SECTION.t_patient_event_info_ds_sf.v1.0.0"] = < + term_definitions = < + ["en"] = < + ["id1"] = < + text = <"Adhoc heading"> + description = <"A generic section header."> + > + ------- etc --------- + > + > + > + ["openEHR-EHR-ADMIN_ENTRY.t_patient_event_info_ds_sf-1.v1.0.0"] = < + term_definitions = < + ["en"] = < + ["id1"] = < + text = <"Admission Short Singapore"> + description = <"Administrative information for the admission of a patient to the care of a hospital/institution"> + > + ------- etc --------- + > + > + >

@@ -8711,7 +8711,7 @@

A.2.1. OMG OCL (Object Constraint Language)

-

The OMG’s Object Constraint Language (OCL) appears at first glance to be an obvious contender for writing archetypes. However, its designed use is to write constraints on object models, rather than on data, which is what archetypes are about. As a concrete example, OCL can be used to make statements about the actors attribute of a class Company - e.g. that actors must exist and contain the Actor who is the lead of Company. However, if used in the normal way to write constraints on a class model, it cannot describe the notion that for a particular kind of (acting) company, such as 'itinerant jugglers', there must be at least four actors, each of whom have among their capabilities 'advanced juggling', plus an Actor who has skill 'musician'. This is because doing so would constrain all instances of the class Company to conform to the specific configuration of instances corresponding to actors and jugglers, when what is intended is to allow a myriad of possibilities. ADL provides the ability to create numerous archetypes, each describing in detail a concrete configuration of instances of type Company. OCL’s constraint types include function pre- and post-conditions, and class invariants. There is no structural character to the syntax - all statements are essentially first-order predicate logic statements about elements in models expressed in UML, and are related to parts of a model by 'context' statements. This makes it impossible to use OCL to express an archetype in a structural way which is natural to domain experts. OCL also has some flaws, described by Beale (2003). However, OCL is in fact relevant to ADL. ADL archetypes include invariants (and one day, might include pre- and post-conditions). Currently these are expressed in a syntax very similar to OCL, with minor differences. The exact definition of the ADL invariant syntax in the future will depend somewhat on the progress of OCL through the OMG standards process.

+

The OMG’s Object Constraint Language (OCL) appears at first glance to be an obvious contender for writing archetypes. However, its designed use is to write constraints on object models, rather than on data, which is what archetypes are about. As a concrete example, OCL can be used to make statements about the actors attribute of a class Company - e.g. that actors must exist and contain the Actor who is the lead of Company. However, if used in the normal way to write constraints on a class model, it cannot describe the notion that for a particular kind of (acting) company, such as 'itinerant jugglers', there must be at least four actors, each of whom have among their capabilities 'advanced juggling', plus an Actor who has skill 'musician'. This is because doing so would constrain all instances of the class Company to conform to the specific configuration of instances corresponding to actors and jugglers, when what is intended is to allow a myriad of possibilities. ADL provides the ability to create numerous archetypes, each describing in detail a concrete configuration of instances of type Company. OCL’s constraint types include function pre- and post-conditions, and class invariants. There is no structural character to the syntax - all statements are essentially first-order predicate logic statements about elements in models expressed in UML, and are related to parts of a model by 'context' statements. This makes it impossible to use OCL to express an archetype in a structural way which is natural to domain experts. OCL also has some flaws, described by Beale (2003). However, OCL is in fact relevant to ADL. ADL archetypes include invariants (and one day, might include pre- and post-conditions). Currently these are expressed in a syntax very similar to OCL, with minor differences. The exact definition of the ADL invariant syntax in the future will depend somewhat on the progress of OCL through the OMG standards process.

@@ -8795,38 +8795,38 @@

A.3.2. KIF (Knowledge Interchange Format)

-

The Knowledge Interchange Format (KIF) is a knowledge representation language whose goal is to be able to describe formal semantics which would be sharable among software entities, such as information systems in an airline and a travel agency. An example of KIF (taken from (Genesereth, Fikes, & Gruber, 1992)) used to describe the simple concept of 'units' in a class is as follows:

+

The Knowledge Interchange Format (KIF) is a knowledge representation language whose goal is to be able to describe formal semantics which would be sharable among software entities, such as information systems in an airline and a travel agency. An example of KIF (taken from (Genesereth, Fikes, & Gruber, 1992)) used to describe the simple concept of 'units' in a class is as follows:

-
(defrelation BASIC-UNIT
-    (=> (BASIC-UNIT ?u) ; basic units are distinguished units of measure
-        (unit-of-measure ?u)))
+
(defrelation BASIC-UNIT
+    (=> (BASIC-UNIT ?u) ; basic units are distinguished units of measure
+        (unit-of-measure ?u)))
 
-(deffunction UNIT*
-        ; Unit* maps all pairs of units to units
-    (=> (and (unit-of-measure ?u1) (unit-of-measure ?u2))
-        (and (defined (UNIT* ?u1 ?u2)) (unit-of-measure (UNIT* ?u1 ?u2))))
+(deffunction UNIT*
+        ; Unit* maps all pairs of units to units
+    (=> (and (unit-of-measure ?u1) (unit-of-measure ?u2))
+        (and (defined (UNIT* ?u1 ?u2)) (unit-of-measure (UNIT* ?u1 ?u2))))
 
-        ; It is commutative
-    (= (UNIT* ?u1 ?u2) (UNIT* ?u2 ?u1))
+        ; It is commutative
+    (= (UNIT* ?u1 ?u2) (UNIT* ?u2 ?u1))
 
-        ; It is associative
-    (= (UNIT* ?u1 (UNIT* ?u2 ?u3))
-        (UNIT* (UNIT* ?u1 ?u2) ?u3))
+        ; It is associative
+    (= (UNIT* ?u1 (UNIT* ?u2 ?u3))
+        (UNIT* (UNIT* ?u1 ?u2) ?u3))
 )
 
-(deffunction UNIT^
-        ; Unit^ maps all units and reals to units
-    (=> (and (unit-of-measure ?u)
-        (real-number ?r))
-        (and (defined (UNIT^ ?u ?r)) (unit-of-measure (UNIT^ ?u ?r))))
-
-        ; It has the algebraic properties of exponentiation
-    (= (UNIT^ ?u 1) ?u)
-    (= (unit* (UNIT^ ?u ?r1) (UNIT^ ?u ?r2)) (UNIT^ ?u (+ ?r1 ?r2)))
-    (= (UNIT^ (unit* ?u1 ?u2) ?r)
-    (unit* (UNIT^ ?u1 ?r) (UNIT^ ?u2 ?r)))
+(deffunction UNIT^
+        ; Unit^ maps all units and reals to units
+    (=> (and (unit-of-measure ?u)
+        (real-number ?r))
+        (and (defined (UNIT^ ?u ?r)) (unit-of-measure (UNIT^ ?u ?r))))
+
+        ; It has the algebraic properties of exponentiation
+    (= (UNIT^ ?u 1) ?u)
+    (= (unit* (UNIT^ ?u ?r1) (UNIT^ ?u ?r2)) (UNIT^ ?u (+ ?r1 ?r2)))
+    (= (UNIT^ (unit* ?u1 ?u2) ?r)
+    (unit* (UNIT^ ?u1 ?r) (UNIT^ ?u2 ?r)))
 )
@@ -8834,7 +8834,7 @@

-

It should also be realised that KIF is intended as a knowledge exchange format, rather than a knowledge representation format, which is to say that it can (in theory) represent the semantics of any other knowledge representation language, such as OWL. This distinction today seems fine, since Web-enabled languages like OWL probably don’t need an exchange format other than their XML equivalents to be shared. The relationship and relative strengths and deficiencies is explored by e.g. Martin (2003).

+

It should also be realised that KIF is intended as a knowledge exchange format, rather than a knowledge representation format, which is to say that it can (in theory) represent the semantics of any other knowledge representation language, such as OWL. This distinction today seems fine, since Web-enabled languages like OWL probably don’t need an exchange format other than their XML equivalents to be shared. The relationship and relative strengths and deficiencies is explored by e.g. Martin (2003).

@@ -8843,7 +8843,7 @@

<

A.4.1. XML-schema

-

Previously, archetypes have been expressed as XML instance documents conforming to W3C XML schemas, for example in the Good Electronic Health Record project (see Beale & Heard (2000)). The schemas used in those projects correspond technically to the XML expressions of information model-dependent object models shown in The Archetypes: Technical Overview specification. XML archetypes are accordingly equivalent to serialised instances of the parse tree, i.e. particular ADL archetypes serialised from objects into XML instance.

+

Previously, archetypes have been expressed as XML instance documents conforming to W3C XML schemas, for example in the Good Electronic Health Record project (see Beale & Heard (2000)). The schemas used in those projects correspond technically to the XML expressions of information model-dependent object models shown in The Archetypes: Technical Overview specification. XML archetypes are accordingly equivalent to serialised instances of the parse tree, i.e. particular ADL archetypes serialised from objects into XML instance.

@@ -8862,104 +8862,104 @@

B.1.
-
//
-//  description: Antlr4 grammar for Archetype Definition Language (ADL2)
-//  author:      Thomas Beale <thomas.beale@openehr.org>
-//  contributors:Pieter Bos <pieter.bos@nedap.com>
-//  support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
-//  copyright:   Copyright (c) 2015- openEHR Foundation <http://www.openEHR.org>
-//  license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
-//
+
//
+//  description: Antlr4 grammar for Archetype Definition Language (ADL2)
+//  author:      Thomas Beale <thomas.beale@openehr.org>
+//  contributors:Pieter Bos <pieter.bos@nedap.com>
+//  support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
+//  copyright:   Copyright (c) 2015- openEHR Foundation <http://www.openEHR.org>
+//  license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
+//
 
-grammar Adl2;
-import cadl2;
+grammar Adl2;
+import cadl2;
 
-//
-//  ============== Parser rules ==============
-//
+//
+//  ============== Parser rules ==============
+//
 
-adl2Archetype: ( authored_archetype | template | template_overlay | operational_template ) EOF ;
+adl2Archetype: ( authored_archetype | template | template_overlay | operational_template ) EOF ;
 
-authored_archetype:
-    SYM_ARCHETYPE meta_data?
-    archetypeHrid
-    specialize_section?
-    language_section
-    description_section
-    definition_section
-    rules_section?
-    terminology_section
-    annotations_section?
-    ;
+authored_archetype:
+    SYM_ARCHETYPE meta_data?
+    archetypeHrid
+    specialize_section?
+    language_section
+    description_section
+    definition_section
+    rules_section?
+    terminology_section
+    annotations_section?
+    ;
 
 template: 
     SYM_TEMPLATE meta_data? 
-    archetypeHrid
-    specialize_section
-    language_section
-    description_section
-    definition_section
-    rules_section?
-    terminology_section
-    annotations_section?
-    (template_overlay)*
-    ;
+    archetypeHrid
+    specialize_section
+    language_section
+    description_section
+    definition_section
+    rules_section?
+    terminology_section
+    annotations_section?
+    (template_overlay)*
+    ;
 
 template_overlay: 
     SYM_TEMPLATE_OVERLAY 
-    archetypeHrid
-    specialize_section
-    definition_section
-    terminology_section
-    ;
+    archetypeHrid
+    specialize_section
+    definition_section
+    terminology_section
+    ;
 
 operational_template: 
     SYM_OPERATIONAL_TEMPLATE meta_data? 
-    archetypeHrid
-    language_section
-    description_section
-    definition_section
-    rules_section?
-    terminology_section
-    annotations_section?
-    component_terminologies_section?
-    ;
-
-archetypeHrid: ARCHETYPE_HRID;
-
-specialize_section  : SYM_SPECIALIZE archetype_ref ;
-language_section    : SYM_LANGUAGE odin_text ;
-description_section : SYM_DESCRIPTION odin_text ;
-definition_section  : SYM_DEFINITION c_complex_object ;
-rules_section       : SYM_RULES statement_block ;
-terminology_section : SYM_TERMINOLOGY odin_text ;
-annotations_section : SYM_ANNOTATIONS odin_text ;
-component_terminologies_section: SYM_COMPONENT_TERMINOLOGIES odin_text ;
-
-meta_data: '(' meta_data_item  (';' meta_data_item )* ')' ;
-
-meta_data_item:
-      meta_data_tag_adl_version '=' VERSION_ID
-    | meta_data_tag_uid '=' GUID
-    | meta_data_tag_build_uid '=' GUID
-    | meta_data_tag_rm_release '=' VERSION_ID
-    | meta_data_tag_is_controlled
-    | meta_data_tag_is_generated
-    | odin_object_key ( '=' meta_data_value )?
-    ;
-
-meta_data_value:
-      primitive_value
-    | GUID
-    | VERSION_ID
-    ;
-
-meta_data_tag_adl_version   : 'adl_version' ;
-meta_data_tag_uid           : 'uid' ;
-meta_data_tag_build_uid     : 'build_uid' ;
-meta_data_tag_rm_release    : 'rm_release' ;
-meta_data_tag_is_controlled : 'controlled' ;
-meta_data_tag_is_generated  : 'generated' ;
+ archetypeHrid + language_section + description_section + definition_section + rules_section? + terminology_section + annotations_section? + component_terminologies_section? + ; + +archetypeHrid: ARCHETYPE_HRID; + +specialize_section : SYM_SPECIALIZE archetype_ref ; +language_section : SYM_LANGUAGE odin_text ; +description_section : SYM_DESCRIPTION odin_text ; +definition_section : SYM_DEFINITION c_complex_object ; +rules_section : SYM_RULES statement_block ; +terminology_section : SYM_TERMINOLOGY odin_text ; +annotations_section : SYM_ANNOTATIONS odin_text ; +component_terminologies_section: SYM_COMPONENT_TERMINOLOGIES odin_text ; + +meta_data: '(' meta_data_item (';' meta_data_item )* ')' ; + +meta_data_item: + meta_data_tag_adl_version '=' VERSION_ID + | meta_data_tag_uid '=' GUID + | meta_data_tag_build_uid '=' GUID + | meta_data_tag_rm_release '=' VERSION_ID + | meta_data_tag_is_controlled + | meta_data_tag_is_generated + | odin_object_key ( '=' meta_data_value )? + ; + +meta_data_value: + primitive_value + | GUID + | VERSION_ID + ; + +meta_data_tag_adl_version : 'adl_version' ; +meta_data_tag_uid : 'uid' ; +meta_data_tag_build_uid : 'build_uid' ; +meta_data_tag_rm_release : 'rm_release' ; +meta_data_tag_is_controlled : 'controlled' ; +meta_data_tag_is_generated : 'generated' ;
@@ -8970,86 +8970,86 @@

B.2. cADL Synta
-
//
-// description: Antlr4 grammar for cADL non-primitves sub-syntax of Archetype Definition Language (ADL2)
-// author:      Thomas Beale <thomas.beale@openehr.org>
-// contributors:Pieter Bos <pieter.bos@nedap.com>
-// support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
-// copyright:   Copyright (c) 2015 openEHR Foundation <http://www.openEHR.org>
-// license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
-//
+
//
+// description: Antlr4 grammar for cADL non-primitves sub-syntax of Archetype Definition Language (ADL2)
+// author:      Thomas Beale <thomas.beale@openehr.org>
+// contributors:Pieter Bos <pieter.bos@nedap.com>
+// support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
+// copyright:   Copyright (c) 2015 openEHR Foundation <http://www.openEHR.org>
+// license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
+//
 
-grammar cadl2;
-import cadl2_primitives, odin, base_expressions;
+grammar cadl2;
+import cadl2_primitives, odin, base_expressions;
 
-//
-//  ======================= Top-level Objects ========================
-//
+//
+//  ======================= Top-level Objects ========================
+//
 
-c_complex_object: rm_type_id '[' ( ROOT_ID_CODE | ID_CODE ) ']' c_occurrences? ( SYM_MATCHES '{' c_attribute_def+ default_value? '}' )? ;
+c_complex_object: rm_type_id '[' ( ROOT_ID_CODE | ID_CODE ) ']' c_occurrences? ( SYM_MATCHES '{' c_attribute_def+ default_value? '}' )? ;
 
-// ======================== Components =======================
+// ======================== Components =======================
 
-c_objects: c_regular_object_ordered+ | c_inline_primitive_object ;
+c_objects: c_regular_object_ordered+ | c_inline_primitive_object ;
 
-sibling_order: ( SYM_AFTER | SYM_BEFORE ) '[' ID_CODE ']' ;
+sibling_order: ( SYM_AFTER | SYM_BEFORE ) '[' ID_CODE ']' ;
 
-c_regular_object_ordered: sibling_order? c_regular_object ;
+c_regular_object_ordered: sibling_order? c_regular_object ;
 
-c_regular_object:
-      c_complex_object
-    | c_archetype_root
-    | c_complex_object_proxy
-    | archetype_slot
-    | c_regular_primitive_object
-    ;
+c_regular_object:
+      c_complex_object
+    | c_archetype_root
+    | c_complex_object_proxy
+    | archetype_slot
+    | c_regular_primitive_object
+    ;
 
-c_archetype_root: SYM_USE_ARCHETYPE rm_type_id '[' ID_CODE ',' archetype_ref ']' c_occurrences? ;
+c_archetype_root: SYM_USE_ARCHETYPE rm_type_id '[' ID_CODE ',' archetype_ref ']' c_occurrences? ;
 
-archetype_ref : ARCHETYPE_HRID | ARCHETYPE_REF ;
+archetype_ref : ARCHETYPE_HRID | ARCHETYPE_REF ;
 
-c_complex_object_proxy: SYM_USE_NODE rm_type_id '[' ID_CODE ']' c_occurrences? ADL_PATH ;
+c_complex_object_proxy: SYM_USE_NODE rm_type_id '[' ID_CODE ']' c_occurrences? ADL_PATH ;
 
-archetype_slot: SYM_ALLOW_ARCHETYPE rm_type_id '[' ID_CODE ']' (( c_occurrences? ( SYM_MATCHES '{' c_includes? c_excludes? '}' )? ) | SYM_CLOSED ) ;
+archetype_slot: SYM_ALLOW_ARCHETYPE rm_type_id '[' ID_CODE ']' (( c_occurrences? ( SYM_MATCHES '{' c_includes? c_excludes? '}' )? ) | SYM_CLOSED ) ;
 
-c_attribute_def:
-      c_attribute
-    | c_attribute_tuple
-    ;
+c_attribute_def:
+      c_attribute
+    | c_attribute_tuple
+    ;
 
-default_value: SYM_DEFAULT SYM_EQ '<' odin_text '>';
+default_value: SYM_DEFAULT SYM_EQ '<' odin_text '>';
 
-c_regular_primitive_object: rm_type_id '[' ID_CODE ']' c_occurrences? ( SYM_MATCHES '{' c_inline_primitive_object '}' )? ;
+c_regular_primitive_object: rm_type_id '[' ID_CODE ']' c_occurrences? ( SYM_MATCHES '{' c_inline_primitive_object '}' )? ;
 
-// We match regexes here, even though technically they are C_STRING instances. This is because the only
-// workable solution to match a regex unambiguously appears to be to match with enclosing {}, which means
-// as a C_OBJECT alternative, not as a C_STRING.
-c_attribute: (ADL_PATH | rm_attribute_id) c_existence? c_cardinality? ( SYM_MATCHES ( '{' c_objects '}' | CONTAINED_REGEXP) )? ;
+// We match regexes here, even though technically they are C_STRING instances. This is because the only
+// workable solution to match a regex unambiguously appears to be to match with enclosing {}, which means
+// as a C_OBJECT alternative, not as a C_STRING.
+c_attribute: (ADL_PATH | rm_attribute_id) c_existence? c_cardinality? ( SYM_MATCHES ( '{' c_objects '}' | CONTAINED_REGEXP) )? ;
 
-c_attribute_tuple : '[' rm_attribute_id ( ',' rm_attribute_id )* ']' SYM_MATCHES '{' c_primitive_tuple ( ',' c_primitive_tuple )* '}' ;
+c_attribute_tuple : '[' rm_attribute_id ( ',' rm_attribute_id )* ']' SYM_MATCHES '{' c_primitive_tuple ( ',' c_primitive_tuple )* '}' ;
 
-c_primitive_tuple : '[' c_primitive_tuple_item ( ',' c_primitive_tuple_item )* ']' ;
+c_primitive_tuple : '[' c_primitive_tuple_item ( ',' c_primitive_tuple_item )* ']' ;
 
-c_primitive_tuple_item: '{' c_inline_primitive_object '}' | CONTAINED_REGEXP;
+c_primitive_tuple_item: '{' c_inline_primitive_object '}' | CONTAINED_REGEXP;
 
-c_includes : SYM_INCLUDE assertion+ ;
-c_excludes : SYM_EXCLUDE assertion+ ;
+c_includes : SYM_INCLUDE assertion+ ;
+c_excludes : SYM_EXCLUDE assertion+ ;
 
-c_existence: SYM_EXISTENCE SYM_MATCHES '{' existence '}' ;
-existence: INTEGER | INTEGER '..' INTEGER ;
+c_existence: SYM_EXISTENCE SYM_MATCHES '{' existence '}' ;
+existence: INTEGER | INTEGER '..' INTEGER ;
 
-c_cardinality    : SYM_CARDINALITY SYM_MATCHES '{' cardinality '}' ;
-cardinality      : multiplicity ( multiplicity_mod multiplicity_mod? )? ; // max of two
-ordering_mod     : ';' ( SYM_ORDERED | SYM_UNORDERED ) ;
-unique_mod       : ';' SYM_UNIQUE ;
-multiplicity_mod : ordering_mod | unique_mod ;
+c_cardinality    : SYM_CARDINALITY SYM_MATCHES '{' cardinality '}' ;
+cardinality      : multiplicity ( multiplicity_mod multiplicity_mod? )? ; // max of two
+ordering_mod     : ';' ( SYM_ORDERED | SYM_UNORDERED ) ;
+unique_mod       : ';' SYM_UNIQUE ;
+multiplicity_mod : ordering_mod | unique_mod ;
 
-c_occurrences : SYM_OCCURRENCES SYM_MATCHES '{' multiplicity '}' ;
-multiplicity  : INTEGER | '*' | INTEGER '..' ( INTEGER | '*' ) ;
+c_occurrences : SYM_OCCURRENCES SYM_MATCHES '{' multiplicity '}' ;
+multiplicity  : INTEGER | '*' | INTEGER '..' ( INTEGER | '*' ) ;
 
-//
-// ---------- Lexer patterns -----------------
-//
+// +// ---------- Lexer patterns ----------------- +//
@@ -9060,63 +9060,63 @@

-
//
-// description: Antlr4 grammar for cADL primitives sub-syntax of Archetype Definition Language (ADL2)
-// author:      Thomas Beale <thomas.beale@openehr.org>
-// contributors:Pieter Bos <pieter.bos@nedap.com>
-// support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
-// copyright:   Copyright (c) 2015 openEHR Foundation
-// license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
-//
+
//
+// description: Antlr4 grammar for cADL primitives sub-syntax of Archetype Definition Language (ADL2)
+// author:      Thomas Beale <thomas.beale@openehr.org>
+// contributors:Pieter Bos <pieter.bos@nedap.com>
+// support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
+// copyright:   Copyright (c) 2015 openEHR Foundation
+// license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
+//
 
-grammar cadl2_primitives;
-import adl_keywords, odin_values;
+grammar cadl2_primitives;
+import adl_keywords, odin_values;
 
-//
-//  ======================= Parser rules ========================
-//
+//
+//  ======================= Parser rules ========================
+//
 
-c_inline_primitive_object:
-      c_integer
-    | c_real
-    | c_date
-    | c_time
-    | c_date_time
-    | c_duration
-    | c_string
-    | c_terminology_code
-    | c_boolean
-    ;
+c_inline_primitive_object:
+      c_integer
+    | c_real
+    | c_date
+    | c_time
+    | c_date_time
+    | c_duration
+    | c_string
+    | c_terminology_code
+    | c_boolean
+    ;
 
-c_integer: ( integer_value | integer_list_value | integer_interval_value | integer_interval_list_value ) assumed_integer_value? ;
-assumed_integer_value: ';' integer_value ;
+c_integer: ( integer_value | integer_list_value | integer_interval_value | integer_interval_list_value ) assumed_integer_value? ;
+assumed_integer_value: ';' integer_value ;
 
-c_real: ( real_value | real_list_value | real_interval_value | real_interval_list_value ) assumed_real_value? ;
-assumed_real_value: ';' real_value ;
+c_real: ( real_value | real_list_value | real_interval_value | real_interval_list_value ) assumed_real_value? ;
+assumed_real_value: ';' real_value ;
 
-c_date_time: ( DATE_TIME_CONSTRAINT_PATTERN | date_time_value | date_time_list_value | date_time_interval_value | date_time_interval_list_value ) assumed_date_time_value? ;
-assumed_date_time_value: ';' date_time_value ;
+c_date_time: ( DATE_TIME_CONSTRAINT_PATTERN | date_time_value | date_time_list_value | date_time_interval_value | date_time_interval_list_value ) assumed_date_time_value? ;
+assumed_date_time_value: ';' date_time_value ;
 
-c_date: ( DATE_CONSTRAINT_PATTERN | date_value | date_list_value | date_interval_value | date_interval_list_value ) assumed_date_value? ;
-assumed_date_value: ';' date_value ;
+c_date: ( DATE_CONSTRAINT_PATTERN | date_value | date_list_value | date_interval_value | date_interval_list_value ) assumed_date_value? ;
+assumed_date_value: ';' date_value ;
 
-c_time: ( TIME_CONSTRAINT_PATTERN | time_value | time_list_value | time_interval_value | time_interval_list_value ) assumed_time_value? ;
-assumed_time_value: ';' time_value ;
+c_time: ( TIME_CONSTRAINT_PATTERN | time_value | time_list_value | time_interval_value | time_interval_list_value ) assumed_time_value? ;
+assumed_time_value: ';' time_value ;
 
-c_duration: ( DURATION_CONSTRAINT_PATTERN ( '/' ( duration_interval_value | duration_value ))?
-    | duration_value | duration_list_value | duration_interval_value | duration_interval_list_value ) assumed_duration_value?
-    ;
-assumed_duration_value: ';' duration_value ;
+c_duration: ( DURATION_CONSTRAINT_PATTERN ( '/' ( duration_interval_value | duration_value ))?
+    | duration_value | duration_list_value | duration_interval_value | duration_interval_list_value ) assumed_duration_value?
+    ;
+assumed_duration_value: ';' duration_value ;
 
-c_string: ( string_value | string_list_value ) assumed_string_value? ;
-assumed_string_value: ';' string_value ;
+c_string: ( string_value | string_list_value ) assumed_string_value? ;
+assumed_string_value: ';' string_value ;
 
-// ADL2 term types: [ac3], [ac3; at5], [at5]
-// NOTE: an assumed at-code (the ';' AT_CODE pattern) can only occur after an ac-code not after the single at-code
-c_terminology_code: '[' ( AC_CODE ( ';' AT_CODE )? | AT_CODE ) ']' ;
+// ADL2 term types: [ac3], [ac3; at5], [at5]
+// NOTE: an assumed at-code (the ';' AT_CODE pattern) can only occur after an ac-code not after the single at-code
+c_terminology_code: '[' ( AC_CODE ( ';' AT_CODE )? | AT_CODE ) ']' ;
 
-c_boolean: ( boolean_value | boolean_list_value ) assumed_boolean_value? ;
-assumed_boolean_value: ';' boolean_value ;
+c_boolean: ( boolean_value | boolean_list_value ) assumed_boolean_value? ; +assumed_boolean_value: ';' boolean_value ;
@@ -9127,188 +9127,188 @@

B.4. Rules Sy
-
//
-//  description: Antlr4 grammar for openEHR Rules core syntax.
-//  author:      Thomas Beale <thomas.beale@openehr.org>
-//  contributors:Pieter Bos <pieter.bos@nedap.com>
-//  support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
-//  copyright:   Copyright (c) 2016- openEHR Foundation <http://www.openEHR.org>
-//  license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
-//
-
-grammar base_expressions;
-import cadl2_primitives, odin_values;
-
-//
-//  ======================= Top-level _objects ========================
-//
-
-statement_block: statement+ ;
-
-// ------------------------- statements ---------------------------
-statement: declaration | assignment | assertion;
-
-declaration:
-      variable_declaration
-    | constant_declaration
-    ;
-
-variable_declaration: local_variable ':' type_id ( SYM_ASSIGNMENT expression )? ;
-
-constant_declaration: constant_name ':' type_id  ( SYM_EQ primitive_object )? ;
-
-assignment:
-      binding
-    | local_assignment
-    ;
-
-//
-// The following is the means of binding a data context path to a local variable
-// TODO: remove this rule when proper external bindings are supported
-binding: local_variable SYM_ASSIGNMENT bound_path ;
-
-local_assignment: local_variable SYM_ASSIGNMENT expression ;
-
-assertion: ( ( ALPHA_LC_ID | ALPHA_UC_ID ) ':' )? boolean_expr ;
-
-//
-// -------------------------- _expressions --------------------------
-//
-expression:
-      boolean_expr
-    | arithmetic_expr
-    ;
-
-//
-// _expressions evaluating to boolean values, using standard precedence
-// The equality_binop ones are not strictly necessary, but allow the use
-// of boolean_leaf = true, which some people like
-//
-boolean_expr:
-      SYM_NOT boolean_expr
-    | boolean_expr SYM_AND boolean_expr
-    | boolean_expr SYM_XOR boolean_expr
-    | boolean_expr SYM_OR boolean_expr
-    | boolean_expr SYM_IMPLIES boolean_expr
-    | boolean_leaf equality_binop boolean_leaf
-    | boolean_leaf
-    ;
-
-//
-// Atomic Boolean-valued expression elements
-// TODO: SYM_EXISTS alternative to be replaced by defined() predicate
-boolean_leaf:
-      boolean_literal
-    | for_all_expr
-    | there_exists_expr
-    | SYM_EXISTS ( bound_path | sub_path_local_variable )
-    | '(' boolean_expr ')'
-    | relational_expr
-    | equality_expr
-    | constraint_expr
-    | value_ref
-    ;
-
-boolean_literal:
-      SYM_TRUE
-    | SYM_FALSE
-    ;
-
-//
-//  Universal and existential quantifier
-// TODO: 'in' probably isn't needed in the long term
-for_all_expr: SYM_FOR_ALL VARIABLE_ID ( ':' | 'in' ) value_ref '|'? boolean_expr ;
-
-there_exists_expr: SYM_THERE_EXISTS VARIABLE_ID ( ':' | 'in' ) value_ref '|'? boolean_expr ;
-
-// Constraint expressions
-// This provides a way of using one operator (matches) to compare a
-// value (LHS) with a value range (RHS). As per ADL, the value range
-// for ordered types like Integer, Date etc may be a single value,
-// a list of values, or a list of intervals, and in future, potentially
-// other comparators, including functions (e.g. divisible_by_N).
-//
-// For non-ordered types like String and Terminology_code, the RHS
-// is in other forms, e.g. regex for Strings.
-//
-// The matches operator can be used to generate a Boolean value that
-// may be used within an expression like any other Boolean (hence it
-// is a booleanLeaf).
-// TODO: non-primitive objects might be supported on the RHS in future.
-constraint_expr: ( arithmetic_expr | value_ref ) SYM_MATCHES  ( '{' c_inline_primitive_object '}' | CONTAINED_REGEXP );
-
-//
-// _expressions evaluating to arithmetic values, using standard precedence
-//
-arithmetic_expr:
-      <assoc=right> arithmetic_expr '^' arithmetic_expr
-    | arithmetic_expr ( '/' | '*' | '%' ) arithmetic_expr
-    | arithmetic_expr ( '+' | '-' ) arithmetic_expr
-    | arithmetic_leaf
-    ;
-
-arithmetic_leaf:
-      integer_value
-    | real_value
-    | date_value
-    | date_time_value
-    | time_value
-    | duration_value
-    | value_ref
-    | '(' arithmetic_expr ')'
-    ;
-
-//
-// Equality expression between any arithmetic value; precedence is
-// lowest, so only needed between leaves, since () will be needed for
-// larger expressions anyway
-//
-equality_expr: arithmetic_expr equality_binop arithmetic_expr ;
-
-equality_binop:
-      SYM_EQ
-    | SYM_NE
-    ;
-
-//
-// Relational expressions of arithmetic operands generating Boolean values
-//
-relational_expr: arithmetic_expr relational_binop arithmetic_expr ;
-
-relational_binop:
-      SYM_GT
-    | SYM_LT
-    | SYM_LE
-    | SYM_GE
-    ;
-
-//
-// instances references: data references, variables, and function calls.
-// TODO: Remove bound_path from this rule when external binding supported
-//
-value_ref:
-      function_call
-    | bound_path
-    | sub_path_local_variable
-    | local_variable
-    | constant_name
-    ;
-
-local_variable: VARIABLE_ID ;
-
-// TODO: change to [] form, e.g.     book_list [{title.contains("Quixote")}]
-sub_path_local_variable: VARIABLE_WITH_PATH;
-
-// TODO: Remove this rule when external binding supported
-bound_path: ADL_PATH ;
-
-constant_name: ALPHA_UC_ID ;
-
-function_call: ALPHA_LC_ID '(' function_args? ')' ;
-
-function_args: expression ( ',' expression )* ;
-
-type_id: ALPHA_UC_ID ( '<' type_id ( ',' type_id )* '>' )? ;
+
//
+//  description: Antlr4 grammar for openEHR Rules core syntax.
+//  author:      Thomas Beale <thomas.beale@openehr.org>
+//  contributors:Pieter Bos <pieter.bos@nedap.com>
+//  support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
+//  copyright:   Copyright (c) 2016- openEHR Foundation <http://www.openEHR.org>
+//  license:     Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
+//
+
+grammar base_expressions;
+import cadl2_primitives, odin_values;
+
+//
+//  ======================= Top-level _objects ========================
+//
+
+statement_block: statement+ ;
+
+// ------------------------- statements ---------------------------
+statement: declaration | assignment | assertion;
+
+declaration:
+      variable_declaration
+    | constant_declaration
+    ;
+
+variable_declaration: local_variable ':' type_id ( SYM_ASSIGNMENT expression )? ;
+
+constant_declaration: constant_name ':' type_id  ( SYM_EQ primitive_object )? ;
+
+assignment:
+      binding
+    | local_assignment
+    ;
+
+//
+// The following is the means of binding a data context path to a local variable
+// TODO: remove this rule when proper external bindings are supported
+binding: local_variable SYM_ASSIGNMENT bound_path ;
+
+local_assignment: local_variable SYM_ASSIGNMENT expression ;
+
+assertion: ( ( ALPHA_LC_ID | ALPHA_UC_ID ) ':' )? boolean_expr ;
+
+//
+// -------------------------- _expressions --------------------------
+//
+expression:
+      boolean_expr
+    | arithmetic_expr
+    ;
+
+//
+// _expressions evaluating to boolean values, using standard precedence
+// The equality_binop ones are not strictly necessary, but allow the use
+// of boolean_leaf = true, which some people like
+//
+boolean_expr:
+      SYM_NOT boolean_expr
+    | boolean_expr SYM_AND boolean_expr
+    | boolean_expr SYM_XOR boolean_expr
+    | boolean_expr SYM_OR boolean_expr
+    | boolean_expr SYM_IMPLIES boolean_expr
+    | boolean_leaf equality_binop boolean_leaf
+    | boolean_leaf
+    ;
+
+//
+// Atomic Boolean-valued expression elements
+// TODO: SYM_EXISTS alternative to be replaced by defined() predicate
+boolean_leaf:
+      boolean_literal
+    | for_all_expr
+    | there_exists_expr
+    | SYM_EXISTS ( bound_path | sub_path_local_variable )
+    | '(' boolean_expr ')'
+    | relational_expr
+    | equality_expr
+    | constraint_expr
+    | value_ref
+    ;
+
+boolean_literal:
+      SYM_TRUE
+    | SYM_FALSE
+    ;
+
+//
+//  Universal and existential quantifier
+// TODO: 'in' probably isn't needed in the long term
+for_all_expr: SYM_FOR_ALL VARIABLE_ID ( ':' | 'in' ) value_ref '|'? boolean_expr ;
+
+there_exists_expr: SYM_THERE_EXISTS VARIABLE_ID ( ':' | 'in' ) value_ref '|'? boolean_expr ;
+
+// Constraint expressions
+// This provides a way of using one operator (matches) to compare a
+// value (LHS) with a value range (RHS). As per ADL, the value range
+// for ordered types like Integer, Date etc may be a single value,
+// a list of values, or a list of intervals, and in future, potentially
+// other comparators, including functions (e.g. divisible_by_N).
+//
+// For non-ordered types like String and Terminology_code, the RHS
+// is in other forms, e.g. regex for Strings.
+//
+// The matches operator can be used to generate a Boolean value that
+// may be used within an expression like any other Boolean (hence it
+// is a booleanLeaf).
+// TODO: non-primitive objects might be supported on the RHS in future.
+constraint_expr: ( arithmetic_expr | value_ref ) SYM_MATCHES  ( '{' c_inline_primitive_object '}' | CONTAINED_REGEXP );
+
+//
+// _expressions evaluating to arithmetic values, using standard precedence
+//
+arithmetic_expr:
+      <assoc=right> arithmetic_expr '^' arithmetic_expr
+    | arithmetic_expr ( '/' | '*' | '%' ) arithmetic_expr
+    | arithmetic_expr ( '+' | '-' ) arithmetic_expr
+    | arithmetic_leaf
+    ;
+
+arithmetic_leaf:
+      integer_value
+    | real_value
+    | date_value
+    | date_time_value
+    | time_value
+    | duration_value
+    | value_ref
+    | '(' arithmetic_expr ')'
+    ;
+
+//
+// Equality expression between any arithmetic value; precedence is
+// lowest, so only needed between leaves, since () will be needed for
+// larger expressions anyway
+//
+equality_expr: arithmetic_expr equality_binop arithmetic_expr ;
+
+equality_binop:
+      SYM_EQ
+    | SYM_NE
+    ;
+
+//
+// Relational expressions of arithmetic operands generating Boolean values
+//
+relational_expr: arithmetic_expr relational_binop arithmetic_expr ;
+
+relational_binop:
+      SYM_GT
+    | SYM_LT
+    | SYM_LE
+    | SYM_GE
+    ;
+
+//
+// instances references: data references, variables, and function calls.
+// TODO: Remove bound_path from this rule when external binding supported
+//
+value_ref:
+      function_call
+    | bound_path
+    | sub_path_local_variable
+    | local_variable
+    | constant_name
+    ;
+
+local_variable: VARIABLE_ID ;
+
+// TODO: change to [] form, e.g.     book_list [{title.contains("Quixote")}]
+sub_path_local_variable: VARIABLE_WITH_PATH;
+
+// TODO: Remove this rule when external binding supported
+bound_path: ADL_PATH ;
+
+constant_name: ALPHA_UC_ID ;
+
+function_call: ALPHA_LC_ID '(' function_args? ')' ;
+
+function_args: expression ( ',' expression )* ;
+
+type_id: ALPHA_UC_ID ( '<' type_id ( ',' type_id )* '>' )? ;
@@ -9319,128 +9319,128 @@

B.5. Value type
-
//
-// grammar defining ODIN terminal value types, including atoms, lists and intervals
-// author:      Pieter Bos <pieter.bos@nedap.com>
-// support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
-// copyright:   Copyright (c) 2018- openEHR Foundation <http://www.openEHR.org>
-//
-
-grammar odin_values;
-import base_lexer;
-
-//
-// ========================= Parser ============================
-//
-
-primitive_object :
-      primitive_value
-    | primitive_list_value
-    | primitive_interval_value
-    ;
-
-primitive_value :
-      string_value
-    | integer_value
-    | real_value
-    | boolean_value
-    | character_value
-    | term_code_value
-    | date_value
-    | time_value
-    | date_time_value
-    | duration_value
-    ;
-
-primitive_list_value :
-      string_list_value
-    | integer_list_value
-    | real_list_value
-    | boolean_list_value
-    | character_list_value
-    | term_code_list_value
-    | date_list_value
-    | time_list_value
-    | date_time_list_value
-    | duration_list_value
-    ;
-
-primitive_interval_value :
-      integer_interval_value
-    | real_interval_value
-    | date_interval_value
-    | time_interval_value
-    | date_time_interval_value
-    | duration_interval_value
-    ;
-
-string_value : STRING ;
-string_list_value : string_value ( ( ',' string_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-integer_value : ( '+' | '-' )? INTEGER ;
-integer_list_value : integer_value ( ( ',' integer_value )+ | ',' SYM_LIST_CONTINUE ) ;
-integer_interval_value :
-      '|' SYM_GT? integer_value '..' SYM_LT? integer_value '|'
-    | '|' relop? integer_value '|'
-    | '|' integer_value SYM_PLUS_OR_MINUS integer_value '|'
-    ;
-integer_interval_list_value : integer_interval_value ( ( ',' integer_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-real_value : ( '+' | '-' )? REAL ;
-real_list_value : real_value ( ( ',' real_value )+ | ',' SYM_LIST_CONTINUE ) ;
-real_interval_value :
-      '|' SYM_GT? real_value '..' SYM_LT? real_value '|'
-    | '|' relop? real_value '|'
-    | '|' real_value SYM_PLUS_OR_MINUS real_value '|'
-    ;
-real_interval_list_value : real_interval_value ( ( ',' real_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-boolean_value : SYM_TRUE | SYM_FALSE ;
-boolean_list_value : boolean_value ( ( ',' boolean_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-character_value : CHARACTER ;
-character_list_value : character_value ( ( ',' character_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-date_value : ISO8601_DATE ;
-date_list_value : date_value ( ( ',' date_value )+ | ',' SYM_LIST_CONTINUE ) ;
-date_interval_value :
-      '|' SYM_GT? date_value '..' SYM_LT? date_value '|'
-    | '|' relop? date_value '|'
-    | '|' date_value SYM_PLUS_OR_MINUS duration_value '|'
-    ;
-date_interval_list_value : date_interval_value ( ( ',' date_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-time_value : ISO8601_TIME ;
-time_list_value : time_value ( ( ',' time_value )+ | ',' SYM_LIST_CONTINUE ) ;
-time_interval_value :
-      '|' SYM_GT? time_value '..' SYM_LT? time_value '|'
-    | '|' relop? time_value '|'
-    | '|' time_value SYM_PLUS_OR_MINUS duration_value '|'
-    ;
-time_interval_list_value : time_interval_value ( ( ',' time_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-date_time_value : ISO8601_DATE_TIME ;
-date_time_list_value : date_time_value ( ( ',' date_time_value )+ | ',' SYM_LIST_CONTINUE ) ;
-date_time_interval_value :
-      '|' SYM_GT? date_time_value '..' SYM_LT? date_time_value '|'
-    | '|' relop? date_time_value '|'
-    | '|' date_time_value SYM_PLUS_OR_MINUS duration_value '|'
-    ;
-date_time_interval_list_value : date_time_interval_value ( ( ',' date_time_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-duration_value : ISO8601_DURATION ;
-duration_list_value : duration_value ( ( ',' duration_value )+ | ',' SYM_LIST_CONTINUE ) ;
-duration_interval_value :
-      '|' SYM_GT? duration_value '..' SYM_LT? duration_value '|'
-    | '|' relop? duration_value '|'
-    | '|' duration_value SYM_PLUS_OR_MINUS duration_value '|'
-    ;
-duration_interval_list_value : duration_interval_value ( ( ',' duration_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-term_code_value : TERM_CODE_REF ;
-term_code_list_value : term_code_value ( ( ',' term_code_value )+ | ',' SYM_LIST_CONTINUE ) ;
-
-relop : SYM_GT | SYM_LT | SYM_LE | SYM_GE ;
+
//
+// grammar defining ODIN terminal value types, including atoms, lists and intervals
+// author:      Pieter Bos <pieter.bos@nedap.com>
+// support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
+// copyright:   Copyright (c) 2018- openEHR Foundation <http://www.openEHR.org>
+//
+
+grammar odin_values;
+import base_lexer;
+
+//
+// ========================= Parser ============================
+//
+
+primitive_object :
+      primitive_value
+    | primitive_list_value
+    | primitive_interval_value
+    ;
+
+primitive_value :
+      string_value
+    | integer_value
+    | real_value
+    | boolean_value
+    | character_value
+    | term_code_value
+    | date_value
+    | time_value
+    | date_time_value
+    | duration_value
+    ;
+
+primitive_list_value :
+      string_list_value
+    | integer_list_value
+    | real_list_value
+    | boolean_list_value
+    | character_list_value
+    | term_code_list_value
+    | date_list_value
+    | time_list_value
+    | date_time_list_value
+    | duration_list_value
+    ;
+
+primitive_interval_value :
+      integer_interval_value
+    | real_interval_value
+    | date_interval_value
+    | time_interval_value
+    | date_time_interval_value
+    | duration_interval_value
+    ;
+
+string_value : STRING ;
+string_list_value : string_value ( ( ',' string_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+integer_value : ( '+' | '-' )? INTEGER ;
+integer_list_value : integer_value ( ( ',' integer_value )+ | ',' SYM_LIST_CONTINUE ) ;
+integer_interval_value :
+      '|' SYM_GT? integer_value '..' SYM_LT? integer_value '|'
+    | '|' relop? integer_value '|'
+    | '|' integer_value SYM_PLUS_OR_MINUS integer_value '|'
+    ;
+integer_interval_list_value : integer_interval_value ( ( ',' integer_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+real_value : ( '+' | '-' )? REAL ;
+real_list_value : real_value ( ( ',' real_value )+ | ',' SYM_LIST_CONTINUE ) ;
+real_interval_value :
+      '|' SYM_GT? real_value '..' SYM_LT? real_value '|'
+    | '|' relop? real_value '|'
+    | '|' real_value SYM_PLUS_OR_MINUS real_value '|'
+    ;
+real_interval_list_value : real_interval_value ( ( ',' real_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+boolean_value : SYM_TRUE | SYM_FALSE ;
+boolean_list_value : boolean_value ( ( ',' boolean_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+character_value : CHARACTER ;
+character_list_value : character_value ( ( ',' character_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+date_value : ISO8601_DATE ;
+date_list_value : date_value ( ( ',' date_value )+ | ',' SYM_LIST_CONTINUE ) ;
+date_interval_value :
+      '|' SYM_GT? date_value '..' SYM_LT? date_value '|'
+    | '|' relop? date_value '|'
+    | '|' date_value SYM_PLUS_OR_MINUS duration_value '|'
+    ;
+date_interval_list_value : date_interval_value ( ( ',' date_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+time_value : ISO8601_TIME ;
+time_list_value : time_value ( ( ',' time_value )+ | ',' SYM_LIST_CONTINUE ) ;
+time_interval_value :
+      '|' SYM_GT? time_value '..' SYM_LT? time_value '|'
+    | '|' relop? time_value '|'
+    | '|' time_value SYM_PLUS_OR_MINUS duration_value '|'
+    ;
+time_interval_list_value : time_interval_value ( ( ',' time_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+date_time_value : ISO8601_DATE_TIME ;
+date_time_list_value : date_time_value ( ( ',' date_time_value )+ | ',' SYM_LIST_CONTINUE ) ;
+date_time_interval_value :
+      '|' SYM_GT? date_time_value '..' SYM_LT? date_time_value '|'
+    | '|' relop? date_time_value '|'
+    | '|' date_time_value SYM_PLUS_OR_MINUS duration_value '|'
+    ;
+date_time_interval_list_value : date_time_interval_value ( ( ',' date_time_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+duration_value : ISO8601_DURATION ;
+duration_list_value : duration_value ( ( ',' duration_value )+ | ',' SYM_LIST_CONTINUE ) ;
+duration_interval_value :
+      '|' SYM_GT? duration_value '..' SYM_LT? duration_value '|'
+    | '|' relop? duration_value '|'
+    | '|' duration_value SYM_PLUS_OR_MINUS duration_value '|'
+    ;
+duration_interval_list_value : duration_interval_value ( ( ',' duration_interval_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+term_code_value : TERM_CODE_REF ;
+term_code_list_value : term_code_value ( ( ',' term_code_value )+ | ',' SYM_LIST_CONTINUE ) ;
+
+relop : SYM_GT | SYM_LT | SYM_LE | SYM_GE ;
@@ -9451,235 +9451,235 @@

B.6. Base Lexer
-
//
-//  General purpose patterns used in all openEHR parser and lexer tools
-//  author:      Pieter Bos <pieter.bos@nedap.com>
-//  support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
-//  copyright:   Copyright (c) 2018- openEHR Foundation <http://www.openEHR.org>
-//
+
//
+//  General purpose patterns used in all openEHR parser and lexer tools
+//  author:      Pieter Bos <pieter.bos@nedap.com>
+//  support:     openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
+//  copyright:   Copyright (c) 2018- openEHR Foundation <http://www.openEHR.org>
+//
 
-lexer grammar base_lexer;
+lexer grammar base_lexer;
 
-// ---------- whitespace & comments ----------
+// ---------- whitespace & comments ----------
 
-WS         : [ \t\r]+    -> channel(HIDDEN) ;
-LINE       : '\r'? EOL  -> channel(HIDDEN) ;  // increment line count
-CMT_LINE   : '--' .*? '\r'? EOL  -> skip ;   // (increment line count)
-fragment EOL : '\n' ;
+WS         : [ \t\r]+    -> channel(HIDDEN) ;
+LINE       : '\r'? EOL  -> channel(HIDDEN) ;  // increment line count
+CMT_LINE   : '--' .*? '\r'? EOL  -> skip ;   // (increment line count)
+fragment EOL : '\n' ;
 
 
-// -------------- template overlay cannot be handled in a more simple way because it includes the comment line
-SYM_TEMPLATE_OVERLAY : H_CMT_LINE (WS|LINE)* SYM_TEMPLATE_OVERLAY_ONLY;
-fragment H_CMT_LINE : '--------' '-'*? ('\n'|'\r''\n'|'\r')  ;  // special type of comment for splitting template overlays
-fragment SYM_TEMPLATE_OVERLAY_ONLY     : [Tt][Ee][Mm][Pp][Ll][Aa][Tt][Ee]'_'[Oo][Vv][Ee][Rr][Ll][Aa][Yy] ;
+// -------------- template overlay cannot be handled in a more simple way because it includes the comment line
+SYM_TEMPLATE_OVERLAY : H_CMT_LINE (WS|LINE)* SYM_TEMPLATE_OVERLAY_ONLY;
+fragment H_CMT_LINE : '--------' '-'*? ('\n'|'\r''\n'|'\r')  ;  // special type of comment for splitting template overlays
+fragment SYM_TEMPLATE_OVERLAY_ONLY     : [Tt][Ee][Mm][Pp][Ll][Aa][Tt][Ee]'_'[Oo][Vv][Ee][Rr][Ll][Aa][Yy] ;
 
-// ---------- path patterns -----------
+// ---------- path patterns -----------
 
-ADL_PATH : ADL_ABSOLUTE_PATH | ADL_RELATIVE_PATH;
-fragment ADL_ABSOLUTE_PATH : ('/' ADL_PATH_SEGMENT)+;
-fragment ADL_RELATIVE_PATH : ADL_PATH_SEGMENT ('/' ADL_PATH_SEGMENT)+;
+ADL_PATH : ADL_ABSOLUTE_PATH | ADL_RELATIVE_PATH;
+fragment ADL_ABSOLUTE_PATH : ('/' ADL_PATH_SEGMENT)+;
+fragment ADL_RELATIVE_PATH : ADL_PATH_SEGMENT ('/' ADL_PATH_SEGMENT)+;
 
-fragment ADL_PATH_SEGMENT      : ALPHA_LC_ID ('[' ADL_PATH_ATTRIBUTE ']')?;
-fragment ADL_PATH_ATTRIBUTE    : ID_CODE | STRING | INTEGER | ARCHETYPE_REF | ARCHETYPE_HRID;
+fragment ADL_PATH_SEGMENT      : ALPHA_LC_ID ('[' ADL_PATH_ATTRIBUTE ']')?;
+fragment ADL_PATH_ATTRIBUTE    : ID_CODE | STRING | INTEGER | ARCHETYPE_REF | ARCHETYPE_HRID;
 
 
-// ---------- ISO8601-based date/time/duration constraint patterns
+// ---------- ISO8601-based date/time/duration constraint patterns
 
-DATE_CONSTRAINT_PATTERN      : YEAR_PATTERN '-' MONTH_PATTERN '-' DAY_PATTERN ;
-TIME_CONSTRAINT_PATTERN      : HOUR_PATTERN ':' MINUTE_PATTERN ':' SECOND_PATTERN TZ_PATTERN? ;
-DATE_TIME_CONSTRAINT_PATTERN : DATE_CONSTRAINT_PATTERN 'T' TIME_CONSTRAINT_PATTERN ;
+DATE_CONSTRAINT_PATTERN      : YEAR_PATTERN '-' MONTH_PATTERN '-' DAY_PATTERN ;
+TIME_CONSTRAINT_PATTERN      : HOUR_PATTERN ':' MINUTE_PATTERN ':' SECOND_PATTERN TZ_PATTERN? ;
+DATE_TIME_CONSTRAINT_PATTERN : DATE_CONSTRAINT_PATTERN 'T' TIME_CONSTRAINT_PATTERN ;
 
-fragment YEAR_PATTERN   : 'yyyy' | 'YYYY' | 'yyy' | 'YYY' ;
-fragment MONTH_PATTERN  : 'mm' | 'MM' | '??' | 'XX' | 'xx' ;
-fragment DAY_PATTERN    : 'dd' | 'DD' | '??' | 'XX' | 'xx'  ;
-fragment HOUR_PATTERN   : 'hh' | 'HH' | '??' | 'XX' | 'xx'  ;
-fragment MINUTE_PATTERN : 'mm' | 'MM' | '??' | 'XX' | 'xx'  ;
-fragment SECOND_PATTERN : 'ss' | 'SS' | '??' | 'XX' | 'xx'  ;
-fragment TZ_PATTERN     : '±' ('hh' | 'HH') (':'? ('mm' | 'MM'))? | 'Z' ;
+fragment YEAR_PATTERN   : 'yyyy' | 'YYYY' | 'yyy' | 'YYY' ;
+fragment MONTH_PATTERN  : 'mm' | 'MM' | '??' | 'XX' | 'xx' ;
+fragment DAY_PATTERN    : 'dd' | 'DD' | '??' | 'XX' | 'xx'  ;
+fragment HOUR_PATTERN   : 'hh' | 'HH' | '??' | 'XX' | 'xx'  ;
+fragment MINUTE_PATTERN : 'mm' | 'MM' | '??' | 'XX' | 'xx'  ;
+fragment SECOND_PATTERN : 'ss' | 'SS' | '??' | 'XX' | 'xx'  ;
+fragment TZ_PATTERN     : '±' ('hh' | 'HH') (':'? ('mm' | 'MM'))? | 'Z' ;
 
-DURATION_CONSTRAINT_PATTERN  : 'P' [yY]?[mM]?[Ww]?[dD]? ( 'T' [hH]?[mM]?[sS]? )? ;
+DURATION_CONSTRAINT_PATTERN  : 'P' [yY]?[mM]?[Ww]?[dD]? ( 'T' [hH]?[mM]?[sS]? )? ;
 
-// ---------- Delimited Regex matcher ------------
-// In ADL, a regexp can only exist between {}.
-// allows for '/' or '^' delimiters
-// logical form - REGEX: '/' ( '\\/' | ~'/' )+ '/' | '^' ( '\\^' | ~'^' )+ '^';
-// The following is used to ensure REGEXes don't get mixed up with paths, which use '/' chars
+// ---------- Delimited Regex matcher ------------
+// In ADL, a regexp can only exist between {}.
+// allows for '/' or '^' delimiters
+// logical form - REGEX: '/' ( '\\/' | ~'/' )+ '/' | '^' ( '\\^' | ~'^' )+ '^';
+// The following is used to ensure REGEXes don't get mixed up with paths, which use '/' chars
 
-//a
-// regexp can only exist between {}. It can optionally have an assumed value, by adding ;"value"
-CONTAINED_REGEXP: '{'WS* (SLASH_REGEXP | CARET_REGEXP) WS* (';' WS* STRING)? WS* '}';
-fragment SLASH_REGEXP: '/' SLASH_REGEXP_CHAR+ '/';
-fragment SLASH_REGEXP_CHAR: ~[/\n\r] | ESCAPE_SEQ | '\\/';
+//a
+// regexp can only exist between {}. It can optionally have an assumed value, by adding ;"value"
+CONTAINED_REGEXP: '{'WS* (SLASH_REGEXP | CARET_REGEXP) WS* (';' WS* STRING)? WS* '}';
+fragment SLASH_REGEXP: '/' SLASH_REGEXP_CHAR+ '/';
+fragment SLASH_REGEXP_CHAR: ~[/\n\r] | ESCAPE_SEQ | '\\/';
 
-fragment CARET_REGEXP: '^' CARET_REGEXP_CHAR+ '^';
-fragment CARET_REGEXP_CHAR: ~[^\n\r] | ESCAPE_SEQ | '\\^';
+fragment CARET_REGEXP: '^' CARET_REGEXP_CHAR+ '^';
+fragment CARET_REGEXP_CHAR: ~[^\n\r] | ESCAPE_SEQ | '\\^';
 
 // ---------- various ADL2 codes -------
 
-ROOT_ID_CODE : 'id1' '.1'* ;
-ID_CODE      : 'id' CODE_STR ;
-AT_CODE      : 'at' CODE_STR ;
-AC_CODE      : 'ac' CODE_STR ;
-fragment CODE_STR : ('0' | [1-9][0-9]*) ( '.' ('0' | [1-9][0-9]* ))* ;
+ROOT_ID_CODE : 'id1' '.1'* ;
+ID_CODE      : 'id' CODE_STR ;
+AT_CODE      : 'at' CODE_STR ;
+AC_CODE      : 'ac' CODE_STR ;
+fragment CODE_STR : ('0' | [1-9][0-9]*) ( '.' ('0' | [1-9][0-9]* ))* ;
 
 // ---------- ISO8601 Date/Time values ----------
 
-ISO8601_DATE      : YEAR '-' MONTH ( '-' DAY )? | YEAR '-' MONTH '-' UNKNOWN_DT | YEAR '-' UNKNOWN_DT '-' UNKNOWN_DT ;
-ISO8601_TIME      : ( HOUR ':' MINUTE ( ':' SECOND ( SECOND_DEC_SEP DIGIT+ )?)? | HOUR ':' MINUTE ':' UNKNOWN_DT | HOUR ':' UNKNOWN_DT ':' UNKNOWN_DT ) TIMEZONE? ;
-ISO8601_DATE_TIME : ( YEAR '-' MONTH '-' DAY 'T' HOUR (':' MINUTE (':' SECOND ( SECOND_DEC_SEP DIGIT+ )?)?)? | YEAR '-' MONTH '-' DAY 'T' HOUR ':' MINUTE ':' UNKNOWN_DT | YEAR '-' MONTH '-' DAY 'T' HOUR ':' UNKNOWN_DT ':' UNKNOWN_DT ) TIMEZONE? ;
-fragment TIMEZONE : 'Z' | ('+'|'-') HOUR_MIN ;   // hour offset, e.g. `+0930`, or else literal `Z` indicating +0000.
-fragment YEAR     : [0-9][0-9][0-9][0-9] ;		   // Year in ISO8601:2004 is 4 digits with 0-filling as needed
-fragment MONTH    : ( [0][1-9] | [1][0-2] ) ;    // month in year
-fragment DAY      : ( [0][1-9] | [12][0-9] | [3][0-1] ) ;  // day in month
-fragment HOUR     : ( [01]?[0-9] | [2][0-3] ) ;  // hour in 24 hour clock
-fragment MINUTE   : [0-5][0-9] ;                 // minutes
-fragment HOUR_MIN : ( [01]?[0-9] | [2][0-3] ) [0-5][0-9] ;  // hour / minutes quad digit pattern
-fragment SECOND   : [0-5][0-9] ;                 // seconds
-fragment SECOND_DEC_SEP : '.' | ',' ;
-fragment UNKNOWN_DT  : '??' ;                    // any unknown date/time value, except years.
+ISO8601_DATE      : YEAR '-' MONTH ( '-' DAY )? | YEAR '-' MONTH '-' UNKNOWN_DT | YEAR '-' UNKNOWN_DT '-' UNKNOWN_DT ;
+ISO8601_TIME      : ( HOUR ':' MINUTE ( ':' SECOND ( SECOND_DEC_SEP DIGIT+ )?)? | HOUR ':' MINUTE ':' UNKNOWN_DT | HOUR ':' UNKNOWN_DT ':' UNKNOWN_DT ) TIMEZONE? ;
+ISO8601_DATE_TIME : ( YEAR '-' MONTH '-' DAY 'T' HOUR (':' MINUTE (':' SECOND ( SECOND_DEC_SEP DIGIT+ )?)?)? | YEAR '-' MONTH '-' DAY 'T' HOUR ':' MINUTE ':' UNKNOWN_DT | YEAR '-' MONTH '-' DAY 'T' HOUR ':' UNKNOWN_DT ':' UNKNOWN_DT ) TIMEZONE? ;
+fragment TIMEZONE : 'Z' | ('+'|'-') HOUR_MIN ;   // hour offset, e.g. `+0930`, or else literal `Z` indicating +0000.
+fragment YEAR     : [0-9][0-9][0-9][0-9] ;		   // Year in ISO8601:2004 is 4 digits with 0-filling as needed
+fragment MONTH    : ( [0][1-9] | [1][0-2] ) ;    // month in year
+fragment DAY      : ( [0][1-9] | [12][0-9] | [3][0-1] ) ;  // day in month
+fragment HOUR     : ( [01]?[0-9] | [2][0-3] ) ;  // hour in 24 hour clock
+fragment MINUTE   : [0-5][0-9] ;                 // minutes
+fragment HOUR_MIN : ( [01]?[0-9] | [2][0-3] ) [0-5][0-9] ;  // hour / minutes quad digit pattern
+fragment SECOND   : [0-5][0-9] ;                 // seconds
+fragment SECOND_DEC_SEP : '.' | ',' ;
+fragment UNKNOWN_DT  : '??' ;                    // any unknown date/time value, except years.
 
 // ISO8601 DURATION PnYnMnWnDTnnHnnMnn.nnnS 
 // here we allow a deviation from the standard to allow weeks to be // mixed in with the rest since this commonly occurs in medicine
 // TODO: the following will incorrectly match just 'P'
-ISO8601_DURATION : '-'?'P' (DIGIT+ [yY])? (DIGIT+ [mM])? (DIGIT+ [wW])? (DIGIT+[dD])? ('T' (DIGIT+[hH])? (DIGIT+[mM])? (DIGIT+ (SECOND_DEC_SEP DIGIT+)?[sS])?)? ;
+ISO8601_DURATION : '-'?'P' (DIGIT+ [yY])? (DIGIT+ [mM])? (DIGIT+ [wW])? (DIGIT+[dD])? ('T' (DIGIT+[hH])? (DIGIT+[mM])? (DIGIT+ (SECOND_DEC_SEP DIGIT+)?[sS])?)? ;
 
 // ------------------- special word symbols --------------
-SYM_TRUE  : [Tt][Rr][Uu][Ee] ;
-SYM_FALSE : [Ff][Aa][Ll][Ss][Ee] ;
+SYM_TRUE  : [Tt][Rr][Uu][Ee] ;
+SYM_FALSE : [Ff][Aa][Ll][Ss][Ee] ;
 
 // ---------------------- Identifiers ---------------------
 
-ARCHETYPE_HRID      : ARCHETYPE_HRID_ROOT '.v' ARCHETYPE_VERSION_ID ;
-ARCHETYPE_REF       : ARCHETYPE_HRID_ROOT '.v' INTEGER ( '.' DIGIT+ )* ;
-fragment ARCHETYPE_HRID_ROOT : (NAMESPACE '::')? IDENTIFIER '-' IDENTIFIER '-' IDENTIFIER '.' LABEL ;
-fragment ARCHETYPE_VERSION_ID: DIGIT+ ('.' DIGIT+ ('.' DIGIT+ ( ( '-rc' | '-alpha' ) ( '.' DIGIT+ )? )?)?)? ;
-VERSION_ID          : DIGIT+ '.' DIGIT+ '.' DIGIT+ ( ( '-rc' | '-alpha' ) ( '.' DIGIT+ )? )? ;
-fragment IDENTIFIER : ALPHA_CHAR WORD_CHAR* ;
+ARCHETYPE_HRID      : ARCHETYPE_HRID_ROOT '.v' ARCHETYPE_VERSION_ID ;
+ARCHETYPE_REF       : ARCHETYPE_HRID_ROOT '.v' INTEGER ( '.' DIGIT+ )* ;
+fragment ARCHETYPE_HRID_ROOT : (NAMESPACE '::')? IDENTIFIER '-' IDENTIFIER '-' IDENTIFIER '.' LABEL ;
+fragment ARCHETYPE_VERSION_ID: DIGIT+ ('.' DIGIT+ ('.' DIGIT+ ( ( '-rc' | '-alpha' ) ( '.' DIGIT+ )? )?)?)? ;
+VERSION_ID          : DIGIT+ '.' DIGIT+ '.' DIGIT+ ( ( '-rc' | '-alpha' ) ( '.' DIGIT+ )? )? ;
+fragment IDENTIFIER : ALPHA_CHAR WORD_CHAR* ;
 
 // --------------------- composed primitive types -------------------
 
 // e.g. [ICD10AM(1998)::F23]; [ISO_639-1::en]
-TERM_CODE_REF : '[' TERM_CODE_CHAR+ ( '(' TERM_CODE_CHAR+ ')' )? '::' TERM_CODE_CHAR+ ']' ;
-fragment TERM_CODE_CHAR: NAME_CHAR | '.';
+TERM_CODE_REF : '[' TERM_CODE_CHAR+ ( '(' TERM_CODE_CHAR+ ')' )? '::' TERM_CODE_CHAR+ ']' ;
+fragment TERM_CODE_CHAR: NAME_CHAR | '.';
 
 // --------------------- URIs --------------------
 
 // URI recogniser based on https://tools.ietf.org/html/rfc3986 and
 // http://www.w3.org/Addressing/URL/5_URI_BNF.html
-EMBEDDED_URI: '<' ([ \t\r\n]|CMT_LINE)* URI ([ \t\r\n]|CMT_LINE)* '>';
+EMBEDDED_URI: '<' ([ \t\r\n]|CMT_LINE)* URI ([ \t\r\n]|CMT_LINE)* '>';
 
-fragment URI : URI_SCHEME ':' URI_HIER_PART ( '?' URI_QUERY )? ('#' URI_FRAGMENT)? ;
+fragment URI : URI_SCHEME ':' URI_HIER_PART ( '?' URI_QUERY )? ('#' URI_FRAGMENT)? ;
 
-fragment URI_HIER_PART : ( '//' URI_AUTHORITY ) URI_PATH_ABEMPTY
-    | URI_PATH_ABSOLUTE
-    | URI_PATH_ROOTLESS
-    | URI_PATH_EMPTY;
+fragment URI_HIER_PART : ( '//' URI_AUTHORITY ) URI_PATH_ABEMPTY
+    | URI_PATH_ABSOLUTE
+    | URI_PATH_ROOTLESS
+    | URI_PATH_EMPTY;
 
-fragment URI_SCHEME : ALPHA_CHAR ( ALPHA_CHAR | DIGIT | '+' | '-' | '.')* ;
+fragment URI_SCHEME : ALPHA_CHAR ( ALPHA_CHAR | DIGIT | '+' | '-' | '.')* ;
 
-fragment URI_AUTHORITY : ( URI_USERINFO '@' )? URI_HOST ( ':' URI_PORT )? ;
-fragment URI_USERINFO: (URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS | ':' )* ;
-fragment URI_HOST : URI_IP_LITERAL | URI_IPV4_ADDRESS | URI_REG_NAME ; //TODO: ipv6
-fragment URI_PORT: DIGIT*;
+fragment URI_AUTHORITY : ( URI_USERINFO '@' )? URI_HOST ( ':' URI_PORT )? ;
+fragment URI_USERINFO: (URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS | ':' )* ;
+fragment URI_HOST : URI_IP_LITERAL | URI_IPV4_ADDRESS | URI_REG_NAME ; //TODO: ipv6
+fragment URI_PORT: DIGIT*;
 
-fragment URI_IP_LITERAL   : '[' URI_IPV6_LITERAL ']'; //TODO, if needed: IPvFuture
-fragment URI_IPV4_ADDRESS : URI_DEC_OCTET '.' URI_DEC_OCTET '.' URI_DEC_OCTET '.' URI_DEC_OCTET ;
-fragment URI_IPV6_LITERAL : HEX_QUAD (':' HEX_QUAD )* ':' ':' HEX_QUAD (':' HEX_QUAD )* ;
+fragment URI_IP_LITERAL   : '[' URI_IPV6_LITERAL ']'; //TODO, if needed: IPvFuture
+fragment URI_IPV4_ADDRESS : URI_DEC_OCTET '.' URI_DEC_OCTET '.' URI_DEC_OCTET '.' URI_DEC_OCTET ;
+fragment URI_IPV6_LITERAL : HEX_QUAD (':' HEX_QUAD )* ':' ':' HEX_QUAD (':' HEX_QUAD )* ;
 
-fragment URI_DEC_OCTET  : DIGIT | [1-9] DIGIT | '1' DIGIT DIGIT | '2' [0-4] DIGIT | '25' [0-5];
-fragment URI_REG_NAME: (URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS)*;
-fragment HEX_QUAD : HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT ;
+fragment URI_DEC_OCTET  : DIGIT | [1-9] DIGIT | '1' DIGIT DIGIT | '2' [0-4] DIGIT | '25' [0-5];
+fragment URI_REG_NAME: (URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS)*;
+fragment HEX_QUAD : HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT ;
 
-fragment URI_PATH_ABEMPTY: ('/' URI_SEGMENT ) *;
-fragment URI_PATH_ABSOLUTE: '/' ( URI_SEGMENT_NZ ( '/' URI_SEGMENT )* )?;
-fragment URI_PATH_NOSCHEME: URI_SEGMENT_NZ_NC ( '/' URI_SEGMENT )*;
-fragment URI_PATH_ROOTLESS: URI_SEGMENT_NZ ( '/' URI_SEGMENT )*;
-fragment URI_PATH_EMPTY: ;
+fragment URI_PATH_ABEMPTY: ('/' URI_SEGMENT ) *;
+fragment URI_PATH_ABSOLUTE: '/' ( URI_SEGMENT_NZ ( '/' URI_SEGMENT )* )?;
+fragment URI_PATH_NOSCHEME: URI_SEGMENT_NZ_NC ( '/' URI_SEGMENT )*;
+fragment URI_PATH_ROOTLESS: URI_SEGMENT_NZ ( '/' URI_SEGMENT )*;
+fragment URI_PATH_EMPTY: ;
 
-fragment URI_SEGMENT: URI_PCHAR*;
-fragment URI_SEGMENT_NZ: URI_PCHAR+;
-fragment URI_SEGMENT_NZ_NC: ( URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS | '@' )+; //non-zero-length segment without any colon ":"
+fragment URI_SEGMENT: URI_PCHAR*;
+fragment URI_SEGMENT_NZ: URI_PCHAR+;
+fragment URI_SEGMENT_NZ_NC: ( URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS | '@' )+; //non-zero-length segment without any colon ":"
 
-fragment URI_PCHAR: URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS | ':' | '@';
+fragment URI_PCHAR: URI_UNRESERVED | URI_PCT_ENCODED | URI_SUB_DELIMS | ':' | '@';
 
 //fragment URI_PATH   : '/' | ( '/' URI_XPALPHA+ )+ ('/')?;
-fragment URI_QUERY : (URI_PCHAR | '/' | '?')*;
-fragment URI_FRAGMENT  : (URI_PCHAR | '/' | '?')*;
+fragment URI_QUERY : (URI_PCHAR | '/' | '?')*;
+fragment URI_FRAGMENT  : (URI_PCHAR | '/' | '?')*;
 
-fragment URI_PCT_ENCODED : '%' HEX_DIGIT HEX_DIGIT ;
+fragment URI_PCT_ENCODED : '%' HEX_DIGIT HEX_DIGIT ;
 
-fragment URI_UNRESERVED: ALPHA_CHAR | DIGIT | '-' | '.' | '_' | '~';
-fragment URI_RESERVED: URI_GEN_DELIMS | URI_SUB_DELIMS;
-fragment URI_GEN_DELIMS: ':' | '/' | '?' | '#' | '[' | ']' | '@'; //TODO: migrate to [/?#...] notation
-fragment URI_SUB_DELIMS: '!' | '$' | '&' | '\'' | '(' | ')'
-                         | '*' | '+' | ',' | ';' | '=';
+fragment URI_UNRESERVED: ALPHA_CHAR | DIGIT | '-' | '.' | '_' | '~';
+fragment URI_RESERVED: URI_GEN_DELIMS | URI_SUB_DELIMS;
+fragment URI_GEN_DELIMS: ':' | '/' | '?' | '#' | '[' | ']' | '@'; //TODO: migrate to [/?#...] notation
+fragment URI_SUB_DELIMS: '!' | '$' | '&' | '\'' | '(' | ')'
+                         | '*' | '+' | ',' | ';' | '=';
 
 // According to IETF http://tools.ietf.org/html/rfc1034[RFC 1034] and http://tools.ietf.org/html/rfc1035[RFC 1035],
 // as clarified by http://tools.ietf.org/html/rfc2181[RFC 2181] (section 11)
-fragment NAMESPACE : LABEL ('.' LABEL)* ;
-fragment LABEL : ALPHA_CHAR (NAME_CHAR|URI_PCT_ENCODED)* ;
+fragment NAMESPACE : LABEL ('.' LABEL)* ;
+fragment LABEL : ALPHA_CHAR (NAME_CHAR|URI_PCT_ENCODED)* ;
 
 
-GUID : HEX_DIGIT+ '-' HEX_DIGIT+ '-' HEX_DIGIT+ '-' HEX_DIGIT+ '-' HEX_DIGIT+ ;
+GUID : HEX_DIGIT+ '-' HEX_DIGIT+ '-' HEX_DIGIT+ '-' HEX_DIGIT+ '-' HEX_DIGIT+ ;
 
-ALPHA_UC_ID :   ALPHA_UCHAR WORD_CHAR* ;   // used for type ids
-ALPHA_LC_ID :   ALPHA_LCHAR WORD_CHAR* ;   // used for attribute / method ids
-ALPHA_UNDERSCORE_ID : '_' WORD_CHAR* ;     // usually used for meta-model ids
+ALPHA_UC_ID :   ALPHA_UCHAR WORD_CHAR* ;   // used for type ids
+ALPHA_LC_ID :   ALPHA_LCHAR WORD_CHAR* ;   // used for attribute / method ids
+ALPHA_UNDERSCORE_ID : '_' WORD_CHAR* ;     // usually used for meta-model ids
 
 // --------------------- atomic primitive types -------------------
 
-INTEGER : DIGIT+ E_SUFFIX? ;
-REAL :    DIGIT+ '.' DIGIT+ E_SUFFIX? ;
-fragment E_SUFFIX : [eE][+-]? DIGIT+ ;
+INTEGER : DIGIT+ E_SUFFIX? ;
+REAL :    DIGIT+ '.' DIGIT+ E_SUFFIX? ;
+fragment E_SUFFIX : [eE][+-]? DIGIT+ ;
 
-STRING : '"' STRING_CHAR*? '"' ;
-fragment STRING_CHAR : ~["\\] | ESCAPE_SEQ | UTF8CHAR ; // strings can be multi-line
+STRING : '"' STRING_CHAR*? '"' ;
+fragment STRING_CHAR : ~["\\] | ESCAPE_SEQ | UTF8CHAR ; // strings can be multi-line
 
 CHARACTER : '\'' CHAR '\'' ;
 fragment CHAR : ~['\\\r\n] | ESCAPE_SEQ | UTF8CHAR  ;
 
-fragment ESCAPE_SEQ: '\\' ['"?abfnrtv\\] ;
+fragment ESCAPE_SEQ: '\\' ['"?abfnrtv\\] ;
 
 // ------------------- character fragments ------------------
 
-fragment NAME_CHAR     : WORD_CHAR | '-' ;
-fragment WORD_CHAR     : ALPHANUM_CHAR | '_' ;
-fragment ALPHANUM_CHAR : ALPHA_CHAR | DIGIT ;
+fragment NAME_CHAR     : WORD_CHAR | '-' ;
+fragment WORD_CHAR     : ALPHANUM_CHAR | '_' ;
+fragment ALPHANUM_CHAR : ALPHA_CHAR | DIGIT ;
 
-fragment ALPHA_CHAR  : [a-zA-Z] ;
-fragment ALPHA_UCHAR : [A-Z] ;
-fragment ALPHA_LCHAR : [a-z] ;
-fragment UTF8CHAR    : '\\u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT ;
+fragment ALPHA_CHAR  : [a-zA-Z] ;
+fragment ALPHA_UCHAR : [A-Z] ;
+fragment ALPHA_LCHAR : [a-z] ;
+fragment UTF8CHAR    : '\\u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT ;
 
-fragment DIGIT     : [0-9] ;
-fragment HEX_DIGIT : [0-9a-fA-F] ;
+fragment DIGIT     : [0-9] ;
+fragment HEX_DIGIT : [0-9a-fA-F] ;
 
 // -------------------- common symbols ---------------------
 
-SYM_COMMA: ',' ;
-SYM_SEMI_COLON : ';' ;
+SYM_COMMA: ',' ;
+SYM_SEMI_COLON : ';' ;
 
-SYM_LPAREN   : '(';
-SYM_RPAREN   : ')';
-SYM_LBRACKET : '[';
-SYM_RBRACKET : ']';
-SYM_LCURLY   : '{' ;
-SYM_RCURLY   : '}' ;
+SYM_LPAREN   : '(';
+SYM_RPAREN   : ')';
+SYM_LBRACKET : '[';
+SYM_RBRACKET : ']';
+SYM_LCURLY   : '{' ;
+SYM_RCURLY   : '}' ;
 
 // --------- symbols ----------
-SYM_ASSIGNMENT: ':=' | '::=' ;
+SYM_ASSIGNMENT: ':=' | '::=' ;
 
-SYM_NE : '/=' | '!=' | '≠' ;
-SYM_EQ : '=' ;
-SYM_GT : '>' ;
-SYM_LT : '<' ;
-SYM_LE : '<=' | '≤' ;
-SYM_GE : '>=' | '≥' ;
+SYM_NE : '/=' | '!=' | '≠' ;
+SYM_EQ : '=' ;
+SYM_GT : '>' ;
+SYM_LT : '<' ;
+SYM_LE : '<=' | '≤' ;
+SYM_GE : '>=' | '≥' ;
 
 // TODO: remove when [] path predicates supported
-VARIABLE_WITH_PATH: VARIABLE_ID ADL_ABSOLUTE_PATH ;
+VARIABLE_WITH_PATH: VARIABLE_ID ADL_ABSOLUTE_PATH ;
 
-VARIABLE_ID: '$' ALPHA_LC_ID ;
+VARIABLE_ID: '$' ALPHA_LC_ID ;
 
 
 //
@@ -9687,18 +9687,18 @@ 

B.6. Base Lexer// // -------------------- symbols for lists ------------------------ -SYM_LIST_CONTINUE: '...' ; +SYM_LIST_CONTINUE: '...' ; // ------------------ symbols for intervals ---------------------- -SYM_PLUS : '+' ; -SYM_MINUS : '-' ; -SYM_PLUS_OR_MINUS : '+/-' | '±' ; -SYM_PERCENT : '%' ; -SYM_CARAT: '^' ; +SYM_PLUS : '+' ; +SYM_MINUS : '-' ; +SYM_PLUS_OR_MINUS : '+/-' | '±' ; +SYM_PERCENT : '%' ; +SYM_CARAT: '^' ; -SYM_IVL_DELIM: '|' ; -SYM_IVL_SEP : '..' ;

+SYM_IVL_DELIM: '|' ; +SYM_IVL_SEP : '..' ;
@@ -9724,7 +9724,7 @@

References

diff --git a/docs/AOM1.4.html b/docs/AOM1.4.html index 52eee1f..fb1155d 100644 --- a/docs/AOM1.4.html +++ b/docs/AOM1.4.html @@ -4,7 +4,7 @@ - + Archetype Object Model 1.4 (AOM1.4) @@ -216,7 +216,7 @@

-

Release: AM latest

+

Release: AM Release-2.3.0

Status: STABLE

@@ -240,7 +240,7 @@

-© 2004 - 2023 The openEHR Foundation +© 2004 - 2024 The openEHR Foundation @@ -280,7 +280,7 @@

Amend -

AM Release 2.3.?

+

AM Release 2.3.0

1.4.6

@@ -591,10 +591,10 @@

1. Preface

1.1. Purpose

-

This document contains the definitive statement of archetype semantics, in the form of an object model for archetypes. The model presented here can be used as a basis for building software that processes archetypes, independent of their persistent representation; equally, it can be used to develop the output side of parsers that process archetypes in a linguistic format, such as the openEHR Archetype Definition Language (ADL), XML-instance and so on. As a specification, it can be treated as an API for archetypes.

+

This document contains the definitive statement of archetype semantics, in the form of an object model for archetypes. The model presented here can be used as a basis for building software that processes archetypes, independent of their persistent representation; equally, it can be used to develop the output side of parsers that process archetypes in a linguistic format, such as the openEHR Archetype Definition Language (ADL), XML-instance and so on. As a specification, it can be treated as an API for archetypes.

-

It is recommended that the openEHR ADL document be read in conjunction with this document, since it contains a detailed explanation of the semantics of archetypes, and many of the examples are more obvious in ADL, regardless of whether ADL is actually used with the object model presented here or not.

+

It is recommended that the openEHR ADL document be read in conjunction with this document, since it contains a detailed explanation of the semantics of archetypes, and many of the examples are more obvious in ADL, regardless of whether ADL is actually used with the object model presented here or not.

@@ -618,7 +618,7 @@

5.1. Overview

-

Assertions are expressed in archetypes in typed first-order predicate logic (FOL). They are used in two places: to express archetype slot constraints, and to express rules in complex object constraints. In both of these places, their role is to constrain something inside the archetype. Constraints on external resources such as terminologies are expressed in the constraint binding part of the archetype ontology, described in [terminology_package]. The assertion package is illustrated below.

+

Assertions are expressed in archetypes in typed first-order predicate logic (FOL). They are used in two places: to express archetype slot constraints, and to express rules in complex object constraints. In both of these places, their role is to constrain something inside the archetype. Constraints on external resources such as terminologies are expressed in the constraint binding part of the archetype ontology, described in Section 7. The assertion package is illustrated below.

@@ -4021,7 +4021,7 @@

References

diff --git a/docs/AOM2.html b/docs/AOM2.html index 73f2d1c..2883161 100644 --- a/docs/AOM2.html +++ b/docs/AOM2.html @@ -4,7 +4,7 @@ - + Archetype Object Model 2 (AOM2) @@ -426,7 +426,7 @@

Release: AM latest

+

Release: AM Release-2.3.0

Status: STABLE

@@ -450,7 +450,7 @@

© 2004 - 2023 The openEHR Foundation +© 2004 - 2024 The openEHR Foundation @@ -490,7 +490,7 @@

Amend -

AM Release 2.3.?

+

AM Release 2.3.0

2.3.0

@@ -1367,7 +1367,7 @@

1. Preface

1.1. Purpose

-

This document contains the normative description of openEHR Archetype and Template semantics (originally described in Beale (2000) and Beale (2002)), in the form of an object model. The model presented here can be used as a basis for building software that represents archetypes and templates, independent of their persistent representation. Equally, it can be used to develop the output side of parsers that process archetypes in a linguistic format, such as the openEHR Archetype Definition Language (ADL) , XML and so on.

+

This document contains the normative description of openEHR Archetype and Template semantics (originally described in Beale (2000) and Beale (2002)), in the form of an object model. The model presented here can be used as a basis for building software that represents archetypes and templates, independent of their persistent representation. Equally, it can be used to develop the output side of parsers that process archetypes in a linguistic format, such as the openEHR Archetype Definition Language (ADL) , XML and so on.

It is recommended in any case that the ADL specification be read in conjunction with this document, since it contains a detailed explanation of the semantics of archetypes, and many of the examples are more obvious in ADL, regardless of whether ADL is actually used with the object model presented here or not.

@@ -1409,7 +1409,7 @@
-
    codes_conformant (a_child_code, a_parent_code: String): Boolean
-            -- True if `a_child_code' conforms to `a_parent_code' in the sense of specialisation, i.e.
-            -- is `a_child_code' the same as or more specialised than `a_parent_code'
-        do
-            Result := is_valid_code (a_child_code) and then a_child_code.starts_with (a_parent_code) and then
-                (a_child_code.count = a_parent_code.count or else
-                a_child_code.item (a_parent_code.count + 1) = Specialisation_separator)
-        end
+
    codes_conformant (a_child_code, a_parent_code: String): Boolean
+            -- True if `a_child_code' conforms to `a_parent_code' in the sense of specialisation, i.e.
+            -- is `a_child_code' the same as or more specialised than `a_parent_code'
+        do
+            Result := is_valid_code (a_child_code) and then a_child_code.starts_with (a_parent_code) and then
+                (a_child_code.count = a_parent_code.count or else
+                a_child_code.item (a_parent_code.count + 1) = Specialisation_separator)
+        end
@@ -1871,7 +1871,7 @@

-

An important aspect of identification relates to the rules governing when the HRID namespace changes or is retained, with respect to when 'moves' or 'forks' occur. Its value is always the same as one of the original_namespace and custodian_namespace properties inherited from AUTHORED_RESOURCE.description (or both, in the case where they are the same). A full explanation of the identification system and rules is given in the openEHR Archetype Identification specification.

+

An important aspect of identification relates to the rules governing when the HRID namespace changes or is retained, with respect to when 'moves' or 'forks' occur. Its value is always the same as one of the original_namespace and custodian_namespace properties inherited from AUTHORED_RESOURCE.description (or both, in the case where they are the same). A full explanation of the identification system and rules is given in the openEHR Archetype Identification specification.

@@ -1908,7 +1908,7 @@

3.3.1. ADL Version

-

The ARCHETYPE.adl_version attribute in ADL 1.4 was used to indicate the ADL release used in the archetype source file from which the AOM structure was created (the version number comes from the amendment record of the ADL2 specification. In the current and future AOM and ADL specifications, the meaning of this attribute is generalised to mean 'the version of the archetype formalism' in which the current archetype is expressed. For reasons of convenience, the version number is still taken from the ADL specification, but now refers to all archetype-related specifications together, since they are always updated in a synchronised fashion.

+

The ARCHETYPE.adl_version attribute in ADL 1.4 was used to indicate the ADL release used in the archetype source file from which the AOM structure was created (the version number comes from the amendment record of the ADL2 specification. In the current and future AOM and ADL specifications, the meaning of this attribute is generalised to mean 'the version of the archetype formalism' in which the current archetype is expressed. For reasons of convenience, the version number is still taken from the ADL specification, but now refers to all archetype-related specifications together, since they are always updated in a synchronised fashion.

@@ -1952,7 +1952,7 @@
3.4.1.1. Package
3.4.1.2. Lifecycle_state
-

The description.lifecycle_state is an important property of an archetype, which is used to record its state in a defined lifecycle. The lifecycle state machine and versioning rules are explained fully in the openEHR Archetype Identification specification. Here we simply note that the value of the property is a coded term corresponding to one of the macro-state names on the diagram, i.e. 'unmanaged', 'in_development', and so on.

+

The description.lifecycle_state is an important property of an archetype, which is used to record its state in a defined lifecycle. The lifecycle state machine and versioning rules are explained fully in the openEHR Archetype Identification specification. Here we simply note that the value of the property is a coded term corresponding to one of the macro-state names on the diagram, i.e. 'unmanaged', 'in_development', and so on.

@@ -2878,7 +2878,7 @@

4.2
4.2.3.1. Rm_type_name and Reference Model Type Matching
-

Every object node has an rm_type_name attribute that states the RM type to be matched by that node in the archetype. The value of rm_type_name is understood as a constraint on the dynamic type of data instances of the stated Reference Model type. It is either a class name from the RM, or a generic type constructed from RM class names, as described in the Reference model type matching section of the ADL2 specification.

+

Every object node has an rm_type_name attribute that states the RM type to be matched by that node in the archetype. The value of rm_type_name is understood as a constraint on the dynamic type of data instances of the stated Reference Model type. It is either a class name from the RM, or a generic type constructed from RM class names, as described in the Reference model type matching section of the ADL2 specification.

The RM type stated in an archetype object node is understood to be a static type constraint. Accordingly, it will match an instance of any RM subtype of the stated type, as long as the inheritance relationship is stated in the RM definition. This holds both for sub-classes, and subtypes of generic types, in a covariant fashion. The following matching will thus succeed:

@@ -2980,7 +2980,7 @@

Constraints on primitive types are defined by the descendants of C_PRIMITIVE_OBJECT, i.e. C_STRING , C_INTEGER and so on. The primitive constraint types are represented in such a way as to accommodate both 'tuple' constraints and logically unary constraints, using a tuple array (C_PRIMITIVE_TUPLE.members) whose members are each a primitive constraint corresponding to each primitive type in the tuple. Tuple constraints are second order constraints, described below, enabling co-varying constraints to be stated. In the unary case, the constraint is the first member of a tuple array.

-

C_PRIMITIVE_OBJECT instances represented in ADL 'short' form are created with a fixed id-code ADL_CODE_DEFINITIONS.primitive_node_id as the value of node_id (see Section 2.3.3). For regularly structured C_PRIMITIVE_OBJECT instances, a normal node identifier is required.

+

C_PRIMITIVE_OBJECT instances represented in ADL 'short' form are created with a fixed id-code ADL_CODE_DEFINITIONS.primitive_node_id as the value of node_id (see Section 2.3.3). For regularly structured C_PRIMITIVE_OBJECT instances, a normal node identifier is required.

-

As described in the openEHR ADL2 specification, these types are constrained using either value intervals or patterns. Both kinds of constraint are formally represented by the classes C_DATE, C_TIME and C_DATE_TIME. (A fourth time-related type, 'Duration' is constrained somewhat differently by the AOM class C_DURATION).

+

As described in the openEHR ADL2 specification, these types are constrained using either value intervals or patterns. Both kinds of constraint are formally represented by the classes C_DATE, C_TIME and C_DATE_TIME. (A fourth time-related type, 'Duration' is constrained somewhat differently by the AOM class C_DURATION).

ADL2 value range constraints, such as the date range |2004-05-20..2005-05-19| are represented in the relevant constrainer meta-class (in this case C_DATE) by an attribute of the form constraint: List<Interval<Iso8601_date>>. Similarly, an ADL2 date/time range constraint such as |<2005-05-19T23:59:59| is represented by C_DATE_TIME.constraint of type List<Interval<Iso8601_date_time>>. The List<> structure allows such constraints to include more than one disjoint range.

-

The other means of expressing constraints in ADL2 is via patterns based on the ISO 8601 extended syntax form (i.e. the form that uses '-' and ':' characters in dates and times, respectively). These allow partial dates and times to be stated. Thus, the time constraint hh:??:XX means: any time consisting of hours, optional minutes, and no seconds. A full table of such constraint patterns is provided in the ADL2 specification.

+

The other means of expressing constraints in ADL2 is via patterns based on the ISO 8601 extended syntax form (i.e. the form that uses '-' and ':' characters in dates and times, respectively). These allow partial dates and times to be stated. Thus, the time constraint hh:??:XX means: any time consisting of hours, optional minutes, and no seconds. A full table of such constraint patterns is provided in the ADL2 specification.

Pattern constraints are represented within the AOM classes C_DATE etc. via the attribute pattern_constraint: String, inherited from the abstract class C_TEMPORAL. Validity may be checked using features defined on the class C_TEMPORAL_DEFINITIONS, such as valid_date_constraint_patterns, and also valid_date_constraint_replacements, for checking redefinitions within specialised archetypes.

@@ -3275,7 +3275,7 @@

<

4.2.10. Duration Constraints

-

Duration constraints follow the same general approach as Date/time constraints, such that the C_DURATION meta-class provides a range constraint attribute constraint: List<Interval<Iso8601_duration>> as well as the inherited attribute pattern_constraint: String to represent pattern constraints. These are described in openEHR ADL2 specification.

+

Duration constraints follow the same general approach as Date/time constraints, such that the C_DURATION meta-class provides a range constraint attribute constraint: List<Interval<Iso8601_duration>> as well as the inherited attribute pattern_constraint: String to represent pattern constraints. These are described in openEHR ADL2 specification.

However, the pattern constraints are of a simpler form, and do not use the ?? or XX lexical elements. The pattern interpretation functions defined on C_DURATION are therefore of the form years_allowed: (): Boolean, months_allowed: (): Boolean. Validity of duration pattern constraints may be checked using relevant functions defined on C_TEMPORAL_DEFINITIONS.

@@ -3320,7 +3320,7 @@

4.3.1. Tuple Constraints

-

Tuple constraints are designed to account for the very common need to constrain the values of more than one RM class attribute together. This effectively treats the attributes in question as a tuple, and the corresponding object constraints are accordingly modelled as tuples as well. A detailed explanation of tuples can be found in the ADL2 specification’s section on second order constraints. Additions to the main constraint model to support tuples are shown below.

+

Tuple constraints are designed to account for the very common need to constrain the values of more than one RM class attribute together. This effectively treats the attributes in question as a tuple, and the corresponding object constraints are accordingly modelled as tuples as well. A detailed explanation of tuples can be found in the ADL2 specification’s section on second order constraints. Additions to the main constraint model to support tuples are shown below.

@@ -3332,7 +3332,7 @@

4.3

In this model, the type C_ATTRIBUTE_TUPLE groups the co-constrained C_ATTRIBUTEs under a C_COMPLEX_OBJECT. Currently, the concrete type is limited to being C_PRIMITIVE_OBJECT to reduce complexity, and since it caters for all known examples of tuple constraints. In principle, any C_DEFINED_OBJECT could be allowed, and this may change in the future.

-

The tuple constraint type replaces all domain-specific constraint types defined in ADL/AOM 1.4, including C_DV_QUANTITY and C_DV_ORDINAL.

+

The tuple constraint type replaces all domain-specific constraint types defined in ADL/AOM 1.4, including C_DV_QUANTITY and C_DV_ORDINAL.

These additions allow standard constraint structures (i.e. C_ATTRIBUTE / C_COMPLEX_OBJECT / C_PRIMITIVE_OBJECT hierarchies) to be 'annotated', while leaving the first order structure intact. The following example shows an archetype instance structure in which a notional ORDINAL type is constrained. The logical requirement is to constrain a ORDINAL to one of three instance possibilities, each of which consists of a pair of values for the attributes value and symbol, of type Integer and TERMINOLOGY_CODE respectively. Each of these three instance constraints should be understood as an alternative for the single valued owning attribute, ELEMENT .value. Tuple constraints achieve the requirement to express the constraints as pairs not just as allowable alternatives at the final leaf level, which would incorrectly allowing any mixing of the Integer and code values.

@@ -3353,14 +3353,14 @@

4.3

4.3.2. Assertions

-

Assertions are used in ARCHETYPE_SLOTs, in order to express the 'included' and 'excluded' archetypes for the slot. In this case, each assertion is an expression that refers to parts of other archetypes, such as its identifier (e.g. 'include archetypes with short_concept_name matching xxxx '). Assertions are modelled here as a generic expression tree of unary prefix and binary infix operators. Examples of archetype slots in ADL syntax are given in the openEHR ADL2 specification.

+

Assertions are used in ARCHETYPE_SLOTs, in order to express the 'included' and 'excluded' archetypes for the slot. In this case, each assertion is an expression that refers to parts of other archetypes, such as its identifier (e.g. 'include archetypes with short_concept_name matching xxxx '). Assertions are modelled here as a generic expression tree of unary prefix and binary infix operators. Examples of archetype slots in ADL syntax are given in the openEHR ADL2 specification.

4.4. AOM Type Substitutions

-

The C_OBJECT types defined in [constraint_model_top] are reproduced below, with concrete types that may actually occur in archetypes shown in dark yellow / non-italic.

+

The C_OBJECT types defined in Section 4.2.3 are reproduced below, with concrete types that may actually occur in archetypes shown in dark yellow / non-italic.

@@ -3727,87 +3727,87 @@
-
c_conforms_to (other: C_ATTRIBUTE; rmcc: FUNCTION<<a_type, other_type: String>, Boolean>): Boolean
-        -- True if this node on its own (ignoring any subparts) expresses the same or narrower
-        -- constraints as `other'.
-        -- Returns False if any of the following is incompatible:
-        --	 * cardinality
-        --	 * existence
-    do
-        Result := existence_conforms_to (other) and
-            ((is_single and other.is_single) or else
-            (is_multiple and cardinality_conforms_to (other)))
-    end
+
c_conforms_to (other: C_ATTRIBUTE; rmcc: FUNCTION<<a_type, other_type: String>, Boolean>): Boolean
+        -- True if this node on its own (ignoring any subparts) expresses the same or narrower
+        -- constraints as `other'.
+        -- Returns False if any of the following is incompatible:
+        --	 * cardinality
+        --	 * existence
+    do
+        Result := existence_conforms_to (other) and
+            ((is_single and other.is_single) or else
+            (is_multiple and cardinality_conforms_to (other)))
+    end
 
-c_congruent_to (other: C_ATTRIBUTE): Boolean
-		-- True if this node on its own (ignoring any subparts) expresses no additional
-        -- constraints than `other'.
-    do
-        Result := existence = Void and ((is_single and other.is_single) or
-                (is_multiple and other.is_multiple and cardinality = Void))
-    end
+c_congruent_to (other: C_ATTRIBUTE): Boolean
+		-- True if this node on its own (ignoring any subparts) expresses no additional
+        -- constraints than `other'.
+    do
+        Result := existence = Void and ((is_single and other.is_single) or
+                (is_multiple and other.is_multiple and cardinality = Void))
+    end
 
-existence_conforms_to (other: C_ATTRIBUTE): Boolean
-		-- True if the existence of this node conforms to other.existence
-    require
-        other /= Void
-    do
-        if existence /= Void and other.existence /= Void then
-            Result := other.existence.contains (existence)
-        else
-            Result := True
-        end
-    end
+existence_conforms_to (other: C_ATTRIBUTE): Boolean
+		-- True if the existence of this node conforms to other.existence
+    require
+        other /= Void
+    do
+        if existence /= Void and other.existence /= Void then
+            Result := other.existence.contains (existence)
+        else
+            Result := True
+        end
+    end
 
-cardinality_conforms_to (other: C_ATTRIBUTE): Boolean
-		-- True if the cardinality of this node conforms to other.cardinality, if it exists
-    require
-        other /= Void
-    do
-        if cardinality /= Void and other.cardinality /= Void then
-            Result := other.cardinality.contains (cardinality)
-        else
-            Result := True
-        end
-    end
+cardinality_conforms_to (other: C_ATTRIBUTE): Boolean
+		-- True if the cardinality of this node conforms to other.cardinality, if it exists
+    require
+        other /= Void
+    do
+        if cardinality /= Void and other.cardinality /= Void then
+            Result := other.cardinality.contains (cardinality)
+        else
+            Result := True
+        end
+    end
 
-collective_occurrences_of (parent_object: C_OBJECT;
-            rm_prop_mult: FUNCTION <<rm_type_name, rm_property_path: String>, Multiplicity_interval>): Multiplicity_interval
-        -- compute collective occurrences according to VSONCO, of all object nodes under this
-        -- attribute node that redefine `parent_object`, which is assumed to be an object node
-        -- within `other`, the specialisation parent of this C_ATTRIBUTE
-    require
-        parent_object /= Void
-        other.is_multiple
-    do
-        -- make a 0..0 interval
-        create Result.make_prohibited
+collective_occurrences_of (parent_object: C_OBJECT;
+            rm_prop_mult: FUNCTION <<rm_type_name, rm_property_path: String>, Multiplicity_interval>): Multiplicity_interval
+        -- compute collective occurrences according to VSONCO, of all object nodes under this
+        -- attribute node that redefine `parent_object`, which is assumed to be an object node
+        -- within `other`, the specialisation parent of this C_ATTRIBUTE
+    require
+        parent_object /= Void
+        other.is_multiple
+    do
+        -- make a 0..0 interval
+        create Result.make_prohibited
 
-        children.do_all (
-            agent (child_co, parent_co: C_OBJECT;
-                    rm_prop_mult: FUNCTION <<rm_type_name, rm_property_path: String>, Multiplicity_interval>;
-                    interval: Multiplicity_interval)
-                local
-                    child_occ: Multiplicity_interval
-                do
-                    if child_co.node_id_conforms_to (parent_co) then
-                        -- child object node may have no occurrences
-                        child_occ := child_obj.effective_occurrences (rm_prop_mult)
+        children.do_all (
+            agent (child_co, parent_co: C_OBJECT;
+                    rm_prop_mult: FUNCTION <<rm_type_name, rm_property_path: String>, Multiplicity_interval>;
+                    interval: Multiplicity_interval)
+                local
+                    child_occ: Multiplicity_interval
+                do
+                    if child_co.node_id_conforms_to (parent_co) then
+                        -- child object node may have no occurrences
+                        child_occ := child_obj.effective_occurrences (rm_prop_mult)
 
-                        interval.set_lower (interval.lower + child_occ.lower)
-                        if child_occ.upper_unbounded then
-                            interval.set_upper_unbounded
-                        elseif not interval.upper_unbounded then
-                            interval.set_upper (interval.upper + child_occ.upper)
-                        end
-                    end
-                end (?, a_parent_co, rm_prop_mult, Result)
-        )
+                        interval.set_lower (interval.lower + child_occ.lower)
+                        if child_occ.upper_unbounded then
+                            interval.set_upper_unbounded
+                        elseif not interval.upper_unbounded then
+                            interval.set_upper (interval.upper + child_occ.upper)
+                        end
+                    end
+                end (?, a_parent_co, rm_prop_mult, Result)
+        )
 
-        if cardinality /= Void and then not cardinality.upper_unbounded then
-            Result.set_upper (if Result.upper_unbounded then cardinality.upper else Result.upper.min (cardinality.upper) end)
-        end
-    end
+ if cardinality /= Void and then not cardinality.upper_unbounded then + Result.set_upper (if Result.upper_unbounded then cardinality.upper else Result.upper.min (cardinality.upper) end) + end + end
@@ -4106,38 +4106,38 @@
-

There are various circumstances where it is useful to know the effective occurrences of an archetype object node. One is in validation, in order to determine validity of occurrences constraints; another is in archetype editor tools. Similarly, in an Operational Template, an occurrences constraint is required on all child object nodes of container attributes. Most such constraints come from the source template(s) and archetypes, but often there will be nodes with no occurrences set. In these cases, the occurrences constraint is inferred from the archetype and the reference model according to the following algorithm, where c_object represents any object node in an archetype.

+

There are various circumstances where it is useful to know the effective occurrences of an archetype object node. One is in validation, in order to determine validity of occurrences constraints; another is in archetype editor tools. Similarly, in an Operational Template, an occurrences constraint is required on all child object nodes of container attributes. Most such constraints come from the source template(s) and archetypes, but often there will be nodes with no occurrences set. In these cases, the occurrences constraint is inferred from the archetype and the reference model according to the following algorithm, where c_object represents any object node in an archetype.

-
effective_occurrences (rm_prop_mult: FUNCTION <<rm_type_name, rm_property_path: String>, Multiplicity_interval>): Multiplicity_interval
-        -- Compute effective occurrences, where no local occurrences constraint set. If the owning
-        -- `C_ATTRIBUTE._cardinality_` is set, use its upper value, else use RM multiplicity of the
-        -- owning attribute.
-        -- `rm_attr_prop_mult` is a function that knows how to compute effective object multiplicity
-        -- by looking at the owning RM property.
-        -- If local `occurrences` not set, always assume 0 as the lower bound.
-    do
-        if occurrences /= Void then
-            Result := occurrences
+
effective_occurrences (rm_prop_mult: FUNCTION <<rm_type_name, rm_property_path: String>, Multiplicity_interval>): Multiplicity_interval
+        -- Compute effective occurrences, where no local occurrences constraint set. If the owning
+        -- `C_ATTRIBUTE._cardinality_` is set, use its upper value, else use RM multiplicity of the
+        -- owning attribute.
+        -- `rm_attr_prop_mult` is a function that knows how to compute effective object multiplicity
+        -- by looking at the owning RM property.
+        -- If local `occurrences` not set, always assume 0 as the lower bound.
+    do
+        if occurrences /= Void then
+            Result := occurrences
 
-        elseif parent /= Void then
-            if parent.cardinality /= Void then
-                if parent.cardinality.interval.upper_unbounded then
-                    create Result.make_open
-                else
-                    create Result.make_bounded (0, parent.cardinality.interval.upper)
-                end
-            elseif parent.parent /= Void then
-                Result := rm_prop_mult (parent.parent.rm_type_name, parent.parent.rm_attribute_path)
-                Result.set_lower (0)
-            else
-                create Result.make_open
-            end
-        else
-            create Result.make_open
-        end
-    end
+ elseif parent /= Void then + if parent.cardinality /= Void then + if parent.cardinality.interval.upper_unbounded then + create Result.make_open + else + create Result.make_bounded (0, parent.cardinality.interval.upper) + end + elseif parent.parent /= Void then + Result := rm_prop_mult (parent.parent.rm_type_name, parent.parent.rm_attribute_path) + Result.set_lower (0) + else + create Result.make_open + end + else + create Result.make_open + end + end
@@ -4176,76 +4176,76 @@
-
c_conforms_to (other: C_OBJECT; rmcc: FUNCTION<<a_type, other_type: String>, Boolean>): Boolean
-        -- True if this node on its own (ignoring any subparts) expresses strictly narrower constraints
-        -- as `other'.
-        -- `other' is typically from the flat parent archetype.
-        -- `rmcc' is an agent (lambda) that can test an RM type's conformance to another RM type
-        -- Returns True when the following is True:
-        --  * rm_type_name is the same or a subtype of rm_type_name of other;
-        --  * node_id is the same, or redefined to a legal code at the level of the owning archetype
-        --  * is_root or else
-        --    parent.is_multiple or else -- we do the real check from the parent C_ATTRIBUTE
-        --    parent.is_single and
-        --    occurrences is same (= Void) or a sub-interval
-        --
-    do
-        Result := node_id_conforms_to (other) and
-            (rm_type_name.is_case_insensitive_equal (other.rm_type_name) or else
-            rmcc (rm_type_name, other.rm_type_name)) and
-            (is_root or else parent.is_multiple or else parent.is_single and occurrences_conforms_to (other))
-    end
+
c_conforms_to (other: C_OBJECT; rmcc: FUNCTION<<a_type, other_type: String>, Boolean>): Boolean
+        -- True if this node on its own (ignoring any subparts) expresses strictly narrower constraints
+        -- as `other'.
+        -- `other' is typically from the flat parent archetype.
+        -- `rmcc' is an agent (lambda) that can test an RM type's conformance to another RM type
+        -- Returns True when the following is True:
+        --  * rm_type_name is the same or a subtype of rm_type_name of other;
+        --  * node_id is the same, or redefined to a legal code at the level of the owning archetype
+        --  * is_root or else
+        --    parent.is_multiple or else -- we do the real check from the parent C_ATTRIBUTE
+        --    parent.is_single and
+        --    occurrences is same (= Void) or a sub-interval
+        --
+    do
+        Result := node_id_conforms_to (other) and
+            (rm_type_name.is_case_insensitive_equal (other.rm_type_name) or else
+            rmcc (rm_type_name, other.rm_type_name)) and
+            (is_root or else parent.is_multiple or else parent.is_single and occurrences_conforms_to (other))
+    end
 
-c_congruent_to (other: C_OBJECT): Boolean
-        -- True if this node on its own (ignoring any subparts) expresses no constraints in addition
-        -- to `other', other than possible redefinition of the node id, which doesn't matter, since
-        -- this won't get lost in a compressed path.
-        -- Current and `other' are typically from flat archetypes being compared to generate a diff.
-        -- Used to determine if path segments can be compressed.
-        -- Returns True if:
-        --	 * rm_type_name is identical
-        --	 * occurrences is Void or else identical to other.occurrences
-        -- 	 * sibling_order is Void or else identical to other.sibling_order
-        --	 * node_id is identical or else is the only child that overlays the parent node
-    do
-        Result := rm_type_name.is_case_insensitive_equal (other.rm_type_name) and
-            (occurrences = Void or else (other.occurrences /= Void and then
-                occurrences.is_equal (other.occurrences))) and
-            (sibling_order = Void or else (other.sibling_order /= Void and then
-                sibling_order.is_equal (other.sibling_order))) and
-            node_reuse_congruent (other)
-    end
+c_congruent_to (other: C_OBJECT): Boolean
+        -- True if this node on its own (ignoring any subparts) expresses no constraints in addition
+        -- to `other', other than possible redefinition of the node id, which doesn't matter, since
+        -- this won't get lost in a compressed path.
+        -- Current and `other' are typically from flat archetypes being compared to generate a diff.
+        -- Used to determine if path segments can be compressed.
+        -- Returns True if:
+        --	 * rm_type_name is identical
+        --	 * occurrences is Void or else identical to other.occurrences
+        -- 	 * sibling_order is Void or else identical to other.sibling_order
+        --	 * node_id is identical or else is the only child that overlays the parent node
+    do
+        Result := rm_type_name.is_case_insensitive_equal (other.rm_type_name) and
+            (occurrences = Void or else (other.occurrences /= Void and then
+                occurrences.is_equal (other.occurrences))) and
+            (sibling_order = Void or else (other.sibling_order /= Void and then
+                sibling_order.is_equal (other.sibling_order))) and
+            node_reuse_congruent (other)
+    end
 
-occurrences_conforms_to (other: C_OBJECT): Boolean
-        -- True if this node's occurrences conforms to other.occurrences;
-        -- `other' is assumed to be in a flat archetype.
-        -- only redefinitions of single-occurrence nodes can be dealt with here;
-        -- redefinitions of multiply-occurrences nodes
-        -- must be evaluated at the owning attribute, according to VSONCO.
-    do
-        if occurrences /= Void and other.occurrences.upper = 1 then
-            Result := other.occurrences.contains (occurrences)
-        else
-            Result := True
-        end
-    end
+occurrences_conforms_to (other: C_OBJECT): Boolean
+        -- True if this node's occurrences conforms to other.occurrences;
+        -- `other' is assumed to be in a flat archetype.
+        -- only redefinitions of single-occurrence nodes can be dealt with here;
+        -- redefinitions of multiply-occurrences nodes
+        -- must be evaluated at the owning attribute, according to VSONCO.
+    do
+        if occurrences /= Void and other.occurrences.upper = 1 then
+            Result := other.occurrences.contains (occurrences)
+        else
+            Result := True
+        end
+    end
 
-node_id_conforms_to (other: C_OBJECT): Boolean
-    require
-        other /= Void
-    do
-        Result := codes_conformant (node_id, other.node_id)
-    end
+node_id_conforms_to (other: C_OBJECT): Boolean
+    require
+        other /= Void
+    do
+        Result := codes_conformant (node_id, other.node_id)
+    end
 
-node_reuse_congruent (other: C_OBJECT): Boolean
-        -- True if this node is the sole re-using node of the corresponding node in the flat
-    require
-        other /= Void
-    do
-        Result := node_id_conforms_to (other) and
-            (is_root or else
-            attached parent and then parent.child_reuse_count (other.node_id) = 1)
-    end
+node_reuse_congruent (other: C_OBJECT): Boolean + -- True if this node is the sole re-using node of the corresponding node in the flat + require + other /= Void + do + Result := node_id_conforms_to (other) and + (is_root or else + attached parent and then parent.child_reuse_count (other.node_id) = 1) + end
@@ -4699,14 +4699,14 @@
-
if includes not empty and = any then
-    not (excludes empty or /= any) ==> VDSEV Error
-elseif includes not empty and /= any then
-    not (excludes empty or = any) ==> VDSEV Error
-elseif excludes not empty and = any then
-    not (includes empty or /= any) ==> VDSIV Error
-elseif excludes not empty and /= any then
-    not (includes empty or = any) ==> VDSIV Error
+
if includes not empty and = any then
+    not (excludes empty or /= any) ==> VDSEV Error
+elseif includes not empty and /= any then
+    not (excludes empty or = any) ==> VDSEV Error
+elseif excludes not empty and = any then
+    not (includes empty or /= any) ==> VDSIV Error
+elseif excludes not empty and /= any then
+    not (includes empty or = any) ==> VDSIV Error
 end

@@ -4976,42 +4976,42 @@
-
c_conforms_to (other: C_PRIMITIVE_OBJECT; rmcc: FUNCTION<<a_type, other_type: String>, Boolean>): Boolean
-        -- True if this node on its own (ignoring any subparts) expresses the same or narrower
-        -- constraints
-        -- as `other'. Returns True only when the following is True:
-        --   * occurrences conforms
-        --   * `rm_type_name' is identical to that in `other'
-        -- `rmcc' is an agent (lambda) that can test an RM type's conformance to another RM type
-    do
-        Result := precursor (other, rmcc) and c_value_conforms_to (other)
-    end
+
c_conforms_to (other: C_PRIMITIVE_OBJECT; rmcc: FUNCTION<<a_type, other_type: String>, Boolean>): Boolean
+        -- True if this node on its own (ignoring any subparts) expresses the same or narrower
+        -- constraints
+        -- as `other'. Returns True only when the following is True:
+        --   * occurrences conforms
+        --   * `rm_type_name' is identical to that in `other'
+        -- `rmcc' is an agent (lambda) that can test an RM type's conformance to another RM type
+    do
+        Result := precursor (other, rmcc) and c_value_conforms_to (other)
+    end
 
-c_value_conforms_to (other: like Current): Boolean
-        -- True if this node expresses a value constraint that conforms to that of `other'
-    deferred
-    end
+c_value_conforms_to (other: like Current): Boolean
+        -- True if this node expresses a value constraint that conforms to that of `other'
+    deferred
+    end
 
-c_congruent_to (other: C_PRIMITIVE_OBJECT): Boolean
-        -- True if this node on its own (ignoring any subparts) expresses no constraints in
-        -- addition to `other'
-    do
-		Result := constrained_typename.is_case_insensitive_equal (other.constrained_typename) and
-            c_value_congruent_to (other)
-    end
+c_congruent_to (other: C_PRIMITIVE_OBJECT): Boolean
+        -- True if this node on its own (ignoring any subparts) expresses no constraints in
+        -- addition to `other'
+    do
+		Result := constrained_typename.is_case_insensitive_equal (other.constrained_typename) and
+            c_value_congruent_to (other)
+    end
 
-c_value_congruent_to (other: C_PRIMITIVE_OBJECT): Boolean
-        -- True if this node's value constraint is the same as that of `other'
-    deferred
-    end
+c_value_congruent_to (other: C_PRIMITIVE_OBJECT): Boolean
+        -- True if this node's value constraint is the same as that of `other'
+    deferred
+    end
 
-constrained_typename: String
-        -- the same as the C_XX clas name with the "C_" removed, but for some types e.g. Date/time types
-        -- it is not true.
-    do
-        Result := generating_type.name
-        Result.remove_head (2)
-    end
+constrained_typename: String + -- the same as the C_XX clas name with the "C_" removed, but for some types e.g. Date/time types + -- it is not true. + do + Result := generating_type.name + Result.remove_head (2) + end

@@ -5120,20 +5120,20 @@
-
c_value_conforms_to (other: C_BOOLEAN): Boolean
-        -- True if this node is a strict subset of `other'
-    do
-        Result := other.any_allowed or
-            constraint.count < other.constraint.count and
-            for all c in constraint | other.constraint.has (c)
-    end
+
c_value_conforms_to (other: C_BOOLEAN): Boolean
+        -- True if this node is a strict subset of `other'
+    do
+        Result := other.any_allowed or
+            constraint.count < other.constraint.count and
+            for all c in constraint | other.constraint.has (c)
+    end
 
-c_value_congruent_to (other: C_BOOLEAN): Boolean
-        -- True if this node's value constraint is the same as that of `other'
-    do
-        Result := constraint.count = other.constraint.count and
-            for all c in constraint | other.constraint.has (c)
-    end
+c_value_congruent_to (other: C_BOOLEAN): Boolean + -- True if this node's value constraint is the same as that of `other' + do + Result := constraint.count = other.constraint.count and + for all c in constraint | other.constraint.has (c) + end

@@ -5253,22 +5253,22 @@
-
c_value_conforms_to (other: C_STRING): Boolean
-        -- True if `constraint' is a strict subset of other.constraint
-    do
-        Result := other.any_allowed or
-            constraint.count < other.constraint.count and
-            for all c in constraint | other.constraint.has (c)
-    end
+
c_value_conforms_to (other: C_STRING): Boolean
+        -- True if `constraint' is a strict subset of other.constraint
+    do
+        Result := other.any_allowed or
+            constraint.count < other.constraint.count and
+            for all c in constraint | other.constraint.has (c)
+    end
 
-c_value_congruent_to (other: C_STRING): Boolean
-        -- True if this node's value constraint is the same as that of `other'
-    do
-        Result := constraint.count = other.constraint.count and then
-            across constraint as str_csr all
-                other.constraint.i_th (str_csr.cursor_index).is_equal (str_csr.item)
-            end
-    end
+c_value_congruent_to (other: C_STRING): Boolean + -- True if this node's value constraint is the same as that of `other' + do + Result := constraint.count = other.constraint.count and then + across constraint as str_csr all + other.constraint.i_th (str_csr.cursor_index).is_equal (str_csr.item) + end + end
@@ -5375,23 +5375,23 @@
-
c_value_conforms_to (other: C_ORDERED): Boolean
-        -- True if this node is a strict subset of `other`
-    do
-        Result := other.any_allowed or
-            for_all c:constraint |
-                there_exists oc:other.constraint | oc.contains (c)
-            end
-    end
+
c_value_conforms_to (other: C_ORDERED): Boolean
+        -- True if this node is a strict subset of `other`
+    do
+        Result := other.any_allowed or
+            for_all c:constraint |
+                there_exists oc:other.constraint | oc.contains (c)
+            end
+    end
 
-c_value_congruent_to (C_ORDERED): Boolean
-        -- True if this node is the same as `other`
-    do
-        Result := constraint.count = other.constraint.count and
-            for_all c:constraint |
-                c.is_equal (other.constraint.i_th (constraint.index_of(c)))
-            end
-    end
+c_value_congruent_to (C_ORDERED): Boolean + -- True if this node is the same as `other` + do + Result := constraint.count = other.constraint.count and + for_all c:constraint | + c.is_equal (other.constraint.i_th (constraint.index_of(c))) + end + end
@@ -5828,21 +5828,21 @@
-
c_value_conforms_to (other: C_TEMPORAL): Boolean
-        -- True if this node is a strict subset of `other`
-    do
-        Result := precursor (other) and
-            other.pattern_constraint.is_empty or
-                not pattern_constraint.is_empty and then
-                valid_pattern_constraint_replacement (pattern_constraint, other.pattern_constraint)
-    end
+
c_value_conforms_to (other: C_TEMPORAL): Boolean
+        -- True if this node is a strict subset of `other`
+    do
+        Result := precursor (other) and
+            other.pattern_constraint.is_empty or
+                not pattern_constraint.is_empty and then
+                valid_pattern_constraint_replacement (pattern_constraint, other.pattern_constraint)
+    end
 
-c_value_congruent_to (other: C_TEMPORAL): Boolean
-        -- True if this node's value constraint is the same as that of `other`
-    do
-        Result := precursor (other) and
-            pattern_constraint ~ other.pattern_constraint
-    end
+c_value_congruent_to (other: C_TEMPORAL): Boolean + -- True if this node's value constraint is the same as that of `other` + do + Result := precursor (other) and + pattern_constraint ~ other.pattern_constraint + end
@@ -6634,65 +6634,65 @@
-
c_value_conforms_to (other: C_TERMINOLOGY_CODE): Boolean
-        -- True if this node expresses a value constraint that conforms to that of `other'
-    local
-        this_vset, other_vset: List<String>
-    do
-        if other.any_allowed then
-            Result := True
+
c_value_conforms_to (other: C_TERMINOLOGY_CODE): Boolean
+        -- True if this node expresses a value constraint that conforms to that of `other'
+    local
+        this_vset, other_vset: List<String>
+    do
+        if other.any_allowed then
+            Result := True
 
-        -- check that constraint_status is valid. The following order hold down the specialisation
-        -- lineage, from lowest to highest: example (3) → preferred (2) → exensible (1) → required (0);
-        -- numerically, specialisation child must be <= parent
-        elseif effective_constraint_status > other.effective_constraint_status then
-            Result := False
+        -- check that constraint_status is valid. The following order hold down the specialisation
+        -- lineage, from lowest to highest: example (3) → preferred (2) → exensible (1) → required (0);
+        -- numerically, specialisation child must be <= parent
+        elseif effective_constraint_status > other.effective_constraint_status then
+            Result := False
 
-        -- if parent's constraint status is not 'required', then child automatically conforms
-        elseif other.effective_constraint_status > 0 then
-            Result := True
+        -- if parent's constraint status is not 'required', then child automatically conforms
+        elseif other.effective_constraint_status > 0 then
+            Result := True
 
-        -- if we get here, we know that parent and child terminology constraint strengths are both `required`
-        -- so perform the value-set conformance check
-        elseif is_valid_value_set_code (constraint) and is_valid_value_set_code (other.constraint) then
-            -- firstly, check if the other value-set is empty, which means there is no value-set,
-            -- i.e. no constraint, which means that this object's value set automatically conforms.
-            other_vset := other.value_set_expanded
-            if not other_vset.is_empty then
-                this_vset := value_set_expanded
-                Result := codes_conformant (constraint, other.constraint) and then
-                    for_all v: this_vset | other_vset.has (v)
-            else
-                Result := True
-            end
+        -- if we get here, we know that parent and child terminology constraint strengths are both `required`
+        -- so perform the value-set conformance check
+        elseif is_valid_value_set_code (constraint) and is_valid_value_set_code (other.constraint) then
+            -- firstly, check if the other value-set is empty, which means there is no value-set,
+            -- i.e. no constraint, which means that this object's value set automatically conforms.
+            other_vset := other.value_set_expanded
+            if not other_vset.is_empty then
+                this_vset := value_set_expanded
+                Result := codes_conformant (constraint, other.constraint) and then
+                    for_all v: this_vset | other_vset.has (v)
+            else
+                Result := True
+            end
 
-        -- otherwise it's at-codes, so we just check lexical conformance
-        else
-            Result := codes_conformant (constraint, other.constraint)
-        end
-    end
+        -- otherwise it's at-codes, so we just check lexical conformance
+        else
+            Result := codes_conformant (constraint, other.constraint)
+        end
+    end
 
-c_value_congruent_to (other: C_TERMINOLOGY_CODE): Boolean
-        -- True if this node's value constraint is the same as that of `other'
-    local
-        this_vset, other_vset: List<String>
-    do
-        -- if both constraints are ac-codes, compare the value-set expansions
-        if is_valid_value_set_code (constraint) and is_valid_value_set_code (other.constraint) then
-            this_vset := value_set_expanded
-            other_vset := other.value_set_expanded
-            Result := constraint.is_equal (other.constraint) and then
-                this_vset.count = other_vset.count and then
-                    for_all v: this_vset | other_vset.has (v)
+c_value_congruent_to (other: C_TERMINOLOGY_CODE): Boolean
+        -- True if this node's value constraint is the same as that of `other'
+    local
+        this_vset, other_vset: List<String>
+    do
+        -- if both constraints are ac-codes, compare the value-set expansions
+        if is_valid_value_set_code (constraint) and is_valid_value_set_code (other.constraint) then
+            this_vset := value_set_expanded
+            other_vset := other.value_set_expanded
+            Result := constraint.is_equal (other.constraint) and then
+                this_vset.count = other_vset.count and then
+                    for_all v: this_vset | other_vset.has (v)
 
-        -- otherwise it's at-codes, so we just compare them literally
-        else
-            Result := constraint.is_equal (other.constraint)
-        end
+        -- otherwise it's at-codes, so we just compare them literally
+        else
+            Result := constraint.is_equal (other.constraint)
+        end
 
-        -- make sure constraint status is identical
-        Result := Result and effective_constraint_status = other.effective_constraint_status
-    end
+ -- make sure constraint status is identical + Result := Result and effective_constraint_status = other.effective_constraint_status + end
@@ -6939,25 +6939,25 @@
-
c_conforms_to (other: C_SECOND_ORDER; rmcc: FUNCTION<<a_type, other_type: String>, Boolean>): Boolean
-        -- True if this node on its own (ignoring any subparts) expresses the same or narrower
-        -- constraints as `other`.
-        -- Returns False if any of the following is incompatible:
-        --	 * cardinality
-        --	 * existence
-    require
-        other /= Void
-        rmcc /= Void
-    deferred
-    end
+
c_conforms_to (other: C_SECOND_ORDER; rmcc: FUNCTION<<a_type, other_type: String>, Boolean>): Boolean
+        -- True if this node on its own (ignoring any subparts) expresses the same or narrower
+        -- constraints as `other`.
+        -- Returns False if any of the following is incompatible:
+        --	 * cardinality
+        --	 * existence
+    require
+        other /= Void
+        rmcc /= Void
+    deferred
+    end
 
-c_congruent_to (other: C_SECOND_ORDER): Boolean
-        -- True if this node on its own (ignoring any subparts) expresses no additional
-        -- constraints than `other`.
-    require
-        other /= Void
-    deferred
-    end
+c_congruent_to (other: C_SECOND_ORDER): Boolean + -- True if this node on its own (ignoring any subparts) expresses no additional + -- constraints than `other`. + require + other /= Void + deferred + end
@@ -6989,27 +6989,27 @@
-
c_conforms_to (other: C_PRIMITIVE_TUPLE; rmcc: FUNCTION<<a_type, other_type: String>, Boolean>): BOOLEAN
-        -- True if this node is a subset of, or the same as `other'
-    do
-        if count = other.count then
-            Result := across members as cpo_csr all
-                cpo_csr.item.same_type (other.members.i_th (cpo_csr.cursor_index)) and then
-                    cpo_csr.item.c_conforms_to (other.members.i_th (cpo_csr.cursor_index), rmcc)
-            end
-        end
-    end
+
c_conforms_to (other: C_PRIMITIVE_TUPLE; rmcc: FUNCTION<<a_type, other_type: String>, Boolean>): BOOLEAN
+        -- True if this node is a subset of, or the same as `other'
+    do
+        if count = other.count then
+            Result := across members as cpo_csr all
+                cpo_csr.item.same_type (other.members.i_th (cpo_csr.cursor_index)) and then
+                    cpo_csr.item.c_conforms_to (other.members.i_th (cpo_csr.cursor_index), rmcc)
+            end
+        end
+    end
 
-c_congruent_to (other: C_PRIMITIVE_TUPLE): BOOLEAN
-        -- True if Current and `other' are semantically the same
-    do
-        if count = other.count then
-            Result := across members as cpo_csr all
-                cpo_csr.item.same_type (other.members.i_th (cpo_csr.cursor_index)) and then
-                    cpo_csr.item.c_congruent_to (other.members.i_th (cpo_csr.cursor_index))
-            end
-        end
-    end
+c_congruent_to (other: C_PRIMITIVE_TUPLE): BOOLEAN + -- True if Current and `other' are semantically the same + do + if count = other.count then + Result := across members as cpo_csr all + cpo_csr.item.same_type (other.members.i_th (cpo_csr.cursor_index)) and then + cpo_csr.item.c_congruent_to (other.members.i_th (cpo_csr.cursor_index)) + end + end + end
@@ -7251,7 +7251,7 @@

6.2. Semantics<

6.2.1. RM Attribute Visibility

-

Currently, the only RM overlay settings are for RM attribute visibility, which relates to RM attributes within the context of an archetype. This is described in more detail in the ADL2 specification.

+

Currently, the only RM overlay settings are for RM attribute visibility, which relates to RM attributes within the context of an archetype. This is described in more detail in the ADL2 specification.

The visibility settings consist of a list of per-RM attribute settings, in the form of instances of the class RM_ATTRIBUTE_VISIBILITY, each keyed by the RM path to the node(s) to which they apply. The path is formed of an object node path within the archetype followed by a path to an RM attribute, which may be on an already-constrained path, or may be a path not already included in the archetype structure. The former part is one of:

@@ -8295,7 +8295,7 @@

10. Templates

10.1. Overview

-

Within the Archetype formalism, a template is used to aggregate and refine archetypes, to produce a structure corresponding to a particular data set. Templates thus provide a way to use archetypes for specific purposes, while the archetypes contain possible data items, not linked to specific purposes. See the ADL2 specification, Templates section for a detailed description of template semantics.

+

Within the Archetype formalism, a template is used to aggregate and refine archetypes, to produce a structure corresponding to a particular data set. Templates thus provide a way to use archetypes for specific purposes, while the archetypes contain possible data items, not linked to specific purposes. See the ADL2 specification, Templates section for a detailed description of template semantics.

Templates are formally defined as specialised archetypes, via the TEMPLATE and TEMPLATE_OVERLAY classes shown in Figure 6. This means that all the formal characteristics of a template are defined by the openEHR Archetype Object Model (AOM) and Archetype Definition Language (ADL) specifications apply to templates. This includes the meta-data (inherited from the AUTHORED_RESOURCE class), specialisation semantics (templates can be specialised into other templates), terminology section (allowing multi-lingual local term definitions and external terminology bindings) as well as the rules and annotations sections.

@@ -8309,7 +8309,7 @@

10.1. Overview

@@ -8738,21 +8738,21 @@

-- mappings from AOM built-in types used for CIMI RM types -- -aom_rm_type_mappings = < - ["TERMINOLOGY_CODE"] = < - source_class_name = <"TERMINOLOGY_CODE"> - target_class_name = <"CODED_TEXT"> - property_mappings = < - ["terminology_id"] = < - source_property_name = <"terminology_id"> - target_property_name = <"terminology_id"> - > - ["code_string"] = < - source_property_name = <"code_string"> - target_property_name = <"code"> - > - > - > +aom_rm_type_mappings = < + ["TERMINOLOGY_CODE"] = < + source_class_name = <"TERMINOLOGY_CODE"> + target_class_name = <"CODED_TEXT"> + property_mappings = < + ["terminology_id"] = < + source_property_name = <"terminology_id"> + target_property_name = <"terminology_id"> + > + ["code_string"] = < + source_property_name = <"code_string"> + target_property_name = <"code"> + > + > + > >

@@ -8773,13 +8773,13 @@

-
rm_primitive_type_equivalences = <
-	["Double"] = <"Real">                      -- treat RM type Double as if it where Real
-	["Integer64"] = <"Integer">                -- treat RM type Integer64 as if it were Integer
-	["ISO8601_DATE"] = <"Date">                -- treat RM type ISO8601_Date as if it were Date
-	["ISO8601_DATE_TIME"] = <"Date_time">
-	["ISO8601_TIME"] = <"Time">
-	["ISO8601_DURATION"] = <"Duration">
+
rm_primitive_type_equivalences = <
+	["Double"] = <"Real">                      -- treat RM type Double as if it where Real
+	["Integer64"] = <"Integer">                -- treat RM type Integer64 as if it were Integer
+	["ISO8601_DATE"] = <"Date">                -- treat RM type ISO8601_Date as if it were Date
+	["ISO8601_DATE_TIME"] = <"Date_time">
+	["ISO8601_TIME"] = <"Time">
+	["ISO8601_DURATION"] = <"Duration">
 >
@@ -8788,16 +8788,16 @@

-
    ELEMENT[id5] occurrences matches {0..1} matches {	-- Systolic
-        value matches {
-            DV_QUANTITY[id1054] matches {
-                property matches {[at1055]}
-                magnitude matches {|0.0..<1000.0|}  --  parses as AOM C_REAL, but is Double in RM
-                precision matches {0}
-                units matches {"mm[Hg]"}
-            }
-        }
-    }
+
    ELEMENT[id5] occurrences matches {0..1} matches {	-- Systolic
+        value matches {
+            DV_QUANTITY[id1054] matches {
+                property matches {[at1055]}
+                magnitude matches {|0.0..<1000.0|}  --  parses as AOM C_REAL, but is Double in RM
+                precision matches {0}
+                units matches {"mm[Hg]"}
+            }
+        }
+    }
@@ -8818,12 +8818,12 @@

-- allowed substitutions from AOM built-in primitive types to openEHR RM types -- -aom_rm_type_substitutions = < - ["ISO8601_DATE"] = <"String"> - ["ISO8601_DATE_TIME"] = <"String"> - ["ISO8601_TIME"] = <"String"> - ["ISO8601_DURATION"] = <"String"> - ["INTEGER"] = <"Double"> +aom_rm_type_substitutions = < + ["ISO8601_DATE"] = <"String"> + ["ISO8601_DATE_TIME"] = <"String"> + ["ISO8601_TIME"] = <"String"> + ["ISO8601_DURATION"] = <"String"> + ["INTEGER"] = <"Double"> > @@ -8832,31 +8832,31 @@

-
    INTERVAL_EVENT[id1043] occurrences matches {0..1} matches {	-- 24 hour average
-        width matches {
-            DV_DURATION[id1064] matches {
-                value matches {PT24H}  --  parses as AOM ISO8601_DURATION, but is String in RM
-            }
-        }
-    }
+
    INTERVAL_EVENT[id1043] occurrences matches {0..1} matches {	-- 24 hour average
+        width matches {
+            DV_DURATION[id1064] matches {
+                value matches {PT24H}  --  parses as AOM ISO8601_DURATION, but is String in RM
+            }
+        }
+    }

11.6. AOM Lifecycle State Mappings

-

Another kind of useful mapping adjustment that can help to make tools process archetypes in a more homogeneous way is to do with the AOM life-cycle states, which are standardised in the openEHR Archetype Identification specification. These states denote the state of a whole archetype in its authoring life cycle. Historically however there were no standard names, with the consequence that various archetype tools implement their own local lifecycle state names. To adjust for this the aom_lifecycle_mappings property in the AOM_PROFILE class can be used. These mappings have the effect of replacing the current value of the lifecycle_state property of the RESOURCE_DESCRIPTION instance of a parsed archetype with an openEHR standard state name. A typical example of the description section of an archetype with a local lifecycle state name is below.

+

Another kind of useful mapping adjustment that can help to make tools process archetypes in a more homogeneous way is to do with the AOM life-cycle states, which are standardised in the openEHR Archetype Identification specification. These states denote the state of a whole archetype in its authoring life cycle. Historically however there were no standard names, with the consequence that various archetype tools implement their own local lifecycle state names. To adjust for this the aom_lifecycle_mappings property in the AOM_PROFILE class can be used. These mappings have the effect of replacing the current value of the lifecycle_state property of the RESOURCE_DESCRIPTION instance of a parsed archetype with an openEHR standard state name. A typical example of the description section of an archetype with a local lifecycle state name is below.

description
-    original_author = <
-        ["name"] = <"Dr J Joyce">
-        ["organisation"] = <"NT Health Service">
-        ["date"] = <2003-08-03>
-    >
-    lifecycle_state =  <"AuthorDraft"> --  should be 'unmanaged'
-    resource_package_uri =  <".....">
+ original_author = < + ["name"] = <"Dr J Joyce"> + ["organisation"] = <"NT Health Service"> + ["date"] = <2003-08-03> + > + lifecycle_state = <"AuthorDraft"> -- should be 'unmanaged' + resource_package_uri = <".....">
@@ -8908,9 +8908,9 @@

-- archetyping -- override archetype parent class from included schema ------------------------------------------------------ -archetype_parent_class = <"CLASS_NAME"> -archetype_data_value_parent_class = <"CLASS_NAME"> -archetype_visualise_descendants_of = <"CLASS_NAME"> +archetype_parent_class = <"CLASS_NAME"> +archetype_data_value_parent_class = <"CLASS_NAME"> +archetype_visualise_descendants_of = <"CLASS_NAME"> diff --git a/docs/Identification.html b/docs/Identification.html index e52f94c..336c17f 100644 --- a/docs/Identification.html +++ b/docs/Identification.html @@ -4,7 +4,7 @@ - + Archetype Identification @@ -172,7 +172,7 @@

Release: AM latest

+

Release: AM Release-2.3.0

Status: STABLE

@@ -196,7 +196,7 @@

© 2009 - 2023 The openEHR Foundation +© 2009 - 2024 The openEHR Foundation @@ -236,7 +236,7 @@

Amend -

AM Release 2.1.?

+

AM Release 2.3.0

0.7.9

@@ -251,6 +251,9 @@

Amend

18 Nov 2018

+

AM Release 2.2.0

+ +

AM Release 2.1.0

@@ -472,7 +475,7 @@