use of org.snomed.snowstorm.validation.domain.DroolsDescription in project snowstorm by IHTSDO.
the class DescriptionDroolsValidationServiceTest method findMatchingDescriptionInHierarchy.
@Test
void findMatchingDescriptionInHierarchy() {
Concept concept = new Concept("1760555000");
concept.addAxiom(new Relationship(ISA, bodyStructureDescendant1.getId()));
Description description = new Description("5582049016", null, true, "900000000000207008", "1760555000", "en", "900000000000013009", "Entire heart", "900000000000448009");
org.ihtsdo.drools.domain.Concept droolConcept = new DroolsConcept(concept);
org.ihtsdo.drools.domain.Description droolDescription = new DroolsDescription(description);
Set<org.ihtsdo.drools.domain.Description> descriptions = validationService.findMatchingDescriptionInHierarchy(droolConcept, droolDescription);
assertEquals(1, descriptions.size());
}
use of org.snomed.snowstorm.validation.domain.DroolsDescription in project snowstorm by IHTSDO.
the class ConceptValidationHelper method replaceTemporaryUUIDWithSCTID.
public static List<InvalidContent> replaceTemporaryUUIDWithSCTID(final List<InvalidContent> invalidContentWarnings, final Concept concept) {
replaceInvalidContentTemporaryUUIDWithSCTIDInConcept(invalidContentWarnings, concept);
replaceInvalidContentTemporaryUUIDWithSCTIDIn(invalidContentWarnings, concept.getDescriptions(), (final InvalidContent invalidContentWarning, final Description description) -> {
final Component component = invalidContentWarning.getComponent();
if (component instanceof DroolsDescription) {
final DroolsDescription droolsDescription = (DroolsDescription) component;
if (description != null && description.getReleaseHash() != null && description.getReleaseHash().equals(droolsDescription.getReleaseHash())) {
invalidContentWarning.setComponent(new DroolsDescription(description));
}
}
});
replaceInvalidContentTemporaryUUIDWithSCTIDIn(invalidContentWarnings, concept.getRelationships(), (final InvalidContent invalidContentWarning, final Relationship relationship) -> {
final Component component = invalidContentWarning.getComponent();
if (component instanceof DroolsRelationship) {
final DroolsRelationship droolsRelationship = (DroolsRelationship) component;
if (relationship != null && relationship.getReleaseHash() != null && relationship.getReleaseHash().equals(droolsRelationship.getReleaseHash())) {
invalidContentWarning.setComponent(new DroolsRelationship(null, false, relationship));
}
}
});
replaceInvalidContentTemporaryUUIDWithSCTIDInAxiom(invalidContentWarnings, concept.getClassAxioms(), false);
replaceInvalidContentTemporaryUUIDWithSCTIDInAxiom(invalidContentWarnings, concept.getGciAxioms(), true);
return invalidContentWarnings;
}
use of org.snomed.snowstorm.validation.domain.DroolsDescription in project snowstorm by IHTSDO.
the class DescriptionDroolsValidationService method findDescriptionByExactTerm.
private Set<org.ihtsdo.drools.domain.Description> findDescriptionByExactTerm(String exactTerm, boolean active) {
NativeSearchQuery query = new NativeSearchQueryBuilder().withQuery(boolQuery().must(branchCriteria.getEntityBranchCriteria(Description.class)).must(termQuery("active", active)).must(termQuery("term", exactTerm))).build();
List<Description> matches = elasticsearchTemplate.search(query, Description.class).get().map(SearchHit::getContent).collect(Collectors.toList());
return matches.stream().filter(description -> description.getTerm().equals(exactTerm)).map(DroolsDescription::new).collect(Collectors.toSet());
}
Aggregations