Search in sources :

Example 11 with ValidationIssues

use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.

the class GenericValidationRuleTest method rule482.

@Test
public void rule482() throws Exception {
    // Brackets in active terms should balance and be sequentially valid
    final String ruleId = "482";
    indexRule(ruleId);
    SnomedDescriptionIndexEntry baadDesc1 = fsn("They are billions (game))").moduleId(Concepts.MODULE_B2I_EXTENSION).build();
    SnomedDescriptionIndexEntry baadDesc2 = fsn("They are billions ((awesome) (game)").moduleId(Concepts.MODULE_B2I_EXTENSION).build();
    SnomedDescriptionIndexEntry baadDesc3 = fsn("They are billions (awe( some) [game]").moduleId(Concepts.MODULE_B2I_EXTENSION).build();
    SnomedDescriptionIndexEntry baadDesc4 = fsn("They are billions (awesome {quite indeed}").moduleId(Concepts.MODULE_B2I_EXTENSION).build();
    SnomedDescriptionIndexEntry baadDesc5 = fsn("They are billions {awesome game").moduleId(Concepts.MODULE_B2I_EXTENSION).build();
    SnomedDescriptionIndexEntry baadDesc6 = fsn("They are billions awesome] (game)").moduleId(Concepts.MODULE_B2I_EXTENSION).build();
    SnomedDescriptionIndexEntry goodDesc1 = fsn("They are billions {game}").moduleId(Concepts.MODULE_B2I_EXTENSION).build();
    SnomedDescriptionIndexEntry goodDesc2 = fsn("They are billions [awesome] (game)").moduleId(Concepts.MODULE_B2I_EXTENSION).build();
    SnomedDescriptionIndexEntry goodDesc3 = fsn("{They are billions} (game)").moduleId(Concepts.MODULE_B2I_EXTENSION).build();
    indexRevision(MAIN, baadDesc1, baadDesc2, baadDesc3, baadDesc4, baadDesc5, baadDesc6, goodDesc1, goodDesc2, goodDesc3);
    ValidationIssues issues = validate(ruleId);
    assertAffectedComponents(issues, ComponentIdentifier.of(SnomedDescription.TYPE, baadDesc1.getId()), ComponentIdentifier.of(SnomedDescription.TYPE, baadDesc2.getId()), ComponentIdentifier.of(SnomedDescription.TYPE, baadDesc3.getId()), ComponentIdentifier.of(SnomedDescription.TYPE, baadDesc4.getId()), ComponentIdentifier.of(SnomedDescription.TYPE, baadDesc5.getId()), ComponentIdentifier.of(SnomedDescription.TYPE, baadDesc6.getId()));
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) Test(org.junit.Test)

Example 12 with ValidationIssues

use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.

the class GenericValidationRuleTest method rule327.

@Test
public void rule327() throws Exception {
    final String ruleId = "327";
    indexRule(ruleId);
    SnomedConceptDocument concept1 = concept(generateConceptId()).effectiveTime(effectiveTime).build();
    SnomedDescriptionIndexEntry description1 = fsn("Good FSN").moduleId(Concepts.MODULE_B2I_EXTENSION).conceptId(concept1.getId()).build();
    SnomedConceptDocument concept2 = concept(generateConceptId()).effectiveTime(effectiveTime).build();
    SnomedDescriptionIndexEntry description2 = fsn("Bad FSN <test>").moduleId(Concepts.MODULE_SCT_CORE).conceptId(concept2.getId()).build();
    SnomedConceptDocument concept3 = concept(generateConceptId()).effectiveTime(effectiveTime).build();
    SnomedDescriptionIndexEntry description3 = fsn("Bad FSN %").moduleId(Concepts.MODULE_B2I_EXTENSION).conceptId(concept3.getId()).build();
    indexRevision(MAIN, concept1, concept2, concept3, description1, description2, description3);
    ValidationIssues issues = validate(ruleId);
    assertAffectedComponents(issues, ComponentIdentifier.of(SnomedDescription.TYPE, description3.getId()));
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) Test(org.junit.Test)

Example 13 with ValidationIssues

use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.

the class GenericValidationRuleTest method rule45a.

@Test
public void rule45a() throws Exception {
    final String ruleId = "45a";
    indexRule(ruleId);
    // index invalid hierarchical relationship to group 1
    final SnomedRelationshipIndexEntry relationship = relationship(Concepts.FINDING_SITE, Concepts.IS_A, Concepts.MODULE_SCT_MODEL_COMPONENT).relationshipGroup(1).build();
    indexRevision(MAIN, relationship);
    ValidationIssues issues = validate(ruleId);
    assertAffectedComponents(issues, ComponentIdentifier.of(SnomedRelationship.TYPE, relationship.getId()));
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) Test(org.junit.Test)

Example 14 with ValidationIssues

use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.

the class GenericValidationRuleTest method rule75.

