Search in sources :

Example 26 with SnomedDescriptionIndexEntry

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

the class DescriptionChangeProcessorTest method addNewDescriptionWithPreferredLanguageMember.

@Test
public void addNewDescriptionWithPreferredLanguageMember() throws Exception {
    SnomedDescriptionIndexEntry fsn = fsn(generateConceptId(), Collections.emptyMap());
    SnomedRefSetMemberIndexEntry preferredInUk = langMember(fsn.getId(), Acceptability.PREFERRED, Concepts.REFSET_LANGUAGE_TYPE_UK);
    stageNew(fsn);
    stageNew(preferredInUk);
    process(processor);
    final SnomedDescriptionIndexEntry expectedDoc = SnomedDescriptionIndexEntry.builder(fsn).memberOf(ImmutableList.of(Concepts.REFSET_LANGUAGE_TYPE_UK)).activeMemberOf(ImmutableList.of(Concepts.REFSET_LANGUAGE_TYPE_UK)).acceptability(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED).build();
    final Revision currentDoc = Iterables.getOnlyElement(processor.getNewMappings().values());
    assertDocEquals(expectedDoc, currentDoc);
    assertEquals(0, processor.getChangedMappings().size());
    assertEquals(0, processor.getDeletions().size());
}
Also used : SnomedRefSetMemberIndexEntry(com.b2international.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry) Revision(com.b2international.index.revision.Revision) SnomedDescriptionIndexEntry(com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionIndexEntry) Test(org.junit.Test)

Example 27 with SnomedDescriptionIndexEntry

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

the class DescriptionChangeProcessorTest method addNewDescriptionWithAcceptableLanguageMember.

@Test
public void addNewDescriptionWithAcceptableLanguageMember() throws Exception {
    SnomedDescriptionIndexEntry fsn = fsn(generateConceptId(), Collections.emptyMap());
    SnomedRefSetMemberIndexEntry acceptableInUk = langMember(fsn.getId(), Acceptability.ACCEPTABLE, Concepts.REFSET_LANGUAGE_TYPE_UK);
    stageNew(fsn);
    stageNew(acceptableInUk);
    process(processor);
    final SnomedDescriptionIndexEntry expectedDoc = SnomedDescriptionIndexEntry.builder(fsn).memberOf(// TODO fix me
    ImmutableList.of(Concepts.REFSET_LANGUAGE_TYPE_UK)).activeMemberOf(ImmutableList.of(Concepts.REFSET_LANGUAGE_TYPE_UK)).acceptability(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.ACCEPTABLE).build();
    final Revision currentDoc = Iterables.getOnlyElement(processor.getNewMappings().values());
    assertDocEquals(expectedDoc, currentDoc);
    assertEquals(0, processor.getChangedMappings().size());
    assertEquals(0, processor.getDeletions().size());
}
Also used : SnomedRefSetMemberIndexEntry(com.b2international.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry) Revision(com.b2international.index.revision.Revision) SnomedDescriptionIndexEntry(com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionIndexEntry) Test(org.junit.Test)

Example 28 with SnomedDescriptionIndexEntry

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

the class DescriptionChangeProcessorTest method addNewMemberToNewDescription.

@Test
public void addNewMemberToNewDescription() {
    final SnomedDescriptionIndexEntry fsn = fsn(generateConceptId(), Collections.emptyMap());
    final String referringRefSetId = generateConceptId();
    final SnomedRefSetMemberIndexEntry member = simpleMember(fsn.getId(), referringRefSetId);
    stageNew(fsn);
    stageNew(member);
    process(processor);
    final SnomedDescriptionIndexEntry expectedDoc = SnomedDescriptionIndexEntry.builder(fsn).memberOf(Collections.singleton(referringRefSetId)).activeMemberOf(Collections.singleton(referringRefSetId)).build();
    final Revision currentDoc = Iterables.getOnlyElement(processor.getNewMappings().values());
    assertDocEquals(expectedDoc, currentDoc);
    assertEquals(0, processor.getChangedMappings().size());
    assertEquals(0, processor.getDeletions().size());
}
Also used : SnomedRefSetMemberIndexEntry(com.b2international.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry) Revision(com.b2international.index.revision.Revision) SnomedDescriptionIndexEntry(com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionIndexEntry) Test(org.junit.Test)

Example 29 with SnomedDescriptionIndexEntry

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

