Search in sources :

Example 76 with SnomedConcept

use of com.b2international.snowowl.snomed.core.domain.SnomedConcept in project snow-owl by b2ihealthcare.

the class Rf2ComplexMapRefSetContentType method resolve.

@Override
public void resolve(SnomedReferenceSetMember component, String[] values) {
    component.setType(SnomedRefSetType.COMPLEX_MAP);
    component.setRefsetId(values[4]);
    // XXX actual type is not relevant here
    component.setReferencedComponent(new SnomedConcept(values[5]));
    component.setProperties(ImmutableMap.<String, Object>builder().put(FIELD_MAP_GROUP, Integer.parseInt(values[6])).put(FIELD_MAP_PRIORITY, Integer.parseInt(values[7])).put(FIELD_MAP_RULE, values[8]).put(FIELD_MAP_ADVICE, values[9]).put(FIELD_MAP_TARGET, values[10]).put(FIELD_CORRELATION_ID, values[11]).build());
}
Also used : SnomedConcept(com.b2international.snowowl.snomed.core.domain.SnomedConcept)

Example 77 with SnomedConcept

use of com.b2international.snowowl.snomed.core.domain.SnomedConcept in project snow-owl by b2ihealthcare.

the class Rf2ComplexBlockMapRefSetContentType method resolve.

@Override
public void resolve(SnomedReferenceSetMember component, String[] values) {
    component.setType(SnomedRefSetType.COMPLEX_BLOCK_MAP);
    component.setRefsetId(values[4]);
    // XXX actual type is not relevant here
    component.setReferencedComponent(new SnomedConcept(values[5]));
    component.setProperties(ImmutableMap.<String, Object>builder().put(FIELD_MAP_GROUP, Integer.parseInt(values[6])).put(FIELD_MAP_PRIORITY, Integer.parseInt(values[7])).put(FIELD_MAP_RULE, values[8]).put(FIELD_MAP_ADVICE, values[9]).put(FIELD_MAP_TARGET, values[10]).put(FIELD_CORRELATION_ID, values[11]).put(FIELD_MAP_BLOCK, Integer.parseInt(values[12])).build());
}
Also used : SnomedConcept(com.b2international.snowowl.snomed.core.domain.SnomedConcept)

Example 78 with SnomedConcept

use of com.b2international.snowowl.snomed.core.domain.SnomedConcept in project snow-owl by b2ihealthcare.

the class Rf2DescriptionTypeRefSetContentType method resolve.

@Override
public void resolve(SnomedReferenceSetMember component, String[] values) {
    component.setType(SnomedRefSetType.DESCRIPTION_TYPE);
    component.setRefsetId(values[4]);
    // XXX actual type is not relevant here
    component.setReferencedComponent(new SnomedConcept(values[5]));
    component.setProperties(ImmutableMap.<String, Object>of(SnomedRf2Headers.FIELD_DESCRIPTION_FORMAT, values[6], SnomedRf2Headers.FIELD_DESCRIPTION_LENGTH, Integer.parseInt(values[7])));
}
Also used : SnomedConcept(com.b2international.snowowl.snomed.core.domain.SnomedConcept)

Example 79 with SnomedConcept

use of com.b2international.snowowl.snomed.core.domain.SnomedConcept in project snow-owl by b2ihealthcare.

the class SnomedClassificationApiTest method issue_SO_1830_testInferredEquivalentConceptParents.

