Search in sources :

Example 61 with Expression

use of com.b2international.index.query.Expression in project snow-owl by b2ihealthcare.

the class SnomedEclEvaluationRequestPropertyFilterTest method dialectAcceptableNotEquals.

@Test
public void dialectAcceptableNotEquals() throws Exception {
    generateAcceptableDescription(Concepts.ROOT_CONCEPT);
    // extra preferred description on another concept to demonstrate that it won't match
    generatePreferredDescription(Concepts.MODULE_ROOT);
    Expression actual = eval("* {{ dialect != en-gb (accept) }}");
    Expression expected = SnomedDocument.Expressions.ids(Set.of(Concepts.MODULE_ROOT));
    assertEquals(expected, actual);
}
Also used : Expression(com.b2international.index.query.Expression) Test(org.junit.Test)

Example 62 with Expression

use of com.b2international.index.query.Expression in project snow-owl by b2ihealthcare.

the class SnomedEclEvaluationRequestPropertyFilterTest method dialectUnknownAlias.

@Test
public void dialectUnknownAlias() throws Exception {
    indexRevision(MAIN, SnomedDescriptionIndexEntry.builder().id(generateDescriptionId()).active(true).moduleId(Concepts.MODULE_SCT_CORE).term("Clinical finding").conceptId(Concepts.ROOT_CONCEPT).typeId(Concepts.TEXT_DEFINITION).languageCode("en").caseSignificanceId(Concepts.ENTIRE_TERM_CASE_INSENSITIVE).acceptabilityMap(Map.of(Concepts.REFSET_LANGUAGE_TYPE_SG, Acceptability.ACCEPTABLE)).build());
    Expression actual = eval("* {{ dialect = en-sg }}");
    Expression expected = SnomedDocument.Expressions.ids(Set.of());
    assertEquals(expected, actual);
}
Also used : Expression(com.b2international.index.query.Expression) Test(org.junit.Test)

Example 63 with Expression

use of com.b2international.index.query.Expression in project snow-owl by b2ihealthcare.

the class SnomedEclEvaluationRequestPropertyFilterTest method definitionStatus.

@Test
public void definitionStatus() throws Exception {
    Expression actual1 = eval("* {{ c definitionStatusId = 900000000000073002 }}");
    Expression actual2 = eval("* {{ c definitionStatus = defined }}");
    Expression expected = SnomedConceptDocument.Expressions.definitionStatusIds(Set.of(Concepts.FULLY_DEFINED));
    assertEquals(expected, actual1);
    assertEquals(expected, actual2);
}
Also used : Expression(com.b2international.index.query.Expression) Test(org.junit.Test)

Example 64 with Expression

use of com.b2international.index.query.Expression in project snow-owl by b2ihealthcare.

the class SnomedEclEvaluationRequestPropertyFilterTest method termDisjunction.

@Test
public void termDisjunction() throws Exception {
    indexRevision(MAIN, SnomedDescriptionIndexEntry.builder().id(generateDescriptionId()).active(true).moduleId(Concepts.MODULE_SCT_CORE).term("Compressed natural gas").conceptId(Concepts.ROOT_CONCEPT).typeId(Concepts.SYNONYM).build());
    indexRevision(MAIN, SnomedDescriptionIndexEntry.builder().id(generateDescriptionId()).active(true).moduleId(Concepts.MODULE_SCT_CORE).term("Endocarditis").conceptId(Concepts.MODULE_SCT_CORE).typeId(Concepts.SYNONYM).build());
    final Expression actual = eval("* {{ term = (match:\"gas\" wild:\"*itis\")}}");
    final Expression expected = SnomedDocument.Expressions.ids(List.of(Concepts.ROOT_CONCEPT, Concepts.MODULE_SCT_CORE));
    assertEquals(expected, actual);
}
Also used : Expression(com.b2international.index.query.Expression) Test(org.junit.Test)

Example 65 with Expression

use of com.b2international.index.query.Expression in project snow-owl by b2ihealthcare.

the class SnomedEclEvaluationRequestPropertyFilterTest method definitionStatusNotEquals.

@Test
public void definitionStatusNotEquals() throws Exception {
    Expression actual1 = eval("* {{ c definitionStatusId != 900000000000074008 }}");
    Expression actual2 = eval("* {{ c definitionStatus != primitive }}");
    Expression expected = Expressions.builder().mustNot(SnomedConceptDocument.Expressions.definitionStatusIds(Set.of(Concepts.PRIMITIVE))).build();
    assertEquals(expected, actual1);
    assertEquals(expected, actual2);
}
Also used : Expression(com.b2international.index.query.Expression) Test(org.junit.Test)

Aggregations

Expression (com.b2international.index.query.Expression)151 Test (org.junit.Test)142 BaseRevisionIndexTest (com.b2international.index.revision.BaseRevisionIndexTest)8 Ignore (org.junit.Ignore)5 Expressions (com.b2international.index.query.Expressions)2 ExpressionBuilder (com.b2international.index.query.Expressions.ExpressionBuilder)2 RevisionData (com.b2international.index.revision.RevisionFixtures.RevisionData)2 RevisionSearcher (com.b2international.index.revision.RevisionSearcher)2 BranchContext (com.b2international.snowowl.core.domain.BranchContext)2 Options (com.b2international.commons.options.Options)1 BulkUpdate (com.b2international.index.BulkUpdate)1 Searcher (com.b2international.index.Searcher)1 Query (com.b2international.index.query.Query)1 RangeData (com.b2international.index.revision.RevisionFixtures.RangeData)1 Ecl (com.b2international.snomed.ecl.Ecl)1 Any (com.b2international.snomed.ecl.ecl.Any)1 EclConceptReference (com.b2international.snomed.ecl.ecl.EclConceptReference)1 ExpressionConstraint (com.b2international.snomed.ecl.ecl.ExpressionConstraint)1 NestedExpression (com.b2international.snomed.ecl.ecl.NestedExpression)1 ResourceURI (com.b2international.snowowl.core.ResourceURI)1