Finalized test suite adoption from legacy collection
Change-Id: I594597f2364df68007c22c8c78fc54f4385d2ccf
diff --git a/src/test/java/de/ids_mannheim/korap/collection/TestCollectionBuilder.java b/src/test/java/de/ids_mannheim/korap/collection/TestCollectionBuilder.java
new file mode 100644
index 0000000..9dd7baf
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/collection/TestCollectionBuilder.java
@@ -0,0 +1,416 @@
+package de.ids_mannheim.korap.collection;
+
+import java.util.*;
+import java.io.*;
+
+import de.ids_mannheim.korap.collection.CollectionBuilder;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Ignore;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+// TODO: More extensive testing!
+
+
+@RunWith(JUnit4.class)
+public class TestCollectionBuilder {
+
+ @Test
+ public void builderTerm () throws IOException {
+ CollectionBuilder kc = new CollectionBuilder();
+ assertEquals("author:tree",
+ kc.term("author", "tree").toString());
+ };
+
+ @Test
+ public void builderRegex () throws IOException {
+ CollectionBuilder kc = new CollectionBuilder();
+ assertEquals("QueryWrapperFilter(author:/tre*?/)",
+ kc.re("author", "tre*?").toString());
+ };
+
+ @Test
+ public void builderDateYear () throws IOException {
+ CollectionBuilder kc = new CollectionBuilder();
+ assertEquals("pubDate:[20050000 TO 20059999]",
+ kc.date("pubDate", "2005").toString());
+ };
+
+ @Test
+ public void builderDateMonth () throws IOException {
+ CollectionBuilder kc = new CollectionBuilder();
+ assertEquals("pubDate:[20051000 TO 20051099]",
+ kc.date("pubDate", "2005-10").toString());
+ };
+
+ @Test
+ public void builderDateDay () throws IOException {
+ CollectionBuilder kc = new CollectionBuilder();
+ assertEquals("pubDate:[20051011 TO 20051011]",
+ kc.date("pubDate", "2005-10-11").toString());
+ };
+
+ @Test
+ public void builderDateBorders () throws IOException {
+ CollectionBuilder kc = new CollectionBuilder();
+ // CollectionBuilderNew.Interface kbi = ;
+ assertNull(kc.date("pubDate", ""));
+
+ assertEquals("pubDate:[20051580 TO 20051580]",
+ kc.date("pubDate", "2005-15-80").toString());
+
+ assertNull(kc.date("pubDate", "2005-15-8"));
+ assertNull(kc.date("pubDate", "2005-5-18"));
+ assertNull(kc.date("pubDate", "200-05-18"));
+ };
+
+ @Test
+ public void builderSince () throws IOException {
+ CollectionBuilder kc = new CollectionBuilder();
+ assertEquals("pubDate:[20050000 TO 99999999]",
+ kc.since("pubDate", "2005").toString());
+
+ assertEquals("pubDate:[20051000 TO 99999999]",
+ kc.since("pubDate", "2005-10").toString());
+
+ assertEquals("pubDate:[20051012 TO 99999999]",
+ kc.since("pubDate", "2005-10-12").toString());
+ };
+
+
+ @Test
+ public void builderTill () throws IOException {
+ CollectionBuilder kc = new CollectionBuilder();
+ assertEquals("pubDate:[0 TO 20059999]",
+ kc.till("pubDate", "2005").toString());
+
+ assertEquals("pubDate:[0 TO 20051299]",
+ kc.till("pubDate", "2005-12").toString());
+
+ assertEquals("pubDate:[0 TO 20051204]",
+ kc.till("pubDate", "2005-12-04").toString());
+ };
+
+
+ @Test
+ public void builderAndSimple () throws IOException {
+ CollectionBuilder kc = new CollectionBuilder();
+ assertEquals("author:tree", kc.andGroup().with(kc.term("author", "tree")).toString());
+ };
+
+ @Test
+ public void builderOrSimple () throws IOException {
+ CollectionBuilder kc = new CollectionBuilder();
+ assertEquals("author:tree", kc.orGroup().with(kc.term("author", "tree")).toString());
+ };
+
+ @Test
+ public void builderAndCombined () throws IOException {
+ CollectionBuilder kc = new CollectionBuilder();
+ assertEquals("AndGroup(author:tree title:name)",
+ kc.andGroup().with(kc.term("author", "tree"))
+ .with(kc.term("title", "name")).toString());
+ };
+
+ @Test
+ public void builderAndNestedSimple () throws IOException {
+ CollectionBuilder kc = new CollectionBuilder();
+ assertEquals("AndGroup(author:tree title:name)",
+ kc.andGroup().with(kc.andGroup().with(kc.term("author", "tree")).with(kc.term("title", "name"))).toString());
+ };
+
+
+ @Test
+ public void builderOrCombined () throws IOException {
+ CollectionBuilder kc = new CollectionBuilder();
+ assertEquals("OrGroup(author:tree title:name)",
+ kc.orGroup().with(kc.term("author", "tree"))
+ .with(kc.term("title", "name")).toString());
+ };
+
+ @Test
+ public void builderOrNestedSimple () throws IOException {
+ CollectionBuilder kc = new CollectionBuilder();
+ assertEquals("OrGroup(author:tree title:name)",
+ kc.orGroup().with(kc.orGroup().with(kc.term("author", "tree"))
+ .with(kc.term("title", "name"))).toString()
+ );
+ };
+
+ @Test
+ public void builderGroups () throws IOException {
+ CollectionBuilder kc = new CollectionBuilder();
+ String g = kc.orGroup().with(
+ kc.orGroup().with(kc.term("author", "tree1")).with(kc.term("title", "name1"))
+ ).with(
+ kc.andGroup().with(kc.term("author", "tree2")).with(kc.term("title", "name2"))
+ ).toString();
+ assertEquals("OrGroup(OrGroup(author:tree1 title:name1) AndGroup(author:tree2 title:name2))", g);
+ };
+
+ @Test
+ public void builderNegationRoot () throws IOException {
+ CollectionBuilder kc = new CollectionBuilder();
+ CollectionBuilder.Interface kbi = kc.orGroup().with(kc.term("author", "tree1")).with(kc.term("title", "name1"));
+ assertEquals(
+ "OrGroup(author:tree1 title:name1)",
+ kbi.toString());
+ assertFalse(kbi.isNegative());
+
+ kbi = kc.andGroup().with(
+ kc.orGroup().with(kc.term("author", "tree1")).with(kc.term("title", "name1"))
+ ).not();
+ assertEquals("OrGroup(author:tree1 title:name1)", kbi.toString());
+ assertTrue(kbi.isNegative());
+ };
+
+
+ @Test
+ public void builderNegation () throws IOException {
+ CollectionBuilder kc = new CollectionBuilder();
+ CollectionBuilder.Interface kbi =
+ kc.term("author", "tree").not();
+ assertEquals("author:tree", kbi.toString());
+ assertTrue(kbi.isNegative());
+
+ kbi = kc.andGroup().with(kc.term("author", "tree").not());
+ assertEquals("author:tree", kbi.toString());
+ assertTrue(kbi.isNegative());
+
+ kbi = kc.orGroup().with(kc.term("author", "tree").not());
+ assertEquals("author:tree", kbi.toString());
+ assertTrue(kbi.isNegative());
+ };
+
+ // The legacy tests were adopted from the legacy collection builder and reformuated
+
+ @Test
+ public void LegacyFilterExample () throws IOException {
+ CollectionBuilder kf = new CollectionBuilder();
+
+ /*
+ assertEquals("+textClass:tree", kf.and("textClass", "tree").toString());
+ */
+ assertEquals("textClass:tree", kf.andGroup().with(kf.term("textClass", "tree")).toString());
+
+ /*
+ assertEquals("+textClass:tree +textClass:sport",
+ kf.and("textClass", "tree").and("textClass", "sport")
+ .toString());
+ */
+ assertEquals("AndGroup(textClass:tree textClass:sport)", kf.andGroup().with(kf.term("textClass", "tree")).with(kf.term("textClass", "sport")).toString());
+
+ /*
+ assertEquals(
+ "+textClass:tree +textClass:sport textClass:news",
+ kf.and("textClass", "tree").and("textClass", "sport")
+ .or("textClass", "news").toString());
+ */
+ assertEquals("OrGroup(AndGroup(textClass:tree textClass:sport) textClass:news)", kf.orGroup().with(kf.andGroup().with("textClass", "tree").with("textClass", "sport")).with("textClass", "news").toString());
+
+ /*
+ assertEquals("+textClass:tree +textClass:sport +textClass:news", kf
+ .and("textClass", "tree", "sport", "news").toString());
+ */
+ assertEquals("AndGroup(textClass:tree textClass:sport textClass:news)", kf.andGroup().with("textClass", "tree").with("textClass", "sport").with("textClass", "news").toString());
+
+ /*
+ assertEquals("corpusID:c-1 corpusID:c-2 corpusID:c-3",
+ kf.or("corpusID", "c-1", "c-2", "c-3").toString());
+ */
+ assertEquals("OrGroup(corpusID:c-1 corpusID:c-2 corpusID:c-3)", kf.orGroup().with("corpusID", "c-1").with("corpusID", "c-2").with("corpusID", "c-3").toString());
+
+ };
+
+ @Test
+ public void LegacyRangeExample () throws IOException {
+ CollectionBuilder kf = new CollectionBuilder();
+ /*
+ assertEquals("+pubDate:[20030604 TO 20030899]",
+ kf.between("2003-06-04", "2003-08-99").toString());
+ */
+ // This will be optimized and probably crash
+ assertEquals("AndGroup(pubDate:[20030604 TO 99999999] pubDate:[0 TO 20030899])", kf.andGroup().with(kf.since("pubDate", "2003-06-04")).with(kf.till("pubDate", "2003-08-99")).toString());
+
+ /*
+ assertEquals("+pubDate:[0 TO 20030604]", kf.till("2003-06-04")
+ .toString());
+ */
+ assertEquals("pubDate:[0 TO 20030604]", kf.till("pubDate", "2003-06-04")
+ .toString());
+
+
+ /*
+ assertEquals("+pubDate:[20030604 TO 99999999]", kf.since("2003-06-04")
+ .toString());
+ */
+ assertEquals("pubDate:[20030604 TO 99999999]", kf.since("pubDate", "2003-06-04")
+ .toString());
+
+ /*
+ assertEquals("+pubDate:20030604", kf.date("2003-06-04").toString());
+ */
+ assertEquals("pubDate:[20030604 TO 20030604]", kf.date("pubDate", "2003-06-04").toString());
+ };
+
+
+ @Test
+ public void LegacyRangeLimited () throws IOException {
+ CollectionBuilder kf = new CollectionBuilder();
+ /*
+ assertEquals("+pubDate:[20050000 TO 20099999]",
+ kf.between("2005", "2009").toString());
+ */
+ assertEquals("AndGroup(pubDate:[20050000 TO 99999999] pubDate:[0 TO 20099999])",
+ kf.between("pubDate", "2005", "2009").toString());
+
+ /*
+ assertEquals("+pubDate:[20051000 TO 20090899]",
+ kf.between("200510", "200908").toString());
+ */
+ assertEquals("AndGroup(pubDate:[20051000 TO 99999999] pubDate:[0 TO 20090899])",
+ kf.between("pubDate", "200510", "200908").toString());
+
+ /*
+ assertEquals("+pubDate:[20051000 TO 20090899]",
+ kf.between("2005-10", "2009-08").toString());
+ */
+ assertEquals("AndGroup(pubDate:[20051000 TO 99999999] pubDate:[0 TO 20090899])",
+ kf.between("pubDate", "2005-10", "2009-08").toString());
+
+
+ /*
+ assertEquals("+pubDate:[20051006 TO 20090803]",
+ kf.between("2005-1006", "2009-0803").toString());
+ */
+ assertEquals("AndGroup(pubDate:[20051006 TO 99999999] pubDate:[0 TO 20090803])",
+ kf.between("pubDate", "2005-1006", "2009-0803").toString());
+
+ /*
+ assertEquals("+pubDate:[20051006 TO 20090803]",
+ kf.between("2005-10-06", "2009-08-03").toString());
+ */
+ assertEquals("AndGroup(pubDate:[20051006 TO 99999999] pubDate:[0 TO 20090803])",
+ kf.between("pubDate", "2005-10-06", "2009-08-03").toString());
+
+ /*
+ assertEquals("+pubDate:[0 TO 20059999]", kf.till("2005").toString());
+ */
+ assertEquals("pubDate:[0 TO 20059999]", kf.till("pubDate", "2005").toString());
+
+ /*
+ assertEquals("+pubDate:[0 TO 20051099]", kf.till("200510").toString());
+ */
+ assertEquals("pubDate:[0 TO 20051099]", kf.till("pubDate", "200510").toString());
+
+ /*
+ assertEquals("+pubDate:[0 TO 20051099]", kf.till("200510").toString());
+ */
+ assertEquals("pubDate:[0 TO 20051099]", kf.till("pubDate", "200510").toString());
+
+ /*
+ assertEquals("+pubDate:[0 TO 20051099]", kf.till("2005-10").toString());
+ */
+ assertEquals("pubDate:[0 TO 20051099]", kf.till("pubDate", "2005-10").toString());
+
+ /*
+ assertEquals("+pubDate:[0 TO 20051006]", kf.till("2005-1006")
+ .toString());
+ */
+ assertEquals("pubDate:[0 TO 20051006]", kf.till("pubDate", "2005-1006")
+ .toString());
+
+ /*
+ assertEquals("+pubDate:[0 TO 20051006]", kf.till("2005-10-06")
+ .toString());
+ */
+ assertEquals("pubDate:[0 TO 20051006]", kf.till("pubDate", "2005-10-06")
+ .toString());
+
+ /*
+ assertEquals("+pubDate:[20050000 TO 99999999]", kf.since("2005")
+ .toString());
+ */
+ assertEquals("pubDate:[20050000 TO 99999999]", kf.since("pubDate", "2005")
+ .toString());
+
+ /*
+ assertEquals("+pubDate:[20051000 TO 99999999]", kf.since("200510")
+ .toString());
+ */
+ assertEquals("pubDate:[20051000 TO 99999999]", kf.since("pubDate", "200510")
+ .toString());
+
+
+ /*
+ assertEquals("+pubDate:[20051000 TO 99999999]", kf.since("2005-10")
+ .toString());
+ */
+ assertEquals("pubDate:[20051000 TO 99999999]", kf.since("pubDate", "2005-10")
+ .toString());
+
+ /*
+ assertEquals("+pubDate:[20051006 TO 99999999]", kf.since("2005-1006")
+ .toString());
+ */
+ assertEquals("pubDate:[20051006 TO 99999999]", kf.since("pubDate", "2005-1006")
+ .toString());
+
+ /*
+ assertEquals("+pubDate:[20051006 TO 99999999]", kf.since("2005-10-06")
+ .toString());
+ */
+ assertEquals("pubDate:[20051006 TO 99999999]", kf.since("pubDate", "2005-10-06")
+ .toString());
+
+ /*
+ assertEquals("+pubDate:[20050000 TO 20059999]", kf.date("2005")
+ .toString());
+ */
+ assertEquals("pubDate:[20050000 TO 20059999]", kf.date("pubDate", "2005")
+ .toString());
+
+
+ /*
+ assertEquals("+pubDate:[20051000 TO 20051099]", kf.date("200510")
+ .toString());
+ */
+ assertEquals("pubDate:[20051000 TO 20051099]", kf.date("pubDate", "200510")
+ .toString());
+
+ /*
+ assertEquals("+pubDate:[20051000 TO 20051099]", kf.date("2005-10")
+ .toString());
+ */
+ assertEquals("pubDate:[20051000 TO 20051099]", kf.date("pubDate", "2005-10")
+ .toString());
+
+ /*
+ assertEquals("+pubDate:20051006", kf.date("2005-1006").toString());
+ */
+ assertEquals("pubDate:[20051006 TO 20051006]", kf.date("pubDate", "2005-1006").toString());
+
+ /*
+ assertEquals("+pubDate:20051006", kf.date("2005-10-06").toString());
+ */
+ assertEquals("pubDate:[20051006 TO 20051006]", kf.date("pubDate", "2005-10-06").toString());
+ };
+
+
+ @Test
+ public void LegacyRangeFailure () throws IOException {
+ CollectionBuilder kf = new CollectionBuilder();
+ /*
+ assertEquals("", kf.between("aaaa-bb-cc", "aaaabbcc").toString());
+ assertEquals("", kf.till("aaaa-bb-cc").toString());
+ assertEquals("", kf.since("aaaa-bb-cc").toString());
+ assertEquals("", kf.date("aaaa-bb-cc").toString());
+ */
+ assertNull(kf.between("pubDate", "aaaa-bb-cc", "aaaabbcc"));
+ assertNull(kf.till("pubDate", "aaaa-bb-cc"));
+ assertNull(kf.since("pubDate", "aaaa-bb-cc"));
+ assertNull(kf.date("pubDate", "aaaa-bb-cc"));
+ };
+};
diff --git a/src/test/java/de/ids_mannheim/korap/collection/TestCollectionBuilderLegacy.java b/src/test/java/de/ids_mannheim/korap/collection/TestCollectionBuilderLegacy.java
index b8f0019..a52a575 100644
--- a/src/test/java/de/ids_mannheim/korap/collection/TestCollectionBuilderLegacy.java
+++ b/src/test/java/de/ids_mannheim/korap/collection/TestCollectionBuilderLegacy.java
@@ -19,6 +19,7 @@
public class TestCollectionBuilderLegacy {
@Test
+ @Ignore
public void filterExample () throws IOException {
CollectionBuilderLegacy kf = new CollectionBuilderLegacy();
@@ -39,6 +40,7 @@
@Test
+ @Ignore
public void rangeExample () throws IOException {
CollectionBuilderLegacy kf = new CollectionBuilderLegacy();
assertEquals("+pubDate:[20030604 TO 20030899]",
@@ -52,6 +54,7 @@
@Test
+ @Ignore
public void rangeLimited () throws IOException {
CollectionBuilderLegacy kf = new CollectionBuilderLegacy();
assertEquals("+pubDate:[20050000 TO 20099999]",
@@ -96,6 +99,7 @@
@Test
+ @Ignore
public void rangeFailure () throws IOException {
CollectionBuilderLegacy kf = new CollectionBuilderLegacy();
assertEquals("", kf.between("aaaa-bb-cc", "aaaabbcc").toString());
@@ -103,7 +107,4 @@
assertEquals("", kf.since("aaaa-bb-cc").toString());
assertEquals("", kf.date("aaaa-bb-cc").toString());
};
-
-
- // TODO: More extensive testing!
};
diff --git a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionJSON.java b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionJSON.java
index da311c0..a504bf2 100644
--- a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionJSON.java
@@ -147,6 +147,92 @@
};
+ @Test
+ public void metaQuery1Legacy () {
+ String metaQuery = getString(getClass().getResource(
+ "/queries/metaquery.jsonld").getFile());
+ KrillCollection kc = new KrillCollection(metaQuery);
+
+ /*
+ assertEquals("filter with QueryWrapperFilter(+textClass:wissenschaft)",
+ kc.getFilter(0).toString());
+ assertEquals(
+ "filter with QueryWrapperFilter(+(+pubPlace:Erfurt +author:Hesse))",
+ kc.getFilter(1).toString());
+ assertEquals(
+ "extend with QueryWrapperFilter(+(+pubDate:[20110429 TO 20131231] +textClass:freizeit))",
+ kc.getFilter(2).toString());
+ assertEquals(3, kc.getCount());
+ */
+
+ // This will and should fail on optimization
+ assertEquals("OrGroup(AndGroup(textClass:wissenschaft AndGroup(pubPlace:Erfurt author:Hesse)) AndGroup(AndGroup(pubDate:[20110429 TO 99999999] pubDate:[0 TO 20131231]) textClass:freizeit))", kc.toString());
+ };
+
+ @Test
+ public void metaQuery2Legacy () {
+ String metaQuery = getString(getClass().getResource(
+ "/queries/metaquery2.jsonld").getFile());
+ KrillCollection kc = new KrillCollection(metaQuery);
+ /*
+ assertEquals(1, kc.getCount());
+ assertEquals(
+ "filter with QueryWrapperFilter(+(+author:Hesse +pubDate:[0 TO 20131205]))",
+ kc.getFilter(0).toString());
+ */
+ assertEquals("AndGroup(author:Hesse pubDate:[0 TO 20131205])", kc.toString());
+ };
+
+
+ @Test
+ public void metaQuery3Legacy () {
+ String metaQuery = getString(getClass().getResource(
+ "/queries/metaquery4.jsonld").getFile());
+ KrillCollection kc = new KrillCollection(metaQuery);
+ /*
+ assertEquals(1, kc.getCount());
+ assertEquals(
+ // "filter with QueryWrapperFilter(+pubDate:[20000101 TO 20131231])"
+ "filter with QueryWrapperFilter(+(+pubDate:[20000101 TO 99999999] +pubDate:[0 TO 20131231]))",
+ kc.getFilter(0).toString());
+ */
+ assertEquals("AndGroup(pubDate:[20000101 TO 99999999] pubDate:[0 TO 20131231])", kc.toString());
+ };
+
+
+ @Test
+ public void metaQuery7Legacy () {
+ String metaQuery = getString(getClass().getResource(
+ "/queries/metaquery7.jsonld").getFile());
+ KrillCollection kc = new KrillCollection(metaQuery);
+ /*
+ assertEquals(2, kc.getCount());
+ assertEquals(
+ "filter with QueryWrapperFilter(+(corpusID:c-1 corpusID:c-2))",
+ kc.getFilter(0).toString());
+ assertEquals(
+ "filter with QueryWrapperFilter(+(+corpusID:d-1 +corpusID:d-2))",
+ kc.getFilter(1).toString());
+ */
+ // TODO: This is subject to optimization and may change in further versions
+ assertEquals("AndGroup(OrGroup(corpusID:c-1 corpusID:c-2) AndGroup(corpusID:d-1 corpusID:d-2))", kc.toString());
+ };
+
+
+ @Test
+ public void metaQuery9 () {
+ String metaQuery = getString(getClass().getResource(
+ "/queries/metaquery9.jsonld").getFile());
+ KrillCollection kc = new KrillCollection(metaQuery);
+ /*
+ assertEquals(1, kc.getCount());
+ assertEquals("filter with QueryWrapperFilter(+corpusID:WPD)", kc
+ .getFilter(0).toString());
+ */
+ assertEquals("corpusID:WPD", kc.toString());
+ };
+
+
private String _getJSONString (String file) {
return getString(getClass().getResource(path + file).getFile());
};
diff --git a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionJSONLegacy.java b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionJSONLegacy.java
index bfa1098..d9a8cff 100644
--- a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionJSONLegacy.java
+++ b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionJSONLegacy.java
@@ -17,6 +17,7 @@
public class TestKrillCollectionJSONLegacy {
@Test
+ @Ignore
public void metaQuery1 () {
String metaQuery = getString(getClass().getResource(
"/queries/metaquery.jsonld").getFile());
@@ -35,6 +36,7 @@
@Test
+ @Ignore
public void metaQuery2 () {
String metaQuery = getString(getClass().getResource(
"/queries/metaquery2.jsonld").getFile());
@@ -47,6 +49,7 @@
@Test
+ @Ignore
public void metaQuery3 () {
String metaQuery = getString(getClass().getResource(
"/queries/metaquery4.jsonld").getFile());
@@ -60,6 +63,7 @@
@Test
+ @Ignore
public void metaQuery7 () {
String metaQuery = getString(getClass().getResource(
"/queries/metaquery7.jsonld").getFile());
@@ -75,6 +79,7 @@
@Test
+ @Ignore
public void metaQuery9 () {
String metaQuery = getString(getClass().getResource(
"/queries/metaquery9.jsonld").getFile());
diff --git a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionLegacy.java b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionLegacy.java
deleted file mode 100644
index 0a3f51f..0000000
--- a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionLegacy.java
+++ /dev/null
@@ -1,256 +0,0 @@
-package de.ids_mannheim.korap.collection;
-
-import java.io.*;
-
-import de.ids_mannheim.korap.KrillIndex;
-import de.ids_mannheim.korap.index.FieldDocument;
-import de.ids_mannheim.korap.KrillCollectionLegacy;
-import de.ids_mannheim.korap.response.Result;
-import de.ids_mannheim.korap.KrillQuery;
-import de.ids_mannheim.korap.query.QueryBuilder;
-import de.ids_mannheim.korap.collection.BooleanFilter;
-
-import org.apache.lucene.index.Term;
-import org.apache.lucene.search.spans.SpanOrQuery;
-import org.apache.lucene.search.spans.SpanQuery;
-import org.apache.lucene.search.spans.SpanTermQuery;
-
-import static org.junit.Assert.*;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(JUnit4.class)
-public class TestKrillCollectionLegacy {
-
- @Test
- @Ignore
- public void filterExample () throws Exception {
-
- // Construct index
- KrillIndex ki = new KrillIndex();
- // Indexing test files
- for (String i : new String[] { "00001", "00002", "00003", "00004",
- "00005", "00006", "02439" }) {
- ki.addDoc(
- getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
- true);
- };
- ki.commit();
-
- CollectionBuilderLegacy kf = new CollectionBuilderLegacy();
-
- // Create Virtual collections:
- KrillCollectionLegacy kc = new KrillCollectionLegacy(ki);
-
- assertEquals("Documents", 7, kc.numberOf("documents"));
-
- // The virtual collection consists of all documents that have
- // the textClass "reisen" and "freizeit"
-
- kc.filter(kf.and("textClass", "reisen").and("textClass",
- "freizeit-unterhaltung"));
-
- assertEquals("Documents", 5, kc.numberOf("documents"));
- assertEquals("Tokens", 1678, kc.numberOf("tokens"));
- assertEquals("Sentences", 194, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 139, kc.numberOf("paragraphs"));
-
- // Subset this to all documents that have also the text
- kc.filter(kf.and("textClass", "kultur"));
-
- assertEquals("Documents", 1, kc.numberOf("documents"));
- assertEquals("Tokens", 405, kc.numberOf("tokens"));
- assertEquals("Sentences", 75, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 48, kc.numberOf("paragraphs"));
-
- kc.filter(kf.and("corpusID", "WPD"));
-
- assertEquals("Documents", 1, kc.numberOf("documents"));
- assertEquals("Tokens", 405, kc.numberOf("tokens"));
- assertEquals("Sentences", 75, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 48, kc.numberOf("paragraphs"));
-
- // Create a query
- QueryBuilder kq = new QueryBuilder("tokens");
- SpanQuery query = kq.seg("opennlp/p:NN").with("tt/p:NN").toQuery();
-
- Result kr = kc.search(query);
- assertEquals(kr.getTotalResults(), 70);
-
- kc.extend(kf.and("textClass", "uninteresting"));
- assertEquals("Documents", 1, kc.numberOf("documents"));
-
- kc.extend(kf.and("textClass", "wissenschaft"));
-
- assertEquals("Documents", 3, kc.numberOf("documents"));
- assertEquals("Tokens", 1669, kc.numberOf("tokens"));
- assertEquals("Sentences", 188, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 130, kc.numberOf("paragraphs"));
- // System.err.println(kr.toJSON());
- };
-
-
- @Test
- @Ignore
- public void filterExampleAtomic () throws Exception {
-
- // That's exactly the same test class, but with multiple atomic indices
-
- // Construct index
- KrillIndex ki = new KrillIndex();
- // Indexing test files
- for (String i : new String[] { "00001", "00002", "00003", "00004",
- "00005", "00006", "02439" }) {
- ki.addDoc(
- getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
- true);
- ki.commit();
- };
-
- CollectionBuilderLegacy kf = new CollectionBuilderLegacy();
-
- // Create Virtual collections:
- KrillCollectionLegacy kc = new KrillCollectionLegacy(ki);
-
- assertEquals("Documents", 7, kc.numberOf("documents"));
-
- // If this is set - everything is fine automatically ...
- kc.filter(kf.and("corpusID", "WPD"));
- assertEquals("Documents", 7, kc.numberOf("documents"));
-
-
- // The virtual collection consists of all documents that have the textClass "reisen" and "freizeit"
-
- kc.filter(kf.and("textClass", "reisen").and("textClass",
- "freizeit-unterhaltung"));
-
- assertEquals("Documents", 5, kc.numberOf("documents"));
- assertEquals("Tokens", 1678, kc.numberOf("tokens"));
- assertEquals("Sentences", 194, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 139, kc.numberOf("paragraphs"));
-
- // Subset this to all documents that have also the text
- kc.filter(kf.and("textClass", "kultur"));
-
- assertEquals("Documents", 1, kc.numberOf("documents"));
- assertEquals("Tokens", 405, kc.numberOf("tokens"));
- assertEquals("Sentences", 75, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 48, kc.numberOf("paragraphs"));
-
- // This is already filtered though ...
- kc.filter(kf.and("corpusID", "WPD"));
-
- assertEquals("Documents", 1, kc.numberOf("documents"));
- assertEquals("Tokens", 405, kc.numberOf("tokens"));
- assertEquals("Sentences", 75, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 48, kc.numberOf("paragraphs"));
-
- // Create a query
- QueryBuilder kq = new QueryBuilder("tokens");
- SpanQuery query = kq.seg("opennlp/p:NN").with("tt/p:NN").toQuery();
-
- Result kr = kc.search(query);
- assertEquals(kr.getTotalResults(), 70);
-
- kc.extend(kf.and("textClass", "uninteresting"));
- assertEquals("Documents", 1, kc.numberOf("documents"));
-
- kc.extend(kf.and("textClass", "wissenschaft"));
-
- assertEquals("Documents", 3, kc.numberOf("documents"));
- assertEquals("Tokens", 1669, kc.numberOf("tokens"));
- assertEquals("Sentences", 188, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 130, kc.numberOf("paragraphs"));
- };
-
-
-
- @Test
- @Ignore
- public void filterExample2 () throws Exception {
-
- // Construct index
- KrillIndex ki = new KrillIndex();
- // Indexing test files
- for (String i : new String[] { "00001", "00002", "00003", "00004",
- "00005", "00006", "02439" }) {
- ki.addDoc(
- getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
- true);
- };
- ki.commit();
-
- ki.addDoc(getClass()
- .getResourceAsStream("/wiki/00012-fakemeta.json.gz"), true);
-
- ki.commit();
-
- CollectionBuilderLegacy kf = new CollectionBuilderLegacy();
-
- // Create Virtual collections:
- KrillCollectionLegacy kc = new KrillCollectionLegacy(ki);
- kc.filter(kf.and("textClass", "reisen").and("textClass",
- "freizeit-unterhaltung"));
- assertEquals("Documents", 5, kc.numberOf("documents"));
- assertEquals("Tokens", 1678, kc.numberOf("tokens"));
- assertEquals("Sentences", 194, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 139, kc.numberOf("paragraphs"));
-
- // Create a query
- QueryBuilder kq = new QueryBuilder("tokens");
- SpanQuery query = kq.seg("opennlp/p:NN").with("tt/p:NN").toQuery();
-
- Result kr = kc.search(query);
-
- assertEquals(kr.getTotalResults(), 369);
-
- kc.filter(kf.and("corpusID", "QQQ"));
-
- assertEquals("Documents", 0, kc.numberOf("documents"));
- assertEquals("Tokens", 0, kc.numberOf("tokens"));
- assertEquals("Sentences", 0, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 0, kc.numberOf("paragraphs"));
- };
-
-
- @Test
- @Ignore
- public void uidCollection () throws IOException {
-
- // Construct index
- KrillIndex ki = new KrillIndex();
- // Indexing test files
- int uid = 1;
- for (String i : new String[] { "00001", "00002", "00003", "00004",
- "00005", "00006", "02439" }) {
- FieldDocument fd = ki.addDoc(uid++,
- getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
- true);
- };
- ki.commit();
-
- assertEquals("Documents", 7, ki.numberOf("documents"));
- assertEquals("Paragraphs", 174, ki.numberOf("paragraphs"));
- assertEquals("Sentences", 281, ki.numberOf("sentences"));
- assertEquals("Tokens", 2661, ki.numberOf("tokens"));
-
- SpanQuery sq = new SpanTermQuery(new Term("tokens", "s:der"));
- Result kr = ki.search(sq, (short) 10);
- assertEquals(86, kr.getTotalResults());
-
- // Create Virtual collections:
- KrillCollectionLegacy kc = new KrillCollectionLegacy();
- kc.filterUIDs(new String[] { "2", "3", "4" });
- kc.setIndex(ki);
- assertEquals("Documents", 3, kc.numberOf("documents"));
-
- assertEquals("Paragraphs", 46, kc.numberOf("paragraphs"));
- assertEquals("Sentences", 103, kc.numberOf("sentences"));
- assertEquals("Tokens", 1229, kc.numberOf("tokens"));
-
- kr = kc.search(sq);
- assertEquals((long) 39, kr.getTotalResults());
- };
-};
diff --git a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionNew.java b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionNew.java
deleted file mode 100644
index 52dc59d..0000000
--- a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionNew.java
+++ /dev/null
@@ -1,186 +0,0 @@
-package de.ids_mannheim.korap.collection;
-
-import java.util.*;
-import java.io.*;
-
-import de.ids_mannheim.korap.collection.CollectionBuilder;
-
-import static org.junit.Assert.*;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-
-@RunWith(JUnit4.class)
-public class TestKrillCollectionNew {
-
- @Test
- public void builderTerm () throws IOException {
- CollectionBuilder kc = new CollectionBuilder();
- assertEquals("author:tree",
- kc.term("author", "tree").toString());
- };
-
- @Test
- public void builderRegex () throws IOException {
- CollectionBuilder kc = new CollectionBuilder();
- assertEquals("QueryWrapperFilter(author:/tre*?/)",
- kc.re("author", "tre*?").toString());
- };
-
- @Test
- public void builderDateYear () throws IOException {
- CollectionBuilder kc = new CollectionBuilder();
- assertEquals("pubDate:[20050000 TO 20059999]",
- kc.date("pubDate", "2005").toString());
- };
-
- @Test
- public void builderDateMonth () throws IOException {
- CollectionBuilder kc = new CollectionBuilder();
- assertEquals("pubDate:[20051000 TO 20051099]",
- kc.date("pubDate", "2005-10").toString());
- };
-
- @Test
- public void builderDateDay () throws IOException {
- CollectionBuilder kc = new CollectionBuilder();
- assertEquals("pubDate:[20051011 TO 20051011]",
- kc.date("pubDate", "2005-10-11").toString());
- };
-
- @Test
- public void builderDateBorders () throws IOException {
- CollectionBuilder kc = new CollectionBuilder();
- // CollectionBuilderNew.CollectionBuilderInterface kbi = ;
- assertNull(kc.date("pubDate", ""));
-
- assertEquals("pubDate:[20051580 TO 20051580]",
- kc.date("pubDate", "2005-15-80").toString());
-
- assertNull(kc.date("pubDate", "2005-15-8"));
- assertNull(kc.date("pubDate", "2005-5-18"));
- assertNull(kc.date("pubDate", "200-05-18"));
- };
-
- @Test
- public void builderSince () throws IOException {
- CollectionBuilder kc = new CollectionBuilder();
- assertEquals("pubDate:[20050000 TO 99999999]",
- kc.since("pubDate", "2005").toString());
-
- assertEquals("pubDate:[20051000 TO 99999999]",
- kc.since("pubDate", "2005-10").toString());
-
- assertEquals("pubDate:[20051012 TO 99999999]",
- kc.since("pubDate", "2005-10-12").toString());
- };
-
-
- @Test
- public void builderTill () throws IOException {
- CollectionBuilder kc = new CollectionBuilder();
- assertEquals("pubDate:[0 TO 20059999]",
- kc.till("pubDate", "2005").toString());
-
- assertEquals("pubDate:[0 TO 20051299]",
- kc.till("pubDate", "2005-12").toString());
-
- assertEquals("pubDate:[0 TO 20051204]",
- kc.till("pubDate", "2005-12-04").toString());
- };
-
-
- @Test
- public void builderAndSimple () throws IOException {
- CollectionBuilder kc = new CollectionBuilder();
- assertEquals("author:tree", kc.andGroup().with(kc.term("author", "tree")).toString());
- };
-
- @Test
- public void builderOrSimple () throws IOException {
- CollectionBuilder kc = new CollectionBuilder();
- assertEquals("author:tree", kc.orGroup().with(kc.term("author", "tree")).toString());
- };
-
- @Test
- public void builderAndCombined () throws IOException {
- CollectionBuilder kc = new CollectionBuilder();
- assertEquals("AndGroup(author:tree title:name)",
- kc.andGroup().with(kc.term("author", "tree"))
- .with(kc.term("title", "name")).toString());
- };
-
- @Test
- public void builderAndNestedSimple () throws IOException {
- CollectionBuilder kc = new CollectionBuilder();
- assertEquals("AndGroup(author:tree title:name)",
- kc.andGroup().with(kc.andGroup().with(kc.term("author", "tree")).with(kc.term("title", "name"))).toString());
- };
-
-
- @Test
- public void builderOrCombined () throws IOException {
- CollectionBuilder kc = new CollectionBuilder();
- assertEquals("OrGroup(author:tree title:name)",
- kc.orGroup().with(kc.term("author", "tree"))
- .with(kc.term("title", "name")).toString());
- };
-
- @Test
- public void builderOrNestedSimple () throws IOException {
- CollectionBuilder kc = new CollectionBuilder();
- assertEquals("OrGroup(author:tree title:name)",
- kc.orGroup().with(kc.orGroup().with(kc.term("author", "tree"))
- .with(kc.term("title", "name"))).toString()
- );
- };
-
- @Test
- public void builderGroups () throws IOException {
- CollectionBuilder kc = new CollectionBuilder();
- String g = kc.orGroup().with(
- kc.orGroup().with(kc.term("author", "tree1")).with(kc.term("title", "name1"))
- ).with(
- kc.andGroup().with(kc.term("author", "tree2")).with(kc.term("title", "name2"))
- ).toString();
- assertEquals("OrGroup(OrGroup(author:tree1 title:name1) AndGroup(author:tree2 title:name2))", g);
- };
-
- @Test
- public void builderNegationRoot () throws IOException {
- CollectionBuilder kc = new CollectionBuilder();
- CollectionBuilder.CollectionBuilderInterface kbi = kc.orGroup().with(kc.term("author", "tree1")).with(kc.term("title", "name1"));
- assertEquals(
- "OrGroup(author:tree1 title:name1)",
- kbi.toString());
- assertFalse(kbi.isNegative());
-
- kbi = kc.andGroup().with(
- kc.orGroup().with(kc.term("author", "tree1")).with(kc.term("title", "name1"))
- ).not();
- assertEquals("OrGroup(author:tree1 title:name1)", kbi.toString());
- assertTrue(kbi.isNegative());
- };
-
-
- @Test
- public void builderNegation () throws IOException {
- CollectionBuilder kc = new CollectionBuilder();
- CollectionBuilder.CollectionBuilderInterface kbi =
- kc.term("author", "tree").not();
- assertEquals("author:tree", kbi.toString());
- assertTrue(kbi.isNegative());
-
- kbi = kc.andGroup().with(kc.term("author", "tree").not());
- assertEquals("author:tree", kbi.toString());
- assertTrue(kbi.isNegative());
-
- kbi = kc.orGroup().with(kc.term("author", "tree").not());
- assertEquals("author:tree", kbi.toString());
- assertTrue(kbi.isNegative());
- };
-
-
-};
diff --git a/src/test/resources/queries/metaquery.jsonld b/src/test/resources/queries/metaquery.jsonld
index b0b4c55..7d785c7 100644
--- a/src/test/resources/queries/metaquery.jsonld
+++ b/src/test/resources/queries/metaquery.jsonld
@@ -1,115 +1,180 @@
{
- "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
- "meta" : {
- "startPage" : 2,
- "count" : 5,
- "context" : {
- "left" : [ "token", 3 ],
- "right" : [ "char", 6 ]
- }
- },
- "query":{
- "@type":"koral:group",
- "operation":"operation:or",
- "operands":[
- {
+ "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "meta" : {
+ "startPage" : 2,
+ "count" : 5,
+ "context" : {
+ "left" : [ "token", 3 ],
+ "right" : [ "char", 6 ]
+ }
+ },
+ "query":{
+ "@type":"koral:group",
+ "operation":"operation:or",
+ "operands":[
+ {
+ "@type":"koral:token",
+ "wrap":{
+ "@type":"koral:term",
+ "foundry":"mate",
+ "layer" : "lemma",
+ "key" : "Vokal",
+ "match":"match:eq"
+ }
+ },
+ {
+ "@type":"koral:group",
+ "operation": "operation:sequence",
+ "operands":[
+ {
"@type":"koral:token",
"wrap":{
- "@type":"koral:term",
- "foundry":"mate",
- "layer" : "lemma",
- "key" : "Vokal",
- "match":"match:eq"
+ "@type":"koral:term",
+ "foundry":"mate",
+ "layer" : "base",
+ "key" : "der",
+ "match":"match:eq"
}
- },
- {
- "@type":"koral:group",
- "operation": "operation:sequence",
- "operands":[
- {
- "@type":"koral:token",
- "wrap":{
- "@type":"koral:term",
- "foundry":"mate",
- "layer" : "base",
- "key" : "der",
- "match":"match:eq"
- }
- },
- {
- "@type":"koral:token",
- "wrap":{
- "@type":"koral:term",
- "foundry":"mate",
- "layer" : "pos",
- "key" : "ADJA",
- "match":"match:eq"
- }
- }
- ]
- }
- ]
- },
- "collections": [
- {
- "@type": "koral:meta-filter",
- "@id": "korap-filter#id-1223232",
- "@value": {
- "@type": "koral:term",
- "@field": "koral:field#textClass",
- "@value": "wissenschaft"
+ },
+ {
+ "@type":"koral:token",
+ "wrap":{
+ "@type":"koral:term",
+ "foundry":"mate",
+ "layer" : "pos",
+ "key" : "ADJA",
+ "match":"match:eq"
}
- },
- {
- "@type": "koral:meta-filter",
- "@id": "korap-filter#id-34345454",
- "@value": {
- "@type": "koral:group",
- "relation": "and",
- "operands": [
- {
- "@type": "koral:term",
- "@field": "koral:field#pubPlace",
- "@value": "Erfurt"
- },
- {
- "@type": "koral:term",
- "@field": "koral:field#author",
- "@value": "Hesse"
- }
- ]
- }
- },
- {
- "@type": "koral:meta-extend",
- "@value": {
- "@type": "koral:group",
- "relation": "and",
- "operands": [
- {
- "@type": "koral:group",
- "comment": "other values can be 'since','until' in combination with a simple korap:term",
- "relation": "between",
- "field": "koral:field#pubDate",
- "operands": [
- {
- "@type": "koral:date",
- "comment": "either long value or String representation '2013-04-29'",
- "@value": "2011-04-29"
- },
- {
- "@type": "koral:date",
- "@value": "2013-12-31"
- }
- ]
- },
- {
- "@type": "koral:term",
- "@field": "koral:field#textClass",
- "@value": "freizeit"
- }
- ]
- }
- }
+ }
+ ]
+ }
]
+ },
+ "collection" : {
+ "@type" : "koral:docGroup",
+ "operation": "operation:or",
+ "operands" : [
+ {
+ "@type" : "koral:docGroup",
+ "operation" : "operation:and",
+ "operands" : [
+ {
+ "@type": "koral:doc",
+ "key": "textClass",
+ "value": "wissenschaft"
+ },
+ {
+ "@type" : "koral:docGroup",
+ "operation" : "operation:and",
+ "operands": [
+ {
+ "@type": "koral:doc",
+ "key": "pubPlace",
+ "value": "Erfurt"
+ },
+ {
+ "@type": "koral:doc",
+ "key": "author",
+ "value": "Hesse"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "@type" : "koral:docGroup",
+ "operation" : "operation:and",
+ "operands": [
+ {
+ "@type": "koral:docGroup",
+ "comment": "other values can be 'since','until' in combination with a simple korap:term",
+ "operation" : "operation:and",
+ "operands": [
+ {
+ "@type": "koral:doc",
+ "type": "type:date",
+ "comment": "either long value or String representation '2013-04-29'",
+ "key" : "pubDate",
+ "match": "match:geq",
+ "value": "2011-04-29"
+ },
+ {
+ "@type": "koral:doc",
+ "type": "type:date",
+ "key" : "pubDate",
+ "match": "match:leq",
+ "value": "2013-12-31"
+ }
+ ]
+ },
+ {
+ "@type": "koral:doc",
+ "key": "textClass",
+ "value": "freizeit"
+ }
+ ]
+ }]
+ },
+ "collections": [
+ {
+ "@type": "koral:meta-filter",
+ "@id": "korap-filter#id-1223232",
+ "@value": {
+ "@type": "koral:term",
+ "@field": "koral:field#textClass",
+ "@value": "wissenschaft"
+ }
+ },
+ {
+ "@type": "koral:meta-filter",
+ "@id": "korap-filter#id-34345454",
+ "@value": {
+ "@type": "koral:group",
+ "relation": "and",
+ "operands": [
+ {
+ "@type": "koral:term",
+ "@field": "koral:field#pubPlace",
+ "@value": "Erfurt"
+ },
+ {
+ "@type": "koral:term",
+ "@field": "koral:field#author",
+ "@value": "Hesse"
+ }
+ ]
+ }
+ },
+ {
+ "@type": "koral:meta-extend",
+ "@value": {
+ "@type": "koral:group",
+ "relation": "and",
+ "operands": [
+ {
+ "@type": "koral:group",
+ "comment": "other values can be 'since','until' in combination with a simple korap:term",
+ "relation": "between",
+ "field": "koral:field#pubDate",
+ "operands": [
+ {
+ "@type": "koral:date",
+ "comment": "either long value or String representation '2013-04-29'",
+ "@value": "2011-04-29"
+ },
+ {
+ "@type": "koral:date",
+ "@value": "2013-12-31"
+ }
+ ]
+ },
+ {
+ "@type": "koral:term",
+ "@field": "koral:field#textClass",
+ "@value": "freizeit"
+ }
+ ]
+ }
+ }
+ ]
}
diff --git a/src/test/resources/queries/metaquery2.jsonld b/src/test/resources/queries/metaquery2.jsonld
index f7c906a..2586b06 100644
--- a/src/test/resources/queries/metaquery2.jsonld
+++ b/src/test/resources/queries/metaquery2.jsonld
@@ -76,5 +76,23 @@
]
}
}
- ]
+ ],
+ "collection" : {
+ "@type" : "koral:docGroup",
+ "operation": "operation:and",
+ "operands" : [
+ {
+ "@type" : "koral:doc",
+ "key" : "author",
+ "value" : "Hesse"
+ },
+ {
+ "@type" : "koral:doc",
+ "key" : "pubDate",
+ "type" : "type:date",
+ "match" : "match:leq",
+ "value" : "2013-12-05"
+ }
+ ]
+ }
}
diff --git a/src/test/resources/queries/metaquery3.jsonld b/src/test/resources/queries/metaquery3.jsonld
index a9fca44..5fbd487 100644
--- a/src/test/resources/queries/metaquery3.jsonld
+++ b/src/test/resources/queries/metaquery3.jsonld
@@ -1,5 +1,5 @@
{
- "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
"meta":{
"startPage" : 2,
"count" : 5,
@@ -7,47 +7,47 @@
"left" : [ "token", 3 ],
"right" : [ "char", 6 ]
}
-},
- "query":{
- "@type":"koral:group",
- "operation":"operation:or",
- "operands":[
- {
+ },
+ "query":{
+ "@type":"koral:group",
+ "operation":"operation:or",
+ "operands":[
+ {
+ "@type":"koral:token",
+ "wrap":{
+ "@type":"koral:term",
+ "foundry" : "mate",
+ "layer":"l",
+ "key":"Vokal",
+ "match":"match:eq"
+ }
+ },
+ {
+ "@type":"koral:group",
+ "operation" : "operation:sequence",
+ "operands":[
+ {
"@type":"koral:token",
"wrap":{
- "@type":"koral:term",
- "foundry" : "mate",
- "layer":"l",
- "key":"Vokal",
- "match":"match:eq"
+ "@type":"koral:term",
+ "foundry" : "mate",
+ "layer":"l",
+ "key" : "der",
+ "match":"match:eq"
}
- },
- {
- "@type":"koral:group",
- "operation" : "operation:sequence",
- "operands":[
- {
- "@type":"koral:token",
- "wrap":{
- "@type":"koral:term",
- "foundry" : "mate",
- "layer":"l",
- "key" : "der",
- "match":"match:eq"
- }
- },
- {
- "@type":"koral:token",
- "wrap":{
- "@type":"koral:term",
- "foundry":"mate",
- "layer" : "p",
- "key" : "ADJA",
- "match":"match:eq"
- }
- }
- ]
- }
- ]
- }
+ },
+ {
+ "@type":"koral:token",
+ "wrap":{
+ "@type":"koral:term",
+ "foundry":"mate",
+ "layer" : "p",
+ "key" : "ADJA",
+ "match":"match:eq"
+ }
+ }
+ ]
+ }
+ ]
+ }
}
diff --git a/src/test/resources/queries/metaquery7.jsonld b/src/test/resources/queries/metaquery7.jsonld
index 0b664ed..0c6ce9e 100644
--- a/src/test/resources/queries/metaquery7.jsonld
+++ b/src/test/resources/queries/metaquery7.jsonld
@@ -1,60 +1,98 @@
{
- "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
- "meta":{
- "startPage" : 1,
- "count" : 5,
- "context" : {
- "left" : [ "token", 3 ],
- "right" : [ "char", 6 ]
- }
+ "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "meta":{
+ "startPage" : 1,
+ "count" : 5,
+ "context" : {
+ "left" : [ "token", 3 ],
+ "right" : [ "char", 6 ]
+ }
+ },
+ "query":{
+ "@type":"koral:token",
+ "wrap":{
+ "@type":"koral:term",
+ "foundry":"mate",
+ "layer":"l",
+ "key":"lediglich"
+ }
+ },
+ "collections": [
+ {
+ "@type": "koral:meta-filter",
+ "@id": "korap-filter#id-1223232",
+ "@value": {
+ "@type": "koral:group",
+ "relation": "or",
+ "@field": "koral:field#corpusID",
+ "operands": [
+ {
+ "@type": "koral:term",
+ "@value": "c-1"
+ },
+ {
+ "@type": "koral:term",
+ "@value": "c-2"
+ }
+ ]
+ }
},
- "query":{
- "@type":"koral:token",
- "wrap":{
- "@type":"koral:term",
- "foundry":"mate",
- "layer":"l",
- "key":"lediglich"
- }
- },
- "collections": [
- {
- "@type": "koral:meta-filter",
- "@id": "korap-filter#id-1223232",
- "@value": {
- "@type": "koral:group",
- "relation": "or",
- "@field": "koral:field#corpusID",
- "operands": [
- {
- "@type": "koral:term",
- "@value": "c-1"
- },
- {
- "@type": "koral:term",
- "@value": "c-2"
- }
- ]
- }
- },
- {
- "@type": "koral:meta-filter",
- "@id": "korap-filter#id-1223232",
- "@value": {
- "@type": "koral:group",
- "relation": "and",
- "@field": "koral:field#corpusID",
- "operands": [
- {
- "@type": "koral:term",
- "@value": "d-1"
- },
- {
- "@type": "koral:term",
- "@value": "d-2"
- }
- ]
- }
- }
+ {
+ "@type": "koral:meta-filter",
+ "@id": "korap-filter#id-1223232",
+ "@value": {
+ "@type": "koral:group",
+ "relation": "and",
+ "@field": "koral:field#corpusID",
+ "operands": [
+ {
+ "@type": "koral:term",
+ "@value": "d-1"
+ },
+ {
+ "@type": "koral:term",
+ "@value": "d-2"
+ }
+ ]
+ }
+ }
+ ],
+ "collection" : {
+ "@type" : "koral:docGroup",
+ "operation" : "operation:and",
+ "operands" : [
+ {
+ "@type" : "koral:docGroup",
+ "operation" : "operation:or",
+ "operands" : [
+ {
+ "@type" : "koral:doc",
+ "key" : "corpusID",
+ "value" : "c-1"
+ },
+ {
+ "@type" : "koral:doc",
+ "key" : "corpusID",
+ "value" : "c-2"
+ }
+ ]
+ },
+ {
+ "@type" : "koral:docGroup",
+ "operation" : "operation:and",
+ "operands" : [
+ {
+ "@type" : "koral:doc",
+ "key" : "corpusID",
+ "value" : "d-1"
+ },
+ {
+ "@type" : "koral:doc",
+ "key" : "corpusID",
+ "value" : "d-2"
+ }
+ ]
+ }
]
+ }
}
diff --git a/src/test/resources/queries/metaquery9.jsonld b/src/test/resources/queries/metaquery9.jsonld
index 5a812ec..a89b584 100644
--- a/src/test/resources/queries/metaquery9.jsonld
+++ b/src/test/resources/queries/metaquery9.jsonld
@@ -1,12 +1,17 @@
{
- "collections":[
- {
- "@type":"koral:meta-filter",
- "@value":{
- "@type":"koral:term",
- "@field":"koral:field#corpusID",
- "@value":"WPD"
- }
- }
- ]
+ "collections":[
+ {
+ "@type":"koral:meta-filter",
+ "@value":{
+ "@type":"koral:term",
+ "@field":"koral:field#corpusID",
+ "@value":"WPD"
+ }
+ }
+ ],
+ "collection" : {
+ "@type" : "koral:doc",
+ "key" : "corpusID",
+ "value" : "WPD"
+ }
}