use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument in project snow-owl by b2ihealthcare.
the class ConceptIconIdUpdaterTest method indexChildConceptWithUSAndGBFsn.
@Test
public void indexChildConceptWithUSAndGBFsn() {
final SnomedConceptDocument concept = concept().iconId(// intentionally unset icon ID before change processing
null).build();
final SnomedDescriptionIndexEntry fsn1 = description(concept.getId(), Concepts.FULLY_SPECIFIED_NAME, String.format(TEST_FSN, FINDING_SEMANTIC_TAG), singletonMap(Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.PREFERRED));
indexRevision(MAIN, concept, fsn1);
final SnomedConceptDocument childConcept = concept().iconId(// intentionally unset icon ID before change processing
null).build();
// the US preferred FSN has priority over the GB and the rest of the preferred FSNs
final SnomedDescriptionIndexEntry fsn2 = description(childConcept.getId(), Concepts.FULLY_SPECIFIED_NAME, String.format(TEST_FSN, DISORDER_SEMANTIC_TAG), singletonMap(Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.PREFERRED));
// the GB preferred FSN has priority over the other preferred FSNs (except the US one)
final SnomedDescriptionIndexEntry fsn3 = description(childConcept.getId(), Concepts.FULLY_SPECIFIED_NAME, String.format(TEST_FSN, "trouble"), singletonMap(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED));
final SnomedRefSetMemberIndexEntry member = createOwlAxiom(childConcept.getId(), String.format("SubClassOf(:%s :%s)", childConcept.getId(), concept.getId())).build();
stageNew(childConcept);
stageNew(fsn3);
stageNew(fsn2);
stageNew(member);
statedChangedConceptIds.add(Long.parseLong(concept.getId()));
statedChangedConceptIds.add(Long.parseLong(childConcept.getId()));
availableImages.add(DISORDER_SEMANTIC_TAG);
final ConceptChangeProcessor processor = process();
final SnomedConceptDocument expectedChild = docWithDefaults(childConcept).semanticTags(// both semantic tags should be extracted
ImmutableSortedSet.of(DISORDER_SEMANTIC_TAG, "trouble")).preferredDescriptions(ImmutableList.of(new SnomedDescriptionFragment(fsn2.getId(), fsn2.getTypeId(), fsn2.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_US), new SnomedDescriptionFragment(fsn3.getId(), fsn3.getTypeId(), fsn3.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_UK))).iconId(// icon ID must be "disorder"
DISORDER_SEMANTIC_TAG).statedParents(Long.parseLong(concept.getId())).statedAncestors(IComponent.ROOT_IDL).activeMemberOf(singleton(Concepts.REFSET_OWL_AXIOM)).memberOf(singleton(Concepts.REFSET_OWL_AXIOM)).build();
final Revision actualChild = Iterables.getOnlyElement(processor.getNewMappings().values());
assertDocEquals(expectedChild, actualChild);
}
use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument in project snow-owl by b2ihealthcare.
the class ConceptIconIdUpdaterTest method indexTopLevelConceptWithUnknownSemanticTag.
@Test
public void indexTopLevelConceptWithUnknownSemanticTag() {
final SnomedConceptDocument concept = concept().statedParents(IComponent.ROOT_IDL).parents(IComponent.ROOT_IDL).iconId(// intentionally unset icon ID before change processing
null).build();
final SnomedDescriptionIndexEntry fsn = description(concept.getId(), Concepts.FULLY_SPECIFIED_NAME, String.format(TEST_FSN, "apple"), singletonMap(Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.PREFERRED));
stageNew(concept);
stageNew(fsn);
final ConceptChangeProcessor processor = process();
final SnomedConceptDocument expected = docWithDefaults(concept).semanticTags(ImmutableSortedSet.of("apple")).preferredDescriptions(ImmutableList.of(new SnomedDescriptionFragment(fsn.getId(), fsn.getTypeId(), fsn.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_US))).iconId(// icon ID must be the root concept's ID
Concepts.ROOT_CONCEPT).build();
final Revision actual = Iterables.getOnlyElement(processor.getNewMappings().values());
assertDocEquals(expected, actual);
}
use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument in project snow-owl by b2ihealthcare.
the class ConceptIconIdUpdaterTest method indexChildConceptWithKnownSemanticTag.
@Test
public void indexChildConceptWithKnownSemanticTag() {
final SnomedConceptDocument concept = concept().iconId(// intentionally unset icon ID before change processing
null).build();
final SnomedDescriptionIndexEntry fsn1 = description(concept.getId(), Concepts.FULLY_SPECIFIED_NAME, String.format(TEST_FSN, FINDING_SEMANTIC_TAG), singletonMap(Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.PREFERRED));
indexRevision(MAIN, concept, fsn1);
final SnomedConceptDocument childConcept = concept().iconId(// intentionally unset icon ID before change processing
null).build();
final SnomedDescriptionIndexEntry fsn2 = description(childConcept.getId(), Concepts.FULLY_SPECIFIED_NAME, String.format(TEST_FSN, DISORDER_SEMANTIC_TAG), singletonMap(Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.PREFERRED));
final SnomedRefSetMemberIndexEntry member = createOwlAxiom(childConcept.getId(), String.format("SubClassOf(:%s :%s)", childConcept.getId(), concept.getId())).build();
stageNew(childConcept);
stageNew(fsn2);
stageNew(member);
statedChangedConceptIds.add(Long.parseLong(concept.getId()));
statedChangedConceptIds.add(Long.parseLong(childConcept.getId()));
availableImages.add(DISORDER_SEMANTIC_TAG);
final ConceptChangeProcessor processor = process();
final SnomedConceptDocument expectedChild = docWithDefaults(childConcept).semanticTags(ImmutableSortedSet.of(DISORDER_SEMANTIC_TAG)).preferredDescriptions(ImmutableList.of(new SnomedDescriptionFragment(fsn2.getId(), fsn2.getTypeId(), fsn2.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_US))).iconId(// icon ID must be "disorder"
DISORDER_SEMANTIC_TAG).statedParents(Long.parseLong(concept.getId())).statedAncestors(IComponent.ROOT_IDL).activeMemberOf(singleton(Concepts.REFSET_OWL_AXIOM)).memberOf(singleton(Concepts.REFSET_OWL_AXIOM)).build();
final Revision actualChild = Iterables.getOnlyElement(processor.getNewMappings().values());
assertDocEquals(expectedChild, actualChild);
}
use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument in project snow-owl by b2ihealthcare.
the class ConceptIconIdUpdaterTest method indexChildConceptWithPreferredAndAcceptableFsn.
@Test
public void indexChildConceptWithPreferredAndAcceptableFsn() {
final SnomedConceptDocument concept = concept().iconId(// intentionally unset icon ID before change processing
null).build();
final SnomedDescriptionIndexEntry fsn1 = description(concept.getId(), Concepts.FULLY_SPECIFIED_NAME, String.format(TEST_FSN, FINDING_SEMANTIC_TAG), singletonMap(Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.PREFERRED));
indexRevision(MAIN, concept, fsn1);
final SnomedConceptDocument childConcept = concept().iconId(// intentionally unset icon ID before change processing
null).build();
final SnomedDescriptionIndexEntry fsn2 = description(childConcept.getId(), Concepts.FULLY_SPECIFIED_NAME, String.format(TEST_FSN, DISORDER_SEMANTIC_TAG), singletonMap(Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.PREFERRED));
// another acceptable FSN must not cause any change in icon calculation
final SnomedDescriptionIndexEntry fsn3 = description(childConcept.getId(), Concepts.FULLY_SPECIFIED_NAME, String.format(TEST_FSN, "trouble"), singletonMap(Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.ACCEPTABLE));
final SnomedRefSetMemberIndexEntry member = createOwlAxiom(childConcept.getId(), String.format("SubClassOf(:%s :%s)", childConcept.getId(), concept.getId())).build();
stageNew(childConcept);
stageNew(fsn2);
stageNew(fsn3);
stageNew(member);
statedChangedConceptIds.add(Long.parseLong(concept.getId()));
statedChangedConceptIds.add(Long.parseLong(childConcept.getId()));
availableImages.add(DISORDER_SEMANTIC_TAG);
final ConceptChangeProcessor processor = process();
final SnomedConceptDocument expectedChild = docWithDefaults(childConcept).semanticTags(ImmutableSortedSet.of(DISORDER_SEMANTIC_TAG)).preferredDescriptions(ImmutableList.of(new SnomedDescriptionFragment(fsn2.getId(), fsn2.getTypeId(), fsn2.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_US))).iconId(// icon ID must be "disorder"
DISORDER_SEMANTIC_TAG).statedParents(Long.parseLong(concept.getId())).statedAncestors(IComponent.ROOT_IDL).activeMemberOf(singleton(Concepts.REFSET_OWL_AXIOM)).memberOf(singleton(Concepts.REFSET_OWL_AXIOM)).build();
final Revision actualChild = Iterables.getOnlyElement(processor.getNewMappings().values());
assertDocEquals(expectedChild, actualChild);
}
use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument in project snow-owl by b2ihealthcare.
the class ConceptIconIdUpdaterTest method indexChildConceptWithUnknownSemanticTag.
@Test
public void indexChildConceptWithUnknownSemanticTag() {
final SnomedConceptDocument concept = concept().iconId(// intentionally unset icon ID before change processing
null).build();
final SnomedDescriptionIndexEntry fsn1 = description(concept.getId(), Concepts.FULLY_SPECIFIED_NAME, String.format(TEST_FSN, FINDING_SEMANTIC_TAG), singletonMap(Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.PREFERRED));
indexRevision(MAIN, concept, fsn1);
final SnomedConceptDocument childConcept = concept().iconId(// intentionally unset icon ID before change processing
null).build();
final SnomedDescriptionIndexEntry fsn2 = description(childConcept.getId(), Concepts.FULLY_SPECIFIED_NAME, String.format(TEST_FSN, "apple"), singletonMap(Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.PREFERRED));
final SnomedRefSetMemberIndexEntry member = createOwlAxiom(childConcept.getId(), String.format("SubClassOf(:%s :%s)", childConcept.getId(), concept.getId())).build();
stageNew(childConcept);
stageNew(fsn2);
stageNew(member);
statedChangedConceptIds.add(Long.parseLong(concept.getId()));
statedChangedConceptIds.add(Long.parseLong(childConcept.getId()));
final ConceptChangeProcessor processor = process();
final SnomedConceptDocument expectedChild = docWithDefaults(childConcept).semanticTags(ImmutableSortedSet.of("apple")).preferredDescriptions(ImmutableList.of(new SnomedDescriptionFragment(fsn2.getId(), fsn2.getTypeId(), fsn2.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_US))).iconId(// icon ID must be the root concept's ID
Concepts.ROOT_CONCEPT).statedParents(Long.parseLong(concept.getId())).statedAncestors(IComponent.ROOT_IDL).activeMemberOf(singleton(Concepts.REFSET_OWL_AXIOM)).memberOf(singleton(Concepts.REFSET_OWL_AXIOM)).build();
final Revision actualChild = Iterables.getOnlyElement(processor.getNewMappings().values());
assertDocEquals(expectedChild, actualChild);
}
Aggregations