use of com.b2international.index.query.Expression in project snow-owl by b2ihealthcare.
the class SnomedEclEvaluationRequestTest method childOrSelfOf.
@Test
public void childOrSelfOf() throws Exception {
final Expression actual = eval("<<!" + ROOT_ID);
Expression expectedParentsClause;
if (isInferred()) {
expectedParentsClause = parents(Collections.singleton(ROOT_ID));
} else {
expectedParentsClause = statedParents(Collections.singleton(ROOT_ID));
}
assertEquals(Expressions.builder().should(ids(Collections.singleton(ROOT_ID))).should(expectedParentsClause).build(), actual);
}
use of com.b2international.index.query.Expression in project snow-owl by b2ihealthcare.
the class SnomedEclEvaluationRequestTest method parentOf.
@Test
public void parentOf() throws Exception {
// SCT Core module has a single parent in this test case
indexRevision(MAIN, concept(Concepts.MODULE_SCT_CORE).parents(Long.parseLong(Concepts.MODULE_ROOT)).statedParents(Long.parseLong(Concepts.MODULE_ROOT)).build());
final Expression actual = eval(">!" + Concepts.MODULE_SCT_CORE);
final Expression expected = ids(Collections.singleton(Concepts.MODULE_ROOT));
assertEquals(expected, actual);
}
use of com.b2international.index.query.Expression in project snow-owl by b2ihealthcare.
the class SnomedEclEvaluationRequestTest method childOfAny.
@Test
public void childOfAny() throws Exception {
final Expression actual = eval("<!*");
Expression expected;
if (isInferred()) {
expected = Expressions.builder().mustNot(parents(Collections.singleton(IComponent.ROOT_ID))).build();
} else {
expected = Expressions.builder().mustNot(statedParents(Collections.singleton(IComponent.ROOT_ID))).build();
}
assertEquals(expected, actual);
}
use of com.b2international.index.query.Expression in project snow-owl by b2ihealthcare.
the class SnomedEclEvaluationRequestTest method refinementIntegerEquals.
@Test
public void refinementIntegerEquals() throws Exception {
generateDrugHierarchy();
final Expression actual = eval(String.format("<%s: %s = #500", DRUG_ROOT, PREFERRED_STRENGTH));
final Expression expected = and(descendantsOf(DRUG_ROOT), ids(Set.of(PANADOL_TABLET)));
assertEquals(expected, actual);
}
use of com.b2international.index.query.Expression in project snow-owl by b2ihealthcare.
the class SnomedEclEvaluationRequestTest method refinementAnyAttributeName.
@Test
public void refinementAnyAttributeName() throws Exception {
generateDrugHierarchy();
final Expression actual = eval(String.format("<%s: R *=%s", SUBSTANCE, TRIPHASIL_TABLET));
final Expression expected = and(descendantsOf(SUBSTANCE), ids(Set.of(INGREDIENT1, INGREDIENT2)));
assertEquals(expected, actual);
}
Aggregations