Search in sources :

Example 6 with SnomedOWLExpressionConverterResult

use of com.b2international.snowowl.snomed.datastore.request.SnomedOWLExpressionConverterResult in project snow-owl by b2ihealthcare.

the class SnomedRefSetMemberDocumentSerializationTest method createClassAxiomMember.

private SnomedRefSetMemberIndexEntry createClassAxiomMember() {
    final String referencedComponentId = "245567007";
    final String owlExpression = "SubClassOf(:245567007 ObjectIntersectionOf(:245565004 :420479003 :7121006 ObjectSomeValuesFrom(:272741003 :24028007)))";
    final SnomedOWLExpressionConverterResult owlRelationships = toSnomedOWLRelationships(referencedComponentId, owlExpression);
    return createBaseMember().referencedComponentId(referencedComponentId).refsetId(Concepts.REFSET_OWL_AXIOM).referenceSetType(SnomedRefSetType.OWL_AXIOM).field(Fields.OWL_EXPRESSION, owlExpression).classAxiomRelationships(owlRelationships.getClassAxiomRelationships()).gciAxiomRelationships(owlRelationships.getGciAxiomRelationships()).build();
}
Also used : SnomedOWLExpressionConverterResult(com.b2international.snowowl.snomed.datastore.request.SnomedOWLExpressionConverterResult)

Example 7 with SnomedOWLExpressionConverterResult

use of com.b2international.snowowl.snomed.datastore.request.SnomedOWLExpressionConverterResult in project snow-owl by b2ihealthcare.

the class SnomedRefSetMemberDocumentSerializationTest method indexOWLAxiomMember_ISA.

@Test
public void indexOWLAxiomMember_ISA() throws Exception {
    final String referencedComponentId = "410607006";
    final String owlExpression = "SubClassOf(:410607006 :138875005)";
    final SnomedOWLExpressionConverterResult owlRelationships = toSnomedOWLRelationships(referencedComponentId, owlExpression);
    final SnomedRefSetMemberIndexEntry member = createBaseMember().referencedComponentId(referencedComponentId).refsetId(Concepts.REFSET_OWL_AXIOM).referenceSetType(SnomedRefSetType.OWL_AXIOM).field(Fields.OWL_EXPRESSION, owlExpression).classAxiomRelationships(owlRelationships.getClassAxiomRelationships()).gciAxiomRelationships(owlRelationships.getGciAxiomRelationships()).build();
    indexRevision(RevisionBranch.MAIN_PATH, member);
    final SnomedRefSetMemberIndexEntry actual = getRevision(RevisionBranch.MAIN_PATH, SnomedRefSetMemberIndexEntry.class, member.getId());
    assertEquals(owlExpression, actual.getOwlExpression());
    assertEquals(ImmutableList.of(SnomedOWLRelationshipDocument.create(Concepts.IS_A, Concepts.ROOT_CONCEPT, 0)), actual.getClassAxiomRelationships());
    assertThat(actual.getGciAxiomRelationships()).isEmpty();
    assertDocEquals(member, actual);
}
Also used : SnomedOWLExpressionConverterResult(com.b2international.snowowl.snomed.datastore.request.SnomedOWLExpressionConverterResult) Test(org.junit.Test) BaseRevisionIndexTest(com.b2international.index.revision.BaseRevisionIndexTest)

Example 8 with SnomedOWLExpressionConverterResult

use of com.b2international.snowowl.snomed.datastore.request.SnomedOWLExpressionConverterResult in project snow-owl by b2ihealthcare.

the class SnomedRepositoryPreCommitHook method collectIds.

private void collectIds(Set<String> sourceIds, Set<String> destinationIds, SnomedRefSetMemberIndexEntry owlMember, SnomedOWLExpressionConverter expressionConverter) {
    final String memberId = owlMember.getId();
    final String referencedComponentId = owlMember.getReferencedComponentId();
    final String owlExpression = owlMember.getOwlExpression();
    SnomedOWLExpressionConverterResult result = expressionConverter.toSnomedOWLRelationships(referencedComponentId, owlExpression);
    if (!CompareUtils.isEmpty(result.getClassAxiomRelationships())) {
        for (SnomedOWLRelationshipDocument owlRelationship : result.getClassAxiomRelationships()) {
            if (Concepts.IS_A.equals(owlRelationship.getTypeId())) {
                // XXX: IS A relationships are expected to have a destination ID, not a value
                checkState(!owlRelationship.hasValue(), "IS A relationship found with value on OWL member: %s", memberId);
                sourceIds.add(referencedComponentId);
                destinationIds.add(owlRelationship.getDestinationId());
            }
        }
    }
}
Also used : SnomedOWLExpressionConverterResult(com.b2international.snowowl.snomed.datastore.request.SnomedOWLExpressionConverterResult)

Aggregations

SnomedOWLExpressionConverterResult (com.b2international.snowowl.snomed.datastore.request.SnomedOWLExpressionConverterResult)8 BaseRevisionIndexTest (com.b2international.index.revision.BaseRevisionIndexTest)3 Test (org.junit.Test)3 SnomedOWLExpressionConverter (com.b2international.snowowl.snomed.datastore.request.SnomedOWLExpressionConverter)2 LongCollection (com.b2international.collections.longs.LongCollection)1 LongCollections (com.b2international.collections.longs.LongCollections)1 LongIterator (com.b2international.collections.longs.LongIterator)1 CompareUtils (com.b2international.commons.CompareUtils)1 LongSets (com.b2international.commons.collect.LongSets)1 Hits (com.b2international.index.Hits)1 Expressions (com.b2international.index.query.Expressions)1 ExpressionBuilder (com.b2international.index.query.Expressions.ExpressionBuilder)1 Query (com.b2international.index.query.Query)1 RevisionSearcher (com.b2international.index.revision.RevisionSearcher)1 StagingArea (com.b2international.index.revision.StagingArea)1 RevisionPropertyDiff (com.b2international.index.revision.StagingArea.RevisionPropertyDiff)1 SnowowlRuntimeException (com.b2international.snowowl.core.api.SnowowlRuntimeException)1 IComponent (com.b2international.snowowl.core.domain.IComponent)1 Concepts (com.b2international.snowowl.snomed.common.SnomedConstants.Concepts)1 SnomedRefSetType (com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType)1