removed ExpertFilterTest
diff --git a/src/test/java/ExpertFilterTest.java b/src/test/java/ExpertFilterTest.java
deleted file mode 100644
index 14a876d..0000000
--- a/src/test/java/ExpertFilterTest.java
+++ /dev/null
@@ -1,252 +0,0 @@
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-import de.ids_mannheim.korap.query.serialize.ExpertFilter;
-import de.ids_mannheim.korap.util.QueryException;
-
-public class ExpertFilterTest {
-
- ExpertFilter ef;
- String map;
- private String query;
-
- @Test
- public void testSimple() throws QueryException {
- query = "textClass=Sport";
- String q1 = "{@type=korap:filter, filter={@type=korap:term, attribute=textClass, key=Sport, match=match:eq}}";
- ef = new ExpertFilter();
- ef.process(query);
- map = ef.getRequestMap().toString();
- assertEquals(q1.replaceAll(" ", ""), map.replaceAll(" ", ""));
- }
-
- @Test
- public void testMultiwordValue() throws QueryException {
- query = "title=\"Ein langer langer Titel\"";
- String q1 = "{@type=korap:filter, filter={@type=korap:term, attribute=title, key=Ein langer langer Titel, match=match:eq}}";
- ef = new ExpertFilter();
- ef.process(query);
- map = ef.getRequestMap().toString();
- assertEquals(q1.replaceAll(" ", ""), map.replaceAll(" ", ""));
- }
-
- @Test
- public void testRegex() throws QueryException {
- query = "title=/Sp.*rt/";
- String q1 = "{@type=korap:filter, filter={@type=korap:term, attribute=title, key=Sp.*rt, type=type:regex, match=match:eq}}";
- ef = new ExpertFilter();
- ef.process(query);
- map = ef.getRequestMap().toString();
- assertEquals(q1.replaceAll(" ", ""), map.replaceAll(" ", ""));
- }
-
- @Test
- public void testNotEqual() throws QueryException {
- query = "textClass!=Sport";
- String q1 = "{@type=korap:filter, filter={@type=korap:term, attribute=textClass, key=Sport, match=match:ne}}";
- ef = new ExpertFilter();
- ef.process(query);
- map = ef.getRequestMap().toString();
- assertEquals(q1.replaceAll(" ", ""), map.replaceAll(" ", ""));
- }
-
-
- @Test
- public void testConj() throws QueryException {
- query = "textClass=Drama&author=Goethe";
- String q1 =
- "{@type=korap:filter, filter=" +
- "{@type=korap:termGroup, relation=relation:and, operands=[" +
- "{@type=korap:term, attribute=textClass, key=Drama, match=match:eq}," +
- "{@type=korap:term, attribute=author, key=Goethe, match=match:eq}" +
- "]}" +
- "}";
- ef = new ExpertFilter();
- ef.process(query);
- map = ef.getRequestMap().toString();
- assertEquals(q1.replaceAll(" ", ""), map.replaceAll(" ", ""));
-
- query = "textClass=Drama&author=Goethe&year=1815";
- String q2 =
- "{@type=korap:filter, filter=" +
- "{@type=korap:termGroup, relation=relation:and, operands=[" +
- "{@type=korap:term, attribute=textClass, key=Drama, match=match:eq}," +
- "{@type=korap:term, attribute=author, key=Goethe, match=match:eq}," +
- "{@type=korap:term, attribute=year, key=1815, match=match:eq}" +
- "]}" +
- "}";
- ef = new ExpertFilter();
- ef.process(query);
- map = ef.getRequestMap().toString();
- assertEquals(q2.replaceAll(" ", ""), map.replaceAll(" ", ""));
- }
-
- @Test
- public void testDisj() throws QueryException {
- query = "textClass=Drama|author=Goethe";
- String q1 =
- "{@type=korap:filter, filter=" +
- "{@type=korap:termGroup, relation=relation:or, operands=[" +
- "{@type=korap:term, attribute=textClass, key=Drama, match=match:eq}," +
- "{@type=korap:term, attribute=author, key=Goethe, match=match:eq}" +
- "]}" +
- "}";
- ef = new ExpertFilter();
- ef.process(query);
- map = ef.getRequestMap().toString();
- assertEquals(q1.replaceAll(" ", ""), map.replaceAll(" ", ""));
-
- query = "textClass=Drama|author=Goethe|year=1815";
- String q2 =
- "{@type=korap:filter, filter=" +
- "{@type=korap:termGroup, relation=relation:or, operands=[" +
- "{@type=korap:term, attribute=textClass, key=Drama, match=match:eq}," +
- "{@type=korap:term, attribute=author, key=Goethe, match=match:eq}," +
- "{@type=korap:term, attribute=year, key=1815, match=match:eq}" +
- "]}" +
- "}";
- ef = new ExpertFilter();
- ef.process(query);
- map = ef.getRequestMap().toString();
- assertEquals(q2.replaceAll(" ", ""), map.replaceAll(" ", ""));
- }
-
- @Test
- public void testComplex() throws QueryException {
- query = "textClass=Drama|(author=Goethe&year=1815)";
- String q1 =
- "{@type=korap:filter, filter=" +
- "{@type=korap:termGroup, relation=relation:or, operands=[" +
- "{@type=korap:term, attribute=textClass, key=Drama, match=match:eq}," +
- "{@type=korap:termGroup, relation=relation:and, operands=[" +
- "{@type=korap:term, attribute=author, key=Goethe, match=match:eq}," +
- "{@type=korap:term, attribute=year, key=1815, match=match:eq}" +
- "]}" +
- "]}" +
- "}";
- ef = new ExpertFilter();
- ef.process(query);
- map = ef.getRequestMap().toString();
- assertEquals(q1.replaceAll(" ", ""), map.replaceAll(" ", ""));
-
- query = "textClass=Drama|(author=Goethe&year=1815)|textClass=Politik";
- String q2 =
- "{@type=korap:filter, filter=" +
- "{@type=korap:termGroup, relation=relation:or, operands=[" +
- "{@type=korap:term, attribute=textClass, key=Drama, match=match:eq}," +
- "{@type=korap:termGroup, relation=relation:and, operands=[" +
- "{@type=korap:term, attribute=author, key=Goethe, match=match:eq}," +
- "{@type=korap:term, attribute=year, key=1815, match=match:eq}" +
- "]}," +
- "{@type=korap:term, attribute=textClass, key=Politik, match=match:eq}" +
- "]}" +
- "}";
- ef = new ExpertFilter();
- ef.process(query);
- map = ef.getRequestMap().toString();
- assertEquals(q2.replaceAll(" ", ""), map.replaceAll(" ", ""));
-
- query = "(author=Goethe&year=1815)|textClass=Drama";
- String q3 =
- "{@type=korap:filter, filter=" +
- "{@type=korap:termGroup, relation=relation:or, operands=[" +
-
- "{@type=korap:termGroup, relation=relation:and, operands=[" +
- "{@type=korap:term, attribute=author, key=Goethe, match=match:eq}," +
- "{@type=korap:term, attribute=year, key=1815, match=match:eq}" +
- "]}," +
- "{@type=korap:term, attribute=textClass, key=Drama, match=match:eq}" +
- "]}" +
- "}";
- ef = new ExpertFilter();
- ef.process(query);
- map = ef.getRequestMap().toString();
- assertEquals(q3.replaceAll(" ", ""), map.replaceAll(" ", ""));
-
- query = "(author=Goethe|year=1815)&textClass=Drama";
- String q4 =
- "{@type=korap:filter, filter=" +
- "{@type=korap:termGroup, relation=relation:and, operands=[" +
-
- "{@type=korap:termGroup, relation=relation:or, operands=[" +
- "{@type=korap:term, attribute=author, key=Goethe, match=match:eq}," +
- "{@type=korap:term, attribute=year, key=1815, match=match:eq}" +
- "]}," +
- "{@type=korap:term, attribute=textClass, key=Drama, match=match:eq}" +
- "]}" +
- "}";
- ef = new ExpertFilter();
- ef.process(query);
- map = ef.getRequestMap().toString();
- assertEquals(q4.replaceAll(" ", ""), map.replaceAll(" ", ""));
-
- query = "(author=Goethe&year=1815)&textClass=Drama";
- String q5 =
- "{@type=korap:filter, filter=" +
- "{@type=korap:termGroup, relation=relation:and, operands=[" +
-
- "{@type=korap:termGroup, relation=relation:and, operands=[" +
- "{@type=korap:term, attribute=author, key=Goethe, match=match:eq}," +
- "{@type=korap:term, attribute=year, key=1815, match=match:eq}" +
- "]}," +
- "{@type=korap:term, attribute=textClass, key=Drama, match=match:eq}" +
- "]}" +
- "}";
- ef = new ExpertFilter();
- ef.process(query);
- map = ef.getRequestMap().toString();
- assertEquals(q5.replaceAll(" ", ""), map.replaceAll(" ", ""));
-
- query = "(textClass=wissenschaft & textClass=politik) & (corpusID=A00 | corpusID=WPD)";
- String q6 =
- "{@type=korap:filter, filter=" +
- "{@type=korap:termGroup, relation=relation:and, operands=[" +
-
- "{@type=korap:termGroup, relation=relation:and, operands=[" +
- "{@type=korap:term, attribute=textClass, key=wissenschaft, match=match:eq}," +
- "{@type=korap:term, attribute=textClass, key=politik, match=match:eq}" +
- "]}," +
- "{@type=korap:termGroup, relation=relation:or, operands=[" +
- "{@type=korap:term, attribute=corpusID, key=A00, match=match:eq}," +
- "{@type=korap:term, attribute=corpusID, key=WPD, match=match:eq}" +
- "]}" +
- "]}" +
- "}";
- ef = new ExpertFilter();
- ef.process(query);
- map = ef.getRequestMap().toString();
- assertEquals(q6.replaceAll(" ", ""), map.replaceAll(" ", ""));
- }
-
- @Test
- public void testDateRange() throws QueryException {
- query = "1990<year<2010";
- String q1 =
- "{@type=korap:filter, filter=" +
- "{@type=korap:termGroup, relation=relation:and, operands=[" +
- "{@type=korap:term, attribute=year, key=1990, match=match:gt}," +
- "{@type=korap:term, attribute=year, key=2010, match=match:lt}" +
- "]}" +
- "}";
- ef = new ExpertFilter();
- ef.process(query);
- map = ef.getRequestMap().toString();
- assertEquals(q1.replaceAll(" ", ""), map.replaceAll(" ", ""));
-
- query = "1990<year<=2010";
- String q2 =
- "{@type=korap:filter, filter=" +
- "{@type=korap:termGroup, relation=relation:and, operands=[" +
- "{@type=korap:term, attribute=year, key=1990, match=match:gt}," +
- "{@type=korap:term, attribute=year, key=2010, match=match:leq}" +
- "]}" +
- "}";
- ef = new ExpertFilter();
- ef.process(query);
- map = ef.getRequestMap().toString();
- assertEquals(q2.replaceAll(" ", ""), map.replaceAll(" ", ""));
- }
-
-}
-