use of de.ids_mannheim.korap.query.QueryBuilder in project Krill by KorAP.
the class TestRealIndex method testCase1.
@Test
public void testCase1() throws IOException, QueryException {
QueryBuilder kq = new QueryBuilder("tokens");
ks = new Krill(kq.within(kq.tag("base/s:s"), kq.seq(kq.re("s:.*")).append(kq.nr(kq.re("s:.*")))).toQuery());
ks.getMeta().setTimeOut(10000);
kr = ks.apply(ki);
System.err.println(kr.toJsonString());
assertEquals(8, kr.getTotalResults());
}
use of de.ids_mannheim.korap.query.QueryBuilder in project Krill by KorAP.
the class TestKrillQueryJSON method jsonQuery.
public static SpanQueryWrapper jsonQuery(String jsonFile) {
SpanQueryWrapper sqwi;
try {
String json = getString(jsonFile);
sqwi = new KrillQuery("tokens").fromKoral(json);
} catch (QueryException e) {
fail(e.getMessage());
sqwi = new QueryBuilder("tokens").seg("???");
}
;
return sqwi;
}
use of de.ids_mannheim.korap.query.QueryBuilder in project Krill by KorAP.
the class TestKrillQuery method KorapShrinkQuery4.
@Test
public void KorapShrinkQuery4() throws QueryException {
QueryBuilder kq = new QueryBuilder("field");
SpanQuery sq = kq.seq(kq.seg("try1"), kq.focus(1, kq.nr(1, kq.seg("try2"))), kq.seg("try3")).toQuery();
assertEquals("spanNext(spanNext(field:try1, focus(1: {1: field:try2})), field:try3)", sq.toString());
}
use of de.ids_mannheim.korap.query.QueryBuilder in project Krill by KorAP.
the class TestKrillQuery method KorapClassQuery.
@Test
public void KorapClassQuery() throws QueryException {
QueryBuilder kq = new QueryBuilder("field");
SpanQuery sq = kq.seq(kq.seg("tree"), kq.nr(1, kq.contains(kq.tag("s"), kq.tag("np"))), kq.re("hey.*")).toQuery();
assertEquals("spanNext(spanNext(field:tree, {1: spanContain(<field:s />, <field:np />)}), SpanMultiTermQueryWrapper(field:/hey.*/))", sq.toString());
}
use of de.ids_mannheim.korap.query.QueryBuilder in project Krill by KorAP.
the class TestKrillQuery method KorapSequenceQuery6.
@Test
public void KorapSequenceQuery6() throws QueryException {
QueryBuilder kq = new QueryBuilder("field");
SpanQuery sq = kq.seq(kq.seg("try1")).append(kq.seg("try2")).withConstraint(2, 3, "s", true).toQuery();
assertEquals("spanElementDistance(field:try1, field:try2, [(s[2:3], ordered, excluded)])", sq.toString());
}
Aggregations