Search in sources :

Example 31 with SpanQueryWrapper

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

the class TestKrillQueryJSON method queryJSONcosmas20.

@Test
public void queryJSONcosmas20() throws QueryException {
    SpanQueryWrapper sqwi = jsonQuery(getClass().getResource("/queries/cosmas20.json").getFile());
    // "MORPH(V) #IN(R) #ELEM(S)"
    assertEquals(sqwi.toQuery().toString(), "focus(1: spanEndsWith(<tokens:s />, {1: tokens:p:V}))");
}
Also used : SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) Test(org.junit.Test)

Example 32 with SpanQueryWrapper

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

the class TestKrillQueryJSON method queryJSONcosmasBoundaryBug.

@Test
public void queryJSONcosmasBoundaryBug() throws QueryException {
    SpanQueryWrapper sqwi = jsonQuery(getClass().getResource("/queries/bugs/cosmas_boundary.jsonld").getFile());
    // Namen /s1 Leben
    assertEquals(sqwi.toQuery().toString(), "focus(129: spanElementDistance({129: tokens:s:Namen}, {129: tokens:s:Leben}, [(base/s:s[0:1], notOrdered, notExcluded)]))");
}
Also used : SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) Test(org.junit.Test)

Example 33 with SpanQueryWrapper

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

the class TestKrillQueryJSON method queryJSONDemo.

@Test
public void queryJSONDemo() throws QueryException {
    SpanQueryWrapper sqwi = new KrillQuery("tokens").fromKoral("{ \"query\" : { \"@type\" : \"koral:token\", \"wrap\" : { \"@type\" : \"koral:term\", \"foundry\" : \"base\", \"layer\" : \"p\", \"key\" : \"foo\", \"match\" : \"match:eq\" }}}");
    assertEquals(sqwi.toQuery().toString(), "tokens:base/p:foo");
}
Also used : KrillQuery(de.ids_mannheim.korap.KrillQuery) SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) Test(org.junit.Test)

Example 34 with SpanQueryWrapper

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

the class TestKrillQueryJSON method queryJSONBsp1Disjunction.

@Test
public void queryJSONBsp1Disjunction() throws QueryException {
    SpanQueryWrapper sqwi = jsonQuery(getClass().getResource("/queries/bsp1c.jsonld").getFile());
    // There is a repetition in here
    // ([base=foo]|[base=bar])[base=foobar]
    assertEquals(sqwi.toQuery().toString(), "spanOr([tokens:base:foo, spanRepetition(spanNext(tokens:base:foo, tokens:base:bar){1,100})])");
    assertTrue(sqwi.isOptional());
}
Also used : SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) Test(org.junit.Test)

Example 35 with SpanQueryWrapper

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

the class TestKrillQueryJSON method queryJSONBsp2.

@Test
public void queryJSONBsp2() throws QueryException {
    SpanQueryWrapper sqwi = jsonQuery(getClass().getResource("/queries/bsp2.jsonld").getFile());
    // ([base=foo]|[base=bar])[base=foobar]
    assertEquals(sqwi.toQuery().toString(), "spanNext(spanOr([tokens:mate/l:foo, tokens:mate/l:bar]), tokens:mate/l:foobar)");
}
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