use of com.b2international.snowowl.snomed.core.domain.SnomedConcept in project snow-owl by b2ihealthcare.
the class SnomedMergeConflictTest method rebaseResolvableAxiomMemberConflict.
@Test
public void rebaseResolvableAxiomMemberConflict() throws Exception {
final String concept = createNewConcept(branchPath, Concepts.ROOT_CONCEPT);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
String axiomOnParent = createNewRefSetMember(branchPath, concept, Concepts.REFSET_OWL_AXIOM, Map.of(SnomedRf2Headers.FIELD_OWL_EXPRESSION, String.format("SubClassOf(:%s :%s)", concept, Concepts.TOPLEVEL_METADATA)));
String axiomOnChild = createNewRefSetMember(a, concept, Concepts.REFSET_OWL_AXIOM, Map.of(SnomedRf2Headers.FIELD_OWL_EXPRESSION, String.format("SubClassOf(:%s :%s)", concept, Concepts.TOPLEVEL_METADATA)));
merge(branchPath, a, "Rebase branch A").body("status", equalTo(Merge.Status.COMPLETED.name()));
getComponent(a, SnomedComponentType.MEMBER, axiomOnChild).statusCode(200);
getComponent(a, SnomedComponentType.MEMBER, axiomOnParent).statusCode(200);
SnomedConcept conceptOnChild = getComponent(a, SnomedComponentType.CONCEPT, concept).statusCode(200).extract().as(SnomedConcept.class);
assertThat(conceptOnChild.getStatedParentIdsAsString()).containsOnly(Concepts.ROOT_CONCEPT, Concepts.TOPLEVEL_METADATA);
assertThat(conceptOnChild.getParentIdsAsString()).containsOnly(IComponent.ROOT_ID);
assertThat(conceptOnChild.getStatedAncestorIdsAsString()).containsOnly(IComponent.ROOT_ID, Concepts.ROOT_CONCEPT);
assertThat(conceptOnChild.getAncestorIdsAsString()).isEmpty();
}
use of com.b2international.snowowl.snomed.core.domain.SnomedConcept in project snow-owl by b2ihealthcare.
the class SnomedMergeConflictTest method rebaseResolvableIsaRelationshipConflictSameDestination.
@Test
public void rebaseResolvableIsaRelationshipConflictSameDestination() throws Exception {
final String concept = createNewConcept(branchPath, Concepts.ROOT_CONCEPT);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
String relationshipOnParent = createNewRelationship(branchPath, concept, Concepts.IS_A, Concepts.TOPLEVEL_METADATA);
String relationshipOnChild = createNewRelationship(a, concept, Concepts.IS_A, Concepts.TOPLEVEL_METADATA);
merge(branchPath, a, "Rebase branch A").body("status", equalTo(Merge.Status.COMPLETED.name()));
getComponent(a, SnomedComponentType.RELATIONSHIP, relationshipOnChild).statusCode(200);
getComponent(a, SnomedComponentType.RELATIONSHIP, relationshipOnParent).statusCode(200);
SnomedConcept conceptOnChild = getComponent(a, SnomedComponentType.CONCEPT, concept).statusCode(200).extract().as(SnomedConcept.class);
assertThat(conceptOnChild.getStatedParentIdsAsString()).containsOnly(Concepts.ROOT_CONCEPT, Concepts.TOPLEVEL_METADATA);
assertThat(conceptOnChild.getParentIdsAsString()).containsOnly(IComponent.ROOT_ID);
assertThat(conceptOnChild.getStatedAncestorIdsAsString()).containsOnly(IComponent.ROOT_ID, Concepts.ROOT_CONCEPT);
assertThat(conceptOnChild.getAncestorIdsAsString()).isEmpty();
}
use of com.b2international.snowowl.snomed.core.domain.SnomedConcept in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method mergeNewConceptForwardWithChildBranchDelete.
@Test
public void mergeNewConceptForwardWithChildBranchDelete() {
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
final String conceptId = createNewConcept(a);
merge(a, branchPath, "Merged new concept from child branch").body("status", equalTo(Merge.Status.COMPLETED.name()));
branching.deleteBranch(a).statusCode(204);
// getComponent(a, SnomedComponentType.CONCEPT, conceptId).statusCode(404);
SnomedConcept concept = getConcept(conceptId, "descriptions(),relationships()");
assertFalse(concept.getDescriptions().isEmpty());
assertFalse(concept.getRelationships().isEmpty());
}
use of com.b2international.snowowl.snomed.core.domain.SnomedConcept in project snow-owl by b2ihealthcare.
the class SnomedRelationshipConverter method expandType.
private void expandType(List<SnomedRelationship> results) {
if (expand().containsKey(SnomedRelationship.Expand.TYPE)) {
final Options typeOptions = expand().get(SnomedRelationship.Expand.TYPE, Options.class);
final Iterable<String> typeConceptIds = FluentIterable.from(results).transform(SnomedRelationship::getTypeId);
context().service(SnomedConceptRequestCache.class).request(typeConceptIds, typeOptions.getOptions("expand"), locales(), typeConceptsById -> {
for (SnomedRelationship relationship : results) {
final String typeId = relationship.getTypeId();
if (typeConceptsById.containsKey(typeId)) {
final SnomedConcept typeConcept = typeConceptsById.get(typeId);
((SnomedRelationship) relationship).setType(typeConcept);
}
}
});
}
}
use of com.b2international.snowowl.snomed.core.domain.SnomedConcept in project snow-owl by b2ihealthcare.
the class SnomedRelationshipConverter method expandSource.
private void expandSource(List<SnomedRelationship> results) {
if (expand().containsKey(SnomedRelationship.Expand.SOURCE)) {
final Options sourceOptions = expand().get(SnomedRelationship.Expand.SOURCE, Options.class);
final Iterable<String> sourceConceptIds = FluentIterable.from(results).transform(SnomedRelationship::getSourceId);
context().service(SnomedConceptRequestCache.class).request(sourceConceptIds, sourceOptions.getOptions("expand"), locales(), sourceConceptsById -> {
for (SnomedRelationship relationship : results) {
final String sourceId = relationship.getSourceId();
if (sourceConceptsById.containsKey(sourceId)) {
final SnomedConcept sourceConcept = sourceConceptsById.get(sourceId);
((SnomedRelationship) relationship).setSource(sourceConcept);
}
}
});
}
}
Aggregations