diff --git a/tools/src/main/java/com/nedap/archie/archetypevalidator/ArchetypeValidator.java b/tools/src/main/java/com/nedap/archie/archetypevalidator/ArchetypeValidator.java index e86cea5d2..0338eebe5 100644 --- a/tools/src/main/java/com/nedap/archie/archetypevalidator/ArchetypeValidator.java +++ b/tools/src/main/java/com/nedap/archie/archetypevalidator/ArchetypeValidator.java @@ -77,6 +77,7 @@ public ArchetypeValidator(MetaModels models) { validationsPhase3 = new ArrayList<>(); validationsPhase3.add(new AnnotationsValidation()); validationsPhase3.add(new FlatFormValidation()); + validationsPhase3.add(new RulesValidation()); } diff --git a/tools/src/main/java/com/nedap/archie/archetypevalidator/ErrorType.java b/tools/src/main/java/com/nedap/archie/archetypevalidator/ErrorType.java index aa702372e..3a0c8e586 100644 --- a/tools/src/main/java/com/nedap/archie/archetypevalidator/ErrorType.java +++ b/tools/src/main/java/com/nedap/archie/archetypevalidator/ErrorType.java @@ -81,10 +81,9 @@ public enum ErrorType implements MessageCode { VDSEV(I18n.register("archetype slot 'exclude' constraint validity. The 'exclude' constraint in an archetype slot must conform to the slot constraint validity rules.")), VACSO(I18n.register("single-valued attribute child object occurrences validity: the occurrences of a child object of a single-valued attribute cannot have an upper limit greater than 1.")), VACMCU(I18n.register("cardinality/occurrences upper bound validity: where a cardinality with a finite upper bound is stated on an attribute, for all immediate child objects for which an occurrences constraint is stated, the occurrences must either have an open upper bound (i.e. n..*) which is interpreted as the maximum value allowed within the cardinality, or else a finite upper bound which is ⇐ the cardinality upper bound.")), - WOUC(I18n.register("code in terminology not used in archetype definition")); - - - + WOUC(I18n.register("code in terminology not used in archetype definition")), + VRRLPAR(I18n.register("path in rules does not exist")), + RULES_VARIABLE_NOT_DEFINED(I18n.register("Variable not defined")); private final String description; diff --git a/tools/src/main/java/com/nedap/archie/archetypevalidator/validations/RulesValidation.java b/tools/src/main/java/com/nedap/archie/archetypevalidator/validations/RulesValidation.java new file mode 100644 index 000000000..fa8252c73 --- /dev/null +++ b/tools/src/main/java/com/nedap/archie/archetypevalidator/validations/RulesValidation.java @@ -0,0 +1,165 @@ +package com.nedap.archie.archetypevalidator.validations; + +import com.google.common.collect.Lists; +import com.nedap.archie.aom.Archetype; +import com.nedap.archie.aom.ArchetypeModelObject; +import com.nedap.archie.aom.CAttribute; +import com.nedap.archie.aom.CObject; +import com.nedap.archie.archetypevalidator.ArchetypeValidationBase; +import com.nedap.archie.archetypevalidator.ErrorType; +import com.nedap.archie.paths.PathSegment; +import com.nedap.archie.paths.PathUtil; +import com.nedap.archie.query.APathQuery; +import com.nedap.archie.rules.Assertion; +import com.nedap.archie.rules.BinaryOperator; +import com.nedap.archie.rules.Expression; +import com.nedap.archie.rules.ExpressionVariable; +import com.nedap.archie.rules.ForAllStatement; +import com.nedap.archie.rules.Function; +import com.nedap.archie.rules.ModelReference; +import com.nedap.archie.rules.RuleStatement; +import com.nedap.archie.rules.UnaryOperator; +import org.openehr.utils.message.I18n; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +public class RulesValidation extends ArchetypeValidationBase { + + + private Map variableToPathMap; + + @Override + public void validate() { + variableToPathMap = new LinkedHashMap<>(); + if(archetype.getRules() != null && archetype.getRules().getRules() != null) { + for(RuleStatement statement:archetype.getRules().getRules()) { + if(statement instanceof Assertion) { + Assertion toValidate = (Assertion) statement; + validate(toValidate); + } else if (statement instanceof ExpressionVariable) { + ExpressionVariable variable = (ExpressionVariable) statement; + validate(variable.getExpression()); + + } + } + } + } + + private void validate(Assertion toValidate) { + Expression expression = toValidate.getExpression(); + validate(expression); + } + + private void validate(Expression expression) { + if(expression instanceof BinaryOperator) { + validate((BinaryOperator) expression); + } else if (expression instanceof ModelReference) { + validate((ModelReference) expression); + } else if (expression instanceof UnaryOperator) { + validate((UnaryOperator) expression); + } else if (expression instanceof Function) { + validate((Function) expression); + } else if (expression instanceof ForAllStatement) { + validate((ForAllStatement) expression); + } + } + + private void validate(BinaryOperator operator) { + validate(operator.getLeftOperand()); + validate(operator.getRightOperand()); + } + + private void validate(UnaryOperator operator) { + validate(operator.getOperand()); + } + + private void validate(ModelReference reference) { + if(!validatePath(getPath(reference))) { + this.addWarning(ErrorType.VRRLPAR, reference.toString()); + } + } + + private void validate(Function function) { + for(Expression argument:function.getArguments()) { + validate(argument); + } + } + + private void validate(ForAllStatement statement) { + if(statement.getPathExpression() instanceof ModelReference) { + String path = getPath((ModelReference) statement.getPathExpression()); + variableToPathMap.put(statement.getVariableName(), path); + validate(statement.getAssertion()); + variableToPathMap.remove(statement.getVariableName()); + } else { + //cannot validate yet + } + + } + + private String getPath(ModelReference pathExpression) { + if(pathExpression.getVariableReferencePrefix() != null && !pathExpression.getVariableReferencePrefix().isEmpty()) { + if(variableToPathMap.containsKey(pathExpression.getVariableReferencePrefix())) { + return variableToPathMap.get(pathExpression.getVariableReferencePrefix()) + pathExpression.getPath(); + } else { + addWarning(ErrorType.RULES_VARIABLE_NOT_DEFINED, I18n.t("Variable {0} used, but not defined", pathExpression.getVariableReferencePrefix())); + } + } + return pathExpression.getPath(); + } + + private boolean validatePath(String path) { + Archetype operationalTemplate = repository.getOperationalTemplate(archetype.getArchetypeId().toString()); + List pathSegments = new APathQuery(path).getPathSegments(); + int i = pathSegments.size() -1; + List archetypeModelObjects = null; + String subPath = null; + for(; i >= 0; i--) { + subPath = joinPathUntil(pathSegments, i); + archetypeModelObjects = operationalTemplate.itemsAtPath(subPath); + if(!archetypeModelObjects.isEmpty()) { + break; + } + } + if(archetypeModelObjects.isEmpty()) { + return false; + } else { + String restOfPath = i >= pathSegments.size() -1 ? "" : PathUtil.getPath(pathSegments.subList(i+1, pathSegments.size())); + if(restOfPath.isEmpty()) { + return true; + } + for(ArchetypeModelObject object: archetypeModelObjects) { + List typeNames = getTypeNames(object); + for(String typeName:typeNames) { + if (this.combinedModels.hasReferenceModelPath(typeName, restOfPath)) { + return true; + } + } + } + } + return false; + + } + + private List getTypeNames(ArchetypeModelObject object) { + if(object instanceof CObject) { + return Lists.newArrayList(((CObject) object).getRmTypeName()); + } else if (object instanceof CAttribute) { + CAttribute attribute = (CAttribute) object; + ArrayList result= new ArrayList<>(); + for(CObject child:attribute.getChildren()) { + result.addAll(getTypeNames(child)); + } + return result; + } + return Collections.emptyList(); + } + + private String joinPathUntil(List pathSegments, int i) { + return PathUtil.getPath(pathSegments.subList(0, i+1)); + } +} diff --git a/tools/src/test/java/com/nedap/archie/archetypevalidator/RuleStatementValidationTest.java b/tools/src/test/java/com/nedap/archie/archetypevalidator/RuleStatementValidationTest.java new file mode 100644 index 000000000..415c784f7 --- /dev/null +++ b/tools/src/test/java/com/nedap/archie/archetypevalidator/RuleStatementValidationTest.java @@ -0,0 +1,58 @@ +package com.nedap.archie.archetypevalidator; + +import com.nedap.archie.flattener.FullArchetypeRepository; +import com.nedap.archie.rminfo.ArchieRMInfoLookup; +import com.nedap.archie.rminfo.MetaModels; +import com.nedap.archie.rminfo.ReferenceModels; +import com.nedap.archie.testutil.TestUtil; +import org.junit.Test; +import org.openehr.referencemodels.BuiltinReferenceModels; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +import static org.junit.Assert.assertTrue; + +public class RuleStatementValidationTest { + + private static final Logger logger = LoggerFactory.getLogger(CKMArchetypeValidatorTest.class); + + private static Set archetypesWithKnownErrors = new HashSet<>(); + static { + + } + + + @Test + public void rulesExamplesValidTest() { + + FullArchetypeRepository repository = TestUtil.parseRuleExamples(); + ReferenceModels models = new ReferenceModels(); + models.registerModel(ArchieRMInfoLookup.getInstance()); + logger.info("archetypes parsed: " + repository.getAllArchetypes().size()); + repository.compile(models); + + runTest(repository); + + } + + private void runTest(FullArchetypeRepository repository) { + List allValidationResults = repository.getAllValidationResults(); + List resultWithErrors = allValidationResults.stream() + .filter(r -> !r.passes()) + .filter(r -> !archetypesWithKnownErrors.contains(r.getArchetypeId())) + .collect(Collectors.toList()); + + StringBuilder error = new StringBuilder(); + for(ValidationResult result:resultWithErrors) { + error.append(result); + error.append("\n\n"); + } + + assertTrue(error.toString(), resultWithErrors.isEmpty()); + } +} diff --git a/tools/src/test/java/com/nedap/archie/testutil/TestUtil.java b/tools/src/test/java/com/nedap/archie/testutil/TestUtil.java index fe9da6c6a..af75b0357 100644 --- a/tools/src/test/java/com/nedap/archie/testutil/TestUtil.java +++ b/tools/src/test/java/com/nedap/archie/testutil/TestUtil.java @@ -181,4 +181,28 @@ public static FullArchetypeRepository parseCKM() { return result; } + public static FullArchetypeRepository parseRuleExamples() { + InMemoryFullArchetypeRepository result = new InMemoryFullArchetypeRepository(); + Reflections reflections = new Reflections("com/nedap/archie/rules/evaluation", new ResourcesScanner()); + List adlFiles = new ArrayList(reflections.getResources(Pattern.compile(".*\\.adls"))); + for(String file:adlFiles) { + Archetype archetype; + ANTLRParserErrors errors; + try (InputStream stream = TestUtil.class.getResourceAsStream("/" + file)) { + ADLParser parser = new ADLParser(); + parser.setLogEnabled(false); + archetype = parser.parse(stream); + errors = parser.getErrors(); + if (errors.hasNoErrors()) { + result.addArchetype(archetype); + } else { + logger.warn("error parsing archetype: {}", errors); + } + } catch (Exception e) { + logger.warn("exception parsing archetype {}", file, e); + } + } + return result; + } + } diff --git a/tools/src/test/resources/com/nedap/archie/rules/evaluation/and.adls b/tools/src/test/resources/com/nedap/archie/rules/evaluation/and.adls index 480f88649..272ffb2b6 100644 --- a/tools/src/test/resources/com/nedap/archie/rules/evaluation/and.adls +++ b/tools/src/test/resources/com/nedap/archie/rules/evaluation/and.adls @@ -1,5 +1,5 @@ archetype (adl_version=2.0.5; rm_release=1.0.2; generated) - openEHR-EHR-OBSERVATION.matches.v1.0.0 + openEHR-EHR-OBSERVATION.and.v1.0.0 language original_language = <[ISO_639-1::en]> @@ -71,12 +71,56 @@ terminology term_definitions = < ["en"] = < ["id1"] = < - text = <"Blood Pressure"> - description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> - > + text = <"Blood Pressure"> + description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> + > + ["id3"] = < + text = <"Event"> + description = <"Event"> + > + ["id4"] = < + text = <"Data"> + description = <"Data"> + > + ["id5"] = < + text = <"element 1"> + description = <"element 1"> + > + ["id6"] = < + text = <"element 2"> + description = <"element 2"> + > + ["id7"] = < + text = <"element 3"> + description = <"element 3"> + > ["at1"] = < text = <"Option 1"> description = <"Option 1"> + > + ["at2"] = < + text = <"Option 2"> + description = <"Option 2"> + > + ["at3"] = < + text = <"Option 3"> + description = <"Option 3"> + > + ["at5"] = < + text = <"Option 5"> + description = <"Option 5"> + > + ["at6"] = < + text = <"Option 6"> + description = <"Option 6"> + > + ["at7"] = < + text = <"Option 7"> + description = <"Option 7"> + > + ["ac1"] = < + text = <"Value set 1"> + description = <"Value set 1"> > > > diff --git a/tools/src/test/resources/com/nedap/archie/rules/evaluation/boolean_operand_relops.adls b/tools/src/test/resources/com/nedap/archie/rules/evaluation/boolean_operand_relops.adls index d2434d326..e9c5ce607 100644 --- a/tools/src/test/resources/com/nedap/archie/rules/evaluation/boolean_operand_relops.adls +++ b/tools/src/test/resources/com/nedap/archie/rules/evaluation/boolean_operand_relops.adls @@ -1,5 +1,5 @@ archetype (adl_version=2.0.5; rm_release=1.0.2; generated) - openEHR-EHR-OBSERVATION.boolean_relops.v1.0.0 + openEHR-EHR-OBSERVATION.boolean_operand_relops.v1.0.0 language original_language = <[ISO_639-1::en]> diff --git a/tools/src/test/resources/com/nedap/archie/rules/evaluation/calculated_path_values.adls b/tools/src/test/resources/com/nedap/archie/rules/evaluation/calculated_path_values.adls index b5b6a2fc2..42eb803e8 100644 --- a/tools/src/test/resources/com/nedap/archie/rules/evaluation/calculated_path_values.adls +++ b/tools/src/test/resources/com/nedap/archie/rules/evaluation/calculated_path_values.adls @@ -1,5 +1,5 @@ archetype (adl_version=2.0.5; rm_release=1.0.2; generated) - openEHR-EHR-OBSERVATION.multiplicity.v1.0.0 + openEHR-EHR-OBSERVATION.calculated_path_values.v1.0.0 language original_language = <[ISO_639-1::en]> @@ -79,9 +79,29 @@ terminology term_definitions = < ["en"] = < ["id1"] = < - text = <"Blood Pressure"> - description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> - > + text = <"Blood Pressure"> + description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> + > + ["id3"] = < + text = <"Event"> + description = <"Event"> + > + ["id4"] = < + text = <"Data"> + description = <"Data"> + > + ["id5"] = < + text = <"element 1"> + description = <"element 1"> + > + ["id6"] = < + text = <"element 2"> + description = <"element 2"> + > + ["id7"] = < + text = <"element 3"> + description = <"element 3"> + > > > diff --git a/tools/src/test/resources/com/nedap/archie/rules/evaluation/calculated_path_values_2.adls b/tools/src/test/resources/com/nedap/archie/rules/evaluation/calculated_path_values_2.adls index bcb2cd095..7131c9b47 100644 --- a/tools/src/test/resources/com/nedap/archie/rules/evaluation/calculated_path_values_2.adls +++ b/tools/src/test/resources/com/nedap/archie/rules/evaluation/calculated_path_values_2.adls @@ -1,5 +1,5 @@ archetype (adl_version=2.0.5; rm_release=1.0.2; generated) - openEHR-EHR-OBSERVATION.multiplicity.v1.0.0 + openEHR-EHR-OBSERVATION.calculated_path_values_2.v1.0.0 language original_language = <[ISO_639-1::en]> @@ -90,9 +90,33 @@ terminology term_definitions = < ["en"] = < ["id1"] = < - text = <"Blood Pressure"> - description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> - > + text = <"Blood Pressure"> + description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> + > + ["id3"] = < + text = <"Event"> + description = <"Event"> + > + ["id4"] = < + text = <"Data"> + description = <"Data"> + > + ["id5"] = < + text = <"element 1"> + description = <"element 1"> + > + ["id6"] = < + text = <"element 2"> + description = <"element 2"> + > + ["id7"] = < + text = <"element 3"> + description = <"element 3"> + > + ["id8"] = < + text = <"element 4"> + description = <"element 4"> + > > > diff --git a/tools/src/test/resources/com/nedap/archie/rules/evaluation/construct_only_necessary_structure.adls b/tools/src/test/resources/com/nedap/archie/rules/evaluation/construct_only_necessary_structure.adls index 840f8534c..9e249508e 100644 --- a/tools/src/test/resources/com/nedap/archie/rules/evaluation/construct_only_necessary_structure.adls +++ b/tools/src/test/resources/com/nedap/archie/rules/evaluation/construct_only_necessary_structure.adls @@ -1,5 +1,5 @@ archetype (adl_version=2.0.5; rm_release=1.0.2; generated) - openEHR-EHR-OBSERVATION.matches.v1.0.0 + openEHR-EHR-OBSERVATION.construct_only_necessary_structure.v1.0.0 language original_language = <[ISO_639-1::en]> @@ -76,6 +76,22 @@ terminology ["at3"] = < text = <"De patiënt heeft hulp van 2 of meer personen nodig"> description = <"De patiënt heeft hulp van 2 of meer personen nodig"> + > + ["id3"] = < + text = <"Event"> + description = <"Event"> + > + ["id4"] = < + text = <"Data"> + description = <"Data"> + > + ["id5"] = < + text = <"element 1"> + description = <"element 1"> + > + ["id6"] = < + text = <"element 2"> + description = <"element 2"> > > > diff --git a/tools/src/test/resources/com/nedap/archie/rules/evaluation/exists.adls b/tools/src/test/resources/com/nedap/archie/rules/evaluation/exists.adls index 557bb0c66..3980ef61c 100644 --- a/tools/src/test/resources/com/nedap/archie/rules/evaluation/exists.adls +++ b/tools/src/test/resources/com/nedap/archie/rules/evaluation/exists.adls @@ -1,5 +1,5 @@ archetype (adl_version=2.0.5; rm_release=1.0.2; generated) - openEHR-EHR-OBSERVATION.multiplicity.v1.0.0 + openEHR-EHR-OBSERVATION.exists.v1.0.0 language original_language = <[ISO_639-1::en]> @@ -79,9 +79,29 @@ terminology term_definitions = < ["en"] = < ["id1"] = < - text = <"Blood Pressure"> - description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> - > + text = <"Blood Pressure"> + description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> + > + ["id3"] = < + text = <"Event"> + description = <"Event"> + > + ["id4"] = < + text = <"Data"> + description = <"Data"> + > + ["id5"] = < + text = <"element 1"> + description = <"element 1"> + > + ["id6"] = < + text = <"element 2"> + description = <"element 2"> + > + ["id7"] = < + text = <"element 3"> + description = <"element 3"> + > > > diff --git a/tools/src/test/resources/com/nedap/archie/rules/evaluation/extended_calculated_path_values.adls b/tools/src/test/resources/com/nedap/archie/rules/evaluation/extended_calculated_path_values.adls index c0476263a..63e3b44ce 100644 --- a/tools/src/test/resources/com/nedap/archie/rules/evaluation/extended_calculated_path_values.adls +++ b/tools/src/test/resources/com/nedap/archie/rules/evaluation/extended_calculated_path_values.adls @@ -1,5 +1,5 @@ archetype (adl_version=2.0.5; rm_release=1.0.2; generated) - openEHR-EHR-OBSERVATION.multiplicity.v1.0.0 + openEHR-EHR-OBSERVATION.extended_calculated_path_values.v1.0.0 language original_language = <[ISO_639-1::en]> @@ -86,9 +86,33 @@ terminology term_definitions = < ["en"] = < ["id1"] = < - text = <"Blood Pressure"> - description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> - > + text = <"Blood Pressure"> + description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> + > + ["id3"] = < + text = <"Event"> + description = <"Event"> + > + ["id4"] = < + text = <"Data"> + description = <"Data"> + > + ["id5"] = < + text = <"element 1"> + description = <"element 1"> + > + ["id6"] = < + text = <"element 2"> + description = <"element 2"> + > + ["id7"] = < + text = <"element 3"> + description = <"element 3"> + > + ["id8"] = < + text = <"element 3"> + description = <"element 3"> + > > > diff --git a/tools/src/test/resources/com/nedap/archie/rules/evaluation/fixable_matches.adls b/tools/src/test/resources/com/nedap/archie/rules/evaluation/fixable_matches.adls index 3b4d69937..52c70cd2d 100644 --- a/tools/src/test/resources/com/nedap/archie/rules/evaluation/fixable_matches.adls +++ b/tools/src/test/resources/com/nedap/archie/rules/evaluation/fixable_matches.adls @@ -1,5 +1,5 @@ archetype (adl_version=2.0.5; rm_release=1.0.2; generated) - openEHR-EHR-OBSERVATION.matches.v1.0.0 + openEHR-EHR-OBSERVATION.fixable_matches.v1.0.0 language original_language = <[ISO_639-1::en]> @@ -79,9 +79,33 @@ terminology term_definitions = < ["en"] = < ["id1"] = < - text = <"Blood Pressure"> - description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> - > + text = <"Blood Pressure"> + description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> + > + ["id3"] = < + text = <"Event"> + description = <"Event"> + > + ["id4"] = < + text = <"Data"> + description = <"Data"> + > + ["id5"] = < + text = <"element 1"> + description = <"element 1"> + > + ["id6"] = < + text = <"element 2"> + description = <"element 2"> + > + ["id7"] = < + text = <"element 3"> + description = <"element 3"> + > + ["id8"] = < + text = <"element 3"> + description = <"element 3"> + > ["at1"] = < text = <"Option 1"> description = <"Option 1"> diff --git a/tools/src/test/resources/com/nedap/archie/rules/evaluation/for_all.adls b/tools/src/test/resources/com/nedap/archie/rules/evaluation/for_all.adls index f6233e868..fce624945 100644 --- a/tools/src/test/resources/com/nedap/archie/rules/evaluation/for_all.adls +++ b/tools/src/test/resources/com/nedap/archie/rules/evaluation/for_all.adls @@ -1,5 +1,5 @@ archetype (adl_version=2.0.5; rm_release=1.0.2; generated) - openEHR-EHR-OBSERVATION.multiplicity.v1.0.0 + openEHR-EHR-OBSERVATION.for_all.v1.0.0 language original_language = <[ISO_639-1::en]> @@ -70,6 +70,22 @@ terminology text = <"Blood Pressure"> description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> > + ["id3"] = < + text = <"Event"> + description = <"Event"> + > + ["id4"] = < + text = <"Data"> + description = <"Data"> + > + ["id5"] = < + text = <"element 1"> + description = <"element 1"> + > + ["id6"] = < + text = <"element 1"> + description = <"element 1"> + > > > diff --git a/tools/src/test/resources/com/nedap/archie/rules/evaluation/for_all_calculated_path_values.adls b/tools/src/test/resources/com/nedap/archie/rules/evaluation/for_all_calculated_path_values.adls index 5723b7b45..0a274fe79 100644 --- a/tools/src/test/resources/com/nedap/archie/rules/evaluation/for_all_calculated_path_values.adls +++ b/tools/src/test/resources/com/nedap/archie/rules/evaluation/for_all_calculated_path_values.adls @@ -1,5 +1,5 @@ archetype (adl_version=2.0.5; rm_release=1.0.2; generated) - openEHR-EHR-OBSERVATION.multiplicity.v1.0.0 + openEHR-EHR-OBSERVATION.for_all_calculated_paths_and_values.v1.0.0 language original_language = <[ISO_639-1::en]> @@ -77,9 +77,29 @@ terminology term_definitions = < ["en"] = < ["id1"] = < - text = <"Blood Pressure"> - description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> - > + text = <"Blood Pressure"> + description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> + > + ["id3"] = < + text = <"Event"> + description = <"Event"> + > + ["id4"] = < + text = <"Data"> + description = <"Data"> + > + ["id5"] = < + text = <"element 1"> + description = <"element 1"> + > + ["id6"] = < + text = <"element 2"> + description = <"element 2"> + > + ["id7"] = < + text = <"element 3"> + description = <"element 3"> + > > > diff --git a/tools/src/test/resources/com/nedap/archie/rules/evaluation/functions.adls b/tools/src/test/resources/com/nedap/archie/rules/evaluation/functions.adls index ff9f8fe5f..6edaa20f8 100644 --- a/tools/src/test/resources/com/nedap/archie/rules/evaluation/functions.adls +++ b/tools/src/test/resources/com/nedap/archie/rules/evaluation/functions.adls @@ -1,5 +1,5 @@ archetype (adl_version=2.0.5; rm_release=1.0.2; generated) - openEHR-EHR-OBSERVATION.multiplicity.v1.0.0 + openEHR-EHR-OBSERVATION.functions.v1.0.0 language original_language = <[ISO_639-1::en]> @@ -88,9 +88,29 @@ terminology term_definitions = < ["en"] = < ["id1"] = < - text = <"Blood Pressure"> - description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> - > + text = <"Blood Pressure"> + description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> + > + ["id3"] = < + text = <"Event"> + description = <"Event"> + > + ["id4"] = < + text = <"Data"> + description = <"Data"> + > + ["id5"] = < + text = <"element 1"> + description = <"element 1"> + > + ["id6"] = < + text = <"element 2"> + description = <"element 2"> + > + ["id7"] = < + text = <"element 3"> + description = <"element 3"> + > > > diff --git a/tools/src/test/resources/com/nedap/archie/rules/evaluation/implies.adls b/tools/src/test/resources/com/nedap/archie/rules/evaluation/implies.adls index f746fb1cc..f70844586 100644 --- a/tools/src/test/resources/com/nedap/archie/rules/evaluation/implies.adls +++ b/tools/src/test/resources/com/nedap/archie/rules/evaluation/implies.adls @@ -1,5 +1,5 @@ archetype (adl_version=2.0.5; rm_release=1.0.2; generated) - openEHR-EHR-OBSERVATION.multiplicity.v1.0.0 + openEHR-EHR-OBSERVATION.implies.v1.0.0 language original_language = <[ISO_639-1::en]> @@ -74,9 +74,29 @@ terminology term_definitions = < ["en"] = < ["id1"] = < - text = <"Blood Pressure"> - description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> - > + text = <"Blood Pressure"> + description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> + > + ["id3"] = < + text = <"Event"> + description = <"Event"> + > + ["id4"] = < + text = <"Data"> + description = <"Data"> + > + ["id5"] = < + text = <"element 1"> + description = <"element 1"> + > + ["id6"] = < + text = <"element 2"> + description = <"element 2"> + > + ["id7"] = < + text = <"element 3"> + description = <"element 3"> + > > > diff --git a/tools/src/test/resources/com/nedap/archie/rules/evaluation/matches.adls b/tools/src/test/resources/com/nedap/archie/rules/evaluation/matches.adls index 3942d9d2a..ea0934516 100644 --- a/tools/src/test/resources/com/nedap/archie/rules/evaluation/matches.adls +++ b/tools/src/test/resources/com/nedap/archie/rules/evaluation/matches.adls @@ -33,7 +33,6 @@ definition ELEMENT[id5] matches { -- Body Mass Index value matches { DV_QUANTITY[id13] matches { - property matches {[at10]} [magnitude, units, precision] matches { [{|0.0..<1000.0|}, {"kg/m2"}, {1}], [{|0.0..<1000.0|}, {"lb/in2"}, {1}] @@ -57,9 +56,21 @@ terminology term_definitions = < ["en"] = < ["id1"] = < - text = <"Blood Pressure"> - description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> - > + text = <"Blood Pressure"> + description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> + > + ["id3"] = < + text = <"Event"> + description = <"Event"> + > + ["id4"] = < + text = <"Data"> + description = <"Data"> + > + ["id5"] = < + text = <"element 1"> + description = <"element 1"> + > > > diff --git a/tools/src/test/resources/com/nedap/archie/rules/evaluation/modelreferences.adls b/tools/src/test/resources/com/nedap/archie/rules/evaluation/modelreferences.adls index 3648f2544..99e97d14b 100644 --- a/tools/src/test/resources/com/nedap/archie/rules/evaluation/modelreferences.adls +++ b/tools/src/test/resources/com/nedap/archie/rules/evaluation/modelreferences.adls @@ -33,7 +33,6 @@ definition ELEMENT[id5] matches { -- Body Mass Index value matches { DV_QUANTITY[id13] matches { - property matches {[at10]} [magnitude, units, precision] matches { [{|0.0..<1000.0|}, {"kg/m2"}, {1}], [{|0.0..<1000.0|}, {"lb/in2"}, {1}] @@ -64,6 +63,18 @@ terminology text = <"Blood Pressure"> description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> > + ["id3"] = < + text = <"Event"> + description = <"Event"> + > + ["id4"] = < + text = <"Data"> + description = <"Data"> + > + ["id5"] = < + text = <"Data"> + description = <"Data"> + > > > diff --git a/tools/src/test/resources/com/nedap/archie/rules/evaluation/multiplicity.adls b/tools/src/test/resources/com/nedap/archie/rules/evaluation/multiplicity.adls index 6b43e1e0e..507a4270e 100644 --- a/tools/src/test/resources/com/nedap/archie/rules/evaluation/multiplicity.adls +++ b/tools/src/test/resources/com/nedap/archie/rules/evaluation/multiplicity.adls @@ -71,9 +71,25 @@ terminology term_definitions = < ["en"] = < ["id1"] = < - text = <"Blood Pressure"> - description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> - > + text = <"Blood Pressure"> + description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> + > + ["id3"] = < + text = <"Event"> + description = <"Event"> + > + ["id4"] = < + text = <"Data"> + description = <"Data"> + > + ["id5"] = < + text = <"element 1"> + description = <"element 1"> + > + ["id6"] = < + text = <"element 2"> + description = <"element 2"> + > > > diff --git a/tools/src/test/resources/com/nedap/archie/rules/evaluation/not_exists.adls b/tools/src/test/resources/com/nedap/archie/rules/evaluation/not_exists.adls index 92666a092..f8c0a3f9a 100644 --- a/tools/src/test/resources/com/nedap/archie/rules/evaluation/not_exists.adls +++ b/tools/src/test/resources/com/nedap/archie/rules/evaluation/not_exists.adls @@ -1,5 +1,5 @@ archetype (adl_version=2.0.5; rm_release=1.0.2; generated) - openEHR-EHR-OBSERVATION.multiplicity.v1.0.0 + openEHR-EHR-OBSERVATION.not_exists.v1.0.0 language original_language = <[ISO_639-1::en]> @@ -79,9 +79,29 @@ terminology term_definitions = < ["en"] = < ["id1"] = < - text = <"Blood Pressure"> - description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> - > + text = <"Blood Pressure"> + description = <"The local measurement of arterial blood pressure which is a surrogate for arterial. pressure in the systemic circulation. Most commonly, use of the term 'blood pressure' refers to measurement of brachial artery pressure in the upper arm."> + > + ["id3"] = < + text = <"Event"> + description = <"Event"> + > + ["id4"] = < + text = <"Data"> + description = <"Data"> + > + ["id5"] = < + text = <"element 1"> + description = <"element 1"> + > + ["id6"] = < + text = <"element 2"> + description = <"element 2"> + > + ["id7"] = < + text = <"element 3"> + description = <"element 3"> + > > > diff --git a/tools/src/test/resources/com/nedap/archie/rules/evaluation/string_literals.adls b/tools/src/test/resources/com/nedap/archie/rules/evaluation/string_literals.adls index 5b79911de..3d93c4f52 100644 --- a/tools/src/test/resources/com/nedap/archie/rules/evaluation/string_literals.adls +++ b/tools/src/test/resources/com/nedap/archie/rules/evaluation/string_literals.adls @@ -1,5 +1,5 @@ archetype (adl_version=2.0.5; rm_release=1.0.2; generated) - openEHR-EHR-OBSERVATION.boolean_relops.v1.0.0 + openEHR-EHR-OBSERVATION.string_literals.v1.0.0 language original_language = <[ISO_639-1::en]>