Search in sources :

Example 6 with Expression

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

the class SnomedEclShortcutTest method queryOrAll.

@Test
public void queryOrAll() throws Exception {
    final Expression actual = eval(ROOT_ID + " OR *");
    final Expression expected = Expressions.matchAll();
    assertEquals(expected, actual);
}
Also used : Expression(com.b2international.index.query.Expression) Test(org.junit.Test) BaseRevisionIndexTest(com.b2international.index.revision.BaseRevisionIndexTest)

Example 7 with Expression

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

the class SnomedEclShortcutTest method idsOnlyOrExpression.

@Test
public void idsOnlyOrExpression() throws Exception {
    final Set<String> ids = ImmutableSet.of(ROOT_ID, Concepts.ABBREVIATION, Concepts.ACCEPTABILITY, Concepts.AMBIGUOUS);
    final Expression actual = eval(Ecl.or(ids));
    final Expression expected = SnomedConceptDocument.Expressions.ids(ids);
    assertEquals(expected, actual);
}
Also used : Expression(com.b2international.index.query.Expression) Test(org.junit.Test) BaseRevisionIndexTest(com.b2international.index.revision.BaseRevisionIndexTest)

Example 8 with Expression

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

the class SnomedStatedEclEvaluationTest method statedRefinementWithZeroToOneCardinalityInAttributeConjuction.

@Test
public void statedRefinementWithZeroToOneCardinalityInAttributeConjuction() throws Exception {
    generateTestHierarchy();
    final Expression actual = eval(String.format("<<%s:[1..*]{[0..1]%s=<<%s}", ROOT_CONCEPT, HAS_ACTIVE_INGREDIENT, SUBSTANCE));
    final Expression expected = and(descendantsOrSelfOf(ROOT_CONCEPT), ids(ImmutableSet.of(STATED_CONCEPT)));
    assertEquals(expected, actual);
}
Also used : Expression(com.b2international.index.query.Expression) Test(org.junit.Test) BaseRevisionIndexTest(com.b2international.index.revision.BaseRevisionIndexTest)

Example 9 with Expression

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

the class SnomedEclEvaluationRequestPropertyFilterTest method dialectAnyAcceptabilityNotEquals.

@Test
public void dialectAnyAcceptabilityNotEquals() throws Exception {
    generatePreferredDescription(Concepts.ROOT_CONCEPT);
    generateAcceptableDescription(Concepts.MODULE_ROOT);
    Expression actual = eval("* {{ dialect != en-gb }}");
    Expression expected = SnomedDocument.Expressions.ids(Set.of());
    assertEquals(expected, actual);
}
Also used : Expression(com.b2international.index.query.Expression) Test(org.junit.Test)

Example 10 with Expression

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

the class SnomedEclEvaluationRequestPropertyFilterTest method dialectIdPreferredNotEquals.

@Test
public void dialectIdPreferredNotEquals() 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("* {{ dialectId != " + Concepts.REFSET_LANGUAGE_TYPE_UK + " (prefer) }}");
    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)

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