use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedRelationshipIndexEntry in project snow-owl by b2ihealthcare.
the class ConceptChangeProcessorAxiomTest method activateIsa_InactivateOwlMember.
@Test
public void activateIsa_InactivateOwlMember() throws Exception {
final SnomedConceptDocument parentConcept = concept().build();
final SnomedConceptDocument concept = concept().statedParents(Long.parseLong(parentConcept.getId())).statedAncestors(IComponent.ROOT_IDL).activeMemberOf(Collections.singleton(Concepts.REFSET_OWL_AXIOM)).memberOf(Collections.singleton(Concepts.REFSET_OWL_AXIOM)).build();
SnomedRelationshipIndexEntry isaRelationship = SnomedRelationshipIndexEntry.builder(createStatedRelationship(concept.getId(), Concepts.IS_A, parentConcept.getId())).active(false).build();
SnomedRefSetMemberIndexEntry member = createOwlAxiom(concept.getId(), String.format("SubClassOf(:%s :%s)", concept.getId(), parentConcept.getId())).classAxiomRelationships(ImmutableList.of(SnomedOWLRelationshipDocument.create(Concepts.IS_A, parentConcept.getId(), 0))).build();
indexRevision(MAIN, concept, parentConcept, isaRelationship, member);
statedChangedConceptIds.add(Long.parseLong(concept.getId()));
statedChangedConceptIds.add(Long.parseLong(parentConcept.getId()));
stageChange(isaRelationship, SnomedRelationshipIndexEntry.builder(isaRelationship).active(true).build());
stageChange(member, SnomedRefSetMemberIndexEntry.builder(member).active(false).build());
final ConceptChangeProcessor processor = process();
assertEquals(1, processor.getChangedMappings().size());
final SnomedConceptDocument expected = docWithDefaults(concept).statedParents(Long.parseLong(parentConcept.getId())).statedAncestors(IComponent.ROOT_IDL).memberOf(Collections.singleton(Concepts.REFSET_OWL_AXIOM)).build();
final Revision actual = Iterables.getOnlyElement(processor.getChangedMappings().values()).getNewRevision();
assertDocEquals(expected, actual);
assertEquals(0, processor.getNewMappings().size());
assertEquals(0, processor.getDeletions().size());
}
use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedRelationshipIndexEntry in project snow-owl by b2ihealthcare.
the class RelationshipChangeProcessorTest method newRelationship.
@Test
public void newRelationship() throws Exception {
final SnomedRelationshipIndexEntry relationship = createRandomRelationship();
stageNew(relationship);
process(processor);
assertEquals(0, processor.getNewMappings().size());
assertEquals(0, processor.getChangedMappings().size());
assertEquals(0, processor.getDeletions().size());
}
use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedRelationshipIndexEntry in project snow-owl by b2ihealthcare.
the class RelationshipChangeProcessorTest method addNewMemberToExistingRelationship.
@Test
public void addNewMemberToExistingRelationship() {
final SnomedRelationshipIndexEntry relationship = createRandomRelationship();
final String referringRefSetId = generateConceptId();
final SnomedRefSetMemberIndexEntry member = simpleMember(relationship.getId(), referringRefSetId);
initRevisions(relationship);
stageNew(member);
process(processor);
final SnomedRelationshipIndexEntry expectedDoc = SnomedRelationshipIndexEntry.builder(relationship).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());
}
use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedRelationshipIndexEntry in project snow-owl by b2ihealthcare.
the class RelationshipChangeProcessorTest method changedRelationshipGroup.
@Test
public void changedRelationshipGroup() throws Exception {
final SnomedRelationshipIndexEntry relationship = createRandomRelationship();
initRevisions(relationship);
stageChange(relationship, SnomedRelationshipIndexEntry.builder(relationship).relationshipGroup(relationship.getRelationshipGroup() + 1).build());
process(processor);
final SnomedRelationshipIndexEntry expected = SnomedRelationshipIndexEntry.builder(relationship).relationshipGroup(relationship.getRelationshipGroup() + 1).build();
final Revision actual = Iterables.getOnlyElement(processor.getChangedMappings().values()).getNewRevision();
assertDocEquals(expected, actual);
assertEquals(0, processor.getNewMappings().size());
assertEquals(0, processor.getDeletions().size());
}
use of com.b2international.snowowl.snomed.datastore.index.entry.SnomedRelationshipIndexEntry in project snow-owl by b2ihealthcare.
the class TaxonomyPreCommitHookTest method indexStatedInferredChild.
@Test
public void indexStatedInferredChild() throws Exception {
// index the ROOT concept as existing concept
final long rootConceptId = Long.parseLong(Concepts.ROOT_CONCEPT);
statedChangedConceptIds.add(rootConceptId);
inferredChangedConceptIds.add(rootConceptId);
final SnomedConceptDocument concept = concept().build();
stageNew(concept);
final SnomedRelationshipIndexEntry statedRelationship = createStatedRelationship(concept.getId(), Concepts.IS_A, Concepts.ROOT_CONCEPT);
stageNew(statedRelationship);
final SnomedRelationshipIndexEntry inferredRelationship = createInferredRelationship(concept.getId(), Concepts.IS_A, Concepts.ROOT_CONCEPT);
stageNew(inferredRelationship);
final ConceptChangeProcessor processor = process();
final SnomedConceptDocument expected = docWithDefaults(concept).parents(PrimitiveSets.newLongSortedSet(rootConceptId)).ancestors(PrimitiveSets.newLongSortedSet(IComponent.ROOT_IDL)).statedParents(PrimitiveSets.newLongSortedSet(rootConceptId)).statedAncestors(PrimitiveSets.newLongSortedSet(IComponent.ROOT_IDL)).build();
final Revision actual = Iterables.getOnlyElement(processor.getNewMappings().values());
assertDocEquals(expected, actual);
assertEquals(0, processor.getChangedMappings().size());
assertEquals(0, processor.getDeletions().size());
}
Aggregations