use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.
the class SnomedQueryValidationRuleEvaluatorTest method descriptionRuleEmptySemanticTag.
@Test
public void descriptionRuleEmptySemanticTag() throws Exception {
final String description1 = RandomSnomedIdentiferGenerator.generateDescriptionId();
final String description2 = RandomSnomedIdentiferGenerator.generateDescriptionId();
indexRevision(MAIN, description(description1, Concepts.SYNONYM, "Minor heart attack").conceptId(generateConceptId()).build(), description(description2, Concepts.SYNONYM, "Clinical finding (finding)").conceptId(generateConceptId()).build());
final Map<String, Object> ruleQuery = ImmutableMap.<String, Object>builder().put("componentType", "description").put("semanticTag", "").build();
final String ruleId = createSnomedQueryRule(ruleQuery);
final ValidationIssues issues = validate(ruleId);
assertThat(issues.getTotal()).isEqualTo(1);
assertThat(issues.getItems().get(0).getAffectedComponent()).isEqualTo(ComponentIdentifier.of(SnomedDescription.TYPE, description1));
}
use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.
the class GenericValidationRuleTest method rule55.
@Test
public void rule55() throws Exception {
final String ruleId = "55";
indexRule(ruleId);
// wrong examples
SnomedConceptDocument invalidDescriptionConcept = concept(generateConceptId()).build();
SnomedDescriptionIndexEntry descWithInvalidHypenSpacing = description(generateDescriptionId(), Concepts.SYNONYM, "Hello -Cruel!").moduleId(Concepts.MODULE_B2I_EXTENSION).conceptId(invalidDescriptionConcept.getId()).build();
SnomedConceptDocument invalidDescriptionConcept2 = concept(generateConceptId()).build();
SnomedDescriptionIndexEntry descWithMultipleInvalidHypenSpacing = description(generateDescriptionId(), Concepts.SYNONYM, "Hello -Cruel- World!").moduleId(Concepts.MODULE_B2I_EXTENSION).conceptId(invalidDescriptionConcept2.getId()).build();
SnomedConceptDocument invalidDescriptionConcept3 = concept(generateConceptId()).build();
SnomedDescriptionIndexEntry descWithSymbolAndInvalidHypenSpacing = description(generateDescriptionId(), Concepts.SYNONYM, "Hello -? -a").moduleId(Concepts.MODULE_B2I_EXTENSION).conceptId(invalidDescriptionConcept3.getId()).build();
// good examples
SnomedConceptDocument validDescriptionConcept = concept(generateConceptId()).build();
SnomedDescriptionIndexEntry descWithValidHypenSpacing = description(generateDescriptionId(), Concepts.SYNONYM, "Hello-Cruel!").moduleId(Concepts.MODULE_B2I_EXTENSION).conceptId(validDescriptionConcept.getId()).build();
SnomedConceptDocument validDescriptionConcept2 = concept(generateConceptId()).build();
SnomedDescriptionIndexEntry descWithSymbolNextToHypen = description(generateDescriptionId(), Concepts.SYNONYM, "Hello -?").moduleId(Concepts.MODULE_B2I_EXTENSION).conceptId(validDescriptionConcept2.getId()).build();
indexRevision(Branch.MAIN_PATH, invalidDescriptionConcept, invalidDescriptionConcept2, invalidDescriptionConcept3, descWithInvalidHypenSpacing, descWithMultipleInvalidHypenSpacing, descWithSymbolAndInvalidHypenSpacing, descWithSymbolNextToHypen, descWithValidHypenSpacing, validDescriptionConcept, validDescriptionConcept2);
ValidationIssues issues = validate(ruleId);
assertAffectedComponents(issues, ComponentIdentifier.of(SnomedDescription.TYPE, descWithInvalidHypenSpacing.getId()), ComponentIdentifier.of(SnomedDescription.TYPE, descWithMultipleInvalidHypenSpacing.getId()), ComponentIdentifier.of(SnomedDescription.TYPE, descWithSymbolAndInvalidHypenSpacing.getId()));
}
use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.
the class GenericValidationRuleTest method rule670.
@Test
public void rule670() throws Exception {
final String ruleId = "670";
indexRule(ruleId);
final SnomedRefSetMemberIndexEntry duplicateSimpleMember1 = member(Concepts.IS_A, Concepts.MODULE_ROOT).referenceSetType(SnomedRefSetType.ASSOCIATION).targetComponentId(Concepts.ATTRIBUTE_TYPE_ASSOCIATION_TARGET).build();
final SnomedRefSetMemberIndexEntry duplicateSimpleMember2 = member(Concepts.IS_A, Concepts.MODULE_ROOT).referenceSetType(SnomedRefSetType.ASSOCIATION).targetComponentId(Concepts.ATTRIBUTE_TYPE_ASSOCIATION_TARGET).build();
final SnomedRefSetMemberIndexEntry correctSimpleMember = member(Concepts.IS_A, Concepts.MODULE_SCT_CORE).referenceSetType(SnomedRefSetType.ASSOCIATION).targetComponentId(Concepts.ATTRIBUTE_TYPE_COMPONENT_TYPE).build();
indexRevision(MAIN, duplicateSimpleMember1, duplicateSimpleMember2, correctSimpleMember);
final ValidationIssues issues = validate(ruleId);
assertAffectedComponents(issues, ComponentIdentifier.of(SnomedConcept.TYPE, Concepts.IS_A));
}
use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.
the class GenericValidationRuleTest method rule38b.
@Test
public void rule38b() throws Exception {
// Active concepts should have at least one active stated parent
final String ruleId = "38b";
indexRule(ruleId);
final SnomedConceptDocument activeConceptWithStatedParent = concept(generateConceptId()).active(true).statedParents(Long.valueOf(Concepts.MODULE_SCT_MODEL_COMPONENT)).build();
final SnomedConceptDocument activeConceptWithoutStatedParent = concept(generateConceptId()).active(true).build();
final SnomedConceptDocument inactiveConceptWithoutStatedParent = concept(generateConceptId()).active(false).build();
indexRevision(MAIN, activeConceptWithStatedParent, activeConceptWithoutStatedParent, inactiveConceptWithoutStatedParent);
ValidationIssues issues = validate(ruleId);
assertThat(issues.stream().map(ValidationIssue::getAffectedComponent).collect(Collectors.toSet())).contains(ComponentIdentifier.of(SnomedConcept.TYPE, activeConceptWithoutStatedParent.getId())).doesNotContainAnyElementsOf(ImmutableList.of(ComponentIdentifier.of(SnomedConcept.TYPE, activeConceptWithStatedParent.getId()), ComponentIdentifier.of(SnomedConcept.TYPE, inactiveConceptWithoutStatedParent.getId())));
}
use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.
the class GenericValidationRuleTest method rule664.
@Test
public void rule664() throws Exception {
final String ruleId = "664";
indexRule(ruleId);
// index three concepts
SnomedConceptDocument c1 = concept(generateConceptId()).build();
SnomedDescriptionIndexEntry d1 = description(generateDescriptionId(), Concepts.FULLY_SPECIFIED_NAME, "Hello World!").conceptId(c1.getId()).build();
SnomedConceptDocument c2 = concept(generateConceptId()).build();
SnomedDescriptionIndexEntry d2 = description(generateDescriptionId(), Concepts.FULLY_SPECIFIED_NAME, "Hello World!").conceptId(c2.getId()).build();
SnomedConceptDocument c3 = concept(generateConceptId()).build();
SnomedDescriptionIndexEntry d3 = description(generateDescriptionId(), Concepts.FULLY_SPECIFIED_NAME, "Hello Cruel World!").conceptId(c3.getId()).build();
indexRevision(MAIN, c1, d1, c2, d2, c3, d3);
ValidationIssues issues = validate(ruleId);
assertAffectedComponents(issues, ComponentIdentifier.of(SnomedDescription.TYPE, d1.getId()), ComponentIdentifier.of(SnomedDescription.TYPE, d2.getId()));
}
Aggregations