diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml new file mode 100644 index 000000000..56303ce81 --- /dev/null +++ b/.github/workflows/pull-request.yaml @@ -0,0 +1,29 @@ +name: Gradle Build & Test + +on: + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up GraalVM JDK 17 + uses: graalvm/setup-graalvm@v1 + with: + java-version: '17' + distribution: 'graalvm-community' + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Gradle Build + uses: gradle/gradle-build-action@v2.8.0 + with: + arguments: build + env: + ORG_GRADLE_PROJECT_mavenUser: ${{ github.actor }} + ORG_GRADLE_PROJECT_mavenPassword: ${{ secrets.GITHUB_TOKEN }} + ORG_GRADLE_PROJECT_snapshotsRepoURL: https://maven.pkg.github.com/${{ github.repository }} + ORG_GRADLE_PROJECT_releasesRepoURL: https://maven.pkg.github.com/${{ github.repository }} \ No newline at end of file diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml new file mode 100644 index 000000000..56303ce81 --- /dev/null +++ b/.github/workflows/push.yaml @@ -0,0 +1,29 @@ +name: Gradle Build & Test + +on: + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up GraalVM JDK 17 + uses: graalvm/setup-graalvm@v1 + with: + java-version: '17' + distribution: 'graalvm-community' + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Gradle Build + uses: gradle/gradle-build-action@v2.8.0 + with: + arguments: build + env: + ORG_GRADLE_PROJECT_mavenUser: ${{ github.actor }} + ORG_GRADLE_PROJECT_mavenPassword: ${{ secrets.GITHUB_TOKEN }} + ORG_GRADLE_PROJECT_snapshotsRepoURL: https://maven.pkg.github.com/${{ github.repository }} + ORG_GRADLE_PROJECT_releasesRepoURL: https://maven.pkg.github.com/${{ github.repository }} \ No newline at end of file diff --git a/bmm/src/main/java/org/openehr/bmm/core/BmmContainerType.java b/bmm/src/main/java/org/openehr/bmm/core/BmmContainerType.java index 57397bfc6..30163e0b4 100644 --- a/bmm/src/main/java/org/openehr/bmm/core/BmmContainerType.java +++ b/bmm/src/main/java/org/openehr/bmm/core/BmmContainerType.java @@ -21,6 +21,8 @@ * Author: Claude Nanjo */ +import org.openehr.bmm.persistence.validation.BmmDefinitions; + import java.util.List; /** @@ -36,7 +38,7 @@ public class BmmContainerType extends BmmType { private BmmGenericClass containerType; /** - * + * The type of the contained item */ private BmmUnitaryType baseType; @@ -90,7 +92,8 @@ public void setBaseType(BmmUnitaryType baseType) { */ @Override public String getTypeName() { - return containerType.getName() + "<" + baseType.getTypeName() + ">"; + return containerType.getName() + + BmmDefinitions.GENERIC_LEFT_DELIMITER + baseType.getTypeName() + BmmDefinitions.GENERIC_RIGHT_DELIMITER; } /** diff --git a/bmm/src/main/java/org/openehr/bmm/core/BmmIndexedContainerProperty.java b/bmm/src/main/java/org/openehr/bmm/core/BmmIndexedContainerProperty.java new file mode 100644 index 000000000..5a5da747a --- /dev/null +++ b/bmm/src/main/java/org/openehr/bmm/core/BmmIndexedContainerProperty.java @@ -0,0 +1,28 @@ +package org.openehr.bmm.core; + +import com.nedap.archie.base.MultiplicityInterval; + +/** + * Subtype of BMM_CONTAINER_PROPERTY that represents an indexed container type based on one of the inbuilt types + * Hash <>. + */ +public class BmmIndexedContainerProperty extends BmmProperty { + + /** + * We have to replicate cardinality here from BmmContainerProperty since we are inheriting from + * BmmProperty <BmmIndexedContainerType> (which creates correct typing of the 'type' property) not BmmContainerProperty + */ + private MultiplicityInterval cardinality; + + public BmmIndexedContainerProperty (String aName, BmmIndexedContainerType aType, String aDocumentation, boolean isMandatoryFlag, boolean isComputedFlag) { + super(aName, aType, aDocumentation, isMandatoryFlag, isComputedFlag); + cardinality = MultiplicityInterval.createOpen(); + } + + public MultiplicityInterval getCardinality() { + return cardinality; + } + public void setCardinality(MultiplicityInterval cardinality) { + this.cardinality = cardinality; + } +} diff --git a/bmm/src/main/java/org/openehr/bmm/core/BmmIndexedContainerType.java b/bmm/src/main/java/org/openehr/bmm/core/BmmIndexedContainerType.java new file mode 100644 index 000000000..6928799b5 --- /dev/null +++ b/bmm/src/main/java/org/openehr/bmm/core/BmmIndexedContainerType.java @@ -0,0 +1,26 @@ +package org.openehr.bmm.core; + +import org.openehr.bmm.persistence.validation.BmmDefinitions; + +public class BmmIndexedContainerType extends BmmContainerType { + + /** + * The type of the index + */ + private BmmSimpleType indexType; + public BmmIndexedContainerType (BmmUnitaryType aBaseType, BmmSimpleType anIndexType, BmmGenericClass aContainerClass) { + super (aBaseType, aContainerClass); + indexType = anIndexType; + } + public BmmSimpleType getIndexType() { return indexType; } + + @Override + public String getTypeName() { + return getContainerType().getName() + + BmmDefinitions.GENERIC_LEFT_DELIMITER + + indexType.getTypeName() + BmmDefinitions.GENERIC_SEPARATOR + + getBaseType().getTypeName() + + BmmDefinitions.GENERIC_RIGHT_DELIMITER; + } + +} diff --git a/bmm/src/main/java/org/openehr/bmm/v2/persistence/PBmmIndexedContainerProperty.java b/bmm/src/main/java/org/openehr/bmm/v2/persistence/PBmmIndexedContainerProperty.java new file mode 100644 index 000000000..2a804bf09 --- /dev/null +++ b/bmm/src/main/java/org/openehr/bmm/v2/persistence/PBmmIndexedContainerProperty.java @@ -0,0 +1,41 @@ +package org.openehr.bmm.v2.persistence; + +import com.nedap.archie.base.Interval; +import com.nedap.archie.base.MultiplicityInterval; +import org.openehr.bmm.core.*; +import org.openehr.bmm.v2.validation.converters.BmmClassProcessor; + +public class PBmmIndexedContainerProperty extends PBmmProperty { + + /** + * We have to replicate cardinality here from PBmmContainerProperty since we are inheriting from + * PBmmProperty (which creates correct typing of typeDef) not PBmmContainerProperty + */ + private Interval cardinality; + + public Interval getCardinality() { + return cardinality; + } + public void setCardinality(Interval cardinality) { + this.cardinality = cardinality; + } + public PBmmIndexedContainerProperty() { + super(); + } + @Override + public BmmIndexedContainerProperty createBmmProperty(BmmClassProcessor classProcessor, BmmClass bmmClass) { + PBmmIndexedContainerType typeRef = getTypeRef(); + if (typeRef != null) { + BmmIndexedContainerType bmmType = (BmmIndexedContainerType) typeRef.createBmmType(classProcessor, bmmClass); + BmmIndexedContainerProperty bmmProperty = new BmmIndexedContainerProperty(getName(), bmmType, getDocumentation(), nullToFalse(isMandatory()), nullToFalse(isComputed())); + if (getCardinality() != null) { + bmmProperty.setCardinality(new MultiplicityInterval(getCardinality())); + } + populateImBooleans(bmmProperty); + return bmmProperty; + } + throw new RuntimeException("BmmTypeCreate failed for type " + typeRef + " of property " + + getName() + " in class " + bmmClass.getName()); + } + +} diff --git a/bmm/src/main/java/org/openehr/bmm/v2/persistence/PBmmIndexedContainerType.java b/bmm/src/main/java/org/openehr/bmm/v2/persistence/PBmmIndexedContainerType.java new file mode 100644 index 000000000..b848c0b0d --- /dev/null +++ b/bmm/src/main/java/org/openehr/bmm/v2/persistence/PBmmIndexedContainerType.java @@ -0,0 +1,57 @@ +package org.openehr.bmm.v2.persistence; + +import org.openehr.bmm.core.*; +import org.openehr.bmm.persistence.validation.BmmDefinitions; +import org.openehr.bmm.v2.validation.converters.BmmClassProcessor; + +import java.util.ArrayList; +import java.util.List; + +public class PBmmIndexedContainerType extends PBmmContainerType { + + private String indexType; + + public String getIndexType() { + return indexType; + } + + public void setIndexType(String indexType) { + this.indexType = indexType; + } + + @Override + public BmmIndexedContainerType createBmmType(BmmClassProcessor processor, BmmClass classDefinition) { + BmmClass containerClassDef = processor.getClassDefinition (getContainerType()); + BmmClass indexClassDef = processor.getClassDefinition (indexType); + PBmmUnitaryType containedType = getTypeRef(); //get the actual typeref for conversion + if (containerClassDef instanceof BmmGenericClass && + indexClassDef instanceof BmmSimpleClass && + containedType != null) + { + BmmType containedBmmType = containedType.createBmmType(processor, classDefinition); + if (containedBmmType instanceof BmmUnitaryType) { + return new BmmIndexedContainerType((BmmUnitaryType) containedBmmType, + ((BmmSimpleClass) indexClassDef).getType(), + (BmmGenericClass) containerClassDef); + } + } + + throw new RuntimeException("BmmClass " + containerClassDef.getName() + " is not defined in this model or not an indexed container type"); + } + @Override + public String asTypeString() { + return getContainerType() + BmmDefinitions.GENERIC_LEFT_DELIMITER + + indexType + BmmDefinitions.GENERIC_SEPARATOR + getTypeRef().asTypeString() + + BmmDefinitions.GENERIC_RIGHT_DELIMITER; + } + @Override + public List flattenedTypeList() { + List result = new ArrayList<>(); + result.add(getContainerType()); + result.add(indexType); + if (getTypeRef() != null) { + result.addAll(getTypeRef().flattenedTypeList()); + } + return result; + } +} diff --git a/bmm/src/main/java/org/openehr/bmm/v2/persistence/jackson/BmmTypeNaming.java b/bmm/src/main/java/org/openehr/bmm/v2/persistence/jackson/BmmTypeNaming.java index d25a5b4b9..2675b2367 100644 --- a/bmm/src/main/java/org/openehr/bmm/v2/persistence/jackson/BmmTypeNaming.java +++ b/bmm/src/main/java/org/openehr/bmm/v2/persistence/jackson/BmmTypeNaming.java @@ -25,6 +25,7 @@ public class BmmTypeNaming extends ClassNameIdResolver { put("BMM_INCLUDE_SPEC", BmmIncludeSpec.class). put("P_BMM_CLASS", PBmmClass.class). put("P_BMM_CONTAINER_PROPERTY", PBmmContainerProperty.class). + put("P_BMM_INDEXED_CONTAINER_PROPERTY", PBmmIndexedContainerProperty.class). put("P_BMM_ENUMERATION", PBmmEnumeration.class). put("P_BMM_ENUMERATION_STRING", PBmmEnumerationString.class). put("P_BMM_ENUMERATION_INTEGER", PBmmEnumerationInteger.class). @@ -33,6 +34,7 @@ public class BmmTypeNaming extends ClassNameIdResolver { put("P_BMM_GENERIC_TYPE", PBmmGenericType.class). put("P_BMM_OPEN_TYPE", PBmmOpenType.class). put("P_BMM_CONTAINER_TYPE", PBmmContainerType.class). + put("P_BMM_INDEXED_CONTAINER_TYPE", PBmmIndexedContainerType.class). put("P_BMM_PACKAGE", PBmmPackage.class). put("P_BMM_PROPERTY", PBmmProperty.class). put("P_BMM_SCHEMA", PBmmSchema.class). diff --git a/bmm/src/test/java/org/openehr/bmm/v2/persistence/converters/BmmParseRoundtripTest.java b/bmm/src/test/java/org/openehr/bmm/v2/persistence/converters/BmmParseRoundtripTest.java index af774f28f..e10159029 100644 --- a/bmm/src/test/java/org/openehr/bmm/v2/persistence/converters/BmmParseRoundtripTest.java +++ b/bmm/src/test/java/org/openehr/bmm/v2/persistence/converters/BmmParseRoundtripTest.java @@ -24,6 +24,14 @@ public void parseTestBmmRoundTrip() throws Exception{ parseRoundTrip("/testbmm/TestBmm1.bmm"); } + @Test + public void parseS2BmmRoundTrip() throws Exception{ + parseRoundTrip("/s2/s2_base_070.bmm"); + parseRoundTrip("/s2/s2_base_data_types_070.bmm"); + parseRoundTrip("/s2/s2_base_resource_070.bmm"); + parseRoundTrip("/s2/s2_care_ehr_065.bmm"); + parseRoundTrip("/s2/s2_care_entry_065.bmm"); + } @Test public void parseOpenEHRRoundTrip() throws Exception{ parseRoundTrip("/openehr/openehr_basic_types_102.bmm"); @@ -32,6 +40,7 @@ public void parseOpenEHRRoundTrip() throws Exception{ parseRoundTrip("/openehr/openehr_primitive_types_102.bmm"); parseRoundTrip("/openehr/openehr_rm_102.bmm"); parseRoundTrip("/openehr/openehr_structures_102.bmm"); + parseRoundTrip("/openehr/openehr_base_110.bmm"); } public void parseRoundTrip(String name) throws Exception { diff --git a/bmm/src/test/java/org/openehr/bmm/v2/persistence/converters/ConversionTest.java b/bmm/src/test/java/org/openehr/bmm/v2/persistence/converters/ConversionTest.java index 486647e31..07acb899b 100644 --- a/bmm/src/test/java/org/openehr/bmm/v2/persistence/converters/ConversionTest.java +++ b/bmm/src/test/java/org/openehr/bmm/v2/persistence/converters/ConversionTest.java @@ -1,9 +1,10 @@ package org.openehr.bmm.v2.persistence.converters; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; -import org.openehr.bmm.core.BmmClass; -import org.openehr.bmm.core.BmmGenericType; -import org.openehr.bmm.core.BmmModel; +import org.openehr.bmm.core.*; import org.openehr.bmm.v2.persistence.PBmmSchema; import org.openehr.bmm.v2.persistence.odin.BmmOdinParser; import org.openehr.bmm.v2.persistence.odin.BmmOdinSerializer; @@ -21,35 +22,59 @@ public class ConversionTest { - @Test - public void testAdlTestSchema() throws Exception { - BmmRepository repo = new BmmRepository(); - repo.addPersistentSchema(parse("/openehr/openehr_primitive_types_102.bmm")); - repo.addPersistentSchema(parse("/openehr/openehr_basic_types_102.bmm")); - repo.addPersistentSchema(parse("/openehr/openehr_adltest_100.bmm")); + private static BmmRepository repo1; + private static BmmRepository repo2; + + @BeforeClass + public static void setup() throws Exception { + BmmSchemaConverter converter; - BmmSchemaConverter converter = new BmmSchemaConverter(repo); + repo1 = new BmmRepository(); + repo1.addPersistentSchema(parse("/openehr/openehr_primitive_types_102.bmm")); + repo1.addPersistentSchema(parse("/openehr/openehr_basic_types_102.bmm")); + repo1.addPersistentSchema(parse("/openehr/openehr_adltest_100.bmm")); + repo1.addPersistentSchema(parse("/openehr/openehr_base_110.bmm")); + + converter = new BmmSchemaConverter(repo1); converter.validateAndConvertRepository(); - for (BmmValidationResult validationResult:repo.getModels()) { + for (BmmValidationResult validationResult:repo1.getModels()) { System.out.println(validationResult.getLogger()); - assertTrue("the OpenEHR ADL Test 1.0.0 BMM files should pass validation", validationResult.passes()); + assertTrue("the OpenEHR schema " + validationResult.getSchemaId() + " should pass validation", validationResult.passes()); } - BmmModel adlTestModel = repo.getModel("openehr_adltest_1.0.0").getModel(); + + repo2 = new BmmRepository(); + repo2.addPersistentSchema(parse("/openehr/openehr_base_for_aom.bmm")); + repo2.addPersistentSchema(parse("/openehr/openEHR_aom_206.bmm")); + converter = new BmmSchemaConverter(repo2); + converter.validateAndConvertRepository(); + for (BmmValidationResult validationResult:repo2.getModels()) { + System.out.println(validationResult.getLogger()); + assertTrue("the OpenEHR schema " + validationResult.getSchemaId() + " should pass validation", validationResult.passes()); + } + } + + @AfterClass + public static void tearDown() { + repo1 = null; + repo2 = null; + } + + @Test + public void testAdlTestSchema() throws Exception { + BmmModel bmmModel = repo1.getModel("openehr_adltest_1.0.0").getModel(); // Descendant relations assertTrue ("\"GENERIC_CHILD_CLOSED\" descendant of \"GENERIC_PARENT\"", - adlTestModel.descendantOf("GENERIC_CHILD_CLOSED", "GENERIC_PARENT")); + bmmModel.descendantOf("GENERIC_CHILD_CLOSED", "GENERIC_PARENT")); // Ancestor relations - List testResult = adlTestModel.getAllAncestorClasses("GENERIC_CHILD_OPEN_T"); + List testResult = bmmModel.getAllAncestorClasses("GENERIC_CHILD_OPEN_T"); // conformance result from ADL Workbench List conformanceResult = Arrays.asList("GENERIC_PARENT"); assertEquals ("\"GENERIC_CHILD_CLOSED\" descendant of \"GENERIC_PARENT\")", testResult, conformanceResult); - } - @Test public void generateOdinTest() throws Exception { PBmmSchema parsed = parse("/openehr/openehr_basic_types_102.bmm"); @@ -58,40 +83,85 @@ public void generateOdinTest() throws Exception { PBmmSchema converted = BmmOdinParser.convert(serialized); } - + /* + * This tests the following (old) BMM way of representing a property of type Hash + * that should now be represented using P_BMM_INDEXED_CONTAINER_PROPERTY + * ["original_resource_uri"] = (P_BMM_GENERIC_PROPERTY) < + * name = <"original_resource_uri"> + * type_def = < + * root_type = <"Hash"> + * generic_parameters = <"String", "String"> + * > + * is_mandatory = + * > + */ @Test public void generateGenericParametersTest() throws Exception { - BmmRepository repo = new BmmRepository(); - repo.addPersistentSchema(parse("/openehr/openehr_base_110.bmm")); - BmmSchemaConverter converter = new BmmSchemaConverter(repo); - converter.validateAndConvertRepository(); - for (BmmValidationResult validationResult:repo.getModels()) { - System.out.println(validationResult.getLogger()); - assertTrue("the OpenEHR RM 1.1.0 Base file should pass validation", validationResult.passes()); - } - //RESOURCE_DESCRIPTION_ITEM.original_resource_uri should be a LIST> - BmmModel baseModel = repo.getModel("openehr_base_1.1.0").getModel(); - BmmClass resourceDescriptionItem = baseModel.getClassDefinition("RESOURCE_DESCRIPTION_ITEM"); - BmmGenericType hashContentType = (BmmGenericType) resourceDescriptionItem.getFlatProperties().get("original_resource_uri").getType().getEffectiveType(); + BmmModel bmmModel = repo1.getModel("openehr_base_1.1.0").getModel(); + BmmClass bmmClass = bmmModel.getClassDefinition("RESOURCE_DESCRIPTION_ITEM"); + BmmGenericType hashContentType = (BmmGenericType) bmmClass.getFlatProperties().get("original_resource_uri").getType().getEffectiveType(); assertEquals(2, hashContentType.getGenericParameters().size()); assertEquals("Hash", hashContentType.toDisplayString()); } + /* + * This tests the BMM way of representing a generic property of type DV_INTERVAL + * ["qty_interval_attr_1"] = (P_BMM_GENERIC_PROPERTY) < + * name = <"qty_interval_attr_1"> + * type_def = < + * root_type = <"DV_INTERVAL"> + * generic_parameters = <"DV_QUANTITY"> + * > + * > + */ + @Test + public void generateGenericParametersTest2() throws Exception { + BmmModel bmmModel = repo1.getModel("openehr_adltest_1.0.0").getModel(); + BmmClass bmmClass = bmmModel.getClassDefinition("SOME_TYPE"); + BmmGenericType genericType = (BmmGenericType) bmmClass.getFlatProperties().get("qty_interval_attr_1").getType().getEffectiveType(); + assertEquals(1, genericType.getGenericParameters().size()); + assertEquals("DV_INTERVAL", genericType.toDisplayString()); + } + + /* + * This tests the BMM way of representing a container property of type Hash + * using the P_BMM_INDEXED_CONTAINER_PROPERTY property meta-type. + * ["other_details"] = (P_BMM_INDEXED_CONTAINER_PROPERTY) < + * name = <"other_details"> + * type_def = < + * container_type = <"Hash"> + * index_type = <"String"> + * type = <"String"> + * > + * > + */ + @Test + public void generateIndexedContainerTest() throws Exception { + BmmModel bmmModel = repo1.getModel("openehr_base_1.1.0").getModel(); + BmmClass bmmClass = bmmModel.getClassDefinition("RESOURCE_DESCRIPTION_ITEM"); + BmmIndexedContainerType hashType = (BmmIndexedContainerType) bmmClass.getFlatProperties().get("other_details").getType(); + + BmmSimpleType hashIndexType = hashType.getIndexType(); + assertEquals(hashIndexType.getTypeName(), "String"); + + BmmUnitaryType hashBaseType = hashType.getBaseType(); + assertEquals(hashBaseType.getTypeName(), "String"); + + BmmGenericClass hashContainerClass = hashType.getContainerType(); + assertEquals(hashContainerClass.getName(), "Hash"); + + assertEquals("Hash", hashType.toDisplayString()); + } + + /* + * RESOURCE_DESCRIPTION_ITEM.original_resource_uri in openehr_aom_2.0.6 + * should be a LIST> + */ @Test public void aomParseAndConvertTest() throws Exception { - BmmRepository repo = new BmmRepository(); - repo.addPersistentSchema(parse("/openehr/openehr_base_for_aom.bmm")); - repo.addPersistentSchema(parse("/openehr/openEHR_aom_206.bmm")); - BmmSchemaConverter converter = new BmmSchemaConverter(repo); - converter.validateAndConvertRepository(); - for (BmmValidationResult validationResult:repo.getModels()) { - System.out.println(validationResult.getLogger()); - assertTrue("the AOM schema must be valid", validationResult.passes()); - } - //RESOURCE_DESCRIPTION_ITEM.original_resource_uri should be a LIST> - BmmModel baseModel = repo.getModel("openehr_aom_2.0.6").getModel(); - BmmClass resourceDescriptionItem = baseModel.getClassDefinition("RESOURCE_DESCRIPTION_ITEM"); - BmmGenericType hashContentType = (BmmGenericType) resourceDescriptionItem.getFlatProperties().get("original_resource_uri").getType().getEffectiveType(); + BmmModel bmmModel = repo2.getModel("openehr_aom_2.0.6").getModel(); + BmmClass bmmClass = bmmModel.getClassDefinition("RESOURCE_DESCRIPTION_ITEM"); + BmmGenericType hashContentType = (BmmGenericType) bmmClass.getFlatProperties().get("original_resource_uri").getType().getEffectiveType(); assertEquals(2, hashContentType.getGenericParameters().size()); assertEquals("Hash", hashContentType.toDisplayString());//this is not according to spec perhaps, but it is how the Archie AOM is implemented, and this is a direct conversion } diff --git a/bmm/src/test/java/org/openehr/bmm/v2/persistence/converters/S2Care065ConversionTest.java b/bmm/src/test/java/org/openehr/bmm/v2/persistence/converters/S2Care065ConversionTest.java new file mode 100644 index 000000000..f60799609 --- /dev/null +++ b/bmm/src/test/java/org/openehr/bmm/v2/persistence/converters/S2Care065ConversionTest.java @@ -0,0 +1,126 @@ + +package org.openehr.bmm.v2.persistence.converters; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openehr.bmm.core.*; +import org.openehr.bmm.v2.validation.BmmRepository; +import org.openehr.bmm.v2.validation.BmmSchemaConverter; +import org.openehr.bmm.v2.validation.BmmValidationResult; + +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.Set; + +import static org.junit.Assert.*; +import static org.openehr.bmm.v2.persistence.converters.BmmTestUtil.parse; + +public class S2Care065ConversionTest { + + private static BmmModel s2care065model; + private static BmmRepository repo; + + @BeforeClass + public static void setup() throws Exception { + repo = new BmmRepository(); + repo.addPersistentSchema(parse("/s2/s2_base_foundation_types_070.bmm")); + repo.addPersistentSchema(parse("/s2/s2_base_data_types_070.bmm")); + repo.addPersistentSchema(parse("/s2/s2_base_model_support_070.bmm")); + repo.addPersistentSchema(parse("/s2/s2_base_patterns_070.bmm")); + repo.addPersistentSchema(parse("/s2/s2_base_resource_070.bmm")); + repo.addPersistentSchema(parse("/s2/s2_base_change_control_070.bmm")); + repo.addPersistentSchema(parse("/s2/s2_base_070.bmm")); + repo.addPersistentSchema(parse("/s2/s2_care_entry_065.bmm")); + repo.addPersistentSchema(parse("/s2/s2_care_ehr_065.bmm")); + repo.addPersistentSchema(parse("/s2/s2_care_065.bmm")); + + BmmSchemaConverter converter = new BmmSchemaConverter(repo); + converter.validateAndConvertRepository(); + + s2care065model = repo.getModel("s2_care_0.6.5").getModel(); + } + + @AfterClass + public static void tearDown() { + //not very important, but frees up some memory + s2care065model = null; + repo = null; + } + + @Test + public void testValid() throws Exception { + + for (BmmValidationResult validationResult:repo.getModels()) { + System.out.println(validationResult.getLogger()); + assertTrue("the S2 RM 0.6.5 BMM files should pass validation", validationResult.passes()); + } + } + + @Test + public void testModelPaths() throws Exception { + // check some paths through the model + assertTrue ("property defined in class: (\"Care_entry\", \"/qualifiers\")", s2care065model.hasPropertyAtPath("Care_entry", "/qualifiers")); + assertTrue ("property defined in descendant: (\"Care_entry\", \"/reporter/external_ref\")", s2care065model.hasPropertyAtPath("Care_entry", "/reporter/external_ref")); + assertTrue ("property defined in ancestor: (\"Observation\", \"/data/items\")", s2care065model.hasPropertyAtPath("Observation", "/data/items")); + assertTrue ("property defined in class: (\"Observation\", \"/state/value\")", s2care065model.hasPropertyAtPath("Observation", "/state/value")); + assertTrue ("property defined in descendant: (\"Direct_observation\", \"/total_duration\")", s2care065model.hasPropertyAtPath("Direct_observation", "/total_duration")); + assertTrue ("property defined in descendant: (\"Direct_observation\", \"/data_series/items\")", s2care065model.hasPropertyAtPath("Direct_observation", "/data_series/items")); + assertTrue ("property defined in descendant: (\"Questionnaire_response\", \"/questionnaire_title/concept/uri\")", s2care065model.hasPropertyAtPath("Questionnaire_response", "/questionnaire_title/concept/uri")); + assertTrue ("property defined in class: (\"Composition\", \"/context\")", s2care065model.hasPropertyAtPath("Composition", "/context")); + assertTrue ("property defined in descendant: (\"Node\", \"/items/items/items\")", s2care065model.hasPropertyAtPath("Node", "/items/items/items")); + assertTrue ("property defined in class: (\"Quantity\", \"/magnitude\")", s2care065model.hasPropertyAtPath("Quantity", "/magnitude")); + } + + @Test + public void testPropertyMetatypes() throws Exception { + // check meta-types of some properties at paths + assertTrue ("BmmSimpleType at path: (\"Observation\", \"/uid\")", s2care065model.propertyAtPath("Observation", "/uid").getType() instanceof BmmSimpleType); + assertTrue ("BmmContainerType at path: (\"Observation\", \"/data\")", s2care065model.propertyAtPath("Observation", "/data").getType() instanceof BmmContainerType); + assertTrue ("BmmIndexedContainerType at path: (\"Locatable\", \"/feeder_audit/feeder_system_audit/other_details\")", s2care065model.propertyAtPath("Locatable", "/feeder_audit/feeder_system_audit/other_details").getType() instanceof BmmIndexedContainerType); + assertTrue ("BmmGenericType at path: (\"Reference_range\", \"/range\")", s2care065model.propertyAtPath("Reference_range", "/range").getType() instanceof BmmGenericType); + assertTrue ("BmmGSimpleType at path: (\"Care_entry\", \"/subject\")", s2care065model.propertyAtPath("Care_entry", "/subject").getType() instanceof BmmSimpleType); + } + + @Test + public void testModelDescendants() throws Exception { + // test descendant relations + assertTrue ("\"Observation\" descendant of \"Locatable\")", s2care065model.descendantOf("Observation", "Locatable")); + assertFalse ("\"Locatable\" not descendant of \"Composition\")", s2care065model.descendantOf("Locatable", "Composition")); + assertTrue ("\"Quantity\" descendant of \"Measurable\")", s2care065model.descendantOf("Quantity", "Measurable")); + assertTrue ("\"Duration_value\" descendant of \"Ordered_datum\")", s2care065model.descendantOf("Duration_value", "Ordered_datum")); + } + + @Test + public void testCompositionImmediateSuppliers() throws Exception { + // test supplier relations + Set testResult = s2care065model.suppliers("Composition"); + + // conformance result from ADL Workbench + Set conformanceResult = new LinkedHashSet<>( + Arrays.asList( + "Party_self", "Terminology_code", "Content_item", "Sample_function_kind", "String", "Archetyped", "Version_status", "Comparison_operator", "Uri", + "Party_identified", "Section", "Feeder_audit", "Party_proxy", "Event_context", "Order_execution_state", "Entry", "Uuid", "Terminology_term", + "Order_execution_transition", "Trend_kind", "Validity_kind", "Link" + ) + ); + assertEquals ("\"Composition\" has suppliers {\"Terminology_code\", \"Party_proxy\", ...})", testResult, conformanceResult); + } + + @Test + public void testPartyIdentifiedSuppliers() throws Exception { + // test supplier relations + Set testResult = s2care065model.supplierClosure("Party_identified"); + + // conformance result from ADL Workbench + Set conformanceResult = new LinkedHashSet<>( + Arrays.asList( + "Sample_function_kind", "String", "Version_status", "Comparison_operator", "Object_version_id", "Uri", "Order_execution_state", + "Locatable_ref", "Object_id", "Rwe_id_ref", "Object_ref", "Order_execution_transition", "Trend_kind", "Validity_kind" + ) + ); + + assertEquals ("\"Party_identified\" has suppliers {\"String\", \"Rwe_id_ref\", ...})", testResult, conformanceResult); + } + +} diff --git a/bmm/src/test/resources/openehr/openehr_base_110.bmm b/bmm/src/test/resources/openehr/openehr_base_110.bmm index 6c19a3dff..81a5c42d8 100644 --- a/bmm/src/test/resources/openehr/openehr_base_110.bmm +++ b/bmm/src/test/resources/openehr/openehr_base_110.bmm @@ -78,7 +78,7 @@ packages = < > ["resource"] = < name = <"resource"> - classes = <"AUTHORED_RESOURCE", "TRANSLATION_DETAILS", "RESOURCE_DESCRIPTION", "RESOURCE_DESCRIPTION_ITEM"> + classes = <"AUTHORED_RESOURCE", "TRANSLATION_DETAILS", "RESOURCE_DESCRIPTION", "RESOURCE_DESCRIPTION_ITEM", "RESOURCE_ANNOTATIONS"> > > > @@ -590,28 +590,29 @@ class_definitions = < properties = < ["original_language"] = (P_BMM_SINGLE_PROPERTY) < name = <"original_language"> - type_ref = < - type = <"Terminology_code"> - value_constraint = <"openEHR::languages"> - > + type = <"Terminology_code"> is_mandatory = > ["is_controlled"] = (P_BMM_SINGLE_PROPERTY) < name = <"is_controlled"> type = <"Boolean"> > - ["translations"] = (P_BMM_CONTAINER_PROPERTY) < - name = <"translations"> - type_def = < - container_type = <"List"> - type = <"TRANSLATION_DETAILS"> - > - cardinality = <|>=1|> - > + ["translations"] = (P_BMM_INDEXED_CONTAINER_PROPERTY) < + name = <"translations"> + type_def = < + container_type = <"Hash"> + index_type = <"String"> + type = <"TRANSLATION_DETAILS"> + > + > ["description"] = (P_BMM_SINGLE_PROPERTY) < name = <"description"> type = <"RESOURCE_DESCRIPTION"> > + ["annotations"] = (P_BMM_SINGLE_PROPERTY) < + name = <"annotations"> + type = <"RESOURCE_ANNOTATIONS"> + > > > @@ -621,46 +622,54 @@ class_definitions = < properties = < ["language"] = (P_BMM_SINGLE_PROPERTY) < name = <"language"> - type_ref = < - type = <"Terminology_code"> - value_constraint = <"openEHR::languages"> - > + type = <"Terminology_code"> is_mandatory = > - ["author"] = (P_BMM_GENERIC_PROPERTY) < - name = <"author"> - type_def = < - root_type = <"Hash"> - generic_parameters = <"String", "String"> - > + ["author"] = (P_BMM_INDEXED_CONTAINER_PROPERTY) < + name = <"author"> + type_def = < + container_type = <"Hash"> + index_type = <"String"> + type = <"String"> + > is_mandatory = > ["accreditation"] = (P_BMM_SINGLE_PROPERTY) < name = <"accreditation"> type = <"String"> > - ["other_details"] = (P_BMM_GENERIC_PROPERTY) < - name = <"other_details"> - type_def = < - root_type = <"Hash"> - generic_parameters = <"String", "String"> - > + ["version_last_translated"] = (P_BMM_SINGLE_PROPERTY) < + name = <"version_last_translated"> + type = <"String"> + > + ["other_details"] = (P_BMM_INDEXED_CONTAINER_PROPERTY) < + name = <"other_details"> + type_def = < + container_type = <"Hash"> + index_type = <"String"> + type = <"String"> + > > > > ["RESOURCE_DESCRIPTION"] = < name = <"RESOURCE_DESCRIPTION"> - ancestors = <"Any", ...> + ancestors = <"Any"> properties = < - ["original_author"] = (P_BMM_GENERIC_PROPERTY) < - name = <"original_author"> - type_def = < - root_type = <"Hash"> - generic_parameters = <"String", "String"> - > + ["original_author"] = (P_BMM_INDEXED_CONTAINER_PROPERTY) < + name = <"original_author"> + type_def = < + container_type = <"Hash"> + index_type = <"String"> + type = <"String"> + > is_mandatory = > + ["original_namespace"] = (P_BMM_SINGLE_PROPERTY) < + name = <"original_namespace"> + type = <"String"> + > ["other_contributors"] = (P_BMM_CONTAINER_PROPERTY) < name = <"other_contributors"> type_def = < @@ -669,6 +678,22 @@ class_definitions = < > cardinality = <|>=0|> > + ["custodian_namespace"] = (P_BMM_SINGLE_PROPERTY) < + name = <"custodian_namespace"> + type = <"String"> + > + ["custodian_organisation"] = (P_BMM_SINGLE_PROPERTY) < + name = <"custodian_organisation"> + type = <"String"> + > + ["copyright"] = (P_BMM_SINGLE_PROPERTY) < + name = <"copyright"> + type = <"String"> + > + ["licence"] = (P_BMM_SINGLE_PROPERTY) < + name = <"licence"> + type = <"String"> + > ["lifecycle_state"] = (P_BMM_SINGLE_PROPERTY) < name = <"lifecycle_state"> type = <"String"> @@ -678,26 +703,51 @@ class_definitions = < name = <"resource_package_uri"> type = <"String"> > - ["other_details"] = (P_BMM_GENERIC_PROPERTY) < - name = <"other_details"> - type_def = < - root_type = <"Hash"> - generic_parameters = <"String", "String"> - > + ["ip_acknowledgements"] = (P_BMM_INDEXED_CONTAINER_PROPERTY) < + name = <"ip_acknowledgements"> + type_def = < + container_type = <"Hash"> + index_type = <"String"> + type = <"String"> + > + > + + ["references"] = (P_BMM_INDEXED_CONTAINER_PROPERTY) < + name = <"references"> + type_def = < + container_type = <"Hash"> + index_type = <"String"> + type = <"String"> + > + > + ["conversion_details"] = (P_BMM_INDEXED_CONTAINER_PROPERTY) < + name = <"conversion_details"> + type_def = < + container_type = <"Hash"> + index_type = <"String"> + type = <"String"> + > + > + ["other_details"] = (P_BMM_INDEXED_CONTAINER_PROPERTY) < + name = <"other_details"> + type_def = < + container_type = <"Hash"> + index_type = <"String"> + type = <"String"> + > > ["parent_resource"] = (P_BMM_SINGLE_PROPERTY) < name = <"parent_resource"> type = <"AUTHORED_RESOURCE"> is_mandatory = > - ["details"] = (P_BMM_CONTAINER_PROPERTY) < - name = <"details"> - type_def = < - container_type = <"List"> - type = <"RESOURCE_DESCRIPTION_ITEM"> - > - is_mandatory = - cardinality = <|>=1|> + ["details"] = (P_BMM_INDEXED_CONTAINER_PROPERTY) < + name = <"details"> + type_def = < + container_type = <"Hash"> + index_type = <"String"> + type = <"RESOURCE_DESCRIPTION_ITEM"> + > > > > @@ -708,10 +758,7 @@ class_definitions = < properties = < ["language"] = (P_BMM_SINGLE_PROPERTY) < name = <"language"> - type_ref = < - type = <"Terminology_code"> - value_constraint = <"openEHR::languages"> - > + type = <"Terminology_code"> is_mandatory = > ["purpose"] = (P_BMM_SINGLE_PROPERTY) < @@ -735,30 +782,53 @@ class_definitions = < name = <"misuse"> type = <"String"> > - ["copyright"] = (P_BMM_SINGLE_PROPERTY) < - name = <"copyright"> - type = <"String"> - > - ["original_resource_uri"] = (P_BMM_CONTAINER_PROPERTY) < - name = <"original_resource_uri"> - type_def = < - container_type = <"List"> - type_def = (P_BMM_GENERIC_TYPE) < - root_type = <"Hash"> - generic_parameters = <"String", "String"> - > - > - cardinality = <|>=0|> - > - ["other_details"] = (P_BMM_GENERIC_PROPERTY) < + ["original_resource_uri"] = (P_BMM_GENERIC_PROPERTY) < + name = <"original_resource_uri"> + type_def = < + root_type = <"Hash"> + generic_parameters = <"String", "String"> + > + is_mandatory = + > + ["other_details"] = (P_BMM_INDEXED_CONTAINER_PROPERTY) < name = <"other_details"> + type_def = < + container_type = <"Hash"> + index_type = <"String"> + type = <"String"> + > + > + > + > + + ["RESOURCE_ANNOTATIONS"] = < + name = <"RESOURCE_ANNOTATIONS"> + ancestors = <"Any"> + properties = < + ["documentation"] = (P_BMM_GENERIC_PROPERTY) < + name = <"documentation"> type_def = < root_type = <"Hash"> - generic_parameters = <"String", "String"> + generic_parameter_defs = < + ["K"] = (P_BMM_SIMPLE_TYPE) < + type = <"String"> + > + ["V"] = (P_BMM_GENERIC_TYPE) < + root_type = <"Hash"> + generic_parameter_defs = < + ["K"] = (P_BMM_SIMPLE_TYPE) < + type = <"String"> + > + ["V"] = (P_BMM_GENERIC_TYPE) < + root_type = <"Hash"> + generic_parameters = <"String", "String"> + > + > + > + > > is_mandatory = > > > - > diff --git a/bmm/src/test/resources/s2/s2_base_070.bmm b/bmm/src/test/resources/s2/s2_base_070.bmm new file mode 100644 index 000000000..6f0afcfca --- /dev/null +++ b/bmm/src/test/resources/s2/s2_base_070.bmm @@ -0,0 +1,46 @@ +-- +-- component: Graphite BMMs +-- description: Graphite BASE Component schema. This file format is based on the BMM specification +-- http://www.openEHR.org/releases/BASE/latest/docs/bmm/bmm.html +-- keywords: reference model, meta-model, archetypes +-- author: Thomas Beale +-- support: https://graphitehealth.atlassian.net/projects/issues +-- copyright: Copyright (c) 2023 Graphite Health +-- license: Apache 2.0 +-- + +------------------------------------------------------ +-- BMM version on which these schemas are based. +------------------------------------------------------ +bmm_version = <"2.3"> + +------------------------------------------------------ +-- schema identification +-- (schema_id computed as __) +------------------------------------------------------ +rm_publisher = <"s2"> +schema_name = <"base"> +rm_release = <"0.7.0"> + +------------------------------------------------------ +-- schema documentation +------------------------------------------------------ +schema_revision = <"0.7.0.1"> +schema_lifecycle_state = <"trial"> +schema_description = <"S2 Release 0.7.0 BASE model foundation and base types packages"> +schema_author = <"Thomas Beale "> + +------------------------------------------------------ +-- includes +------------------------------------------------------ +includes = < + ["1"] = < + id = <"s2_base_resource_0.7.0"> + > + ["2"] = < + id = <"s2_base_change_control_0.7.0"> + > + ["3"] = < + id = <"s2_base_patterns_0.7.0"> + > +> diff --git a/bmm/src/test/resources/s2/s2_base_change_control_070.bmm b/bmm/src/test/resources/s2/s2_base_change_control_070.bmm new file mode 100644 index 000000000..9c0a53735 --- /dev/null +++ b/bmm/src/test/resources/s2/s2_base_change_control_070.bmm @@ -0,0 +1,284 @@ +-- +-- component: Graphite Canonical Model BMM - BASE Change control +-- description: Graphite Canonical Model component formal expression. This file is an ODIN serialisation of +-- the BMM object meta-model classes found at +-- https://www.openEHR.org/releases/LANG/latest/p_bmm.html +-- keywords: reference model, meta-model, archetypes +-- author: Thomas Beale +-- support: https://graphite.atlassian.net/issues/ +-- copyright: Copyright (c) 2023- Graphite Health +-- license: Apache 2.0 +-- + +------------------------------------------------------ +-- BMM version on which these schemas are based. +------------------------------------------------------ +bmm_version = <"2.3"> + +------------------------------------------------------ +-- schema identification +-- (schema_id computed as __) +------------------------------------------------------ +rm_publisher = <"s2"> +schema_name = <"base_change_control"> +rm_release = <"0.7.0"> + +------------------------------------------------------ +-- schema documentation +------------------------------------------------------ +schema_revision = <"0.7.0.1"> +schema_lifecycle_state = <"trial"> +schema_description = <"S2 Release 0.7.0 change control schema"> +schema_author = <"Thomas Beale "> + +------------------------------------------------------ +-- inclusions +------------------------------------------------------ +includes = < + ["1"] = < + id = <"s2_base_model_support_0.7.0"> + > +> + +------------------------------------------------------ +-- packages +------------------------------------------------------ + +packages = < + ["org.s2.base.change_control"] = < + name = <"org.s2.base.change_control"> + classes = <"Versioned_object", "Contribution", "Version", "Original_version", "Imported_version", "Audit_details", "Attestation"> + > +> + + +------------------------------------------------------ +-- classes +------------------------------------------------------ + +class_definitions = < + + ["Audit_details"] = < + name = <"Audit_details"> + ancestors = <"Any"> + properties = < + ["system_id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"system_id"> + type = <"String"> + is_mandatory = + > + ["time_committed"] = (P_BMM_SINGLE_PROPERTY) < + name = <"time_committed"> + type = <"Date_time"> + is_mandatory = + > + ["change_type"] = (P_BMM_SINGLE_PROPERTY) < + name = <"change_type"> + type = <"Terminology_term"> + is_mandatory = + > + ["description"] = (P_BMM_SINGLE_PROPERTY) < + name = <"description"> + type = <"Terminology_term"> + > + ["committer"] = (P_BMM_SINGLE_PROPERTY) < + name = <"committer"> + type = <"Party_proxy"> + is_mandatory = + > + > + > + + ["Attestation"] = < + name = <"Attestation"> + ancestors = <"Audit_details"> + properties = < + ["attested_view"] = (P_BMM_SINGLE_PROPERTY) < + name = <"attested_view"> + type = <"Multimedia"> + > + ["proof"] = (P_BMM_SINGLE_PROPERTY) < + name = <"proof"> + type = <"String"> + > + ["items"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"items"> + type_def = < + container_type = <"List"> + type = <"Uri"> + > + cardinality = <|>=0|> + > + ["reason"] = (P_BMM_SINGLE_PROPERTY) < + name = <"reason"> + type = <"String"> + is_mandatory = + > + ["is_pending"] = (P_BMM_SINGLE_PROPERTY) < + name = <"is_pending"> + type = <"Boolean"> + is_mandatory = + > + > + > + + ["Contribution"] = < + name = <"Contribution"> + ancestors = <"Any"> + properties = < + ["uid"] = (P_BMM_SINGLE_PROPERTY) < + name = <"uid"> + type = <"Uuid"> + is_mandatory = + is_im_infrastructure = + > + ["audit"] = (P_BMM_SINGLE_PROPERTY) < + name = <"audit"> + type = <"Audit_details"> + is_mandatory = + is_im_infrastructure = + > + ["versions"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"versions"> + type_def = < + container_type = <"List"> + type = <"Object_ref"> + > + cardinality = <|>=0|> + is_mandatory = + is_im_infrastructure = + > + > + > + + ["Versioned_object"] = < + name = <"Versioned_object"> + ancestors = <"Any"> + generic_parameter_defs = < + ["T"] = < + name = <"T"> + > + > + properties = < + ["uid"] = (P_BMM_SINGLE_PROPERTY) < + name = <"uid"> + type = <"Uuid"> + is_mandatory = + is_im_infrastructure = + > + ["owner_id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"owner_id"> + type = <"Object_ref"> + is_mandatory = + is_im_infrastructure = + > + ["time_created"] = (P_BMM_SINGLE_PROPERTY) < + name = <"time_created"> + type = <"Date_time"> + is_mandatory = + is_im_infrastructure = + > + > + > + + ["Version"] = < + name = <"Version"> + ancestors = <"Any"> + is_abstract = + generic_parameter_defs = < + ["T"] = < + name = <"T"> + > + > + properties = < + ["contribution"] = (P_BMM_SINGLE_PROPERTY) < + name = <"contribution"> + type = <"Object_ref"> + is_mandatory = + is_im_infrastructure = + > + ["commit_audit"] = (P_BMM_SINGLE_PROPERTY) < + name = <"commit_audit"> + type = <"Audit_details"> + is_mandatory = + is_im_infrastructure = + > + ["signature"] = (P_BMM_SINGLE_PROPERTY) < + name = <"signature"> + type = <"String"> + is_im_infrastructure = + > + > + > + + ["Original_version"] = < + name = <"Original_version"> + ancestors = <"Version"> + generic_parameter_defs = < + ["T"] = < + name = <"T"> + > + > + properties = < + ["uid"] = (P_BMM_SINGLE_PROPERTY) < + name = <"uid"> + type = <"Object_version_id"> + is_mandatory = + is_im_infrastructure = + > + ["preceding_version_uid"] = (P_BMM_SINGLE_PROPERTY) < + name = <"preceding_version_uid"> + type = <"Object_version_id"> + is_im_infrastructure = + > + ["other_input_version_uids"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"other_input_version_uids"> + type_def = < + container_type = <"List"> + type = <"Object_version_id"> + > + cardinality = <|>=1|> + is_im_infrastructure = + > + ["attestations"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"attestations"> + type_def = < + container_type = <"List"> + type = <"Attestation"> + > + cardinality = <|>=1|> + > + ["lifecycle_state"] = (P_BMM_SINGLE_PROPERTY) < + name = <"lifecycle_state"> + type = <"Terminology_term"> + is_mandatory = + > + ["data"] = (P_BMM_SINGLE_PROPERTY_OPEN) < + name = <"data"> + type = <"T"> + > + > + > + + ["Imported_version"] = < + name = <"Imported_version"> + ancestors = <"Version"> + generic_parameter_defs = < + ["T"] = < + name = <"T"> + > + > + properties = < + ["item"] = (P_BMM_GENERIC_PROPERTY) < + name = <"item"> + type_def = < + root_type = <"Original_version"> + generic_parameters = <"T"> + > + is_mandatory = + is_im_infrastructure = + > + > + > + +> diff --git a/bmm/src/test/resources/s2/s2_base_data_types_070.bmm b/bmm/src/test/resources/s2/s2_base_data_types_070.bmm new file mode 100644 index 000000000..6d04c25bc --- /dev/null +++ b/bmm/src/test/resources/s2/s2_base_data_types_070.bmm @@ -0,0 +1,804 @@ +-- +-- component: Graphite Canonical Model BMM +-- description: Graphite Canonical Model component formal expression. This file is an ODIN serialisation of +-- the BMM object meta-model classes found at +-- https://www.openEHR.org/releases/LANG/latest/p_bmm.html +-- keywords: reference model, meta-model, archetypes +-- author: Thomas Beale +-- support: https://graphite.atlassian.net/issues/ +-- copyright: Copyright (c) 2023- Graphite Health +-- license: Apache 2.0 +-- + +------------------------------------------------------ +-- BMM version on which these schemas are based. +------------------------------------------------------ +bmm_version = <"2.3"> + +------------------------------------------------------ +-- schema identification +-- (schema_id computed as __) +------------------------------------------------------ +rm_publisher = <"s2"> +schema_name = <"base_data_types"> +rm_release = <"0.7.0"> + +------------------------------------------------------ +-- schema documentation +------------------------------------------------------ +schema_revision = <"0.7.0.1"> +schema_lifecycle_state = <"development"> +schema_description = <"S2 Release 0.7.0 canonical model Data types"> +schema_author = <"Thomas Beale "> + +------------------------------------------------------ +-- inclusions +------------------------------------------------------ +includes = < + ["1"] = < + id = <"s2_base_foundation_types_0.7.0"> + > +> + +------------------------------------------------------ +-- packages +------------------------------------------------------ + +packages = < + ["org.s2.base.data_types"] = < + name = <"org.s2.base.data_types"> + classes = <"Data_value", "Boolean_value", "Rwe_id_ref"> + packages = < + ["text"] = < + name = <"text"> + classes = <"Text", "Text_format_types", "Coded_text", "Plain_text"> + > + ["quantity"] = < + name = <"quantity"> + classes = < + "Range", "Ordered_datum", "Ordered_value", + "Money", "Coded_ordinal", "Measurable", + "Quantity", "Proportion", "Ratio", "Count", "Ratio_kind", + "Measured", "Comparison_operator", "Reference_range", + "Temporal_value", "Date_value", "Date_time_value", "Time_value", "Duration_value" + > + > + ["timing"] = < + name = <"timing"> + classes = <"Timing", "Occurrence", "Occurrence_pattern", "Time_specifier", + "Period_specifier", "Day_specifier", "Hour_specifier", + "Customary_time", "Clock_time", "Temporal_relation"> + > + ["encapsulated"] = < + name = <"encapsulated"> + classes = <"Encapsulated", "Multimedia", "Parsable"> + > + ["uri"] = < + name = <"uri"> + classes = <"Uri_ref", "Ehr_uri_ref"> + > + > + > +> + +------------------------------------------------------ +-- classes +------------------------------------------------------ + +class_definitions = < + + ------------------------------------------------------------ + --------------------- base.data_types ------------------------ + ------------------------------------------------------------ + + ["Data_value"] = < + name = <"Data_value"> + ancestors = <"Any"> + is_abstract = + > + + ["Boolean_value"] = < + name = <"Boolean_value"> + ancestors = <"Data_value"> + properties = < + ["value"] = (P_BMM_SINGLE_PROPERTY) < + name = <"value"> + type = <"Boolean"> + is_mandatory = + > + ["true_term"] = (P_BMM_SINGLE_PROPERTY) < + name = <"true_term"> + type = <"Terminology_term"> + is_mandatory = + > + ["false_term"] = (P_BMM_SINGLE_PROPERTY) < + name = <"false_term"> + type = <"Terminology_term"> + is_mandatory = + > + > + > + + ["Rwe_id_ref"] = < + name = <"Rwe_id_ref"> + ancestors = <"Data_value"> + properties = < + ["id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"id"> + type = <"String"> + is_mandatory = + > + ["issuer"] = (P_BMM_SINGLE_PROPERTY) < + name = <"issuer"> + type = <"String"> + > + ["assigner"] = (P_BMM_SINGLE_PROPERTY) < + name = <"assigner"> + type = <"String"> + > + ["type"] = (P_BMM_SINGLE_PROPERTY) < + name = <"type"> + type = <"String"> + > + > + > + + -- + --------------------- base.data_types.text ------------------ + -- + + ["Text"] = < + name = <"Text"> + ancestors = <"Data_value"> + properties = < + ["text"] = (P_BMM_SINGLE_PROPERTY) < + name = <"text"> + type = <"String"> + is_mandatory = + > + ["language"] = (P_BMM_SINGLE_PROPERTY) < + name = <"language"> + type = <"Terminology_code"> + is_im_infrastructure = + > + ["encoding"] = (P_BMM_SINGLE_PROPERTY) < + name = <"encoding"> + type = <"Terminology_code"> + is_im_infrastructure = + > + ["formatting"] = (P_BMM_SINGLE_PROPERTY) < + name = <"formatting"> + type = <"Text_format_types"> + is_im_runtime = + > + > + > + + ["Text_format_types"] = (P_BMM_ENUMERATION_INTEGER) < + name = <"Text_format_types"> + ancestors = <"Integer"> + item_names = <"plain", "plain_no_newlines", "markdown"> + > + + ["Plain_text"] = < + name = <"Plain_text"> + ancestors = <"Text"> + > + + ["Coded_text"] = < + name = <"Coded_text"> + ancestors = <"Text"> + properties = < + ["term"] = (P_BMM_SINGLE_PROPERTY) < + name = <"term"> + type = <"Terminology_term"> + is_mandatory = + > + > + > + + -- + --------------------- base.data_types.quantity ------------------ + -- + + ["Range"] = < + name = <"Range"> + ancestors = <"Data_value"> + generic_parameter_defs = < + ["V"] = < + name = <"V"> + conforms_to_type = <"Ordered_datum"> + > + > + properties = < + ["lower"] = (P_BMM_SINGLE_PROPERTY_OPEN) < + name = <"lower"> + type = <"V"> + > + ["upper"] = (P_BMM_SINGLE_PROPERTY_OPEN) < + name = <"upper"> + type = <"V"> + > + > + > + + ["Reference_range"] = < + name = <"Reference_range"> + ancestors = <"Any"> + generic_parameter_defs = < + ["V"] = < + name = <"V"> + conforms_to_type = <"Measurable"> + > + > + properties = < + ["type"] = (P_BMM_SINGLE_PROPERTY) < + name = <"type"> + type = <"Terminology_term"> + is_mandatory = + > + ["range"] = (P_BMM_GENERIC_PROPERTY) < + name = <"range"> + type_def = < + root_type = <"Range"> + generic_parameters = <"V"> + > + is_mandatory = + > + ["phenotype"] = (P_BMM_SINGLE_PROPERTY) < + name = <"phenotype"> + type = <"Text"> + > + > + > + + ["Ordered_datum"] = < + name = <"Ordered_datum"> + is_abstract = + ancestors = <"Data_value"> + > + + ["Ordered_value"] = < + name = <"Ordered_value"> + is_abstract = + ancestors = <"Ordered_datum"> + properties = < + ["magnitude"] = (P_BMM_SINGLE_PROPERTY) < + name = <"magnitude"> + type = <"Comparable"> + is_mandatory = + > + ["precision"] = (P_BMM_SINGLE_PROPERTY) < + name = <"precision"> + type = <"Integer"> + > + > + > + + ["Measurable"] = < + name = <"Measurable"> + is_abstract = + ancestors = <"Ordered_value"> + properties = < + ["magnitude"] = (P_BMM_SINGLE_PROPERTY) < + name = <"magnitude"> + type = <"Numeric"> + > + > + > + + ["Coded_ordinal"] = < + name = <"Coded_ordinal"> + ancestors = <"Ordered_value"> + properties = < + ["magnitude"] = (P_BMM_SINGLE_PROPERTY) < + name = <"magnitude"> + type = <"Real"> + is_mandatory = + > + ["concept"] = (P_BMM_SINGLE_PROPERTY) < + name = <"concept"> + type = <"Coded_text"> + is_mandatory = + > + > + > + + ["Money"] = < + name = <"Money"> + ancestors = <"Ordered_value"> + properties = < + ["magnitude"] = (P_BMM_SINGLE_PROPERTY) < + name = <"magnitude"> + type = <"Real"> + is_mandatory = + > + ["currency"] = (P_BMM_SINGLE_PROPERTY) < + name = <"currency"> + type = <"Terminology_code"> + is_mandatory = + > + > + > + + ["Measured"] = < + name = <"Measured"> + ancestors = <"Ordered_datum"> + generic_parameter_defs = < + ["V"] = < + name = <"V"> + conforms_to_type = <"Measurable"> + > + > + properties = < + ["value"] = (P_BMM_SINGLE_PROPERTY_OPEN) < + name = <"value"> + type = <"V"> + > + ["accuracy"] = (P_BMM_SINGLE_PROPERTY) < + name = <"accuracy"> + type = <"Quantity"> + is_im_runtime = + > + ["value_status"] = (P_BMM_SINGLE_PROPERTY) < + name = <"value_status"> + type = <"Comparison_operator"> + is_im_runtime = + > + ["reference_ranges"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"reference_ranges"> + type_def = < + container_type = <"List"> + type_def = (P_BMM_GENERIC_TYPE) < + root_type = <"Reference_range"> + generic_parameters = <"V"> + > + > + > + ["interpretation"] = (P_BMM_SINGLE_PROPERTY) < + name = <"interpretation"> + type = <"Coded_text"> + > + ["interpretation_guide"] = (P_BMM_SINGLE_PROPERTY) < + name = <"interpretation_guide"> + type = <"Text"> + > + > + > + + ["Comparison_operator"] = (P_BMM_ENUMERATION_STRING) < + name = <"Comparison_operator"> + ancestors = <"String"> + item_names = <"<", "<=", ">", ">=", "="> + > + + ["Quantity"] = < + name = <"Quantity"> + ancestors = <"Measurable"> + properties = < + ["magnitude"] = (P_BMM_SINGLE_PROPERTY) < + name = <"magnitude"> + type = <"Real"> + is_mandatory = + > + ["units"] = (P_BMM_SINGLE_PROPERTY) < + name = <"units"> + type = <"Coded_text"> + is_mandatory = + > + > + > + + ["Count"] = < + name = <"Count"> + ancestors = <"Measurable"> + properties = < + ["magnitude"] = (P_BMM_SINGLE_PROPERTY) < + name = <"magnitude"> + type = <"Integer"> + is_mandatory = + > + > + > + + ["Proportion"] = < + name = <"Proportion"> + ancestors = <"Measurable"> + properties = < + ["magnitude"] = (P_BMM_SINGLE_PROPERTY) < + name = <"magnitude"> + type = <"Real"> + is_mandatory = + > + ["numerator"] = (P_BMM_SINGLE_PROPERTY) < + name = <"numerator"> + type = <"Quantity"> + is_mandatory = + > + ["denominator"] = (P_BMM_SINGLE_PROPERTY) < + name = <"denominator"> + type = <"Quantity"> + is_mandatory = + > + > + > + + ["Ratio"] = < + name = <"Ratio"> + ancestors = <"Measurable"> + properties = < + ["magnitude"] = (P_BMM_SINGLE_PROPERTY) < + name = <"magnitude"> + type = <"Real"> + is_mandatory = + > + ["numerator"] = (P_BMM_SINGLE_PROPERTY) < + name = <"numerator"> + type = <"Real"> + is_mandatory = + > + ["denominator"] = (P_BMM_SINGLE_PROPERTY) < + name = <"denominator"> + type = <"Real"> + is_mandatory = + > + ["type"] = (P_BMM_SINGLE_PROPERTY) < + name = <"type"> + type = <"Ratio_kind"> + is_mandatory = + > + > + > + + ["Ratio_kind"] = (P_BMM_ENUMERATION_INTEGER) < + name = <"Ratio_kind"> + ancestors = <"Integer"> + item_names = <"rational_fraction", "fraction", "ratio"> + > + +-- +-- Not needed but may help some tools (replicate for Measured_count etc if used) +-- +-- ["Measured_quantity"] = < +-- name = <"Measured_quantity"> +-- ancestor_defs = < +-- ["Measured"] = (P_BMM_GENERIC_TYPE) < +-- root_type = <"Measured"> +-- generic_parameters = <"Quantity"> +-- > +-- > +-- > + + -- + --------------------- base.data_types.quantity.date_time ------------------ + -- + + ["Temporal_value"] = < + name = <"Temporal_value"> + is_abstract = + ancestors = <"Ordered_value"> + properties = < + ["magnitude"] = (P_BMM_SINGLE_PROPERTY) < + name = <"magnitude"> + type = <"Temporal"> + is_mandatory = + > + > + > + + ["Date_value"] = < + name = <"Date_value"> + ancestors = <"Temporal_value"> + properties = < + ["magnitude"] = (P_BMM_SINGLE_PROPERTY) < + name = <"magnitude"> + type = <"Date"> + is_mandatory = + > + > + > + + ["Time_value"] = < + name = <"Time_value"> + ancestors = <"Temporal_value"> + properties = < + ["magnitude"] = (P_BMM_SINGLE_PROPERTY) < + name = <"magnitude"> + type = <"Time"> + is_mandatory = + > + > + > + + ["Date_time_value"] = < + name = <"Date_time_value"> + ancestors = <"Temporal_value"> + properties = < + ["magnitude"] = (P_BMM_SINGLE_PROPERTY) < + name = <"magnitude"> + type = <"Date_time"> + is_mandatory = + > + > + > + + ["Duration_value"] = < + name = <"Duration_value"> + ancestors = <"Temporal_value"> + properties = < + ["magnitude"] = (P_BMM_SINGLE_PROPERTY) < + name = <"magnitude"> + type = <"Duration"> + is_mandatory = + > + > + > + + -- + --------------------- base.data_types.uri ------------------ + -- + + ["Uri_ref"] = < + name = <"Uri_ref"> + ancestors = <"Data_value"> + properties = < + ["value"] = (P_BMM_SINGLE_PROPERTY) < + name = <"value"> + type = <"String"> + is_mandatory = + > + > + > + + ["Ehr_uri_ref"] = < + name = <"Ehr_uri_ref"> + ancestors = <"Uri_ref"> + > + + -- + --------------------- base.data_types.timing ------------------ + -- + + ["Timing"] = < + name = <"Timing"> + ancestors = <"Data_value"> + properties = < + ["history"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"history"> + type_def = < + container_type = <"List"> + type = <"Occurrence"> + > + cardinality = <|>=0|> + > + ["pattern"] = (P_BMM_SINGLE_PROPERTY) < + name = <"pattern"> + type = <"Occurrence_pattern"> + > + > + > + + ["Occurrence"] = < + name = <"Occurrence"> + ancestors = <"Any"> + properties = < + ["date"] = (P_BMM_SINGLE_PROPERTY) < + name = <"date"> + type = <"Date"> + is_mandatory = + > + ["time_of_day"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"time_of_day"> + type_def = < + container_type = <"List"> + type = <"Hour_specifier"> + > + cardinality = <|>=0|> + > + > + > + + ["Occurrence_pattern"] = < + name = <"Occurrence_pattern"> + ancestors = <"Any"> + properties = < + ["times"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"times"> + type_def = < + container_type = <"List"> + type = <"Time_specifier"> + > + cardinality = <|>=0|> + > + ["total_count"] = (P_BMM_SINGLE_PROPERTY) < + name = <"total_count"> + type = <"Integer"> + > + ["bounding_period"] = (P_BMM_GENERIC_PROPERTY) < + name = <"bounding_period"> + type_def = < + root_type = <"Interval"> + generic_parameters = <"Date"> + > + is_mandatory = + > + > + > + + ["Time_specifier"] = < + name = <"Time_specifier"> + ancestors = <"Any"> + is_abstract = + properties = < + ["event_count"] = (P_BMM_SINGLE_PROPERTY) < + name = <"event_count"> + type = <"Integer"> + is_mandatory = + > + > + > + + ["Period_specifier"] = < + name = <"Period_specifier"> + ancestors = <"Time_specifier"> + properties = < + ["period"] = (P_BMM_SINGLE_PROPERTY) < + name = <"period"> + type = <"Duration"> + is_mandatory = + > + > + > + + ["Day_specifier"] = < + name = <"Day_specifier"> + ancestors = <"Time_specifier"> + properties = < + ["day"] = (P_BMM_SINGLE_PROPERTY) < + name = <"day"> + type = <"Terminology_term"> + > + ["time_of_day"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"time_of_day"> + type_def = < + container_type = <"List"> + type = <"Hour_specifier"> + > + cardinality = <|>=0|> + > + > + > + + ["Hour_specifier"] = < + name = <"Hour_specifier"> + ancestors = <"Any"> + is_abstract = + properties = < + ["duration"] = (P_BMM_SINGLE_PROPERTY) < + name = <"duration"> + type = <"Duration"> + > + > + > + + ["Customary_time"] = < + name = <"Customary_time"> + ancestors = <"Hour_specifier"> + properties = < + ["reference_event"] = (P_BMM_SINGLE_PROPERTY) < + name = <"reference_event"> + type = <"Terminology_term"> + is_mandatory = + > + ["temporal_relation"] = (P_BMM_SINGLE_PROPERTY) < + name = <"temporal_relation"> + type = <"Temporal_relation"> + > + > + > + + ["Clock_time"] = < + name = <"Clock_time"> + ancestors = <"Hour_specifier"> + properties = < + ["time"] = (P_BMM_SINGLE_PROPERTY) < + name = <"time"> + type = <"Time"> + is_mandatory = + > + > + > + + ["Temporal_relation"] = (P_BMM_ENUMERATION_INTEGER) < + name = <"Temporal_relation"> + ancestors = <"Integer"> + item_names = <"after", "before", "with"> + > + + -- + --------------------- base.data_types.encapsulated ------------------ + -- + + ["Encapsulated"] = < + name = <"Encapsulated"> + is_abstract = + ancestors = <"Data_value"> + properties = < + ["language"] = (P_BMM_SINGLE_PROPERTY) < + name = <"language"> + type = <"Terminology_code"> + -- value_constraint = <"ISO::639-2"> + is_im_runtime = + > + ["uri"] = (P_BMM_SINGLE_PROPERTY) < + name = <"uri"> + type = <"Uri"> + > + > + > + + ["Multimedia"] = < + name = <"Multimedia"> + ancestors = <"Encapsulated"> + properties = < + ["alternate_text"] = (P_BMM_SINGLE_PROPERTY) < + name = <"alternate_text"> + type = <"String"> + > + ["data"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"data"> + type_def = < + container_type = <"Array"> + type = <"Byte"> + > + cardinality = <|>=0|> + > + ["media_type"] = (P_BMM_SINGLE_PROPERTY) < + name = <"media_type"> + type = <"Terminology_code"> + -- value_constraint = <"IANA::media_types"> + is_mandatory = + > + ["hash"] = (P_BMM_SINGLE_PROPERTY) < + name = <"hash"> + type = <"String"> + > + ["thumbnail"] = (P_BMM_SINGLE_PROPERTY) < + name = <"thumbnail"> + type = <"Multimedia"> + > + ["size"] = (P_BMM_SINGLE_PROPERTY) < + name = <"size"> + type = <"Integer"> + is_im_runtime = + > + > + > + + ["Parsable"] = < + name = <"Parsable"> + ancestors = <"Encapsulated"> + properties = < + ["text"] = (P_BMM_SINGLE_PROPERTY) < + name = <"text"> + type = <"String"> + > + ["schema"] = (P_BMM_SINGLE_PROPERTY) < + name = <"schema"> + type = <"String"> + > + ["formalism"] = (P_BMM_SINGLE_PROPERTY) < + name = <"formalism"> + type = <"String"> + is_mandatory = + > + ["encoding"] = (P_BMM_SINGLE_PROPERTY) < + name = <"encoding"> + type = <"Terminology_code"> + -- value_constraint = <"IANA::charsets"> + is_im_runtime = + > + > + > + +> diff --git a/bmm/src/test/resources/s2/s2_base_foundation_types_070.bmm b/bmm/src/test/resources/s2/s2_base_foundation_types_070.bmm new file mode 100644 index 000000000..1c5341d37 --- /dev/null +++ b/bmm/src/test/resources/s2/s2_base_foundation_types_070.bmm @@ -0,0 +1,322 @@ +-- +-- component: Graphite BMMs +-- description: Graphite BASE Component schema. This file format is based on the BMM specification +-- http://www.openEHR.org/releases/BASE/latest/docs/bmm/bmm.html +-- keywords: reference model, meta-model, archetypes +-- author: Thomas Beale +-- support: https://graphitehealth.atlassian.net/projects/issues +-- copyright: Copyright (c) 2023 Graphite Health +-- license: Apache 2.0 +-- + +------------------------------------------------------ +-- BMM version on which these schemas are based. +------------------------------------------------------ +bmm_version = <"2.3"> + +------------------------------------------------------ +-- schema identification +-- (schema_id computed as __) +------------------------------------------------------ +rm_publisher = <"s2"> +schema_name = <"base_foundation_types"> +rm_release = <"0.7.0"> + +------------------------------------------------------ +-- schema documentation +------------------------------------------------------ +schema_revision = <"0.7.0.1"> +schema_lifecycle_state = <"stable"> +schema_description = <"S2 Release 0.7.0 BASE model foundation types packages"> +schema_author = <"Thomas Beale "> + +------------------------------------------------------ +-- packages +------------------------------------------------------ +packages = < + ["org.s2.base.foundation_types"] = < + name = <"org.s2.base.foundation_types"> + packages = < + ["primitive_types"] = < + name = <"primitive_types"> + classes = <"Any", "Comparable", "Numeric", "Byte", "Boolean", "Integer", "Real", "String", "Uri"> + > + ["terminology"] = < + name = <"terminology"> + classes = <"Terminology_code", "Terminology_term"> + > + ["structures"] = < + name = <"structures"> + classes = <"List", "Array", "Set", "Hash", "Container"> + > + ["interval"] = < + name = <"interval"> + classes = <"Interval", "Multiplicity_interval", "Cardinality"> + > + ["time"] = < + name = <"time"> + classes = <"Temporal", "Date", "Time", "Date_time", "Duration"> + > + > + > +> + +------------------------------------------------------ +-- primitive types +------------------------------------------------------ + +primitive_types = < + ["Any"] = < + name = <"Any"> + is_abstract = + > + ["Comparable"] = < + name = <"Comparable"> + is_abstract = + documentation = <"Ancestor of types with total order relation defined, i.e. '<' and '='."> + ancestors = <"Any"> + > + ["Numeric"] = < + name = <"Numeric"> + is_abstract = + documentation = <"Ancestor of numeric types."> + ancestors = <"Comparable"> + > + ["Byte"] = < + name = <"Byte"> + ancestors = <"Comparable"> + > + ["Boolean"] = < + name = <"Boolean"> + ancestors = <"Any"> + > + ["Integer"] = < + name = <"Integer"> + ancestors = <"Numeric"> + > + ["Real"] = < + name = <"Real"> + ancestors = <"Numeric"> + > + ["String"] = < + name = <"String"> + ancestors = <"Comparable"> + > + ["Uri"] = < + name = <"Uri"> + ancestors = <"String"> + > + + ["Temporal"] = < + name = <"Temporal"> + ancestors = <"Comparable"> + is_abstract = + documentation = <"Parent of ISO8601 types."> + properties = < + ["value"] = (P_BMM_SINGLE_PROPERTY) < + name = <"value"> + type = <"String"> + is_mandatory = + > + > + > + + ["Date"] = < + name = <"Date"> + documentation = <"Date type based on IS8601 representation."> + ancestors = <"Temporal"> + > + + ["Time"] = < + name = <"Time"> + documentation = <"Time type based on IS8601 representation."> + ancestors = <"Temporal"> + > + + ["Date_time"] = < + name = <"Date_time"> + documentation = <"Date Time type based on IS8601 representation."> + ancestors = <"Temporal"> + > + + ["Duration"] = < + name = <"Duration"> + documentation = <"Duration type based on IS8601 representation."> + ancestors = <"Temporal"> + > + + ["Terminology_code"] = < + name = <"Terminology_code"> + ancestors = <"Any"> + properties = < + ["terminology_id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"terminology_id"> + type = <"String"> + is_mandatory = + > + ["terminology_version"] = (P_BMM_SINGLE_PROPERTY) < + name = <"terminology_version"> + type = <"String"> + > + ["code_string"] = (P_BMM_SINGLE_PROPERTY) < + name = <"code_string"> + type = <"String"> + is_mandatory = + > + ["uri"] = (P_BMM_SINGLE_PROPERTY) < + name = <"uri"> + type = <"Uri"> + > + > + > + + ["Container"] = < + name = <"Container"> + ancestors = <"Any"> + generic_parameter_defs = < + ["V"] = < + name = <"V"> + > + > + is_abstract = + > + + ["List"] = < + name = <"List"> + ancestors = <"Container"> + generic_parameter_defs = < + ["V"] = < + name = <"V"> + > + > + > + + ["Array"] = < + name = <"Array"> + ancestors = <"Container"> + generic_parameter_defs = < + ["V"] = < + name = <"V"> + > + > + > + + ["Set"] = < + name = <"Set"> + ancestors = <"Container"> + generic_parameter_defs = < + ["V"] = < + name = <"V"> + > + > + > + + ["Interval"] = < + name = <"Interval"> + documentation = <"Type defining an interval of any ordered type."> + ancestors = <"Any"> + generic_parameter_defs = < + ["T"] = < + name = <"T"> + conforms_to_type = <"Comparable"> + > + > + properties = < + ["lower"] = (P_BMM_SINGLE_PROPERTY_OPEN) < + name = <"lower"> + type = <"T"> + > + ["upper"] = (P_BMM_SINGLE_PROPERTY_OPEN) < + name = <"upper"> + type = <"T"> + > + ["lower_unbounded"] = (P_BMM_SINGLE_PROPERTY) < + name = <"lower_unbounded"> + type = <"Boolean"> + is_mandatory = + > + ["upper_unbounded"] = (P_BMM_SINGLE_PROPERTY) < + name = <"upper_unbounded"> + type = <"Boolean"> + is_mandatory = + > + ["lower_included"] = (P_BMM_SINGLE_PROPERTY) < + name = <"lower_included"> + type = <"Boolean"> + is_mandatory = + > + ["upper_included"] = (P_BMM_SINGLE_PROPERTY) < + name = <"upper_included"> + type = <"Boolean"> + is_mandatory = + > + > + > + + ["Cardinality"] = (P_BMM_CLASS) < + name = <"Cardinality"> + ancestors = <"Any", ...> + properties = < + ["is_ordered"] = (P_BMM_SINGLE_PROPERTY) < + name = <"is_ordered"> + type = <"Boolean"> + is_mandatory = + > + ["is_unique"] = (P_BMM_SINGLE_PROPERTY) < + name = <"is_unique"> + type = <"Boolean"> + is_mandatory = + > + ["interval"] = (P_BMM_SINGLE_PROPERTY) < + name = <"interval"> + type = <"Multiplicity_interval"> + is_mandatory = + > + > + > + + ["Multiplicity_interval"] = (P_BMM_CLASS) < + name = <"Multiplicity_interval"> + ancestor_defs = < + ["Interval"] = (P_BMM_GENERIC_TYPE) < + root_type = <"Interval"> + generic_parameters = <"Integer"> + > + > + > + + + ["Hash"] = < + name = <"Hash"> + documentation = <"Type defining Hash table / hash map structure, whose type parameters V and K represent a value type and an Comparable key type respectively."> + ancestors = <"Container"> + generic_parameter_defs = < + ["K"] = < + name = <"K"> + conforms_to_type = <"Comparable"> + > + ["V"] = < + name = <"V"> + > + > + > +> + +class_definitions = < + ["Terminology_term"] = < + name = <"Terminology_term"> + ancestors = <"Any"> + properties = < + ["description"] = (P_BMM_SINGLE_PROPERTY) < + name = <"description"> + type = <"String"> + is_mandatory = + > + ["concept"] = (P_BMM_SINGLE_PROPERTY) < + name = <"concept"> + type = <"Terminology_code"> + is_mandatory = + > + > + > +> diff --git a/bmm/src/test/resources/s2/s2_base_model_support_070.bmm b/bmm/src/test/resources/s2/s2_base_model_support_070.bmm new file mode 100644 index 000000000..bc2e5db25 --- /dev/null +++ b/bmm/src/test/resources/s2/s2_base_model_support_070.bmm @@ -0,0 +1,511 @@ +-- +-- component: Graphite BMMs +-- description: Graphite BASE Component schema. This file format is based on the BMM specification +-- http://www.openEHR.org/releases/BASE/latest/docs/bmm/bmm.html +-- keywords: reference model, meta-model, archetypes +-- author: Thomas Beale +-- support: https://graphitehealth.atlassian.net/projects/issues +-- copyright: Copyright (c) 2023 Graphite Health +-- license: Apache 2.0 +-- + +------------------------------------------------------ +-- BMM version on which these schemas are based. +------------------------------------------------------ +bmm_version = <"2.3"> + +------------------------------------------------------ +-- schema identification +-- (schema_id computed as __) +------------------------------------------------------ +rm_publisher = <"s2"> +schema_name = <"base_model_support"> +rm_release = <"0.7.0"> + +------------------------------------------------------ +-- schema documentation +------------------------------------------------------ +schema_revision = <"0.7.0.1"> +schema_lifecycle_state = <"trial"> +schema_description = <"S2 Release 0.7.0 BASE model base types packages"> +schema_author = <"Thomas Beale "> + +------------------------------------------------------ +-- includes +------------------------------------------------------ +includes = < + ["1"] = < + id = <"s2_base_data_types_0.7.0"> + > +> + +------------------------------------------------------ +-- packages +------------------------------------------------------ +packages = < + ["org.s2.base.model_support"] = < + name = <"org.s2.base.model_support"> + packages = < + ["definitions"] = < + name = <"definitions"> + classes = <"Validity_kind", "Version_status", "Sample_function_kind", "Trend_kind"> + > + ["identification"] = < + name = <"identification"> + classes = <"Object_ref", "Object_id", "Primitive_id", "Locatable_ref", + "Artifact_id", "Terminology_id", "Archetype_id", "Object_version_id", + "Version_tree_id", "Internet_id", "Uuid", "Iso_oid" + > + > + ["archetyped"] = < + name = <"archetyped"> + classes = <"Pathable", "Locatable", "Link", "Archetyped", "Feeder_audit", "Feeder_audit_details"> + > + ["participation"] = < + name = <"participation"> + classes = <"Participation", "Party_proxy", "Party_identified", "Party_related", "Party_self"> + > + > + > +> + +------------------------------------------------------ +-- classes +------------------------------------------------------ + +class_definitions = < + + ------------------------------------------------------------ + ------------------ base.model_support.identification --------------- + ------------------------------------------------------------ + + ["Object_ref"] = < + name = <"Object_ref"> + ancestors = <"Any"> + properties = < + ["id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"id"> + type = <"Object_id"> + is_mandatory = + > + ["namespace"] = (P_BMM_SINGLE_PROPERTY) < + name = <"namespace"> + type = <"String"> + > + ["type"] = (P_BMM_SINGLE_PROPERTY) < + name = <"type"> + type = <"String"> + is_mandatory = + > + > + > + + ["Locatable_ref"] = < + name = <"Locatable_ref"> + ancestors = <"Object_ref"> + properties = < + ["id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"id"> + type = <"Object_version_id"> + is_mandatory = + > + ["path"] = (P_BMM_SINGLE_PROPERTY) < + name = <"path"> + type = <"String"> + is_im_infrastructure = + > + > + > + + ["Object_id"] = < + name = <"Object_id"> + is_abstract = + ancestors = <"Any"> + properties = < + ["value"] = (P_BMM_SINGLE_PROPERTY) < + name = <"value"> + type = <"String"> + is_mandatory = + > + > + > + + ["Artifact_id"] = < + name = <"Artifact_id"> + is_abstract = + ancestors = <"Any"> + properties = < + ["value"] = (P_BMM_SINGLE_PROPERTY) < + name = <"value"> + type = <"String"> + is_mandatory = + > + > + > + + ["Terminology_id"] = < + name = <"Terminology_id"> + ancestors = <"Artifact_id"> + > + + + ["Archetype_id"] = < + name = <"Archetype_id"> + ancestors = <"Artifact_id"> + > + + ["Object_version_id"] = < + name = <"Object_version_id"> + ancestors = <"Object_id"> + > + + + ["Version_tree_id"] = < + name = <"Version_tree_id"> + ancestors = <"Any"> + properties = < + ["value"] = (P_BMM_SINGLE_PROPERTY) < + name = <"value"> + type = <"String"> + is_mandatory = + > + > + > + + ["Primitive_id"] = < + name = <"Primitive_id"> + is_abstract = + ancestors = <"Any"> + properties = < + ["value"] = (P_BMM_SINGLE_PROPERTY) < + name = <"value"> + type = <"String"> + is_mandatory = + > + > + > + + ["Internet_id"] = < + name = <"Internet_id"> + ancestors = <"Primitive_id"> + > + + ["Iso_oid"] = < + name = <"Iso_oid"> + ancestors = <"Primitive_id"> + > + + ["Uuid"] = < + name = <"Uuid"> + ancestors = <"Primitive_id"> + > + + -- + --------------------- base.model_support.definitions ------------------ + -- + + ["Validity_kind"] = (P_BMM_ENUMERATION_STRING) < + name = <"Validity_kind"> + ancestors = <"String"> + item_names = <"mandatory", "optional", "prohibited"> + > + + ["Version_status"] = (P_BMM_ENUMERATION_STRING) < + name = <"Version_status"> + ancestors = <"String"> + item_names = <"alpha", "beta", "release_candidate", "released", "build"> + > + + ["Sample_function_kind"] = (P_BMM_ENUMERATION_STRING) < + name = <"Sample_function_kind"> + ancestors = <"String"> + item_names = <"actual", "minimum", "maximum", "mean", "mode", "median", "increase", "decrease", "change", "total"> + > + + ["Trend_kind"] = (P_BMM_ENUMERATION_STRING) < + name = <"Trend_kind"> + ancestors = <"String"> + item_names = <"decrease", "increase", "change"> + > + + -- + --------------------- base.model_support.archetyped ------------------ + -- + ["Pathable"] = < + name = <"Pathable"> + is_abstract = + ancestors = <"Any"> + > + + ["Locatable"] = < + name = <"Locatable"> + is_abstract = + ancestors = <"Pathable"> + properties = < + ["uid"] = (P_BMM_SINGLE_PROPERTY) < + name = <"uid"> + type = <"Uuid"> + is_im_infrastructure = + > + ["archetype_node_id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"archetype_node_id"> + type = <"String"> + is_mandatory = + is_im_infrastructure = + > + ["name"] = (P_BMM_SINGLE_PROPERTY) < + name = <"name"> + type = <"String"> + is_mandatory = + > + ["code"] = (P_BMM_SINGLE_PROPERTY) < + name = <"code"> + type = <"Terminology_term"> + is_im_infrastructure = + > + ["original_code"] = (P_BMM_SINGLE_PROPERTY) < + name = <"original_code"> + type = <"Terminology_term"> + is_im_runtime = + > + ["archetype_details"] = (P_BMM_SINGLE_PROPERTY) < + name = <"archetype_details"> + type = <"Archetyped"> + is_im_infrastructure = + > + ["feeder_audit"] = (P_BMM_SINGLE_PROPERTY) < + name = <"feeder_audit"> + type = <"Feeder_audit"> + is_im_runtime = + > + ["links"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"links"> + type_def = < + container_type = <"List"> + type = <"Link"> + > + cardinality = <|>=1|> + > + > + > + + ["Link"] = < + name = <"Link"> + ancestors = <"Any"> + properties = < + ["meaning"] = (P_BMM_SINGLE_PROPERTY) < + name = <"meaning"> + type = <"Terminology_term"> + is_mandatory = + > + ["type"] = (P_BMM_SINGLE_PROPERTY) < + name = <"type"> + type = <"Terminology_term"> + is_mandatory = + > + ["target"] = (P_BMM_SINGLE_PROPERTY) < + name = <"target"> + type = <"Uri"> + is_mandatory = + > + > + > + + ["Archetyped"] = < + name = <"Archetyped"> + ancestors = <"Any"> + properties = < + ["archetype_id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"archetype_id"> + type = <"Archetype_id"> + is_mandatory = + is_im_infrastructure = + > + ["template_id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"template_id"> + type = <"Archetype_id"> + is_im_infrastructure = + > + ["rm_version"] = (P_BMM_SINGLE_PROPERTY) < + name = <"rm_version"> + type = <"String"> + is_mandatory = + is_im_infrastructure = + > + > + > + + ["Feeder_audit"] = < + name = <"Feeder_audit"> + ancestors = <"Any"> + properties = < + ["originating_system_item_ids"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"originating_system_item_ids"> + type_def = < + container_type = <"List"> + type = <"Rwe_id_ref"> + > + cardinality = <|>=0|> + is_im_runtime = + > + ["feeder_system_item_ids"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"feeder_system_item_ids"> + type_def = < + container_type = <"List"> + type = <"Rwe_id_ref"> + > + cardinality = <|>=0|> + is_im_runtime = + > + ["original_content"] = (P_BMM_SINGLE_PROPERTY) < + name = <"original_content"> + type = <"Encapsulated"> + is_im_runtime = + > + ["originating_system_audit"] = (P_BMM_SINGLE_PROPERTY) < + name = <"originating_system_audit"> + type = <"Feeder_audit_details"> + is_mandatory = + is_im_runtime = + > + ["feeder_system_audit"] = (P_BMM_SINGLE_PROPERTY) < + name = <"feeder_system_audit"> + type = <"Feeder_audit_details"> + is_im_runtime = + > + > + > + + ["Feeder_audit_details"] = < + name = <"Feeder_audit_details"> + ancestors = <"Any"> + properties = < + ["system_id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"system_id"> + type = <"String"> + is_mandatory = + is_im_runtime = + > + ["location"] = (P_BMM_SINGLE_PROPERTY) < + name = <"location"> + type = <"Party_identified"> + is_im_runtime = + > + ["provider"] = (P_BMM_SINGLE_PROPERTY) < + name = <"provider"> + type = <"Party_identified"> + is_im_runtime = + > + ["subject"] = (P_BMM_SINGLE_PROPERTY) < + name = <"subject"> + type = <"Party_proxy"> + is_im_runtime = + > + ["time"] = (P_BMM_SINGLE_PROPERTY) < + name = <"time"> + type = <"Date_time"> + is_im_runtime = + > + ["version_id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"version_id"> + type = <"String"> + is_im_runtime = + > + ["other_details"] = (P_BMM_INDEXED_CONTAINER_PROPERTY) < + name = <"other_details"> + type_def = < + container_type = <"Hash"> + index_type = <"String"> + type = <"String"> + > + > + > + > + + -- + --------------------- base.patterns.participation ------------------ + -- + + ["Participation"] = < + name = <"Participation"> + ancestors = <"Any"> + properties = < + ["function"] = (P_BMM_SINGLE_PROPERTY) < + name = <"function"> + type = <"String"> + -- value_constraint = <"openEHR::participation_function"> + is_mandatory = + > + ["time"] = (P_BMM_GENERIC_PROPERTY) < + name = <"time"> + type_def = < + root_type = <"Interval"> + generic_parameters = <"Date_time"> + > + is_im_runtime = + > + ["mode"] = (P_BMM_SINGLE_PROPERTY) < + name = <"mode"> + type = <"Terminology_term"> + -- value_constraint = <"openEHR::participation_mode"> + > + ["performer"] = (P_BMM_SINGLE_PROPERTY) < + name = <"performer"> + type = <"Party_proxy"> + is_mandatory = + > + > + > + + ["Party_proxy"] = < + name = <"Party_proxy"> + is_abstract = + ancestors = <"Any"> + properties = < + ["external_ref"] = (P_BMM_SINGLE_PROPERTY) < + name = <"external_ref"> + type = <"Object_ref"> + is_im_infrastructure = + > + > + > + + ["Party_identified"] = < + name = <"Party_identified"> + ancestors = <"Party_proxy"> + properties = < + ["name"] = (P_BMM_SINGLE_PROPERTY) < + name = <"name"> + type = <"String"> + > + ["identifiers"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"identifiers"> + type_def = < + container_type = <"List"> + type = <"Rwe_id_ref"> + > + is_im_runtime = + > + > + > + + ["Party_related"] = < + name = <"Party_related"> + ancestors = <"Party_identified"> + properties = < + ["relationship"] = (P_BMM_SINGLE_PROPERTY) < + name = <"relationship"> + type = <"Terminology_term"> + -- value_constraint = <"openEHR::subject_relationship"> + is_mandatory = + > + > + > + + ["Party_self"] = < + name = <"Party_self"> + ancestors = <"Party_proxy"> + > + + +> diff --git a/bmm/src/test/resources/s2/s2_base_patterns_070.bmm b/bmm/src/test/resources/s2/s2_base_patterns_070.bmm new file mode 100644 index 000000000..f9aaf685e --- /dev/null +++ b/bmm/src/test/resources/s2/s2_base_patterns_070.bmm @@ -0,0 +1,148 @@ +-- +-- component: Graphite Reference Model BMM +-- description: Graphite Reference Model component formal expression. This file is an ODIN serialisation of +-- the BMM object meta-model classes found at +-- https://www.openEHR.org/releases/LANG/latest/p_bmm.html +-- keywords: reference model, meta-model, archetypes +-- author: Thomas Beale +-- support: https://graphite.atlassian.net/issues/ +-- copyright: Copyright (c) 2023- Graphite Health +-- license: Apache 2.0 +-- + +------------------------------------------------------ +-- BMM version on which these schemas are based. +------------------------------------------------------ +bmm_version = <"2.3"> + +------------------------------------------------------ +-- schema identification +-- (schema_id computed as __) +------------------------------------------------------ +schema_name = <"base_patterns"> +rm_publisher = <"s2"> +rm_release = <"0.7.0"> + +------------------------------------------------------ +-- schema documentation +------------------------------------------------------ +schema_revision = <"0.7.0.1"> +schema_lifecycle_state = <"trial"> +schema_description = <"S2 Release 0.7.0 structures schema"> +schema_author = <"Thomas Beale "> + +------------------------------------------------------ +-- inclusions +------------------------------------------------------ +includes = < + ["1"] = < + id = <"s2_base_model_support_0.7.0"> + > +> + +------------------------------------------------------ +-- packages +------------------------------------------------------ + +packages = < + ["org.s2.base.patterns"] = < + name = <"org.s2.base.patterns"> + packages = < + ["data_structures"] = < + name = <"data_structures"> + classes = <"Node", "Event", "Point_event", "Interval_event"> + > + > + > +> + + +------------------------------------------------------ +-- classes +------------------------------------------------------ + +class_definitions = < + + -- + --------------------- base.patterns.data_structures ------------------ + -- + + ["Node"] = < + name = <"Node"> + ancestors = <"Locatable"> + properties = < + ["value"] = (P_BMM_SINGLE_PROPERTY) < + name = <"value"> + type = <"Data_value"> + > + ["original_value"] = (P_BMM_SINGLE_PROPERTY) < + name = <"original_value"> + type = <"Data_value"> + > + ["null_flavour"] = (P_BMM_SINGLE_PROPERTY) < + name = <"null_flavour"> + type = <"Terminology_term"> + > + ["null_reason"] = (P_BMM_SINGLE_PROPERTY) < + name = <"null_reason"> + type = <"Text"> + > + ["items"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"items"> + type_def = < + container_type = <"List"> + type = <"Node"> + > + > + > + > + + ["Event"] = < + name = <"Event"> + ancestors = <"Locatable"> + is_abstract = + properties = < + ["time"] = (P_BMM_SINGLE_PROPERTY) < + name = <"time"> + type = <"Date_time"> + is_mandatory = + is_im_runtime = + > + ["items"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"items"> + type_def = < + container_type = <"List"> + type = <"Node"> + > + cardinality = <|>=1|> + > + > + > + + ["Point_event"] = < + name = <"Point_event"> + ancestors = <"Event"> + > + + ["Interval_event"] = < + name = <"Interval_event"> + ancestors = <"Event"> + properties = < + ["width"] = (P_BMM_SINGLE_PROPERTY) < + name = <"width"> + type = <"Duration"> + is_mandatory = + > + ["sample_count"] = (P_BMM_SINGLE_PROPERTY) < + name = <"sample_count"> + type = <"Integer"> + is_im_runtime = + > + ["sample_function"] = (P_BMM_SINGLE_PROPERTY) < + name = <"sample_function"> + type = <"Sample_function_kind"> + > + > + > + +> diff --git a/bmm/src/test/resources/s2/s2_base_resource_070.bmm b/bmm/src/test/resources/s2/s2_base_resource_070.bmm new file mode 100644 index 000000000..db5ae2a9d --- /dev/null +++ b/bmm/src/test/resources/s2/s2_base_resource_070.bmm @@ -0,0 +1,319 @@ +-- +-- component: Graphite BMMs +-- description: Graphite BASE Component schema. This file format is based on the BMM specification +-- http://www.openEHR.org/releases/BASE/latest/docs/bmm/bmm.html +-- keywords: reference model, meta-model, archetypes +-- author: Thomas Beale +-- support: https://graphitehealth.atlassian.net/projects/issues +-- copyright: Copyright (c) 2023 Graphite Health +-- license: Apache 2.0 +-- + +------------------------------------------------------ +-- BMM version on which these schemas are based. +------------------------------------------------------ +bmm_version = <"2.3"> + +------------------------------------------------------ +-- schema identification +-- (schema_id computed as __) +------------------------------------------------------ +rm_publisher = <"s2"> +schema_name = <"base_resource"> +rm_release = <"0.7.0"> + +------------------------------------------------------ +-- schema documentation +------------------------------------------------------ +schema_revision = <"0.7.0.1"> +schema_lifecycle_state = <"trial"> +schema_description = <"S2 Release 0.7.0 BASE model resource package"> +schema_author = <"Thomas Beale "> + +------------------------------------------------------ +-- includes +------------------------------------------------------ +includes = < + ["1"] = < + id = <"s2_base_model_support_0.7.0"> + > +> + +------------------------------------------------------ +-- packages +------------------------------------------------------ +packages = < + ["org.s2.base"] = < + name = <"org.s2.base"> + packages = < + ["resource"] = < + name = <"resource"> + classes = <"Authored_resource", "Translation_details", "Resource_description", "Resource_description_item", "Resource_annotations"> + > + > + > +> + +------------------------------------------------------ +-- classes +------------------------------------------------------ + +class_definitions = < + + -- + --------------------- base.resource ------------------ + -- + + ["Authored_resource"] = < + name = <"Authored_resource"> + ancestors = <"Any", ...> + is_abstract = + properties = < + ["original_language"] = (P_BMM_SINGLE_PROPERTY) < + name = <"original_language"> + type = <"Terminology_code"> + is_mandatory = + > + ["is_controlled"] = (P_BMM_SINGLE_PROPERTY) < + name = <"is_controlled"> + type = <"Boolean"> + > + ["translations"] = (P_BMM_GENERIC_PROPERTY) < + name = <"translations"> + type_def = < + root_type = <"Hash"> + generic_parameters = <"String", "Translation_details"> + > + > + ["description"] = (P_BMM_SINGLE_PROPERTY) < + name = <"description"> + type = <"Resource_description"> + > + ["annotations"] = (P_BMM_SINGLE_PROPERTY) < + name = <"annotations"> + type = <"Resource_annotations"> + > + > + > + + ["Translation_details"] = < + name = <"Translation_details"> + ancestors = <"Any", ...> + properties = < + ["language"] = (P_BMM_SINGLE_PROPERTY) < + name = <"language"> + type = <"Terminology_code"> + is_mandatory = + > + ["author"] = (P_BMM_GENERIC_PROPERTY) < + name = <"author"> + type_def = < + root_type = <"Hash"> + generic_parameters = <"String", "String"> + > + is_mandatory = + > + ["accreditation"] = (P_BMM_SINGLE_PROPERTY) < + name = <"accreditation"> + type = <"String"> + > + ["version_last_translated"] = (P_BMM_SINGLE_PROPERTY) < + name = <"version_last_translated"> + type = <"String"> + > + ["other_details"] = (P_BMM_GENERIC_PROPERTY) < + name = <"other_details"> + type_def = < + root_type = <"Hash"> + generic_parameters = <"String", "String"> + > + > + ["other_contributors"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"other_contributors"> + type_def = < + container_type = <"List"> + type = <"String"> + > + cardinality = <|>=0|> + > + > + > + + ["Resource_description"] = < + name = <"Resource_description"> + ancestors = <"Any"> + properties = < + ["original_author"] = (P_BMM_GENERIC_PROPERTY) < + name = <"original_author"> + type_def = < + root_type = <"Hash"> + generic_parameters = <"String", "String"> + > + is_mandatory = + > + ["original_namespace"] = (P_BMM_SINGLE_PROPERTY) < + name = <"original_namespace"> + type = <"String"> + > + ["original_publisher"] = (P_BMM_SINGLE_PROPERTY) < + name = <"original_publisher"> + type = <"String"> + > + ["other_contributors"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"other_contributors"> + type_def = < + container_type = <"List"> + type = <"String"> + > + cardinality = <|>=0|> + > + ["custodian_namespace"] = (P_BMM_SINGLE_PROPERTY) < + name = <"custodian_namespace"> + type = <"String"> + > + ["custodian_organisation"] = (P_BMM_SINGLE_PROPERTY) < + name = <"custodian_organisation"> + type = <"String"> + > + ["copyright"] = (P_BMM_SINGLE_PROPERTY) < + name = <"copyright"> + type = <"String"> + > + ["licence"] = (P_BMM_SINGLE_PROPERTY) < + name = <"licence"> + type = <"String"> + > + ["lifecycle_state"] = (P_BMM_SINGLE_PROPERTY) < + name = <"lifecycle_state"> + type = <"String"> + is_mandatory = + > + ["resource_package_uri"] = (P_BMM_SINGLE_PROPERTY) < + name = <"resource_package_uri"> + type = <"String"> + > + ["ip_acknowledgements"] = (P_BMM_GENERIC_PROPERTY) < + name = <"ip_acknowledgements"> + type_def = < + root_type = <"Hash"> + generic_parameters = <"String", "String"> + > + > + ["references"] = (P_BMM_GENERIC_PROPERTY) < + name = <"references"> + type_def = < + root_type = <"Hash"> + generic_parameters = <"String", "String"> + > + > + ["conversion_details"] = (P_BMM_GENERIC_PROPERTY) < + name = <"conversion_details"> + type_def = < + root_type = <"Hash"> + generic_parameters = <"String", "String"> + > + > + ["other_details"] = (P_BMM_GENERIC_PROPERTY) < + name = <"other_details"> + type_def = < + root_type = <"Hash"> + generic_parameters = <"String", "String"> + > + > + ["parent_resource"] = (P_BMM_SINGLE_PROPERTY) < + name = <"parent_resource"> + type = <"Authored_resource"> + is_mandatory = + > + ["details"] = (P_BMM_GENERIC_PROPERTY) < + name = <"details"> + type_def = < + root_type = <"Hash"> + generic_parameters = <"String", "Resource_description_item"> + > + > + > + > + + ["Resource_description_item"] = < + name = <"Resource_description_item"> + ancestors = <"Any", ...> + properties = < + ["language"] = (P_BMM_SINGLE_PROPERTY) < + name = <"language"> + type = <"Terminology_code"> + is_mandatory = + > + ["purpose"] = (P_BMM_SINGLE_PROPERTY) < + name = <"purpose"> + type = <"String"> + is_mandatory = + > + ["keywords"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"keywords"> + type_def = < + container_type = <"List"> + type = <"String"> + > + cardinality = <|>=0|> + > + ["use"] = (P_BMM_SINGLE_PROPERTY) < + name = <"use"> + type = <"String"> + > + ["misuse"] = (P_BMM_SINGLE_PROPERTY) < + name = <"misuse"> + type = <"String"> + > + ["original_resource_uri"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"original_resource_uri"> + type_def = < + container_type = <"List"> + type_def = (P_BMM_GENERIC_TYPE) < + root_type = <"Hash"> + generic_parameters = <"String", "String"> + > + > + cardinality = <|>=0|> + > + ["other_details"] = (P_BMM_GENERIC_PROPERTY) < + name = <"other_details"> + type_def = < + root_type = <"Hash"> + generic_parameters = <"String", "String"> + > + > + > + > + + ["Resource_annotations"] = < + name = <"Resource_annotations"> + ancestors = <"Any"> + properties = < + ["documentation"] = (P_BMM_GENERIC_PROPERTY) < + name = <"documentation"> + type_def = < + root_type = <"Hash"> + generic_parameter_defs = < + ["K"] = (P_BMM_SIMPLE_TYPE) < + type = <"String"> + > + ["V"] = (P_BMM_GENERIC_TYPE) < + root_type = <"Hash"> + generic_parameter_defs = < + ["K"] = (P_BMM_SIMPLE_TYPE) < + type = <"String"> + > + ["V"] = (P_BMM_GENERIC_TYPE) < + root_type = <"Hash"> + generic_parameters = <"String", "String"> + > + > + > + > + > + is_mandatory = + > + > + > +> diff --git a/bmm/src/test/resources/s2/s2_care_065.bmm b/bmm/src/test/resources/s2/s2_care_065.bmm new file mode 100644 index 000000000..ae1b88ca8 --- /dev/null +++ b/bmm/src/test/resources/s2/s2_care_065.bmm @@ -0,0 +1,383 @@ +-- +-- component: Graphite Reference Model BMM +-- description: Graphite Reference Model component formal expression. This file is an ODIN serialisation of +-- the BMM object meta-model classes found at +-- https://www.openEHR.org/releases/LANG/latest/p_bmm.html +-- keywords: reference model, meta-model, archetypes +-- author: Thomas Beale +-- support: https://graphite.atlassian.net/issues/ +-- copyright: Copyright (c) 2023- Graphite Health +-- license: Apache 2.0 +-- + +------------------------------------------------------ +-- BMM version on which these schemas are based. +------------------------------------------------------ +bmm_version = <"2.3"> + +------------------------------------------------------ +-- schema identification +-- (schema_id computed as __) +------------------------------------------------------ +rm_publisher = <"s2"> +schema_name = <"care"> +rm_release = <"0.6.5"> + +model_name = <"EHR"> + +------------------------------------------------------ +-- schema documentation +------------------------------------------------------ +schema_revision = <"0.6.5.1"> +schema_lifecycle_state = <"trial"> +schema_description = <"S2 Release 0.6.5 CARE schema"> +schema_author = <"Thomas Beale "> + +------------------------------------------------------ +-- inclusions +------------------------------------------------------ +includes = < + ["1"] = < + id = <"s2_care_entry_0.6.5"> + > +> + +------------------------------------------------------ +-- packages - software structure +------------------------------------------------------ + +packages = < + ["org.s2.care"] = < + name = <"org.s2.care"> + packages = < + ["ehr"] = < + name = <"ehr"> + classes = <"Ehr", "Ehr_access", "Ehr_status", "Access_control_settings", "Folder", + "Versioned_composition", "Versioned_folder", "Versioned_ehr_access", "Versioned_ehr_status" + > + > + ["composition"] = < + name = <"composition"> + classes = <"Composition", "Event_context", "Content_item", "Section"> + > + + > + > +> + +------------------------------------------------------ +-- classes +------------------------------------------------------ + +class_definitions = < + + -- + --------------------- care.ehr ------------------ + -- + ["Ehr"] = < + name = <"Ehr"> + properties = < + ["system_id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"system_id"> + type = <"Internet_id"> + is_mandatory = + > + ["ehr_id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"ehr_id"> + type = <"Uuid"> + is_mandatory = + > + ["time_created"] = (P_BMM_SINGLE_PROPERTY) < + name = <"time_created"> + type = <"Date_time"> + is_mandatory = + > + ["ehr_access"] = (P_BMM_SINGLE_PROPERTY) < + name = <"ehr_access"> + type = <"Object_ref"> + is_mandatory = + > + ["ehr_status"] = (P_BMM_SINGLE_PROPERTY) < + name = <"ehr_status"> + type = <"Object_ref"> + is_mandatory = + > + ["directory"] = (P_BMM_SINGLE_PROPERTY) < + name = <"directory"> + type = <"Object_ref"> + > + ["folders"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"folders"> + type_def = < + container_type = <"List"> + type = <"Object_ref"> + > + cardinality = <|>=0|> + > + ["compositions"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"compositions"> + type_def = < + container_type = <"List"> + type = <"Object_ref"> + > + cardinality = <|>=0|> + > + ["contributions"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"contributions"> + type_def = < + container_type = <"List"> + type = <"Object_ref"> + > + cardinality = <|>=0|> + is_mandatory = + > + > + > + + ["Ehr_access"] = < + name = <"Ehr_access"> + ancestors = <"Locatable"> + properties = < + ["settings"] = (P_BMM_SINGLE_PROPERTY) < + name = <"settings"> + type = <"Access_control_settings"> + > + > + > + + ["Access_control_settings"] = < + name = <"Access_control_settings"> + ancestors = <"Any"> + is_abstract = + > + + ["Ehr_status"] = < + name = <"Ehr_status"> + ancestors = <"Locatable"> + properties = < + ["subject"] = (P_BMM_SINGLE_PROPERTY) < + name = <"subject"> + type = <"Party_self"> + is_mandatory = + > + ["is_queryable"] = (P_BMM_SINGLE_PROPERTY) < + name = <"is_queryable"> + type = <"Boolean"> + is_mandatory = + > + ["is_modifiable"] = (P_BMM_SINGLE_PROPERTY) < + name = <"is_modifiable"> + type = <"Boolean"> + is_mandatory = + > + ["other_details"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"other_details"> + type_def = < + container_type = <"List"> + type = <"Node"> + > + > + > + > + + -- + --------------------- care.composition ------------------ + -- + + ["Composition"] = < + name = <"Composition"> + ancestors = <"Locatable"> + properties = < + ["uid"] = (P_BMM_SINGLE_PROPERTY) < + name = <"uid"> + type = <"Uuid"> + is_mandatory = + is_im_infrastructure = + > + ["language"] = (P_BMM_SINGLE_PROPERTY) < + name = <"language"> + type = <"Terminology_code"> + -- value_constraint = <"ISO::639-2"> + is_mandatory = + > + ["territory"] = (P_BMM_SINGLE_PROPERTY) < + name = <"territory"> + type = <"Terminology_code"> + -- value_constraint = <"ISO::3166"> + is_mandatory = + > + ["category"] = (P_BMM_SINGLE_PROPERTY) < + name = <"category"> + type = <"Terminology_term"> + -- value_constraint = <"openehr::Comp-category"> + is_mandatory = + > + ["composer"] = (P_BMM_SINGLE_PROPERTY) < + name = <"composer"> + type = <"Party_proxy"> + is_mandatory = + > + ["context"] = (P_BMM_SINGLE_PROPERTY) < + name = <"context"> + type = <"Event_context"> + > + ["content"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"content"> + type_def = < + container_type = <"List"> + type = <"Content_item"> + > + cardinality = <|>=1|> + > + > + > + + ["Event_context"] = < + name = <"Event_context"> + ancestors = <"Locatable"> + properties = < + ["health_care_facility"] = (P_BMM_SINGLE_PROPERTY) < + name = <"health_care_facility"> + type = <"Party_identified"> + > + ["start_time"] = (P_BMM_SINGLE_PROPERTY) < + name = <"start_time"> + type = <"Date_time"> + is_mandatory = + > + ["end_time"] = (P_BMM_SINGLE_PROPERTY) < + name = <"end_time"> + type = <"Date_time"> + > + ["participations"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"participations"> + type_def = < + container_type = <"List"> + type = <"Participation"> + > + cardinality = <|>=1|> + > + ["location"] = (P_BMM_SINGLE_PROPERTY) < + name = <"location"> + type = <"String"> + > + ["setting"] = (P_BMM_SINGLE_PROPERTY) < + name = <"setting"> + type = <"Terminology_term"> + is_mandatory = + > + ["other_context"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"other_context"> + type_def = < + container_type = <"List"> + type = <"Node"> + > + > + > + > + + ------------------------------------------------------------ + ---------------------- care.ehr.directory ------------------- + ------------------------------------------------------------ + + ["Folder"] = < + name = <"Folder"> + ancestors = <"Locatable"> + properties = < + ["folders"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"folders"> + type_def = < + container_type = <"List"> + type = <"Folder"> + > + > + ["items"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"items"> + type_def = < + container_type = <"List"> + type = <"Object_ref"> + > + > + ["details"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"details"> + type_def = < + container_type = <"List"> + type = <"Node"> + > + > + > + > + + ["Versioned_ehr_access"] = < + name = <"Versioned_ehr_access"> + ancestor_defs = < + ["Versioned_object"] = (P_BMM_GENERIC_TYPE) < + root_type = <"Versioned_object"> + generic_parameters = <"Folder"> + > + > + > + + ["Versioned_ehr_status"] = < + name = <"Versioned_ehr_status"> + ancestor_defs = < + ["Versioned_object"] = (P_BMM_GENERIC_TYPE) < + root_type = <"Versioned_object"> + generic_parameters = <"Folder"> + > + > + > + + ["Versioned_composition"] = < + name = <"Versioned_composition"> + ancestor_defs = < + ["Versioned_object"] = (P_BMM_GENERIC_TYPE) < + root_type = <"Versioned_object"> + generic_parameters = <"Folder"> + > + > + > + + ["Versioned_folder"] = < + name = <"Versioned_folder"> + ancestor_defs = < + ["Versioned_object"] = (P_BMM_GENERIC_TYPE) < + root_type = <"Versioned_object"> + generic_parameters = <"Folder"> + > + > + > + + + + + -- + --------------------- care.composition.content ------------------ + -- + + ["Content_item"] = < + name = <"Content_item"> + ancestors = <"Locatable"> + is_abstract = + > + + -- + --------------- care.composition.content.navigation ------------- + -- + + ["Section"] = < + name = <"Section"> + ancestors = <"Content_item"> + properties = < + ["items"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"items"> + type_def = < + container_type = <"List"> + type = <"Content_item"> + > + cardinality = <|>=1|> + > + > + > + +> diff --git a/bmm/src/test/resources/s2/s2_care_ehr_065.bmm b/bmm/src/test/resources/s2/s2_care_ehr_065.bmm new file mode 100644 index 000000000..e1be950d4 --- /dev/null +++ b/bmm/src/test/resources/s2/s2_care_ehr_065.bmm @@ -0,0 +1,381 @@ +-- +-- component: Graphite Reference Model BMM +-- description: Graphite Reference Model component formal expression. This file is an ODIN serialisation of +-- the BMM object meta-model classes found at +-- https://www.openEHR.org/releases/LANG/latest/p_bmm.html +-- keywords: reference model, meta-model, archetypes +-- author: Thomas Beale +-- support: https://graphite.atlassian.net/issues/ +-- copyright: Copyright (c) 2023- Graphite Health +-- license: Apache 2.0 +-- + +------------------------------------------------------ +-- BMM version on which these schemas are based. +------------------------------------------------------ +bmm_version = <"2.3"> + +------------------------------------------------------ +-- schema identification +-- (schema_id computed as __) +------------------------------------------------------ +rm_publisher = <"s2"> +schema_name = <"care_ehr"> +rm_release = <"0.6.5"> + +------------------------------------------------------ +-- schema documentation +------------------------------------------------------ +schema_revision = <"0.6.5.1"> +schema_lifecycle_state = <"development"> +schema_description = <"S2 CARE Release 0.6.5 EHR schema"> +schema_author = <"Thomas Beale "> + +------------------------------------------------------ +-- inclusions +------------------------------------------------------ +includes = < + ["1"] = < + id = <"s2_base_0.7.0"> + > +> + +------------------------------------------------------ +-- packages - software structure +------------------------------------------------------ + +packages = < + ["org.s2.care"] = < + name = <"org.s2.care"> + packages = < + ["ehr"] = < + name = <"ehr"> + classes = <"Ehr", "Ehr_access", "Ehr_status", "Access_control_settings", "Folder", + "Versioned_composition", "Versioned_folder", "Versioned_ehr_access", "Versioned_ehr_status" + > + > + ["composition"] = < + name = <"composition"> + classes = <"Composition", "Event_context", "Content_item", "Section"> + > + + > + > +> + +------------------------------------------------------ +-- classes +------------------------------------------------------ + +class_definitions = < + + -- + --------------------- care.ehr ------------------ + -- + ["Ehr"] = < + name = <"Ehr"> + properties = < + ["system_id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"system_id"> + type = <"Internet_id"> + is_mandatory = + > + ["ehr_id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"ehr_id"> + type = <"Uuid"> + is_mandatory = + > + ["time_created"] = (P_BMM_SINGLE_PROPERTY) < + name = <"time_created"> + type = <"Date_time"> + is_mandatory = + > + ["ehr_access"] = (P_BMM_SINGLE_PROPERTY) < + name = <"ehr_access"> + type = <"Object_ref"> + is_mandatory = + > + ["ehr_status"] = (P_BMM_SINGLE_PROPERTY) < + name = <"ehr_status"> + type = <"Object_ref"> + is_mandatory = + > + ["directory"] = (P_BMM_SINGLE_PROPERTY) < + name = <"directory"> + type = <"Object_ref"> + > + ["folders"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"folders"> + type_def = < + container_type = <"List"> + type = <"Object_ref"> + > + cardinality = <|>=0|> + > + ["compositions"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"compositions"> + type_def = < + container_type = <"List"> + type = <"Object_ref"> + > + cardinality = <|>=0|> + > + ["contributions"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"contributions"> + type_def = < + container_type = <"List"> + type = <"Object_ref"> + > + cardinality = <|>=0|> + is_mandatory = + > + > + > + + ["Ehr_access"] = < + name = <"Ehr_access"> + ancestors = <"Locatable"> + properties = < + ["settings"] = (P_BMM_SINGLE_PROPERTY) < + name = <"settings"> + type = <"Access_control_settings"> + > + > + > + + ["Access_control_settings"] = < + name = <"Access_control_settings"> + ancestors = <"Any"> + is_abstract = + > + + ["Ehr_status"] = < + name = <"Ehr_status"> + ancestors = <"Locatable"> + properties = < + ["subject"] = (P_BMM_SINGLE_PROPERTY) < + name = <"subject"> + type = <"Party_self"> + is_mandatory = + > + ["is_queryable"] = (P_BMM_SINGLE_PROPERTY) < + name = <"is_queryable"> + type = <"Boolean"> + is_mandatory = + > + ["is_modifiable"] = (P_BMM_SINGLE_PROPERTY) < + name = <"is_modifiable"> + type = <"Boolean"> + is_mandatory = + > + ["other_details"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"other_details"> + type_def = < + container_type = <"List"> + type = <"Node"> + > + > + > + > + + -- + --------------------- care.composition ------------------ + -- + + ["Composition"] = < + name = <"Composition"> + ancestors = <"Locatable"> + properties = < + ["uid"] = (P_BMM_SINGLE_PROPERTY) < + name = <"uid"> + type = <"Uuid"> + is_mandatory = + is_im_infrastructure = + > + ["language"] = (P_BMM_SINGLE_PROPERTY) < + name = <"language"> + type = <"Terminology_code"> + -- value_constraint = <"ISO::639-2"> + is_mandatory = + > + ["territory"] = (P_BMM_SINGLE_PROPERTY) < + name = <"territory"> + type = <"Terminology_code"> + -- value_constraint = <"ISO::3166"> + is_mandatory = + > + ["category"] = (P_BMM_SINGLE_PROPERTY) < + name = <"category"> + type = <"Terminology_term"> + -- value_constraint = <"openehr::Comp-category"> + is_mandatory = + > + ["composer"] = (P_BMM_SINGLE_PROPERTY) < + name = <"composer"> + type = <"Party_proxy"> + is_mandatory = + > + ["context"] = (P_BMM_SINGLE_PROPERTY) < + name = <"context"> + type = <"Event_context"> + > + ["content"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"content"> + type_def = < + container_type = <"List"> + type = <"Content_item"> + > + cardinality = <|>=1|> + > + > + > + + ["Event_context"] = < + name = <"Event_context"> + ancestors = <"Locatable"> + properties = < + ["health_care_facility"] = (P_BMM_SINGLE_PROPERTY) < + name = <"health_care_facility"> + type = <"Party_identified"> + > + ["start_time"] = (P_BMM_SINGLE_PROPERTY) < + name = <"start_time"> + type = <"Date_time"> + is_mandatory = + > + ["end_time"] = (P_BMM_SINGLE_PROPERTY) < + name = <"end_time"> + type = <"Date_time"> + > + ["participations"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"participations"> + type_def = < + container_type = <"List"> + type = <"Participation"> + > + cardinality = <|>=1|> + > + ["location"] = (P_BMM_SINGLE_PROPERTY) < + name = <"location"> + type = <"String"> + > + ["setting"] = (P_BMM_SINGLE_PROPERTY) < + name = <"setting"> + type = <"Terminology_term"> + is_mandatory = + > + ["other_context"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"other_context"> + type_def = < + container_type = <"List"> + type = <"Node"> + > + > + > + > + + ------------------------------------------------------------ + ---------------------- care.ehr.directory ------------------- + ------------------------------------------------------------ + + ["Folder"] = < + name = <"Folder"> + ancestors = <"Locatable"> + properties = < + ["folders"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"folders"> + type_def = < + container_type = <"List"> + type = <"Folder"> + > + > + ["items"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"items"> + type_def = < + container_type = <"List"> + type = <"Object_ref"> + > + > + ["details"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"details"> + type_def = < + container_type = <"List"> + type = <"Node"> + > + > + > + > + + ["Versioned_ehr_access"] = < + name = <"Versioned_ehr_access"> + ancestor_defs = < + ["Versioned_object"] = (P_BMM_GENERIC_TYPE) < + root_type = <"Versioned_object"> + generic_parameters = <"Folder"> + > + > + > + + ["Versioned_ehr_status"] = < + name = <"Versioned_ehr_status"> + ancestor_defs = < + ["Versioned_object"] = (P_BMM_GENERIC_TYPE) < + root_type = <"Versioned_object"> + generic_parameters = <"Folder"> + > + > + > + + ["Versioned_composition"] = < + name = <"Versioned_composition"> + ancestor_defs = < + ["Versioned_object"] = (P_BMM_GENERIC_TYPE) < + root_type = <"Versioned_object"> + generic_parameters = <"Folder"> + > + > + > + + ["Versioned_folder"] = < + name = <"Versioned_folder"> + ancestor_defs = < + ["Versioned_object"] = (P_BMM_GENERIC_TYPE) < + root_type = <"Versioned_object"> + generic_parameters = <"Folder"> + > + > + > + + + + + -- + --------------------- care.composition.content ------------------ + -- + + ["Content_item"] = < + name = <"Content_item"> + ancestors = <"Locatable"> + is_abstract = + > + + -- + --------------- care.composition.content.navigation ------------- + -- + + ["Section"] = < + name = <"Section"> + ancestors = <"Content_item"> + properties = < + ["items"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"items"> + type_def = < + container_type = <"List"> + type = <"Content_item"> + > + cardinality = <|>=1|> + > + > + > + +> diff --git a/bmm/src/test/resources/s2/s2_care_entry_065.bmm b/bmm/src/test/resources/s2/s2_care_entry_065.bmm new file mode 100644 index 000000000..a35c637bb --- /dev/null +++ b/bmm/src/test/resources/s2/s2_care_entry_065.bmm @@ -0,0 +1,464 @@ +-- +-- component: Graphite Reference Model BMM +-- description: Graphite Reference Model component formal expression. This file is an ODIN serialisation of +-- the BMM object meta-model classes found at +-- https://www.openEHR.org/releases/LANG/latest/p_bmm.html +-- keywords: reference model, meta-model, archetypes +-- author: Thomas Beale +-- support: https://graphite.atlassian.net/issues/ +-- copyright: Copyright (c) 2023- Graphite Health +-- license: Apache 2.0 +-- + +------------------------------------------------------ +-- BMM version on which these schemas are based. +------------------------------------------------------ +bmm_version = <"2.3"> + +------------------------------------------------------ +-- schema identification +-- (schema_id computed as __) +------------------------------------------------------ +rm_publisher = <"s2"> +schema_name = <"care_entry"> +rm_release = <"0.6.5"> + +------------------------------------------------------ +-- schema documentation +------------------------------------------------------ +schema_revision = <"0.6.5.1"> +schema_lifecycle_state = <"stable"> +schema_description = <"S2 Release 0.6.5 Entry schema"> +schema_author = <"Thomas Beale "> + +------------------------------------------------------ +-- inclusions +------------------------------------------------------ +includes = < + ["1"] = < + id = <"s2_care_ehr_0.6.5"> + > +> + +------------------------------------------------------ +-- packages - software structure +------------------------------------------------------ + +packages = < + ["org.s2.care"] = < + name = <"org.s2.care"> + packages = < + ["entry"] = < + name = <"entry"> + classes = <"Entry", "Care_entry", "Care_act_entry", "Admin_entry", + "Observation", "Direct_observation", + "Indirect_observation", "Lab_result", "Imaging", + "Questionnaire_response", "Score", + "Assessment", + "Order", "Action", "Activity", "State_transition", "Order_tracking", + "Order_execution_state", "Order_execution_transition" + > + > + > + > +> + +------------------------------------------------------ +-- classes +------------------------------------------------------ + +class_definitions = < + + -- + --------------- care.entry ------------- + -- + + ["Entry"] = < + name = <"Entry"> + is_abstract = + ancestors = <"Content_item"> + properties = < + ["uid"] = (P_BMM_SINGLE_PROPERTY) < + name = <"uid"> + type = <"Uuid"> + is_mandatory = + is_im_infrastructure = + > + ["time"] = (P_BMM_SINGLE_PROPERTY) < + name = <"time"> + type = <"Date_time"> + is_mandatory = + is_im_runtime = + > + ["language"] = (P_BMM_SINGLE_PROPERTY) < + name = <"language"> + type = <"Terminology_code"> + -- value_constraint = <"ISO::639-2"> + is_mandatory = + is_im_infrastructure = + > + ["subject"] = (P_BMM_SINGLE_PROPERTY) < + name = <"subject"> + type = <"Party_proxy"> + is_mandatory = + > + ["reporter"] = (P_BMM_SINGLE_PROPERTY) < + name = <"reporter"> + type = <"Party_proxy"> + > + ["authorization_actions"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"authorization_actions"> + type_def = < + container_type = <"List"> + type = <"Participation"> + > + cardinality = <|>=0|> + > + ["other_participations"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"other_participations"> + type_def = < + container_type = <"List"> + type = <"Participation"> + > + cardinality = <|>=0|> + > + ["workflow_id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"workflow_id"> + type = <"String"> + is_im_runtime = + > + ["comment"] = (P_BMM_SINGLE_PROPERTY) < + name = <"comment"> + type = <"Text"> + > + > + > + + ["Admin_entry"] = < + name = <"Admin_entry"> + ancestors = <"Entry"> + properties = < + ["data"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"data"> + type_def = < + container_type = <"List"> + type = <"Node"> + > + cardinality = <|>=1|> + > + > + > + + ["Care_entry"] = < + name = <"Care_entry"> + is_abstract = + documentation = <"Abstract Entry subtype corresponding to any type of Entry in the clinical care cycle."> + ancestors = <"Entry"> + properties = < + ["qualifiers"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"qualifiers"> + type_def = < + container_type = <"List"> + type = <"Node"> + > + > + ["guideline_ids"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"guideline_ids"> + type_def = < + container_type = <"List"> + type = <"Uri"> + > + is_im_runtime = + > + > + > + + ["Care_act_entry"] = < + name = <"Care_act_entry"> + is_abstract = + documentation = <"Entry type for billable and/or ordered acts"> + ancestors = <"Care_entry"> + properties = < + ["order_tracking"] = (P_BMM_SINGLE_PROPERTY) < + name = <"order_tracking"> + type = <"Order_tracking"> + > + > + > + + ["Order_tracking"] = < + name = <"Order_tracking"> + ancestors = <"Any"> + properties = < + ["order_id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"order_id"> + type = <"String"> + is_mandatory = + is_im_runtime = + > + ["requestor_id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"requestor_id"> + type = <"String"> + is_im_runtime = + > + ["filler_id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"filler_id"> + type = <"String"> + is_im_runtime = + > + ["details"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"details"> + type_def = < + container_type = <"List"> + type = <"Node"> + > + > + > + > + + ["Observation"] = < + name = <"Observation"> + documentation = <"Entry subtype used to represent single sample observation."> + ancestors = <"Care_act_entry"> + properties = < + ["data"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"data"> + type_def = < + container_type = <"List"> + type = <"Node"> + > + cardinality = <|>=1|> + > + ["state"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"state"> + type_def = < + container_type = <"List"> + type = <"Node"> + > + > + > + > + + ["Direct_observation"] = < + name = <"Direct_observation"> + ancestors = <"Observation"> + properties = < + ["trend"] = (P_BMM_SINGLE_PROPERTY) < + name = <"trend"> + type = <"Trend_kind"> + > + ["total_duration"] = (P_BMM_SINGLE_PROPERTY) < + name = <"total_duration"> + type = <"Duration"> + > + ["data_series"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"data_series"> + type_def = < + container_type = <"List"> + type = <"Event"> + > + > + ["state_series"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"state_series"> + type_def = < + container_type = <"List"> + type = <"Event"> + > + > + > + > + + ["Indirect_observation"] = < + name = <"Indirect_observation"> + ancestors = <"Observation"> + properties = < + ["result_time"] = (P_BMM_SINGLE_PROPERTY) < + name = <"result_time"> + type = <"Date_time"> + is_im_runtime = + is_mandatory = + > + > + > + + ["Lab_result"] = < + name = <"Lab_result"> + ancestors = <"Indirect_observation"> + > + + ["Imaging"] = < + name = <"Imaging"> + ancestors = <"Indirect_observation"> + > + + ["Score"] = < + name = <"Score"> + ancestors = <"Observation"> + > + + ["Questionnaire_response"] = < + name = <"Questionnaire_response"> + documentation = <"Entry subtype used questionnaire responses"> + ancestors = <"Observation"> + properties = < + ["questionnaire_identifier"] = (P_BMM_SINGLE_PROPERTY) < + name = <"questionnaire_identifier"> + is_mandatory = + type = <"String"> + > + ["questionnaire_version"] = (P_BMM_SINGLE_PROPERTY) < + name = <"questionnaire_version"> + type = <"String"> + > + ["questionnaire_title"] = (P_BMM_SINGLE_PROPERTY) < + name = <"questionnaire_title"> + type = <"Terminology_term"> + is_mandatory = + > + ["completion_status"] = (P_BMM_SINGLE_PROPERTY) < + name = <"completion_status"> + type = <"Terminology_code"> + > + > + > + + ["Assessment"] = < + name = <"Assessment"> + ancestors = <"Care_entry"> + properties = < + ["data"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"data"> + type_def = < + container_type = <"List"> + type = <"Node"> + > + cardinality = <|>=1|> + > + ["probability"] = (P_BMM_SINGLE_PROPERTY) < + name = <"probability"> + type = <"Real"> + > + ["certainty"] = (P_BMM_SINGLE_PROPERTY) < + name = <"certainty"> + type = <"Terminology_code"> + > + > + > + + ["Order"] = < + name = <"Order"> + ancestors = <"Care_act_entry"> + properties = < + ["narrative"] = (P_BMM_SINGLE_PROPERTY) < + name = <"narrative"> + type = <"Text"> + is_mandatory = + > + ["expiry_time"] = (P_BMM_SINGLE_PROPERTY) < + name = <"expiry_time"> + type = <"Date_time"> + > + ["activities"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"activities"> + type_def = < + container_type = <"List"> + type = <"Activity"> + > + cardinality = <|>=1|> + > + > + > + + ["Activity"] = < + name = <"Activity"> + ancestors = <"Locatable"> + properties = < + ["description"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"description"> + type_def = < + container_type = <"List"> + type = <"Node"> + > + cardinality = <|>=1|> + > + ["timing"] = (P_BMM_SINGLE_PROPERTY) < + name = <"timing"> + type = <"Timing"> + > + > + > + + ["Action"] = < + name = <"Action"> + ancestors = <"Care_act_entry"> + properties = < + ["activity_id"] = (P_BMM_SINGLE_PROPERTY) < + name = <"activity_id"> + type = <"String"> + is_im_runtime = + is_mandatory = + > + ["duration"] = (P_BMM_SINGLE_PROPERTY) < + name = <"duration"> + type = <"Duration"> + is_im_runtime = + > + ["description"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"description"> + type_def = < + container_type = <"List"> + type = <"Node"> + > + cardinality = <|>=1|> + > + ["state_transition"] = (P_BMM_SINGLE_PROPERTY) < + name = <"state_transition"> + type = <"State_transition"> + > + > + > + + ["State_transition"] = < + name = <"State_transition"> + ancestors = <"Locatable"> + properties = < + ["current_state"] = (P_BMM_SINGLE_PROPERTY) < + name = <"current_state"> + type = <"Order_execution_state"> + is_mandatory = + > + ["transition"] = (P_BMM_SINGLE_PROPERTY) < + name = <"transition"> + type = <"Order_execution_transition"> + > + ["careflow_step"] = (P_BMM_SINGLE_PROPERTY) < + name = <"careflow_step"> + type = <"Terminology_term"> + > + ["reason"] = (P_BMM_CONTAINER_PROPERTY) < + name = <"reason"> + type_def = < + container_type = <"List"> + type = <"Text"> + > + cardinality = <|>=0|> + > + > + > + + ["Order_execution_state"] = (P_BMM_ENUMERATION_STRING) < + name = <"Order_execution_state"> + ancestors = <"String"> + item_names = <"initial", "planned", "scheduled", "postponed", "cancelled", "active", "suspended", "aborted", "completed", "expired"> + > + + ["Order_execution_transition"] = (P_BMM_ENUMERATION_STRING) < + name = <"Order_execution_transition"> + ancestors = <"String"> + item_names = <"initiate", "start", "schedule", "plan_step", "cancel", "do", "resume", "suspend", "suspended_step", + "active_step", "scheduled_step", "postponed_step", "finish", "abort", "restore", "postpone", "time_out", "notify_completed", + "notify_cancelled", "notify_aborted"> + > + + +> diff --git a/bmm/src/test/resources/testbmm/TestBmm1.bmm b/bmm/src/test/resources/testbmm/TestBmm1.bmm index 90f690c59..6bc2c8a3b 100644 --- a/bmm/src/test/resources/testbmm/TestBmm1.bmm +++ b/bmm/src/test/resources/testbmm/TestBmm1.bmm @@ -283,6 +283,20 @@ class_definitions = < > > + ["TypeWithHashMap"] = < + name = <"TypeWithHashMap"> + properties = < + ["employees"] = (P_BMM_INDEXED_CONTAINER_PROPERTY) < + name = <"employees"> + type_def = < + container_type = <"Hash"> + index_type = <"String"> + type = <"Party"> + > + > + > + > + ["ProportionKind"] = (P_BMM_ENUMERATION_INTEGER) < name = <"ProportionKind"> ancestors = <"Integer", ...> diff --git a/build.gradle b/build.gradle index 6d831a802..c58bce76b 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ wrapper { allprojects { version = '3.9.1' - group = 'com.nedap.healthcare.archie' + group = 'io.graphitehealth.archie' ext.gradleScriptDir = "${rootProject.projectDir}/gradle" //archivesBaseName = 'archie' diff --git a/gradle/publish-maven.gradle b/gradle/publish-maven.gradle index 33a94ffa0..b8dcd5b20 100644 --- a/gradle/publish-maven.gradle +++ b/gradle/publish-maven.gradle @@ -12,16 +12,12 @@ if(gradle.ext.shouldSign) { publishing { repositories { maven { - name = "ossrh" - // OSSRH URLS - def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' - def snapshotsRepoUrl = 'ttps://oss.sonatype.org/content/repositories/snapshots/' - url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl - credentials { - username = project.hasProperty('ossrhUsername') ? ossrhUsername : "Unknown user" - password = project.hasProperty('ossrhPassword') ? ossrhPassword : "Unknown password" + username mavenUser + password mavenPassword } + + url = version.endsWith('SNAPSHOT') ? snapshotsRepoURL : releasesRepoURL } } }