Search in sources :

Example 21 with KrillQuery

use of de.ids_mannheim.korap.KrillQuery in project Krill by KorAP.

the class TestKrillQueryJSON method queryJSONmerge.

@Test
public void queryJSONmerge() throws QueryException {
    // treat merging gracefully
    String json = getString(getClass().getResource("/queries/merge.jsonld").getFile());
    KrillQuery kq = new KrillQuery("tokens");
    assertEquals(kq.fromKoral(json).toQuery().toString(), "spanNext(tokens:s:der, tokens:s:Baum)");
    assertEquals(kq.getWarning(0).getCode(), 774);
}
Also used : KrillQuery(de.ids_mannheim.korap.KrillQuery) Test(org.junit.Test)

Example 22 with KrillQuery

use of de.ids_mannheim.korap.KrillQuery 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;
}
Also used : QueryException(de.ids_mannheim.korap.util.QueryException) KrillQuery(de.ids_mannheim.korap.KrillQuery) SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) QueryBuilder(de.ids_mannheim.korap.query.QueryBuilder)

Aggregations

KrillQuery (de.ids_mannheim.korap.KrillQuery)22 Test (org.junit.Test)17 SpanQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanQueryWrapper)13 QueryException (de.ids_mannheim.korap.util.QueryException)10 KrillIndex (de.ids_mannheim.korap.KrillIndex)7 QueryBuilder (de.ids_mannheim.korap.query.QueryBuilder)5 SpanQuery (org.apache.lucene.search.spans.SpanQuery)4 Result (de.ids_mannheim.korap.response.Result)3 SpanWithinQuery (de.ids_mannheim.korap.query.SpanWithinQuery)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Krill (de.ids_mannheim.korap.Krill)1 TestSimple.getJsonString (de.ids_mannheim.korap.TestSimple.getJsonString)1 SpanNextQuery (de.ids_mannheim.korap.query.SpanNextQuery)1