Skip to content

Commit

Permalink
Support open references (no version on archetype id) from use_archety…
Browse files Browse the repository at this point in the history
…pe statements.
  • Loading branch information
wolandscat committed Feb 26, 2024
1 parent e99208b commit a208a3f
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 2 deletions.
2 changes: 1 addition & 1 deletion combined/src/main/antlr/Cadl2Parser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ cRegularObject:
| cRegularPrimitiveObject
;

cArchetypeRoot: SYM_USE_ARCHETYPE rmTypeId '[' ID_CODE ',' ARCHETYPE_REF ']' cOccurrences? ;
cArchetypeRoot: SYM_USE_ARCHETYPE rmTypeId '[' ID_CODE ',' ( FULLY_QUALIFIED_RM_ENTITY | ARCHETYPE_REF ) ']' cOccurrences? ;

cComplexObjectProxy: SYM_USE_NODE rmTypeId nodeId cOccurrences? adlPath ;

Expand Down
2 changes: 1 addition & 1 deletion combined/src/main/antlr/OpenehrPatterns.g4
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fragment VERSION_TREE_ID: NUMBER ( '.' NUMBER '.' NUMBER )? ;
ARCHETYPE_HRID : FULLY_QUALIFIED_RM_ENTITY '.v' VERSION_ID ;
ARCHETYPE_REF : FULLY_QUALIFIED_RM_ENTITY '.v' VERSION_REF ;
VERSION_ID : NUMBER '.' NUMBER '.' NUMBER VERSION_MOD? ;
fragment FULLY_QUALIFIED_RM_ENTITY : ( NAMESPACE '::' )? QUALIFIED_RM_ENTITY ;
FULLY_QUALIFIED_RM_ENTITY : ( NAMESPACE '::' )? QUALIFIED_RM_ENTITY ;
fragment QUALIFIED_RM_ENTITY : WORD_ID '-' WORD_ID '-' WORD_ID '.' NAME_ID ;
fragment VERSION_REF: NUMBER ( '.' NUMBER ( '.' NUMBER VERSION_MOD )? )? ;
fragment VERSION_MOD: VERSION_PREREL? VERSION_BUILD? ;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
archetype (adl_version=2.0.5; rm_release=1.0.2)
openEHR-EHR-COMPOSITION.ext_ref.v1.0.0

language
original_language = <[ISO_639-1::en]>

description
custodian_namespace = <"org.openehr">
custodian_organisation = <"openEHR Foundation <http://www.openEHR.org>">

original_author = <
["name"] = <"Thomas Beale">
["email"] = <"[email protected]">
["organisation"] = <"openEHR Foundation <http://www.openEHR.org>">
["date"] = <"2011-06-01">
>
details = <
["en"] = <
language = <[ISO_639-1::en]>
purpose = <"Example of an external reference, expressed using the 'use_archetype' keyword. This defines a direct association between the archetypes, without the need for a slot, and a corresponding association (which may be an aggregation or composition) of Reference Model structures. The constraint below says concretely that the COMPOSITION object contains SECTION and OBSERVATION objects under its content attribute.">
keywords = <"ADL", "test", "external reference">
>
>

lifecycle_state = <"published">
other_details = <
["regression"] = <"PASS">
>
copyright = <"Copyright © 2011 openEHR Foundation <http://www.openEHR.org>">
licence = <"Creative Commons CC-BY-SA <https://creativecommons.org/licenses/by-sa/3.0/>">

definition
COMPOSITION[id1] matches { -- Composition
content matches {
use_archetype SECTION[id2, openEHR-EHR-SECTION.section_parent] occurrences matches {0..1}
use_archetype OBSERVATION[id3, openEHR-EHR-OBSERVATION.spec_test_obs.v1] occurrences matches {1}
}
}

terminology
term_definitions = <
["en"] = <
["id1"] = <
text = <"Composition">
description = <"Composition">
>
["id2"] = <
text = <"Section">
description = <"Section">
>
["id3"] = <
text = <"Observation">
description = <"Observation">
>
>
>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
COMPOSITION[id1] matches { -- Composition
content matches {
use_archetype SECTION[id2, openEHR-EHR-SECTION.section_parent] occurrences matches {0..1}
use_archetype OBSERVATION[id3, openEHR-EHR-OBSERVATION.spec_test_obs.v1] occurrences matches {1}
}
}

0 comments on commit a208a3f

Please sign in to comment.