Search in sources :

Example 31 with QueryException

use of de.ids_mannheim.korap.util.QueryException 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)

Example 32 with QueryException

use of de.ids_mannheim.korap.util.QueryException in project Krill by KorAP.

the class TestSpanSequenceQueryJSON method queryJSONseqNegativelastConstraint.

@Test
public void queryJSONseqNegativelastConstraint() throws QueryException {
    SpanQueryWrapper sqwi = jsonQueryFile("negative-last-constraint.jsonld");
    try {
        sqwi.toQuery().toString();
        fail("Should throw an exception");
    } catch (QueryException qe) {
        assertEquals("Distance constraints not supported with empty, optional or negative operands", qe.getMessage());
    }
    ;
}
Also used : QueryException(de.ids_mannheim.korap.util.QueryException) SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) Test(org.junit.Test)

Aggregations

QueryException (de.ids_mannheim.korap.util.QueryException)32 SpanQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanQueryWrapper)14 JsonNode (com.fasterxml.jackson.databind.JsonNode)10 KrillQuery (de.ids_mannheim.korap.KrillQuery)10 Test (org.junit.Test)9 QueryBuilder (de.ids_mannheim.korap.query.QueryBuilder)5 SpanRepetitionQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanRepetitionQueryWrapper)4 DistanceConstraint (de.ids_mannheim.korap.query.DistanceConstraint)2 SpanAlterQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanAlterQueryWrapper)2 SpanFocusQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanFocusQueryWrapper)2 SpanRegexQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanRegexQueryWrapper)2 SpanSegmentQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanSegmentQueryWrapper)2 SpanSequenceQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanSequenceQueryWrapper)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 KrillIndex (de.ids_mannheim.korap.KrillIndex)1 RelationDirection (de.ids_mannheim.korap.constants.RelationDirection)1 SpanDistanceQuery (de.ids_mannheim.korap.query.SpanDistanceQuery)1 SpanMultipleDistanceQuery (de.ids_mannheim.korap.query.SpanMultipleDistanceQuery)1