@Test
public void rule75() throws Exception {
    // Message: Relationships in group 0 should not be duplicated in any other group.
    final String ruleId = "75";
    indexRule(ruleId);
    SnomedRelationshipIndexEntry goodRel1 = relationship(Concepts.MODULE_ROOT, Concepts.IS_A, Concepts.CONCEPT_INACTIVATION_VALUE).active(true).relationshipGroup(0).build();
    SnomedRelationshipIndexEntry badRel1 = relationship(Concepts.MODULE_ROOT, Concepts.IS_A, Concepts.CONCEPT_INACTIVATION_VALUE).active(true).relationshipGroup(1).build();
    SnomedRelationshipIndexEntry badRel2 = relationship(Concepts.MODULE_ROOT, Concepts.IS_A, Concepts.CONCEPT_INACTIVATION_VALUE).active(true).relationshipGroup(2).build();
    SnomedRelationshipIndexEntry goodRel2 = relationship(Concepts.MODULE_ROOT, Concepts.IS_A, Concepts.CORE_NAMESPACE).active(true).relationshipGroup(0).build();
    final SnomedRelationshipIndexEntry concreteValue1 = concreteValue(Concepts.FINDING_SITE, Concepts.IS_A, new RelationshipValue("Test value")).relationshipGroup(0).build();
    final SnomedRelationshipIndexEntry concreteValue2 = concreteValue(Concepts.FINDING_SITE, Concepts.IS_A, new RelationshipValue("Test value")).relationshipGroup(3).build();
    final SnomedRelationshipIndexEntry concreteValue3 = concreteValue(Concepts.FINDING_SITE, Concepts.IS_A, new RelationshipValue("Test value 2")).relationshipGroup(3).build();
    indexRevision(MAIN, goodRel1, goodRel2, badRel1, badRel2, concreteValue1, concreteValue2, concreteValue3);
    ValidationIssues issues = validate(ruleId);
    assertAffectedComponents(issues, ComponentIdentifier.of(SnomedRelationship.TYPE, badRel1.getId()), ComponentIdentifier.of(SnomedRelationship.TYPE, badRel2.getId()), ComponentIdentifier.of(SnomedRelationship.TYPE, concreteValue2.getId()));
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) Test(org.junit.Test)

Example 15 with ValidationIssues

use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.

the class GenericValidationRuleTest method rule665.

@Test
public void rule665() throws Exception {
    final String ruleId = "665";
    indexRule(ruleId);
    // Relationships with deprecated characteristic types
    SnomedRelationshipIndexEntry relationshipWithDefiningCharType = relationship(generateConceptId(), Concepts.IS_A, generateConceptId()).characteristicTypeId(Concepts.DEFINING_RELATIONSHIP).build();
    SnomedRelationshipIndexEntry relationshipWithQualifingCharType = relationship(generateConceptId(), Concepts.IS_A, generateConceptId()).characteristicTypeId(Concepts.QUALIFYING_RELATIONSHIP).build();
    // Relationships with acceptable characteristic types
    SnomedRelationshipIndexEntry relationshipWithStatedCharType = relationship(generateConceptId(), Concepts.IS_A, generateConceptId()).characteristicTypeId(Concepts.STATED_RELATIONSHIP).build();
    SnomedRelationshipIndexEntry relationshipWithInferredCharType = relationship(generateConceptId(), Concepts.IS_A, generateConceptId()).characteristicTypeId(Concepts.INFERRED_RELATIONSHIP).build();
    SnomedRelationshipIndexEntry relationshipWithAdditionalCharType = relationship(generateConceptId(), Concepts.IS_A, generateConceptId()).characteristicTypeId(Concepts.ADDITIONAL_RELATIONSHIP).build();
    SnomedRelationshipIndexEntry relationshipWithCharTypeOutsideOfCharTypeHierarchy = relationship(generateConceptId(), Concepts.IS_A, generateConceptId()).characteristicTypeId(Concepts.ROOT_CONCEPT).build();
    indexRevision(MAIN, relationshipWithDefiningCharType, relationshipWithQualifingCharType, relationshipWithStatedCharType, relationshipWithInferredCharType, relationshipWithAdditionalCharType, relationshipWithCharTypeOutsideOfCharTypeHierarchy);
    ValidationIssues issues = validate(ruleId);
    assertAffectedComponents(issues, ComponentIdentifier.of(SnomedRelationship.TYPE, relationshipWithDefiningCharType.getId()), ComponentIdentifier.of(SnomedRelationship.TYPE, relationshipWithQualifingCharType.getId()));
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) Test(org.junit.Test)

Aggregations

ValidationIssues (com.b2international.snowowl.core.validation.issue.ValidationIssues)44 Test (org.junit.Test)43 ValidationIssue (com.b2international.snowowl.core.validation.issue.ValidationIssue)9 BaseRevisionIndexTest (com.b2international.index.revision.BaseRevisionIndexTest)5 BaseValidationTest (com.b2international.snowowl.test.commons.validation.BaseValidationTest)5 ComponentURI (com.b2international.snowowl.core.uri.ComponentURI)1 SnomedConceptDocument (com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument)1