Search in sources :

Example 6 with SnomedDescriptionFragment

use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionFragment in project snow-owl by b2ihealthcare.

the class ConceptIconIdUpdaterTest method indexChildConceptWithKnownId.

@Test
public void indexChildConceptWithKnownId() {
    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(Concepts.NAMESPACE_ROOT).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 known concept's ID
    Concepts.NAMESPACE_ROOT).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);
}
Also used : SnomedConceptDocument(com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument) SnomedRefSetMemberIndexEntry(com.b2international.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry) SnomedDescriptionFragment(com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionFragment) Revision(com.b2international.index.revision.Revision) SnomedDescriptionIndexEntry(com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionIndexEntry) Test(org.junit.Test)

Example 7 with SnomedDescriptionFragment

use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionFragment in project snow-owl by b2ihealthcare.

the class PreferredDescriptionPreCommitHookTest method indexConceptWithFsnAndDefinition.

@Test
public void indexConceptWithFsnAndDefinition() throws Exception {
    final SnomedConceptDocument concept = concept().build();
    final SnomedDescriptionIndexEntry fsn = fsn(concept.getId(), Collections.singletonMap(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED));
    final SnomedDescriptionIndexEntry definition = definition(concept.getId(), Collections.singletonMap(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED));
    stageNew(concept);
    stageNew(fsn);
    stageNew(definition);
    final ConceptChangeProcessor processor = process();
    final SnomedConceptDocument expected = docWithDefaults(concept).semanticTags(ImmutableSortedSet.of("semantic tag")).preferredDescriptions(ImmutableList.of(new SnomedDescriptionFragment(fsn.getId(), fsn.getTypeId(), fsn.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_UK))).build();
    final Revision actual = Iterables.getOnlyElement(processor.getNewMappings().values());
    assertDocEquals(expected, actual);
    assertEquals(0, processor.getChangedMappings().size());
    assertEquals(0, processor.getDeletions().size());
}
Also used : SnomedConceptDocument(com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument) SnomedDescriptionFragment(com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionFragment) Revision(com.b2international.index.revision.Revision) SnomedDescriptionIndexEntry(com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionIndexEntry) Test(org.junit.Test)

Example 8 with SnomedDescriptionFragment

use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionFragment in project snow-owl by b2ihealthcare.

the class PreferredDescriptionPreCommitHookTest method updateCaseSignificanceOfConceptDescription.

@Test
public void updateCaseSignificanceOfConceptDescription() throws Exception {
    final SnomedConceptDocument concept = concept().build();
    final SnomedDescriptionIndexEntry fsn = fsn(concept.getId(), Collections.singletonMap(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED));
    initRevisions(docWithDefaults(concept).preferredDescriptions(ImmutableList.of(new SnomedDescriptionFragment(fsn.getId(), fsn.getTypeId(), fsn.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_UK))).build(), fsn);
    stageChange(fsn, SnomedDescriptionIndexEntry.builder(fsn).caseSignificanceId(Concepts.ENTIRE_TERM_CASE_INSENSITIVE).build());
    final ConceptChangeProcessor processor = process();
    assertEquals(0, processor.getNewMappings().size());
    assertEquals(0, processor.getChangedMappings().size());
    assertEquals(0, processor.getDeletions().size());
}
Also used : SnomedConceptDocument(com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument) SnomedDescriptionFragment(com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionFragment) SnomedDescriptionIndexEntry(com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionIndexEntry) Test(org.junit.Test)

Example 9 with SnomedDescriptionFragment

use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionFragment in project snow-owl by b2ihealthcare.

the class PreferredDescriptionPreCommitHookTest method indexConceptWithSingleFsn.

