Skip to content

Commit

Permalink
fix(snomed): properly delegate expand keys to the expander methods...
Browse files Browse the repository at this point in the history
...when expanding type and destination for owlRelationships.

Fixes https://snowowl.atlassian.net/browse/SO-6169
  • Loading branch information
cmark committed Jun 24, 2024
1 parent d1f466f commit 3da86f8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2011-2023 B2i Healthcare, https://b2ihealthcare.com
* Copyright 2011-2024 B2i Healthcare, https://b2ihealthcare.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,6 +55,7 @@
import com.b2international.snowowl.core.request.CommitResult;
import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts;
import com.b2international.snowowl.snomed.common.SnomedRf2Headers;
import com.b2international.snowowl.snomed.core.domain.SnomedConcept;
import com.b2international.snowowl.snomed.core.domain.refset.*;
import com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest;
import com.b2international.snowowl.snomed.core.rest.SnomedApiTestConstants;
Expand Down Expand Up @@ -425,7 +426,7 @@ public void updateOwlAxiomRefsetMembers() {
String memberId = assertCreated(createComponent(branchPath, SnomedComponentType.MEMBER, createRequestBody));

final SnomedReferenceSetMember member = SnomedRequests.prepareGetMember(memberId)
.setExpand("owlRelationships()")
.setExpand("owlRelationships(expand(type(),destination()))")
.build(branchPath.getPath())
.execute(getBus())
.getSync();
Expand All @@ -436,6 +437,17 @@ public void updateOwlAxiomRefsetMembers() {
SnomedOWLRelationship.create("734136001", "900000000000470007", 1)
);

// successful expansion check
assertThat(member.getClassOWLRelationships())
.extracting(SnomedOWLRelationship::getType)
.extracting(SnomedConcept::isActive)
.containsOnly(true);

assertThat(member.getClassOWLRelationships())
.extracting(SnomedOWLRelationship::getDestination)
.extracting(SnomedConcept::isActive)
.containsOnly(true);

final Json updateRequestBody = Json.object(
SnomedRf2Headers.FIELD_OWL_EXPRESSION, SnomedApiTestConstants.owlAxiom4(conceptId),
"commitComment", "Update OWL Axiom reference set member"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ protected SnomedReferenceSetMember toResource(SnomedRefSetMemberIndexEntry entry
expand().containsKey(SnomedReferenceSetMember.Expand.OWL_RELATIONSHIPS) &&
!Strings.isNullOrEmpty(owlExpression)) {

Options expandOptions = expand().getOptions(SnomedReferenceSetMember.Expand.OWL_RELATIONSHIPS);
Options expandOptions = expand().getOptions(SnomedReferenceSetMember.Expand.OWL_RELATIONSHIPS).getOptions("expand");

if (!CompareUtils.isEmpty(entry.getClassAxiomRelationships())) {
if (owlExpression.startsWith("EquivalentClasses")) {
Expand Down

0 comments on commit 3da86f8

Please sign in to comment.