Search in sources :

Example 1 with EquivalentConceptSetDocument

use of com.b2international.snowowl.snomed.reasoner.index.EquivalentConceptSetDocument in project snow-owl by b2ihealthcare.

the class EquivalentConceptSetSerializationTest method indexClassificationTask.

@Test
public void indexClassificationTask() throws Exception {
    final String classificationId = randomUUID();
    final EquivalentConceptSetDocument expected = EquivalentConceptSetDocument.builder().classificationId(classificationId).conceptIds(PrimitiveLists.newLongArrayList(1L, 2L, 3L)).unsatisfiable(true).build();
    indexDocument(expected);
    final EquivalentConceptSetDocument actual = rawIndex().read(r -> r.search(Query.select(EquivalentConceptSetDocument.class).where(Expressions.matchAll()).build()).first());
    assertDocEquals(expected, actual);
}
Also used : EquivalentConceptSetDocument(com.b2international.snowowl.snomed.reasoner.index.EquivalentConceptSetDocument) BaseRevisionIndexTest(com.b2international.index.revision.BaseRevisionIndexTest) Test(org.junit.Test)

Example 2 with EquivalentConceptSetDocument

use of com.b2international.snowowl.snomed.reasoner.index.EquivalentConceptSetDocument in project snow-owl by b2ihealthcare.

the class ClassificationTracker method indexUnsatisfiableConcepts.

private void indexUnsatisfiableConcepts(final Writer writer, final String classificationId, final IInternalSctIdSet unsatisfiableConcepts) throws IOException {
    if (!unsatisfiableConcepts.isEmpty()) {
        final EquivalentConceptSetDocument equivalentDoc = EquivalentConceptSetDocument.builder().classificationId(classificationId).conceptIds(unsatisfiableConcepts.toLongList()).unsatisfiable(true).build();
        writer.put(equivalentDoc);
    }
}
Also used : EquivalentConceptSetDocument(com.b2international.snowowl.snomed.reasoner.index.EquivalentConceptSetDocument)

Example 3 with EquivalentConceptSetDocument

use of com.b2international.snowowl.snomed.reasoner.index.EquivalentConceptSetDocument in project snow-owl by b2ihealthcare.

the class ClassificationTracker method indexEquivalentConcepts.

private void indexEquivalentConcepts(final Writer writer, final String classificationId, final IInternalSctIdMultimap equivalentConcepts) throws IOException {
    for (final LongIterator itr = equivalentConcepts.keySet().iterator(); itr.hasNext(); ) /*empty*/
    {
        final long representativeConcept = itr.next();
        final LongSet equivalents = equivalentConcepts.get(representativeConcept);
        final LongList orderedConcepts = PrimitiveLists.newLongArrayListWithExpectedSize(equivalents.size() + 1);
        orderedConcepts.add(representativeConcept);
        orderedConcepts.addAll(equivalents);
        final EquivalentConceptSetDocument equivalentDoc = EquivalentConceptSetDocument.builder().classificationId(classificationId).conceptIds(orderedConcepts).unsatisfiable(false).build();
        writer.put(equivalentDoc);
    }
}
Also used : EquivalentConceptSetDocument(com.b2international.snowowl.snomed.reasoner.index.EquivalentConceptSetDocument) LongSet(com.b2international.collections.longs.LongSet) LongList(com.b2international.collections.longs.LongList) LongIterator(com.b2international.collections.longs.LongIterator)

Aggregations

EquivalentConceptSetDocument (com.b2international.snowowl.snomed.reasoner.index.EquivalentConceptSetDocument)3 LongIterator (com.b2international.collections.longs.LongIterator)1 LongList (com.b2international.collections.longs.LongList)1 LongSet (com.b2international.collections.longs.LongSet)1 BaseRevisionIndexTest (com.b2international.index.revision.BaseRevisionIndexTest)1 Test (org.junit.Test)1