@Test
public void issue_SO_1830_testInferredEquivalentConceptParents() throws Exception {
    String parentConceptId = createNewConcept(branchPath);
    String childConceptId = createNewConcept(branchPath, parentConceptId);
    String equivalentConceptId = createNewConcept(branchPath, parentConceptId);
    changeToDefining(branchPath, equivalentConceptId);
    String classificationId = getClassificationJobId(beginClassification(branchPath));
    waitForClassificationJob(branchPath, classificationId).statusCode(200).body("status", equalTo(ClassificationStatus.COMPLETED.name()));
    /* 
		 * Expecting that childConceptId will get two inferred IS A-s pointing to parentConceptId and equivalentConceptId, respectively, 
		 * while parentConceptId and equivalentConceptId each will get a single inferred IS A pointing to the root concept.
		 */
    RelationshipChanges changes = MAPPER.readValue(getRelationshipChanges(branchPath, classificationId).statusCode(200).extract().asInputStream(), RelationshipChanges.class);
    FluentIterable<RelationshipChange> changesIterable = FluentIterable.from(changes.getItems());
    assertEquals(4, changes.getTotal());
    assertTrue("All changes should be inferred.", changesIterable.allMatch(relationshipChange -> ChangeNature.NEW.equals(relationshipChange.getChangeNature())));
    assertInferredIsAExists(changesIterable, childConceptId, parentConceptId);
    assertInferredIsAExists(changesIterable, childConceptId, equivalentConceptId);
    assertInferredIsAExists(changesIterable, parentConceptId, Concepts.ROOT_CONCEPT);
    assertInferredIsAExists(changesIterable, equivalentConceptId, Concepts.ROOT_CONCEPT);
    EquivalentConceptSets equivalentConceptSets = MAPPER.readValue(getEquivalentConceptSets(branchPath, classificationId).statusCode(200).extract().asInputStream(), EquivalentConceptSets.class);
    assertEquals(1, equivalentConceptSets.getItems().size());
    SnomedConcepts equivalentConceptsInFirstSet = equivalentConceptSets.first().get().getEquivalentConcepts();
    FluentIterable<SnomedConcept> equivalentConceptsIterable = FluentIterable.from(equivalentConceptsInFirstSet);
    assertEquals(2, equivalentConceptsInFirstSet.getTotal());
    assertEquivalentConceptPresent(equivalentConceptsIterable, parentConceptId);
    assertEquivalentConceptPresent(equivalentConceptsIterable, equivalentConceptId);
}
Also used : CodeSystemVersionRestRequests.getNextAvailableEffectiveDate(com.b2international.snowowl.test.commons.codesystem.CodeSystemVersionRestRequests.getNextAvailableEffectiveDate) SnomedConcept(com.b2international.snowowl.snomed.core.domain.SnomedConcept) RestExtensions.assertCreated(com.b2international.snowowl.test.commons.rest.RestExtensions.assertCreated) CoreMatchers.anyOf(org.hamcrest.CoreMatchers.anyOf) Iterables(com.google.common.collect.Iterables) CodeSystemVersionRestRequests.createVersion(com.b2international.snowowl.test.commons.codesystem.CodeSystemVersionRestRequests.createVersion) CoreMatchers.equalTo(org.hamcrest.CoreMatchers.equalTo) com.b2international.snowowl.snomed.reasoner.domain(com.b2international.snowowl.snomed.reasoner.domain) Multimap(com.google.common.collect.Multimap) SnomedRestFixtures(com.b2international.snowowl.snomed.core.rest.SnomedRestFixtures) Concepts(com.b2international.snowowl.snomed.common.SnomedConstants.Concepts) SnomedComponentType(com.b2international.snowowl.snomed.core.rest.SnomedComponentType) Multimaps(com.google.common.collect.Multimaps) SnomedComponentRestRequests.getComponent(com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.getComponent) BigDecimal(java.math.BigDecimal) FluentIterable(com.google.common.collect.FluentIterable) Map(java.util.Map) SnomedComponentRestRequests.createComponent(com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.createComponent) RelationshipValue(com.b2international.snowowl.snomed.core.domain.RelationshipValue) Collection(java.util.Collection) SnomedConcepts(com.b2international.snowowl.snomed.core.domain.SnomedConcepts) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Assert.assertTrue(org.junit.Assert.assertTrue) JsonSupport(com.b2international.snowowl.core.repository.JsonSupport) Test(org.junit.Test) CodeSystemRestRequests.createCodeSystem(com.b2international.snowowl.test.commons.codesystem.CodeSystemRestRequests.createCodeSystem) SnomedClassificationRestRequests(com.b2international.snowowl.snomed.core.rest.SnomedClassificationRestRequests) List(java.util.List) Assert.assertFalse(org.junit.Assert.assertFalse) LocalDate(java.time.LocalDate) SnomedRf2Headers(com.b2international.snowowl.snomed.common.SnomedRf2Headers) IBranchPath(com.b2international.snowowl.core.api.IBranchPath) Assert.assertEquals(org.junit.Assert.assertEquals) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest) InputStream(java.io.InputStream) SnomedConcepts(com.b2international.snowowl.snomed.core.domain.SnomedConcepts) SnomedConcept(com.b2international.snowowl.snomed.core.domain.SnomedConcept) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 80 with SnomedConcept

use of com.b2international.snowowl.snomed.core.domain.SnomedConcept in project snow-owl by b2ihealthcare.

the class SnomedExpressionLabelTest method getEcl.

@Test
public void getEcl() throws Exception {
    String conceptId = createNewConcept(branchPath);
    String shortName = "SNOMEDCT-Test";
    createCodeSystem(branchPath, shortName).statusCode(201);
    List<String> expressionLabels = getExpressionLabels(branchPath.getPath(), List.of(conceptId));
    SnomedConcept concept = getConcept(conceptId, "fsn()");
    String validExpression = conceptId + " |" + concept.getFsn().getTerm() + "|";
    Assertions.assertThat(expressionLabels).containsOnly(validExpression);
}
Also used : SnomedConcept(com.b2international.snowowl.snomed.core.domain.SnomedConcept) Test(org.junit.Test)

Aggregations

SnomedConcept (com.b2international.snowowl.snomed.core.domain.SnomedConcept)90 Test (org.junit.Test)42 AbstractSnomedApiTest (com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)17 CodeSystem (com.b2international.snowowl.core.codesystem.CodeSystem)15 SnomedDescription (com.b2international.snowowl.snomed.core.domain.SnomedDescription)15 LocalDate (java.time.LocalDate)15 IBranchPath (com.b2international.snowowl.core.api.IBranchPath)12 SnomedConcepts (com.b2international.snowowl.snomed.core.domain.SnomedConcepts)12 Options (com.b2international.commons.options.Options)10 SnomedRelationship (com.b2international.snowowl.snomed.core.domain.SnomedRelationship)10 Concepts (com.b2international.snowowl.snomed.common.SnomedConstants.Concepts)9 ExtendedLocale (com.b2international.commons.http.ExtendedLocale)8 SnomedReferenceSetMember (com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember)8 CodeSystemRestRequests.createCodeSystem (com.b2international.snowowl.test.commons.codesystem.CodeSystemRestRequests.createCodeSystem)8 List (java.util.List)8 Map (java.util.Map)8 Collectors (java.util.stream.Collectors)8 Json (com.b2international.commons.json.Json)7 SnomedRf2Headers (com.b2international.snowowl.snomed.common.SnomedRf2Headers)7 SnomedRequests (com.b2international.snowowl.snomed.datastore.request.SnomedRequests)5