Search in sources :

Example 56 with Expression

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

the class SnomedEclEvaluationRequestPropertyFilterTest method dialectPreferred.

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

Example 57 with Expression

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

the class SnomedEclEvaluationRequestPropertyFilterTest method inactiveOnly.

@Test
public void inactiveOnly() throws Exception {
    final Expression actual = eval("* {{ c active=false }}");
    final Expression expected = SnomedDocument.Expressions.inactive();
    assertEquals(expected, actual);
}
Also used : Expression(com.b2international.index.query.Expression) Test(org.junit.Test)

Example 58 with Expression

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

the class SnomedEclEvaluationRequestPropertyFilterTest method multiDomainQueryOr.

@Test
public void multiDomainQueryOr() throws Exception {
    Expression actual = eval("* {{ c active=false }} OR * {{ d term=\"clin find\" }}");
    Expression expected = Expressions.builder().should(SnomedDocument.Expressions.inactive()).should(SnomedDocument.Expressions.ids(Collections.emptySet())).build();
    assertEquals(expected, actual);
}
Also used : Expression(com.b2international.index.query.Expression) Test(org.junit.Test)

Example 59 with Expression

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

the class SnomedEclEvaluationRequestPropertyFilterTest method languageRefSet.

@Test
public void languageRefSet() 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).preferredIn(Set.of(Concepts.REFSET_LANGUAGE_TYPE_UK)).acceptableIn(Set.of(Concepts.REFSET_LANGUAGE_TYPE_US)).build());
    indexRevision(MAIN, SnomedDescriptionIndexEntry.builder().id(generateDescriptionId()).active(true).moduleId(Concepts.MODULE_SCT_CORE).term("Clinical finding").conceptId(Concepts.SUBSTANCE).typeId(Concepts.TEXT_DEFINITION).preferredIn(Set.of(Concepts.REFSET_LANGUAGE_TYPE_US)).acceptableIn(Set.of(Concepts.REFSET_LANGUAGE_TYPE_UK)).build());
    final Expression actual = eval("* {{ languageRefSetId = " + Concepts.REFSET_LANGUAGE_TYPE_UK + " }}");
    final Expression expected = SnomedDocument.Expressions.ids(Set.of(Concepts.ROOT_CONCEPT, Concepts.SUBSTANCE));
    assertEquals(expected, actual);
}
Also used : Expression(com.b2international.index.query.Expression) Test(org.junit.Test)

Example 60 with Expression

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

the class SnomedEclEvaluationRequestPropertyFilterTest method activeOnly.

@Test
public void activeOnly() throws Exception {
    final Expression actual = eval("* {{ c active=true }}");
    final Expression expected = SnomedDocument.Expressions.active();
    assertEquals(expected, actual);
}
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