Search in sources :

Example 41 with SpanQueryWrapper

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

the class TestKrillQueryJSON method queryJSONfoundryForOrthBug.

@Test
public void queryJSONfoundryForOrthBug() throws QueryException {
    SpanQueryWrapper sqwi = jsonQuery(getClass().getResource("/queries/bugs/foundry_for_orth.jsonld").getFile());
    // opennlp/orth:Baum
    assertEquals(sqwi.toQuery().toString(), "tokens:s:Baum");
}
Also used : SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) Test(org.junit.Test)

Example 42 with SpanQueryWrapper

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

the class TestKrillQueryJSON method queryJSONfoundryForOrthBug2.

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

Example 43 with SpanQueryWrapper

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

the class TestSpanRelationQueryJSON method testFocusEmptyBoth.

@Test
public void testFocusEmptyBoth() throws QueryException {
    String filepath = getClass().getResource("/queries/relation/focus-empty-both.json").getFile();
    SpanQueryWrapper sqwi = getJSONQuery(filepath);
    SpanQuery sq = sqwi.toQuery();
    assertEquals("focus(2: focus(#[1,2]{1: source:{2: target:spanRelation(tokens:>:mate/d:HEAD)}}))", sq.toString());
}
Also used : SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) SpanQuery(org.apache.lucene.search.spans.SpanQuery) Test(org.junit.Test)

Example 44 with SpanQueryWrapper

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

the class TestSpanRelationQueryJSON method testMatchOperandWithAttribute.

@Test
public void testMatchOperandWithAttribute() throws QueryException {
    // 
    String filepath = getClass().getResource("/queries/relation/operand-with-attribute.json").getFile();
    SpanQueryWrapper sqwi = getJSONQuery(filepath);
    SpanQuery sq = sqwi.toQuery();
    assertEquals("focus(#[1,2]spanSegment(<tokens:c:vp />, focus(#2: spanSegment(spanRelation(tokens:>:mate/d:HEAD), " + "spanElementWithAttribute(<tokens:c:s />, spanAttribute(tokens:type:top))))))", sq.toString());
}
Also used : SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) SpanQuery(org.apache.lucene.search.spans.SpanQuery) Test(org.junit.Test)

Example 45 with SpanQueryWrapper

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

the class TestSpanRelationQueryJSON method testFocusTarget.

@Test
public void testFocusTarget() throws QueryException {
    String filepath = getClass().getResource("/queries/relation/focus-target.json").getFile();
    SpanQueryWrapper sqwi = getJSONQuery(filepath);
    SpanQuery sq = sqwi.toQuery();
    assertEquals("focus(2: focus(#[1,2]spanSegment({2: <tokens:c:np />}, " + "focus(#2: spanSegment(spanRelation(tokens:>:mate/d:HEAD), {1: <tokens:c:s />})))))", sq.toString());
}
Also used : SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) SpanQuery(org.apache.lucene.search.spans.SpanQuery) 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