From 5a465451ee5eb3fd9d6a212bd907bc51380a4eaa Mon Sep 17 00:00:00 2001 From: AAAlinaaa Date: Fri, 22 Nov 2024 11:36:48 +0100 Subject: [PATCH 1/2] SO-6148: Only apply MRCM rules to Sub/Equivalent Class axioms --- .../scripts/rule_mrcm_constraint.groovy | 54 +++++++---- .../scripts/rule_mrcm_constraint_type.groovy | 38 ++++++-- .../snomed/GenericValidationRuleTest.java | 96 ++++++++++--------- 3 files changed, 113 insertions(+), 75 deletions(-) diff --git a/snomed/com.b2international.snowowl.validation.snomed/src/main/resources/scripts/rule_mrcm_constraint.groovy b/snomed/com.b2international.snowowl.validation.snomed/src/main/resources/scripts/rule_mrcm_constraint.groovy index b1b3451c9c8..77a6dcbf6e9 100644 --- a/snomed/com.b2international.snowowl.validation.snomed/src/main/resources/scripts/rule_mrcm_constraint.groovy +++ b/snomed/com.b2international.snowowl.validation.snomed/src/main/resources/scripts/rule_mrcm_constraint.groovy @@ -13,6 +13,7 @@ import com.b2international.index.query.Expressions.ExpressionBuilder import com.b2international.index.revision.RevisionSearcher import com.b2international.snowowl.core.ComponentIdentifier import com.b2international.snowowl.core.date.EffectiveTimes +import com.b2international.snowowl.snomed.common.SnomedRf2Headers import com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts import com.b2international.snowowl.snomed.core.domain.constraint.SnomedCardinalityPredicate @@ -38,6 +39,9 @@ Set issues = Sets.newHashSet() String oneMandatoryIsAPerConceptRuleId = "b93819e3-2679-46f6-a35d-3a749842d83e" +Set unsupportedAxiomMarkers = [ "TransitiveObjectProperty", "ReflexiveObjectProperty", + "SubDataPropertyOf", "SubObjectPropertyOf", "ObjectPropertyChain", "SubAnnotationPropertyOf"]; + def getPredicate = { SnomedConstraint constraint -> return constraint.getPredicate() instanceof SnomedCardinalityPredicate ? ((SnomedCardinalityPredicate) constraint.getPredicate()).getPredicate() @@ -154,20 +158,26 @@ if (params.isUnpublishedOnly) { .execute(ctx); for (SnomedReferenceSetMember owlAxiomMember : owlAxiomMembers) { - def applicableRulePredicates = getApplicableRules(owlAxiomMember.referencedComponent.id) - .stream() - .map({getPredicate(it)}) - .filter({ SnomedRelationshipPredicate predicate -> - def charType = predicate.getCharacteristicTypeId() - return Concepts.STATED_RELATIONSHIP == charType || Strings.isNullOrEmpty(charType) - }).collect(Collectors.toSet()) - - for (SnomedRelationshipPredicate predicate : applicableRulePredicates) { - for (SnomedOWLRelationshipDocument relationship : getOWLRelationships(owlAxiomMember)) { - if (!relationship.hasValue() && - getApplicableConcepts(predicate.getAttributeExpression()).contains(relationship.getTypeId()) && - !getApplicableConcepts(predicate.getRangeExpression()).contains(relationship.getDestinationId())) { - issues.add(ComponentIdentifier.of(SnomedTerminologyComponentConstants.REFSET_MEMBER_NUMBER, owlAxiomMember.getId())) + + final String owlExpression = owlAxiomMember.getProperties().get(SnomedRf2Headers.FIELD_OWL_EXPRESSION); + def shouldValidate = unsupportedAxiomMarkers.stream().noneMatch({ marker -> owlExpression.contains(marker)}); + + if (shouldValidate) { + def applicableRulePredicates = getApplicableRules(owlAxiomMember.referencedComponent.id) + .stream() + .map({getPredicate(it)}) + .filter({ SnomedRelationshipPredicate predicate -> + def charType = predicate.getCharacteristicTypeId() + return Concepts.STATED_RELATIONSHIP == charType || Strings.isNullOrEmpty(charType) + }).collect(Collectors.toSet()) + + for (SnomedRelationshipPredicate predicate : applicableRulePredicates) { + for (SnomedOWLRelationshipDocument relationship : getOWLRelationships(owlAxiomMember)) { + if (!relationship.hasValue() && + getApplicableConcepts(predicate.getAttributeExpression()).contains(relationship.getTypeId()) && + !getApplicableConcepts(predicate.getRangeExpression()).contains(relationship.getDestinationId())) { + issues.add(ComponentIdentifier.of(SnomedTerminologyComponentConstants.REFSET_MEMBER_NUMBER, owlAxiomMember.getId())) + } } } } @@ -241,19 +251,23 @@ if (params.isUnpublishedOnly) { .filter(SnomedRefSetMemberIndexEntry.Expressions.active()) .filter(SnomedRefSetMemberIndexEntry.Expressions.referencedComponentIds(domain)) .should(nestedMatch(SnomedRefSetMemberIndexEntry.Fields.CLASS_AXIOM_RELATIONSHIP, nestedBuilder.build())) - .should(nestedMatch(SnomedRefSetMemberIndexEntry.Fields.GCI_AXIOM_RELATIONSHIP, nestedBuilder.build())) .setMinimumNumberShouldMatch(1) - final Query query = Query.select(String.class) + final Query query = Query.select(String[].class) .from(SnomedRefSetMemberIndexEntry.class) - .fields(SnomedRelationshipIndexEntry.Fields.ID) + .fields(SnomedRelationshipIndexEntry.Fields.ID, SnomedRf2Headers.FIELD_OWL_EXPRESSION) .where(expressionBuilder.build()) .limit(10_000) .build() - + searcher.scroll(query).forEach({ hits -> - hits.forEach({ id -> - issues.add(ComponentIdentifier.of(SnomedTerminologyComponentConstants.REFSET_MEMBER_NUMBER, id)) + hits.forEach({ hit -> + def id = hit[0] + def owlExpression = hit[1] + def shouldValidate = unsupportedAxiomMarkers.stream().noneMatch({ marker -> owlExpression.contains(marker)}); + if (shouldValidate) { + issues.add(ComponentIdentifier.of(SnomedTerminologyComponentConstants.REFSET_MEMBER_NUMBER, id)) + } }) }) } diff --git a/snomed/com.b2international.snowowl.validation.snomed/src/main/resources/scripts/rule_mrcm_constraint_type.groovy b/snomed/com.b2international.snowowl.validation.snomed/src/main/resources/scripts/rule_mrcm_constraint_type.groovy index 492c0740e2a..c35107044a7 100644 --- a/snomed/com.b2international.snowowl.validation.snomed/src/main/resources/scripts/rule_mrcm_constraint_type.groovy +++ b/snomed/com.b2international.snowowl.validation.snomed/src/main/resources/scripts/rule_mrcm_constraint_type.groovy @@ -10,6 +10,7 @@ import com.b2international.index.query.Expressions.ExpressionBuilder import com.b2international.index.revision.RevisionSearcher import com.b2international.snowowl.core.ComponentIdentifier import com.b2international.snowowl.core.date.EffectiveTimes +import com.b2international.snowowl.snomed.common.SnomedRf2Headers import com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts import com.b2international.snowowl.snomed.core.domain.SnomedRelationship @@ -37,6 +38,9 @@ import com.google.common.collect.Sets RevisionSearcher searcher = ctx.service(RevisionSearcher.class) Set issues = Sets.newHashSet() +Set unsupportedAxiomMarkers = [ "TransitiveObjectProperty", "ReflexiveObjectProperty", + "SubDataPropertyOf", "SubObjectPropertyOf", "ObjectPropertyChain", "SubAnnotationPropertyOf"]; + def getInnerPredicate = { SnomedPredicate predicate -> if (predicate instanceof SnomedCardinalityPredicate) { return predicate.getPredicate() @@ -187,11 +191,17 @@ if (params.isUnpublishedOnly) { .execute(ctx) for (SnomedReferenceSetMember owlAxiomMember : owlAxiomMembers) { - def sourceId = owlAxiomMember.getReferencedComponent().getId() - for (SnomedOWLRelationshipDocument relationship : getOWLRelationships(owlAxiomMember)) { - def typeId = relationship.getTypeId() - if (!typeId.equals(Concepts.IS_A) && getApplicableRules(sourceId, typeId, true).isEmpty()) { - issues.add(ComponentIdentifier.of(SnomedTerminologyComponentConstants.REFSET_MEMBER_NUMBER, owlAxiomMember.getId())) + + String owlExpression = owlAxiomMember.getProperties().get(SnomedRf2Headers.FIELD_OWL_EXPRESSION) + boolean shouldValidate = unsupportedAxiomMarkers.stream().noneMatch({ marker -> owlExpression.contains(marker)}); + + if (shouldValidate) { + def sourceId = owlAxiomMember.getReferencedComponent().getId() + for (SnomedOWLRelationshipDocument relationship : getOWLRelationships(owlAxiomMember)) { + def typeId = relationship.getTypeId() + if (!typeId.equals(Concepts.IS_A) && getApplicableRules(sourceId, typeId, true).isEmpty()) { + issues.add(ComponentIdentifier.of(SnomedTerminologyComponentConstants.REFSET_MEMBER_NUMBER, owlAxiomMember.getId())) + } } } } @@ -296,22 +306,30 @@ if (params.isUnpublishedOnly) { allowedTypeIdsForOwlRelationships.add(Concepts.IS_A) + final ExpressionBuilder nestedBuilder = Expressions.builder() + .mustNot(SnomedRelationshipIndexEntry.Expressions.typeIds(allowedTypeIdsForOwlRelationships)) + final ExpressionBuilder owlMemberExpressionBuilder = Expressions.builder() .filter(SnomedRefSetMemberIndexEntry.Expressions.active()) .filter(SnomedRefSetMemberIndexEntry.Expressions.refSetTypes([SnomedRefSetType.OWL_AXIOM])) - .mustNot(SnomedRefSetMemberIndexEntry.Expressions.owlExpressionType(allowedTypeIdsForOwlRelationships)) + .should(Expressions.nestedMatch(SnomedRefSetMemberIndexEntry.Fields.CLASS_AXIOM_RELATIONSHIP, nestedBuilder.build())) - final Query owlMemberQuery = Query.select(String.class) + final Query owlMemberQuery = Query.select(String[].class) .from(SnomedRefSetMemberIndexEntry.class) - .fields(SnomedRefSetMemberIndexEntry.Fields.ID) + .fields(SnomedRefSetMemberIndexEntry.Fields.ID, SnomedRf2Headers.FIELD_OWL_EXPRESSION) .where(owlMemberExpressionBuilder.build()) .limit(10_000) .scroll("2m") .build() searcher.scroll(owlMemberQuery).forEach({ hits -> - hits.forEach({ id -> - issues.add(ComponentIdentifier.of(SnomedTerminologyComponentConstants.REFSET_MEMBER_NUMBER, id)) + hits.forEach({ hit -> + def id = hit[0] + def owlExpression = hit[1] + def shouldValidate = unsupportedAxiomMarkers.stream().noneMatch({ marker -> owlExpression.contains(marker)}); + if (shouldValidate) { + issues.add(ComponentIdentifier.of(SnomedTerminologyComponentConstants.REFSET_MEMBER_NUMBER, id)) + } }) }) } diff --git a/snomed/com.b2international.snowowl.validation.snomed/src/test/java/com/b2international/snowowl/validation/snomed/GenericValidationRuleTest.java b/snomed/com.b2international.snowowl.validation.snomed/src/test/java/com/b2international/snowowl/validation/snomed/GenericValidationRuleTest.java index ca2c1308c92..11618fbcfe0 100644 --- a/snomed/com.b2international.snowowl.validation.snomed/src/test/java/com/b2international/snowowl/validation/snomed/GenericValidationRuleTest.java +++ b/snomed/com.b2international.snowowl.validation.snomed/src/test/java/com/b2international/snowowl/validation/snomed/GenericValidationRuleTest.java @@ -62,7 +62,7 @@ @RunWith(Parameterized.class) public class GenericValidationRuleTest extends BaseGenericValidationRuleTest { - @Test + //@Test public void affectedComponentURI() throws Exception { final String ruleId = "45a"; indexRule(ruleId); @@ -81,7 +81,7 @@ public void affectedComponentURI() throws Exception { } - @Test + //@Test public void rule34() throws Exception { // Relationships must be unique within a relationship group final String ruleId = "34"; @@ -117,7 +117,7 @@ public void rule34() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.RELATIONSHIP_NUMBER, concreteValue2.getId())); } - @Test + //@Test public void rule38a() throws Exception { // Active concepts should have at least one active inferred parent. final String ruleId = "38a"; @@ -141,7 +141,7 @@ public void rule38a() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.CONCEPT_NUMBER, inactiveConceptWithoutInferredParent.getId()))); } - @Test + //@Test public void rule38b() throws Exception { // Active concepts should have at least one active stated parent final String ruleId = "38b"; @@ -165,7 +165,7 @@ public void rule38b() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.CONCEPT_NUMBER, inactiveConceptWithoutStatedParent.getId()))); } - @Test + //@Test public void rule45a() throws Exception { final String ruleId = "45a"; indexRule(ruleId); @@ -181,7 +181,7 @@ public void rule45a() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(SnomedTerminologyComponentConstants.RELATIONSHIP_NUMBER, relationship.getId())); } - @Test + //@Test public void rule45b() throws Exception { final String ruleId = "45b"; indexRule(ruleId); @@ -198,7 +198,7 @@ public void rule45b() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(SnomedTerminologyComponentConstants.RELATIONSHIP_NUMBER, relationship.getId())); } - @Test + //@Test public void rule45c() throws Exception { final String ruleId = "45c"; indexRule(ruleId); @@ -228,7 +228,7 @@ public void rule45c() throws Exception { ComponentIdentifier.of(RELATIONSHIP_NUMBER, relationshipInGroup2.getId()))); } - @Test + //@Test public void rule54() throws Exception { final String ruleId = "54"; indexRule(ruleId); @@ -250,7 +250,7 @@ public void rule54() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, description.getId())); } - @Test + //@Test public void rule55() throws Exception { final String ruleId = "55"; indexRule(ruleId); @@ -300,7 +300,7 @@ public void rule55() throws Exception { ); } - @Test + //@Test public void rule74() throws Exception { final String ruleId = "74"; indexRule(ruleId); @@ -328,7 +328,7 @@ public void rule74() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, description1.getId())); } - @Test + //@Test public void rule75() throws Exception { // Message: Relationships in group 0 should not be duplicated in any other group. final String ruleId = "75"; @@ -360,7 +360,7 @@ public void rule75() throws Exception { ); } - @Test + //@Test public void rule80() throws Exception { final String ruleId = "80"; indexRule(ruleId); @@ -394,7 +394,7 @@ public void rule80() throws Exception { ComponentIdentifier.of(CONCEPT_NUMBER, validConcept2.getId()))); } - @Test + //@Test public void rule84() throws Exception { final String ruleId = "84"; indexRule(ruleId); @@ -424,7 +424,7 @@ public void rule84() throws Exception { ); } - @Test + //@Test public void rule83() throws Exception { final String ruleId = "83"; indexRule(ruleId); @@ -448,7 +448,7 @@ public void rule83() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, description2.getId())); } - @Test + //@Test public void rule110() throws Exception { // Subsets should not contain retired concepts final String ruleId = "110"; @@ -494,7 +494,7 @@ public void rule110() throws Exception { ); } - @Test + //@Test public void rule115a() throws Exception { // Reference Sets should not contain retired concepts final String ruleId = "115a"; @@ -523,7 +523,7 @@ public void rule115a() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(CONCEPT_NUMBER, badConcept.getId())); } - @Test + //@Test public void rule115b() throws Exception { // Reference Sets should not contain retired descriptions final String ruleId = "115b"; @@ -552,7 +552,7 @@ public void rule115b() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, badDesc.getId())); } - @Test + //@Test public void rule266() throws Exception { final String ruleId = "266"; indexRule(ruleId); @@ -595,7 +595,7 @@ public void rule266() throws Exception { ); } - @Test + //@Test public void rule326() throws Exception { final String ruleId = "326"; indexRule(ruleId); @@ -621,7 +621,7 @@ public void rule326() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, description3.getId())); } - @Test + //@Test public void rule327() throws Exception { final String ruleId = "327"; indexRule(ruleId); @@ -649,7 +649,7 @@ public void rule327() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, description3.getId())); } - @Test + //@Test public void rule328() throws Exception { final String ruleId = "328"; indexRule(ruleId); @@ -676,7 +676,7 @@ public void rule328() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, description3.getId())); } - @Test + //@Test public void rule482() throws Exception { // Brackets in active terms should balance and be sequentially valid final String ruleId = "482"; @@ -707,22 +707,22 @@ public void rule482() throws Exception { ); } - @Test + //@Test public void rule532a_pharmacy_1() throws Exception { rule532("532a", Concepts.FULLY_SPECIFIED_NAME, Concepts.MODULE_B2I_EXTENSION); } - @Test + //@Test public void rule532a_pharmacy_2() throws Exception { rule532("532a", Concepts.FULLY_SPECIFIED_NAME, Concepts.MODULE_B2I_EXTENSION); } - @Test + //@Test public void rule532b_pharmacy_1() throws Exception { rule532("532b", Concepts.SYNONYM, Concepts.MODULE_B2I_EXTENSION); } - @Test + //@Test public void rule532b_pharmacy_2() throws Exception { rule532("532b", Concepts.SYNONYM, Concepts.MODULE_B2I_EXTENSION); } @@ -804,7 +804,7 @@ private void rule532(String ruleId, String descriptionType, String moduleId) thr ); } - @Test + //@Test public void rule663() throws Exception { final String ruleId = "663"; indexRule(ruleId); @@ -836,7 +836,7 @@ public void rule663() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.RELATIONSHIP_NUMBER, invalidTypeRelationship.getId())); } - @Test + //@Test public void rule664() throws Exception { final String ruleId = "664"; indexRule(ruleId); @@ -866,7 +866,7 @@ public void rule664() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, d2.getId())); } - @Test + //@Test public void rule665() throws Exception { final String ruleId = "665"; indexRule(ruleId); @@ -914,7 +914,7 @@ public void rule665() throws Exception { } - @Test + //@Test public void rule666() throws Exception { final String ruleId = "666"; indexRule(ruleId); @@ -982,7 +982,7 @@ public void rule666() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.CONCEPT_NUMBER, c2.getId())); } - @Test + //@Test public void rule667() throws Exception { final String ruleId = "667"; indexRule(ruleId); @@ -1035,7 +1035,7 @@ public void rule667() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, newIncorrectDescriptionTypedDesc.getId())); } - @Test + //@Test public void rule668() throws Exception { final String ruleId = "668"; indexRule(ruleId); @@ -1094,7 +1094,7 @@ public void rule668() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.REFSET_MEMBER_NUMBER, invalidTypeAxiomMember.getId())); } - @Test + //@Test public void rule669() throws Exception { final String ruleId = "669"; indexRule(ruleId); @@ -1131,7 +1131,7 @@ public void rule669() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.CONCEPT_NUMBER, Concepts.ATTRIBUTE)); } - @Test + //@Test public void rule670() throws Exception { final String ruleId = "670"; indexRule(ruleId); @@ -1148,7 +1148,7 @@ public void rule670() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.CONCEPT_NUMBER, Concepts.IS_A)); } - @Test + //@Test public void rule671() throws Exception { final String ruleId = "671"; indexRule(ruleId); @@ -1252,7 +1252,13 @@ public void rule_mrcm_constraint() throws Exception { .referenceSetType(SnomedRefSetType.OWL_AXIOM) .build(); - indexRevision(MAIN, relationship1, relationship2, relationship3, axiomMember1, axiomMember2, axiomMember3); + SnomedRefSetMemberIndexEntry axiomMember4 = member(Concepts.CONCEPT_MODEL_ATTRIBUTE, Concepts.REFSET_OWL_AXIOM) + .classAxiomRelationships(Lists.newArrayList(SnomedOWLRelationshipDocument.create(Concepts.FINDING_SITE, Concepts.CONCEPT_MODEL_ATTRIBUTE, 0))) + .owlExpression(String.format("TransitiveObjectProperty(:%s)", Concepts.CONCEPT_MODEL_ATTRIBUTE)) + .referenceSetType(SnomedRefSetType.OWL_AXIOM) + .build(); + + indexRevision(MAIN, relationship1, relationship2, relationship3, axiomMember1, axiomMember2, axiomMember3, axiomMember4); ValidationIssues issues = validate(ruleId); assertAffectedComponents(issues, @@ -1324,24 +1330,24 @@ public void rule_mrcm_constraint_type() throws Exception { .owlExpression(String.format("ObjectSomeValuesFrom(:%s :%s)", Concepts.PHYSICAL_OBJECT, Concepts.CONCEPT_MODEL_ATTRIBUTE)) .build(); + SnomedRefSetMemberIndexEntry axiomMember4 = member(Concepts.ROOT_CONCEPT, Concepts.REFSET_OWL_AXIOM) + .referenceSetType(SnomedRefSetType.OWL_AXIOM) + .classAxiomRelationships(Lists.newArrayList(SnomedOWLRelationshipDocument.create(Concepts.PHYSICAL_OBJECT, Concepts.CONCEPT_MODEL_ATTRIBUTE, 0))) + .owlExpression(String.format("ReflexiveObjectProperty(:%s)", Concepts.ROOT_CONCEPT)) + .build(); + indexRevision(MAIN, attributeConstraint1, attributeConstraint2, attributeConstraint3, relationship1, relationship2, relationship3, relationship4, relationship5, relationship6, relationship7, relationship8, - axiomMember1, axiomMember2, axiomMember3); + axiomMember1, axiomMember2, axiomMember3, axiomMember4); ValidationIssues issues = validate(ruleId); - Assertions.assertThat(issues.stream().map(ValidationIssue::getAffectedComponent).collect(Collectors.toSet())) - .contains( + assertAffectedComponents(issues, ComponentIdentifier.of(SnomedTerminologyComponentConstants.REFSET_MEMBER_NUMBER, axiomMember2.getId()), ComponentIdentifier.of(SnomedTerminologyComponentConstants.REFSET_MEMBER_NUMBER, axiomMember3.getId()), ComponentIdentifier.of(SnomedTerminologyComponentConstants.RELATIONSHIP_NUMBER, relationship3.getId()), ComponentIdentifier.of(SnomedTerminologyComponentConstants.RELATIONSHIP_NUMBER, relationship4.getId()), ComponentIdentifier.of(SnomedTerminologyComponentConstants.RELATIONSHIP_NUMBER, relationship7.getId()), - ComponentIdentifier.of(SnomedTerminologyComponentConstants.RELATIONSHIP_NUMBER, relationship8.getId())) - .doesNotContain(ComponentIdentifier.of(SnomedTerminologyComponentConstants.REFSET_MEMBER_NUMBER, axiomMember1.getId()), - ComponentIdentifier.of(SnomedTerminologyComponentConstants.RELATIONSHIP_NUMBER, relationship1.getId()), - ComponentIdentifier.of(SnomedTerminologyComponentConstants.RELATIONSHIP_NUMBER, relationship2.getId()), - ComponentIdentifier.of(SnomedTerminologyComponentConstants.RELATIONSHIP_NUMBER, relationship5.getId()), - ComponentIdentifier.of(SnomedTerminologyComponentConstants.RELATIONSHIP_NUMBER, relationship6.getId())); + ComponentIdentifier.of(SnomedTerminologyComponentConstants.RELATIONSHIP_NUMBER, relationship8.getId())); } private SnomedRefSetMemberIndexEntry createLanguageRefsetMember(SnomedDescriptionIndexEntry description) { From 9daee35c2e9fa4ca001d38ba17e6d5c7c84caa70 Mon Sep 17 00:00:00 2001 From: AAAlinaaa Date: Fri, 22 Nov 2024 11:43:42 +0100 Subject: [PATCH 2/2] SO-6148: Restore tests --- .../snomed/GenericValidationRuleTest.java | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/snomed/com.b2international.snowowl.validation.snomed/src/test/java/com/b2international/snowowl/validation/snomed/GenericValidationRuleTest.java b/snomed/com.b2international.snowowl.validation.snomed/src/test/java/com/b2international/snowowl/validation/snomed/GenericValidationRuleTest.java index 11618fbcfe0..23ee86c4291 100644 --- a/snomed/com.b2international.snowowl.validation.snomed/src/test/java/com/b2international/snowowl/validation/snomed/GenericValidationRuleTest.java +++ b/snomed/com.b2international.snowowl.validation.snomed/src/test/java/com/b2international/snowowl/validation/snomed/GenericValidationRuleTest.java @@ -62,7 +62,7 @@ @RunWith(Parameterized.class) public class GenericValidationRuleTest extends BaseGenericValidationRuleTest { - //@Test + @Test public void affectedComponentURI() throws Exception { final String ruleId = "45a"; indexRule(ruleId); @@ -81,7 +81,7 @@ public void affectedComponentURI() throws Exception { } - //@Test + @Test public void rule34() throws Exception { // Relationships must be unique within a relationship group final String ruleId = "34"; @@ -117,7 +117,7 @@ public void rule34() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.RELATIONSHIP_NUMBER, concreteValue2.getId())); } - //@Test + @Test public void rule38a() throws Exception { // Active concepts should have at least one active inferred parent. final String ruleId = "38a"; @@ -141,7 +141,7 @@ public void rule38a() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.CONCEPT_NUMBER, inactiveConceptWithoutInferredParent.getId()))); } - //@Test + @Test public void rule38b() throws Exception { // Active concepts should have at least one active stated parent final String ruleId = "38b"; @@ -165,7 +165,7 @@ public void rule38b() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.CONCEPT_NUMBER, inactiveConceptWithoutStatedParent.getId()))); } - //@Test + @Test public void rule45a() throws Exception { final String ruleId = "45a"; indexRule(ruleId); @@ -181,7 +181,7 @@ public void rule45a() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(SnomedTerminologyComponentConstants.RELATIONSHIP_NUMBER, relationship.getId())); } - //@Test + @Test public void rule45b() throws Exception { final String ruleId = "45b"; indexRule(ruleId); @@ -198,7 +198,7 @@ public void rule45b() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(SnomedTerminologyComponentConstants.RELATIONSHIP_NUMBER, relationship.getId())); } - //@Test + @Test public void rule45c() throws Exception { final String ruleId = "45c"; indexRule(ruleId); @@ -228,7 +228,7 @@ public void rule45c() throws Exception { ComponentIdentifier.of(RELATIONSHIP_NUMBER, relationshipInGroup2.getId()))); } - //@Test + @Test public void rule54() throws Exception { final String ruleId = "54"; indexRule(ruleId); @@ -250,7 +250,7 @@ public void rule54() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, description.getId())); } - //@Test + @Test public void rule55() throws Exception { final String ruleId = "55"; indexRule(ruleId); @@ -300,7 +300,7 @@ public void rule55() throws Exception { ); } - //@Test + @Test public void rule74() throws Exception { final String ruleId = "74"; indexRule(ruleId); @@ -328,7 +328,7 @@ public void rule74() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, description1.getId())); } - //@Test + @Test public void rule75() throws Exception { // Message: Relationships in group 0 should not be duplicated in any other group. final String ruleId = "75"; @@ -360,7 +360,7 @@ public void rule75() throws Exception { ); } - //@Test + @Test public void rule80() throws Exception { final String ruleId = "80"; indexRule(ruleId); @@ -394,7 +394,7 @@ public void rule80() throws Exception { ComponentIdentifier.of(CONCEPT_NUMBER, validConcept2.getId()))); } - //@Test + @Test public void rule84() throws Exception { final String ruleId = "84"; indexRule(ruleId); @@ -424,7 +424,7 @@ public void rule84() throws Exception { ); } - //@Test + @Test public void rule83() throws Exception { final String ruleId = "83"; indexRule(ruleId); @@ -448,7 +448,7 @@ public void rule83() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, description2.getId())); } - //@Test + @Test public void rule110() throws Exception { // Subsets should not contain retired concepts final String ruleId = "110"; @@ -494,7 +494,7 @@ public void rule110() throws Exception { ); } - //@Test + @Test public void rule115a() throws Exception { // Reference Sets should not contain retired concepts final String ruleId = "115a"; @@ -523,7 +523,7 @@ public void rule115a() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(CONCEPT_NUMBER, badConcept.getId())); } - //@Test + @Test public void rule115b() throws Exception { // Reference Sets should not contain retired descriptions final String ruleId = "115b"; @@ -552,7 +552,7 @@ public void rule115b() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, badDesc.getId())); } - //@Test + @Test public void rule266() throws Exception { final String ruleId = "266"; indexRule(ruleId); @@ -595,7 +595,7 @@ public void rule266() throws Exception { ); } - //@Test + @Test public void rule326() throws Exception { final String ruleId = "326"; indexRule(ruleId); @@ -621,7 +621,7 @@ public void rule326() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, description3.getId())); } - //@Test + @Test public void rule327() throws Exception { final String ruleId = "327"; indexRule(ruleId); @@ -649,7 +649,7 @@ public void rule327() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, description3.getId())); } - //@Test + @Test public void rule328() throws Exception { final String ruleId = "328"; indexRule(ruleId); @@ -676,7 +676,7 @@ public void rule328() throws Exception { assertAffectedComponents(issues, ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, description3.getId())); } - //@Test + @Test public void rule482() throws Exception { // Brackets in active terms should balance and be sequentially valid final String ruleId = "482"; @@ -707,22 +707,22 @@ public void rule482() throws Exception { ); } - //@Test + @Test public void rule532a_pharmacy_1() throws Exception { rule532("532a", Concepts.FULLY_SPECIFIED_NAME, Concepts.MODULE_B2I_EXTENSION); } - //@Test + @Test public void rule532a_pharmacy_2() throws Exception { rule532("532a", Concepts.FULLY_SPECIFIED_NAME, Concepts.MODULE_B2I_EXTENSION); } - //@Test + @Test public void rule532b_pharmacy_1() throws Exception { rule532("532b", Concepts.SYNONYM, Concepts.MODULE_B2I_EXTENSION); } - //@Test + @Test public void rule532b_pharmacy_2() throws Exception { rule532("532b", Concepts.SYNONYM, Concepts.MODULE_B2I_EXTENSION); } @@ -804,7 +804,7 @@ private void rule532(String ruleId, String descriptionType, String moduleId) thr ); } - //@Test + @Test public void rule663() throws Exception { final String ruleId = "663"; indexRule(ruleId); @@ -836,7 +836,7 @@ public void rule663() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.RELATIONSHIP_NUMBER, invalidTypeRelationship.getId())); } - //@Test + @Test public void rule664() throws Exception { final String ruleId = "664"; indexRule(ruleId); @@ -866,7 +866,7 @@ public void rule664() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, d2.getId())); } - //@Test + @Test public void rule665() throws Exception { final String ruleId = "665"; indexRule(ruleId); @@ -914,7 +914,7 @@ public void rule665() throws Exception { } - //@Test + @Test public void rule666() throws Exception { final String ruleId = "666"; indexRule(ruleId); @@ -982,7 +982,7 @@ public void rule666() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.CONCEPT_NUMBER, c2.getId())); } - //@Test + @Test public void rule667() throws Exception { final String ruleId = "667"; indexRule(ruleId); @@ -1035,7 +1035,7 @@ public void rule667() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.DESCRIPTION_NUMBER, newIncorrectDescriptionTypedDesc.getId())); } - //@Test + @Test public void rule668() throws Exception { final String ruleId = "668"; indexRule(ruleId); @@ -1094,7 +1094,7 @@ public void rule668() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.REFSET_MEMBER_NUMBER, invalidTypeAxiomMember.getId())); } - //@Test + @Test public void rule669() throws Exception { final String ruleId = "669"; indexRule(ruleId); @@ -1131,7 +1131,7 @@ public void rule669() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.CONCEPT_NUMBER, Concepts.ATTRIBUTE)); } - //@Test + @Test public void rule670() throws Exception { final String ruleId = "670"; indexRule(ruleId); @@ -1148,7 +1148,7 @@ public void rule670() throws Exception { ComponentIdentifier.of(SnomedTerminologyComponentConstants.CONCEPT_NUMBER, Concepts.IS_A)); } - //@Test + @Test public void rule671() throws Exception { final String ruleId = "671"; indexRule(ruleId);