the class DescriptionChangeProcessorTest method deleteOneMemberFromMultipleMembersOfDescription.

@Test
public void deleteOneMemberFromMultipleMembersOfDescription() {
    final SnomedDescriptionIndexEntry fsn = fsn(generateConceptId(), Collections.emptyMap());
    final String referringRefSetId = generateConceptId();
    final SnomedRefSetMemberIndexEntry member1 = simpleMember(fsn.getId(), referringRefSetId);
    final SnomedRefSetMemberIndexEntry member2 = simpleMember(fsn.getId(), referringRefSetId);
    initRevisions(SnomedDescriptionIndexEntry.builder(fsn).memberOf(ImmutableList.of(referringRefSetId, referringRefSetId)).activeMemberOf(ImmutableList.of(referringRefSetId, referringRefSetId)).build(), member1, member2);
    stageRemove(member1);
    process(processor);
    final SnomedDescriptionIndexEntry expectedDoc = SnomedDescriptionIndexEntry.builder(fsn).memberOf(Collections.singleton(referringRefSetId)).activeMemberOf(Collections.singleton(referringRefSetId)).build();
    final Revision currentDoc = Iterables.getOnlyElement(processor.getChangedMappings().values()).getNewRevision();
    assertDocEquals(expectedDoc, currentDoc);
    assertEquals(0, processor.getNewMappings().size());
    assertEquals(0, processor.getDeletions().size());
}
Also used : SnomedRefSetMemberIndexEntry(com.b2international.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry) Revision(com.b2international.index.revision.Revision) SnomedDescriptionIndexEntry(com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionIndexEntry) Test(org.junit.Test)

Example 30 with SnomedDescriptionIndexEntry

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

the class DescriptionChangeProcessorTest method changeDescriptionCaseSignificance.

@Test
public void changeDescriptionCaseSignificance() throws Exception {
    final SnomedDescriptionIndexEntry fsn = fsn(generateConceptId(), Collections.emptyMap());
    initRevisions(fsn);
    stageChange(fsn, SnomedDescriptionIndexEntry.builder(fsn).caseSignificanceId(Concepts.ENTIRE_TERM_CASE_INSENSITIVE).build());
    process(processor);
    final SnomedDescriptionIndexEntry expectedDoc = SnomedDescriptionIndexEntry.builder(fsn).caseSignificanceId(Concepts.ENTIRE_TERM_CASE_INSENSITIVE).build();
    final Revision currentDoc = Iterables.getOnlyElement(processor.getChangedMappings().values()).getNewRevision();
    assertDocEquals(expectedDoc, currentDoc);
    assertEquals(0, processor.getNewMappings().size());
    assertEquals(0, processor.getDeletions().size());
}
Also used : Revision(com.b2international.index.revision.Revision) SnomedDescriptionIndexEntry(com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionIndexEntry) Test(org.junit.Test)

Aggregations

SnomedDescriptionIndexEntry (com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionIndexEntry)38 Test (org.junit.Test)33 Revision (com.b2international.index.revision.Revision)32 SnomedConceptDocument (com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument)23 SnomedDescriptionFragment (com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionFragment)21 SnomedRefSetMemberIndexEntry (com.b2international.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry)17 RevisionSearcher (com.b2international.index.revision.RevisionSearcher)3 StagingArea (com.b2international.index.revision.StagingArea)3 ChangeSetProcessorBase (com.b2international.snowowl.core.repository.ChangeSetProcessorBase)3 Acceptability (com.b2international.snowowl.snomed.core.domain.Acceptability)3 RefSetMemberChange (com.b2international.snowowl.snomed.datastore.index.refset.RefSetMemberChange)3 ReferenceSetMembershipUpdater (com.b2international.snowowl.snomed.datastore.index.update.ReferenceSetMembershipUpdater)3 com.google.common.collect (com.google.common.collect)3 Sets.newHashSet (com.google.common.collect.Sets.newHashSet)3 IOException (java.io.IOException)3 Collectors (java.util.stream.Collectors)3 LongSets (com.b2international.commons.collect.LongSets)2 ObjectId (com.b2international.index.revision.ObjectId)2 RevisionDiff (com.b2international.index.revision.StagingArea.RevisionDiff)2 Concepts (com.b2international.snowowl.snomed.common.SnomedConstants.Concepts)2