Search in sources :

Example 36 with ValidationIssues

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

the class GenericValidationRuleTest method rule74.

@Test
public void rule74() throws Exception {
    final String ruleId = "74";
    indexRule(ruleId);
    // index concept without bracketed suffix.
    SnomedConceptDocument concept1 = concept(generateConceptId()).active(true).parents(Long.parseLong(Concepts.ROOT_CONCEPT)).build();
    SnomedDescriptionIndexEntry description1 = description(generateDescriptionId(), Concepts.FULLY_SPECIFIED_NAME, "Hello Cruel").moduleId(Concepts.MODULE_B2I_EXTENSION).conceptId(concept1.getId()).build();
    // index concept with bracketed suffix.
    SnomedConceptDocument concept2 = concept(generateConceptId()).active(true).parents(Long.parseLong(Concepts.ROOT_CONCEPT)).build();
    SnomedDescriptionIndexEntry description2 = description(generateDescriptionId(), Concepts.FULLY_SPECIFIED_NAME, "Hello Cruel(Coco)").moduleId(Concepts.MODULE_B2I_EXTENSION).conceptId(concept2.getId()).build();
    indexRevision(MAIN, concept1, concept2, description1, description2);
    ValidationIssues issues = validate(ruleId);
    assertAffectedComponents(issues, ComponentIdentifier.of(SnomedDescription.TYPE, description1.getId()));
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) Test(org.junit.Test)

Example 37 with ValidationIssues

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

the class GenericValidationRuleTest method rule84.

@Test
public void rule84() throws Exception {
    final String ruleId = "84";
    indexRule(ruleId);
    // index term containing space before ":"
    SnomedDescriptionIndexEntry description1 = description(generateDescriptionId(), Concepts.SYNONYM, "hello :").moduleId(Concepts.MODULE_B2I_EXTENSION).build();
    // index term containing space before "."
    SnomedDescriptionIndexEntry description2 = description(generateDescriptionId(), Concepts.SYNONYM, "hello .").moduleId(Concepts.MODULE_B2I_EXTENSION).build();
    // index correct term.
    SnomedDescriptionIndexEntry description3 = description(generateDescriptionId(), Concepts.SYNONYM, "hello").moduleId(Concepts.MODULE_B2I_EXTENSION).build();
    indexRevision(MAIN, description1, description2, description3);
    ValidationIssues issues = validate(ruleId);
    assertAffectedComponents(issues, ComponentIdentifier.of(SnomedDescription.TYPE, description1.getId()), ComponentIdentifier.of(SnomedDescription.TYPE, description2.getId()));
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) Test(org.junit.Test)

Example 38 with ValidationIssues

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

the class GenericValidationRuleTest method rule671.