@Test
public void indexConceptWithSingleFsn() throws Exception {
    final SnomedConceptDocument concept = concept().build();
    final SnomedDescriptionIndexEntry fsn = fsn(concept.getId(), Collections.singletonMap(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED));
    stageNew(concept);
    stageNew(fsn);
    final ConceptChangeProcessor processor = process();
    final SnomedConceptDocument expected = docWithDefaults(concept).semanticTags(ImmutableSortedSet.of("semantic tag")).preferredDescriptions(ImmutableList.of(new SnomedDescriptionFragment(fsn.getId(), fsn.getTypeId(), fsn.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_UK))).build();
    final Revision actual = Iterables.getOnlyElement(processor.getNewMappings().values());
    assertDocEquals(expected, actual);
    assertEquals(0, processor.getChangedMappings().size());
    assertEquals(0, processor.getDeletions().size());
}
Also used : SnomedConceptDocument(com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument) SnomedDescriptionFragment(com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionFragment) Revision(com.b2international.index.revision.Revision) SnomedDescriptionIndexEntry(com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionIndexEntry) Test(org.junit.Test)

Example 10 with SnomedDescriptionFragment

use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionFragment in project snow-owl by b2ihealthcare.

the class PreferredDescriptionPreCommitHookTest method updateTypeOfConceptDescription.

@Test
public void updateTypeOfConceptDescription() throws Exception {
    final SnomedConceptDocument concept = concept().build();
    final SnomedDescriptionIndexEntry fsn = fsn(concept.getId(), Collections.singletonMap(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED));
    initRevisions(docWithDefaults(concept).preferredDescriptions(ImmutableList.of(new SnomedDescriptionFragment(fsn.getId(), fsn.getTypeId(), fsn.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_UK))).build(), fsn);
    SnomedDescriptionIndexEntry synonym = SnomedDescriptionIndexEntry.builder(fsn).typeId(Concepts.SYNONYM).build();
    stageChange(fsn, synonym);
    final ConceptChangeProcessor processor = process();
    final SnomedConceptDocument expected = docWithDefaults(concept).preferredDescriptions(ImmutableList.of(new SnomedDescriptionFragment(synonym.getId(), synonym.getTypeId(), synonym.getTerm(), Concepts.REFSET_LANGUAGE_TYPE_UK))).build();
    final Revision actual = Iterables.getOnlyElement(processor.getChangedMappings().values()).getNewRevision();
    assertDocEquals(expected, actual);
    assertEquals(0, processor.getNewMappings().size());
    assertEquals(0, processor.getDeletions().size());
}
Also used : SnomedConceptDocument(com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument) SnomedDescriptionFragment(com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionFragment) Revision(com.b2international.index.revision.Revision) SnomedDescriptionIndexEntry(com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionIndexEntry) Test(org.junit.Test)

Aggregations

SnomedConceptDocument (com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument)22 SnomedDescriptionFragment (com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionFragment)22 SnomedDescriptionIndexEntry (com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionIndexEntry)22 Revision (com.b2international.index.revision.Revision)21 Test (org.junit.Test)19 SnomedRefSetMemberIndexEntry (com.b2international.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry)9 LongSets (com.b2international.commons.collect.LongSets)3 ObjectId (com.b2international.index.revision.ObjectId)3 RevisionSearcher (com.b2international.index.revision.RevisionSearcher)3 StagingArea (com.b2international.index.revision.StagingArea)3 RevisionDiff (com.b2international.index.revision.StagingArea.RevisionDiff)3 ChangeSetProcessorBase (com.b2international.snowowl.core.repository.ChangeSetProcessorBase)3 Concepts (com.b2international.snowowl.snomed.common.SnomedConstants.Concepts)3 Acceptability (com.b2international.snowowl.snomed.core.domain.Acceptability)3 SnomedConcept (com.b2international.snowowl.snomed.core.domain.SnomedConcept)3 Builder (com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument.Builder)3 RefSetMemberChange (com.b2international.snowowl.snomed.datastore.index.refset.RefSetMemberChange)3 IconIdUpdater (com.b2international.snowowl.snomed.datastore.index.update.IconIdUpdater)3 ParentageUpdater (com.b2international.snowowl.snomed.datastore.index.update.ParentageUpdater)3 ReferenceSetMembershipUpdater (com.b2international.snowowl.snomed.datastore.index.update.ReferenceSetMembershipUpdater)3