use of com.b2international.index.query.Expression in project snow-owl by b2ihealthcare.
the class SnomedEclEvaluationRequestTest method refinementGroupCardinalityZeroToZero.
@Test
public void refinementGroupCardinalityZeroToZero() throws Exception {
generateDrugsWithGroups();
final Expression actual = eval(String.format("<%s: [0..0] {%s=<%s}", DRUG_ROOT, HAS_ACTIVE_INGREDIENT, SUBSTANCE));
final Expression expected = Expressions.builder().filter(descendantsOf(DRUG_ROOT)).mustNot(ids(Set.of(ASPIRIN_TABLET, ALGOFLEX_TABLET, TRIPLEX_TABLET))).build();
assertEquals(expected, actual);
}
use of com.b2international.index.query.Expression in project snow-owl by b2ihealthcare.
the class SnomedEclEvaluationRequestTest method refinementCardinalityExactlyOne.
@Test
public void refinementCardinalityExactlyOne() throws Exception {
generateDrugHierarchy();
final Expression actual = eval(String.format("<%s: [1..1] %s=<%s", DRUG_ROOT, HAS_ACTIVE_INGREDIENT, SUBSTANCE));
final Expression expected = and(descendantsOf(DRUG_ROOT), ids(Collections.singleton(PANADOL_TABLET)));
assertEquals(expected, actual);
}
use of com.b2international.index.query.Expression in project snow-owl by b2ihealthcare.
the class SnomedEclEvaluationRequestTest method refinementGroupNestedConjunctionDisjunction.
@Test
public void refinementGroupNestedConjunctionDisjunction() throws Exception {
generateDrugsWithGroups();
final Expression actual = eval(String.format("<%s: [1..1] {(%s=%s AND %s=%s) OR %s=%s}", DRUG_ROOT, HAS_ACTIVE_INGREDIENT, INGREDIENT5, HAS_BOSS, INGREDIENT6, HAS_ACTIVE_INGREDIENT, INGREDIENT6));
final Expression expected = and(descendantsOf(DRUG_ROOT), ids(Set.of(ASPIRIN_TABLET)));
assertEquals(expected, actual);
}
use of com.b2international.index.query.Expression in project snow-owl by b2ihealthcare.
the class SnomedEclEvaluationRequestTest method refinementCardinalityOneOrTwo.
@Test
public void refinementCardinalityOneOrTwo() throws Exception {
generateDrugHierarchy();
final Expression actual = eval(String.format("<%s: [1..2] %s=<%s", DRUG_ROOT, HAS_ACTIVE_INGREDIENT, SUBSTANCE));
final Expression expected = and(descendantsOf(DRUG_ROOT), ids(Set.of(TRIPHASIL_TABLET, PANADOL_TABLET)));
assertEquals(expected, actual);
}
use of com.b2international.index.query.Expression in project snow-owl by b2ihealthcare.
the class SnomedEclEvaluationRequestTest method ancestorOrSelfOf.
@Test
public void ancestorOrSelfOf() throws Exception {
// SCT Core module has a single parent and a single ancestor in this test case
indexRevision(MAIN, concept(Concepts.MODULE_SCT_CORE).ancestors(Long.parseLong(Concepts.ROOT_CONCEPT)).parents(Long.parseLong(Concepts.MODULE_ROOT)).statedAncestors(Long.parseLong(Concepts.ROOT_CONCEPT)).statedParents(Long.parseLong(Concepts.MODULE_ROOT)).build());
final Expression actual = eval(">>" + Concepts.MODULE_SCT_CORE);
final Expression expected = ids(Set.of(Concepts.ROOT_CONCEPT, Concepts.MODULE_ROOT, Concepts.MODULE_SCT_CORE));
assertEquals(expected, actual);
}
Aggregations