@Test
public void rule671() throws Exception {
    final String ruleId = "671";
    indexRule(ruleId);
    String conceptId1 = generateConceptId();
    SnomedDescriptionIndexEntry fsn1 = description(generateDescriptionId(), Concepts.FULLY_SPECIFIED_NAME, "Fully specified name 1 (tag)").conceptId(conceptId1).acceptability(Concepts.REFSET_LANGUAGE_TYPE_ES, Acceptability.PREFERRED).build();
    SnomedDescriptionIndexEntry pt1 = description(generateDescriptionId(), Concepts.SYNONYM, "Preferred term 1").acceptability(Concepts.REFSET_LANGUAGE_TYPE_ES, Acceptability.PREFERRED).conceptId(conceptId1).build();
    SnomedDescriptionIndexEntry pt2 = description(generateDescriptionId(), Concepts.SYNONYM, "Preferred term 2").acceptability(Concepts.REFSET_LANGUAGE_TYPE_ES, Acceptability.PREFERRED).conceptId(conceptId1).build();
    SnomedRefSetMemberIndexEntry ptMember1 = member(pt1.getId(), Concepts.REFSET_DESCRIPTION_INACTIVITY_INDICATOR).valueId(Concepts.CONCEPT_NON_CURRENT).build();
    SnomedRefSetMemberIndexEntry ptMember2 = member(pt2.getId(), Concepts.REFSET_DESCRIPTION_INACTIVITY_INDICATOR).valueId(Concepts.ERRONEOUS).build();
    SnomedConceptDocument conceptWithActiveDescription = concept(conceptId1).preferredDescriptions(ImmutableList.of(new SnomedDescriptionFragment(fsn1.getId(), fsn1.getTypeId(), fsn1.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_ES), new SnomedDescriptionFragment(pt1.getId(), pt1.getTypeId(), pt1.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_ES), new SnomedDescriptionFragment(pt2.getId(), pt2.getTypeId(), pt2.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_ES))).active(false).build();
    String conceptId2 = generateConceptId();
    SnomedDescriptionIndexEntry fsn2 = description(generateDescriptionId(), Concepts.FULLY_SPECIFIED_NAME, "Fully specified name 2 (tag)").conceptId(conceptId2).acceptability(Concepts.REFSET_LANGUAGE_TYPE_ES, Acceptability.PREFERRED).build();
    SnomedDescriptionIndexEntry pt3 = description(generateDescriptionId(), Concepts.SYNONYM, "Preferred term 3").acceptability(Concepts.REFSET_LANGUAGE_TYPE_ES, Acceptability.PREFERRED).active(false).conceptId(conceptId2).build();
    SnomedRefSetMemberIndexEntry ptMember3 = member(pt3.getId(), Concepts.REFSET_DESCRIPTION_INACTIVITY_INDICATOR).valueId(Concepts.CONCEPT_NON_CURRENT).build();
    SnomedConceptDocument conceptWithInactiveDescription = concept(conceptId2).preferredDescriptions(ImmutableList.of(new SnomedDescriptionFragment(fsn2.getId(), fsn2.getTypeId(), fsn2.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_ES), new SnomedDescriptionFragment(pt3.getId(), pt3.getTypeId(), pt3.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_ES))).active(false).build();
    indexRevision(MAIN, conceptWithActiveDescription, fsn1, pt1, ptMember1, conceptWithInactiveDescription, fsn2, pt2, pt3, ptMember2, ptMember3);
    final ValidationIssues issues = validate(ruleId);
    assertAffectedComponents(issues, ComponentIdentifier.of(SnomedDescription.TYPE, pt2.getId()), ComponentIdentifier.of(SnomedDescription.TYPE, pt3.getId()));
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) Test(org.junit.Test)

Example 39 with ValidationIssues

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

the class GenericValidationRuleTest method rule38a.

@Test
public void rule38a() throws Exception {
    // Active concepts should have at least one active inferred parent.
    final String ruleId = "38a";
    indexRule(ruleId);
    final SnomedConceptDocument activeConceptWithInferredParent = concept(generateConceptId()).active(true).parents(Long.valueOf(Concepts.MODULE_SCT_MODEL_COMPONENT)).build();
    final SnomedConceptDocument activeConceptWithoutInferredParent = concept(generateConceptId()).active(true).build();
    final SnomedConceptDocument inactiveConceptWithoutInferredParent = concept(generateConceptId()).active(false).build();
    indexRevision(MAIN, activeConceptWithInferredParent, activeConceptWithoutInferredParent, inactiveConceptWithoutInferredParent);
    ValidationIssues issues = validate(ruleId);
    assertThat(issues.stream().map(ValidationIssue::getAffectedComponent).collect(Collectors.toSet())).contains(ComponentIdentifier.of(SnomedConcept.TYPE, activeConceptWithoutInferredParent.getId())).doesNotContainAnyElementsOf(ImmutableList.of(ComponentIdentifier.of(SnomedConcept.TYPE, activeConceptWithInferredParent.getId()), ComponentIdentifier.of(SnomedConcept.TYPE, inactiveConceptWithoutInferredParent.getId())));
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) ValidationIssue(com.b2international.snowowl.core.validation.issue.ValidationIssue) Test(org.junit.Test)

Example 40 with ValidationIssues

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

the class GenericValidationRuleTest method rule83.

@Test
public void rule83() throws Exception {
    final String ruleId = "83";
    indexRule(ruleId);
    // index terms containing double spaces
    SnomedDescriptionIndexEntry description1 = description(generateDescriptionId(), Concepts.SYNONYM, "Hello  world").build();
    SnomedDescriptionIndexEntry description2 = description(generateDescriptionId(), Concepts.SYNONYM, "Hello  world").build();
    // index correct term
    SnomedDescriptionIndexEntry description3 = description(generateDescriptionId(), Concepts.SYNONYM, "Hello world").build();
    indexRevision(MAIN, description1, description2, description3);
    ValidationIssues issues = validate(ruleId);
    assertAffectedComponents(issues, ComponentIdentifier.of(SnomedDescription.TYPE, description1.getId()), ComponentIdentifier.of(SnomedDescription.TYPE, description2.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