Search in sources :

Example 26 with SpanQueryWrapper

use of de.ids_mannheim.korap.query.wrap.SpanQueryWrapper in project Krill by KorAP.

the class TestKrillQueryJSON method queryJSONBsp11.

@Test
public void queryJSONBsp11() throws QueryException {
    SpanQueryWrapper sqwi = jsonQuery(getClass().getResource("/queries/bsp11.jsonld").getFile());
    // [base!=Katze | orth!=Katzen]
    /*
          Imagine a([^b]|[^c])d
          Matches abd and acd
          Interpretation would be not(spanAnd(...))
        */
    assertEquals(sqwi.toQuery().toString(), "spanOr([tokens:mate/l:Katze, tokens:s:Katzen])");
    assertTrue(sqwi.isNegative());
}
Also used : SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) Test(org.junit.Test)

Example 27 with SpanQueryWrapper

use of de.ids_mannheim.korap.query.wrap.SpanQueryWrapper in project Krill by KorAP.

the class TestKrillQueryJSON method queryJSONBsp6.

@Test
public void queryJSONBsp6() throws QueryException {
    SpanQueryWrapper sqwi = jsonQuery(getClass().getResource("/queries/bsp6.jsonld").getFile());
    // [base=katze]
    assertEquals(sqwi.toQuery().toString(), "tokens:mate/l:Katze");
}
Also used : SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) Test(org.junit.Test)

Example 28 with SpanQueryWrapper

use of de.ids_mannheim.korap.query.wrap.SpanQueryWrapper in project Krill by KorAP.

the class TestKrillQueryJSON method queryJSONspecialLayerBug.

@Test
public void queryJSONspecialLayerBug() throws QueryException {
    SpanQueryWrapper sqwi = jsonQuery(getClass().getResource("/queries/bugs/special_layer.jsonld").getFile());
    assertEquals(sqwi.toQuery().toString(), "spanNext(spanNext(spanNext(tokens:s:Baum, tokens:cnx/p:CC), tokens:tt/l:Baum), <tokens:xip/c:MC />)");
}
Also used : SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) Test(org.junit.Test)

Example 29 with SpanQueryWrapper

use of de.ids_mannheim.korap.query.wrap.SpanQueryWrapper in project Krill by KorAP.

the class TestKrillQueryJSON method queryJSONflags1.

@Test
public void queryJSONflags1() throws QueryException {
    // buchstabe/i
    SpanQueryWrapper sqwi = jsonQuery(getClass().getResource("/queries/flags/caseInsensitive.jsonld").getFile());
    assertEquals(sqwi.toQuery().toString(), "tokens:i:buchstabe");
}
Also used : SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) Test(org.junit.Test)

Example 30 with SpanQueryWrapper

use of de.ids_mannheim.korap.query.wrap.SpanQueryWrapper in project Krill by KorAP.

the class TestKrillQueryJSON method queryJSONrepetition.

@Test
public void queryJSONrepetition() throws QueryException {
    SpanQueryWrapper sqwi = jsonQuery(getClass().getResource("/queries/bsp-repetition.jsonld").getFile());
    // der[cnx/p=A]{0,2}[tt/p=NN]
    assertEquals(sqwi.toQuery().toString(), "spanNext(tokens:s:der, spanOr([tokens:tt/p:NN, spanNext(spanRepetition(tokens:cnx/p:A{1,2}), tokens:tt/p:NN)]))");
}
Also used : SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) Test(org.junit.Test)

Aggregations

SpanQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanQueryWrapper)165 Test (org.junit.Test)150 SpanQuery (org.apache.lucene.search.spans.SpanQuery)65 KrillIndex (de.ids_mannheim.korap.KrillIndex)17 QueryException (de.ids_mannheim.korap.util.QueryException)14 KrillQuery (de.ids_mannheim.korap.KrillQuery)13 QueryBuilder (de.ids_mannheim.korap.query.QueryBuilder)11 Result (de.ids_mannheim.korap.response.Result)8 JsonNode (com.fasterxml.jackson.databind.JsonNode)7 Krill (de.ids_mannheim.korap.Krill)5 SpanRepetitionQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanRepetitionQueryWrapper)3 TestSimple.getJsonString (de.ids_mannheim.korap.TestSimple.getJsonString)2 SpanClassQuery (de.ids_mannheim.korap.query.SpanClassQuery)2 SpanDistanceQuery (de.ids_mannheim.korap.query.SpanDistanceQuery)2 SpanWithinQuery (de.ids_mannheim.korap.query.SpanWithinQuery)2 SpanAlterQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanAlterQueryWrapper)2 SpanRegexQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanRegexQueryWrapper)2 SpanSegmentQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanSegmentQueryWrapper)2 Term (org.apache.lucene.index.Term)2 SpanOrQuery (org.apache.lucene.search.spans.SpanOrQuery)2