use of com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember in project snow-owl by b2ihealthcare.
the class SnomedRefSetMemberApiTest method createAndUpdateNewModuleDependencyMembers.
@Test
public void createAndUpdateNewModuleDependencyMembers() {
Json requestBody = createRefSetMemberRequestBody(Concepts.REFSET_MODULE_DEPENDENCY_TYPE, Concepts.MODULE_SCT_MODEL_COMPONENT).with("commitComment", "Created new module dependency reference set member");
String memberId = assertCreated(createComponent(branchPath, SnomedComponentType.MEMBER, requestBody));
SnomedReferenceSetMember member = getComponent(branchPath, SnomedComponentType.MEMBER, memberId).statusCode(200).extract().as(SnomedReferenceSetMember.class);
assertNull(member.getProperties().get(SnomedRf2Headers.FIELD_SOURCE_EFFECTIVE_TIME));
assertNull(member.getProperties().get(SnomedRf2Headers.FIELD_TARGET_EFFECTIVE_TIME));
Json updateRequest = Json.object(SnomedRf2Headers.FIELD_SOURCE_EFFECTIVE_TIME, "20181002", SnomedRf2Headers.FIELD_TARGET_EFFECTIVE_TIME, "20181002", "commitComment", "Updated reference set member");
updateRefSetComponent(branchPath, SnomedComponentType.MEMBER, memberId, updateRequest, false).statusCode(204);
SnomedReferenceSetMember updatedMember = getComponent(branchPath, SnomedComponentType.MEMBER, memberId).statusCode(200).extract().as(SnomedReferenceSetMember.class);
assertEquals(EffectiveTimes.parse("20181002", DateFormats.SHORT), updatedMember.getProperties().get(SnomedRf2Headers.FIELD_SOURCE_EFFECTIVE_TIME));
assertEquals(EffectiveTimes.parse("20181002", DateFormats.SHORT), updatedMember.getProperties().get(SnomedRf2Headers.FIELD_TARGET_EFFECTIVE_TIME));
}
use of com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember in project snow-owl by b2ihealthcare.
the class SnomedRefSetMemberApiTest method searchOWLAxiomRefsetMemberBySourceTypeDestination.
@Test
public void searchOWLAxiomRefsetMemberBySourceTypeDestination() {
String conceptId = createNewConcept(branchPath);
Json requestBody = createRefSetMemberRequestBody(Concepts.REFSET_OWL_AXIOM, conceptId).with(SnomedRf2Headers.FIELD_OWL_EXPRESSION, "SubClassOf(:" + conceptId + " :" + Concepts.NAMESPACE_ROOT + ")").with("commitComment", "Created new OWL Axiom reference set member");
String memberId = assertCreated(createComponent(branchPath, SnomedComponentType.MEMBER, requestBody));
SnomedReferenceSetMembers results = givenAuthenticatedRequest(SnomedApiTestConstants.SCT_API).queryParam("referencedComponentId", conceptId).queryParam("owlExpression.typeId", Concepts.IS_A).queryParam("owlExpression.destinationId", Concepts.NAMESPACE_ROOT).get("/{path}/members", branchPath.getPath()).then().extract().as(SnomedReferenceSetMembers.class);
assertEquals(1, results.getItems().size());
SnomedReferenceSetMember member = results.getItems().stream().findFirst().get();
assertEquals(memberId, member.getId());
}
use of com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember in project snow-owl by b2ihealthcare.
the class SnomedRefSetMemberApiTest method createAndUpdateUnpublishedModuleDependencyMembers.
@Test
public void createAndUpdateUnpublishedModuleDependencyMembers() {
Json requestBody = createRefSetMemberRequestBody(Concepts.REFSET_MODULE_DEPENDENCY_TYPE, Concepts.MODULE_SCT_MODEL_COMPONENT).with(SnomedRf2Headers.FIELD_SOURCE_EFFECTIVE_TIME, "").with(SnomedRf2Headers.FIELD_TARGET_EFFECTIVE_TIME, "").with("commitComment", "Created new module dependency reference set member");
String memberId = assertCreated(createComponent(branchPath, SnomedComponentType.MEMBER, requestBody));
SnomedReferenceSetMember member = getComponent(branchPath, SnomedComponentType.MEMBER, memberId).statusCode(200).extract().as(SnomedReferenceSetMember.class);
assertNull(member.getProperties().get(SnomedRf2Headers.FIELD_SOURCE_EFFECTIVE_TIME));
assertNull(member.getProperties().get(SnomedRf2Headers.FIELD_TARGET_EFFECTIVE_TIME));
Json updateRequest = Json.object(SnomedRf2Headers.FIELD_SOURCE_EFFECTIVE_TIME, "20181002", SnomedRf2Headers.FIELD_TARGET_EFFECTIVE_TIME, "20181002", "commitComment", "Updated reference set member");
updateRefSetComponent(branchPath, SnomedComponentType.MEMBER, memberId, updateRequest, false).statusCode(204);
SnomedReferenceSetMember updatedMember = getComponent(branchPath, SnomedComponentType.MEMBER, memberId).statusCode(200).extract().as(SnomedReferenceSetMember.class);
assertEquals(EffectiveTimes.parse("20181002", DateFormats.SHORT), updatedMember.getProperties().get(SnomedRf2Headers.FIELD_SOURCE_EFFECTIVE_TIME));
assertEquals(EffectiveTimes.parse("20181002", DateFormats.SHORT), updatedMember.getProperties().get(SnomedRf2Headers.FIELD_TARGET_EFFECTIVE_TIME));
}
use of com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember in project snow-owl by b2ihealthcare.
the class SnomedConceptApiTest method testUpdateConceptDefinitionStatusWithSubClassOfAxiomMemberShouldChangeToPrimitive.
@Test
public void testUpdateConceptDefinitionStatusWithSubClassOfAxiomMemberShouldChangeToPrimitive() {
final String conceptId = createNewConcept(branchPath);
// Update the definition status on concept
final Map<?, ?> definitionStatusUpdateRequestBody = Json.object("definitionStatusId", Concepts.FULLY_DEFINED, "commitComment", "Changed definition status of concept to fully defined");
updateComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, definitionStatusUpdateRequestBody).statusCode(204);
// Add a reference set member
final SnomedReferenceSetMember newMember = new SnomedReferenceSetMember();
newMember.setId(UUID.randomUUID().toString());
newMember.setActive(true);
newMember.setRefsetId(Concepts.REFSET_OWL_AXIOM);
newMember.setProperties(Json.object(SnomedRf2Headers.FIELD_OWL_EXPRESSION, String.format("SubClassOf(:%s :%s)", conceptId, Concepts.AMBIGUOUS)));
newMember.setType(SnomedRefSetType.OWL_AXIOM);
newMember.setModuleId(Concepts.MODULE_SCT_CORE);
final Json updateRequestBody = Json.object("members", SnomedReferenceSetMembers.of(Json.array(newMember)), "commitComment", "Add new reference set member via concept update");
updateComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, updateRequestBody).statusCode(204);
final SnomedConcept updatedConcept = getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, "members()").statusCode(200).extract().as(SnomedConcept.class);
assertEquals(1, updatedConcept.getMembers().getTotal());
// Verify that definition status was updated to FULLY DEFINED
assertEquals(Concepts.PRIMITIVE, updatedConcept.getDefinitionStatusId());
}
use of com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember in project snow-owl by b2ihealthcare.
the class SnomedConceptApiTest method testUpdateConceptDefinitionStatusWithEquivalentClassesAxiomMember.
@Test
public void testUpdateConceptDefinitionStatusWithEquivalentClassesAxiomMember() {
final String conceptId = createNewConcept(branchPath);
// Add a reference set member
final SnomedReferenceSetMember newMember = new SnomedReferenceSetMember();
newMember.setId(UUID.randomUUID().toString());
newMember.setActive(true);
newMember.setRefsetId(Concepts.REFSET_OWL_AXIOM);
newMember.setProperties(Json.object(SnomedRf2Headers.FIELD_OWL_EXPRESSION, String.format("EquivalentClasses(:%s ObjectIntersectionOf(:%s :%s))", conceptId, Concepts.AMBIGUOUS, Concepts.NAMESPACE_ROOT)));
newMember.setType(SnomedRefSetType.OWL_AXIOM);
newMember.setModuleId(Concepts.MODULE_SCT_CORE);
final Map<?, ?> updateRequestBody = Json.object("members", SnomedReferenceSetMembers.of(Json.array(newMember)), "commitComment", "Add new reference set member via concept update");
updateComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, updateRequestBody).statusCode(204);
final SnomedConcept updatedConcept = getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, "members()").statusCode(200).extract().as(SnomedConcept.class);
assertEquals(1, updatedConcept.getMembers().getTotal());
// Verify that definition status was updated to FULLY DEFINED
assertEquals(Concepts.FULLY_DEFINED, updatedConcept.getDefinitionStatusId());
}
Aggregations