- bump up to most recent REST version (0.7).
- policy serialization
- bug fixes
- term relation integration for corpus views (refactored to collection views)
diff --git a/src/test/java/MetaQuerySerializationTest.java b/src/test/java/MetaQuerySerializationTest.java
index 7e430fa..2f7d8c3 100644
--- a/src/test/java/MetaQuerySerializationTest.java
+++ b/src/test/java/MetaQuerySerializationTest.java
@@ -4,7 +4,6 @@
import de.ids_mannheim.korap.query.serialize.CollectionQuery;
import de.ids_mannheim.korap.query.serialize.QuerySerializer;
import de.ids_mannheim.korap.util.QueryException;
-
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -30,9 +29,10 @@
b.append(" AND ");
b.append("textClass:wissenschaft");
// CollectionQuery qu = new CollectionQuery().addMetaFilter(b.toString());
- CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString());
- System.out.println(query.buildString());
- System.out.println(query.toCollections());
+ CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString(),
+ CollectionQuery.RELATION.AND);
+ System.out.println(query.buildString(CollectionQuery.RELATION.AND, CollectionQuery.RELATION.AND));
+ System.out.println(query.toCollections(CollectionQuery.RELATION.AND, CollectionQuery.RELATION.AND));
// System.out.println("value reference " + qu.stringify());
// System.out.println();
}
@@ -41,7 +41,7 @@
public void testSingle() throws IOException {
CollectionQuery query = new CollectionQuery().addMetaFilter("textClass", "wissenschaft");
// System.out.println("------ TEXT SINGLE " + query.stringify());
- System.out.println(query.buildString());
+ System.out.println(query.buildString(CollectionQuery.RELATION.AND, CollectionQuery.RELATION.AND));
}
@Test
@@ -52,10 +52,10 @@
b.append("pubDate:<2012-04-01");
b.append(" AND ");
b.append("author:Goethe");
- CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString());
- System.out.println("value until/since : " + query.buildString());
- System.out.println("meta value until/since " + query.toCollections());
- Assert.assertEquals("[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:group\",\"relation\":\"and\",\"operands\":[{\"@type\":\"korap:term\",\"@field\":\"korap:field#author\",\"@value\":\"Goethe\"},{\"@type\":\"korap:group\",\"@field\":\"korap:field#pubDate\",\"relation\":\"between\",\"operands\":[{\"@type\":\"korap:date\",\"@value\":\"2012-04-01\"},{\"@type\":\"korap:date\",\"@value\":\"2013-04-01\"}]}]}}]", query.buildString());
+ CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString(), CollectionQuery.RELATION.AND);
+ System.out.println("value until/since : " + query.buildString(CollectionQuery.RELATION.AND, CollectionQuery.RELATION.AND));
+ System.out.println("meta value until/since " + query.toCollections(CollectionQuery.RELATION.AND, CollectionQuery.RELATION.AND));
+ Assert.assertEquals("[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:group\",\"relation\":\"and\",\"operands\":[{\"@type\":\"korap:term\",\"@field\":\"korap:field#author\",\"@value\":\"Goethe\"},{\"@type\":\"korap:group\",\"@field\":\"korap:field#pubDate\",\"relation\":\"between\",\"operands\":[{\"@type\":\"korap:date\",\"@value\":\"2012-04-01\"},{\"@type\":\"korap:date\",\"@value\":\"2013-04-01\"}]}]}}]", query.buildString(CollectionQuery.RELATION.AND, CollectionQuery.RELATION.AND));
// System.out.println();
}
@@ -65,9 +65,9 @@
b.append("pubDate:>2013-12-10");
b.append(" AND ");
b.append("author:Hesse");
- CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString());
+ CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString(), CollectionQuery.RELATION.AND);
System.out.println("Running date check (until) with additional attribute author");
- Assert.assertEquals("[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:group\",\"relation\":\"and\",\"operands\":[{\"@type\":\"korap:term\",\"@field\":\"korap:field#author\",\"@value\":\"Hesse\"},{\"@type\":\"korap:group\",\"@field\":\"korap:field#pubDate\",\"relation\":\"until\",\"operands\":[{\"@type\":\"korap:date\",\"@value\":\"2013-12-10\"}]}]}}]", query.buildString());
+ Assert.assertEquals("[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:group\",\"relation\":\"and\",\"operands\":[{\"@type\":\"korap:term\",\"@field\":\"korap:field#author\",\"@value\":\"Hesse\"},{\"@type\":\"korap:group\",\"@field\":\"korap:field#pubDate\",\"relation\":\"until\",\"operands\":[{\"@type\":\"korap:date\",\"@value\":\"2013-12-10\"}]}]}}]", query.buildString(CollectionQuery.RELATION.AND, CollectionQuery.RELATION.AND));
// System.out.println("value until : " + query.stringify());
// System.out.println();
}
@@ -78,12 +78,13 @@
b.append("pubDate:<2013-12-10");
b.append(" AND ");
b.append("author:Kafka");
- CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString());
- System.out.println("value since : " + query.buildString());
- System.out.println("meta value since " + query.toCollections());
+ CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString(), CollectionQuery.RELATION.AND);
+ System.out.println("value since : " + query.buildString(CollectionQuery.RELATION.AND,
+ CollectionQuery.RELATION.AND));
+ System.out.println("meta value since " + query.toCollections(CollectionQuery.RELATION.AND, CollectionQuery.RELATION.AND));
// System.out.println();
System.out.println("Running date check (since) with additional attribute author");
- Assert.assertEquals("[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:group\",\"relation\":\"and\",\"operands\":[{\"@type\":\"korap:term\",\"@field\":\"korap:field#author\",\"@value\":\"Kafka\"},{\"@type\":\"korap:group\",\"@field\":\"korap:field#pubDate\",\"relation\":\"since\",\"operands\":[{\"@type\":\"korap:date\",\"@value\":\"2013-12-10\"}]}]}}]", query.buildString());
+ Assert.assertEquals("[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:group\",\"relation\":\"and\",\"operands\":[{\"@type\":\"korap:term\",\"@field\":\"korap:field#author\",\"@value\":\"Kafka\"},{\"@type\":\"korap:group\",\"@field\":\"korap:field#pubDate\",\"relation\":\"since\",\"operands\":[{\"@type\":\"korap:date\",\"@value\":\"2013-12-10\"}]}]}}]", query.buildString(CollectionQuery.RELATION.AND, CollectionQuery.RELATION.AND));
}
@Test
@@ -126,10 +127,10 @@
b.append("pubDate:<2013-12-10");
b.append(" AND ");
b.append("author:Kafka");
- CollectionQuery q = new CollectionQuery().addMetaFilter(b.toString());
+ CollectionQuery q = new CollectionQuery().addMetaFilter(b.toString(), CollectionQuery.RELATION.AND);
q.addMetaExtend("author", "Hesse");
- System.out.println("--- ALL " + q.buildString());
+ System.out.println("--- ALL " + q.buildString(CollectionQuery.RELATION.AND, CollectionQuery.RELATION.AND));
System.out.println();
}
@@ -140,8 +141,8 @@
b.append("pubDate:<2013-12-10");
b.append(" AND ");
b.append("author:Kafka");
- CollectionQuery q = new CollectionQuery().addMetaExtend(b.toString());
- System.out.println("array repres " + q.buildString());
+ CollectionQuery q = new CollectionQuery().addMetaExtend(b.toString(), CollectionQuery.RELATION.AND);
+ System.out.println("array repres " + q.buildString(CollectionQuery.RELATION.AND, CollectionQuery.RELATION.AND));
System.out.println();
}
@@ -150,8 +151,8 @@
CollectionQuery q = new CollectionQuery().addMetaFilter("corpusID", "A00");
q.addMetaExtend("corpusID", "A01");
- System.out.println("results stringified " + q.buildString());
- System.out.println("results to meta" + q.toCollections());
+ System.out.println("results stringified " + q.buildString(CollectionQuery.RELATION.AND, CollectionQuery.RELATION.AND));
+ System.out.println("results to meta" + q.toCollections(CollectionQuery.RELATION.AND, CollectionQuery.RELATION.AND));
System.out.println();
}
@@ -166,13 +167,13 @@
String meta = "[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:term\",\"@field\":\"korap:field#corpusID\",\"@value\":\"WPD\"}}]";
CollectionQuery q = new CollectionQuery().addResource(meta);
System.out.println("Testing Resource Meta data");
- org.junit.Assert.assertEquals("{\"collections\":" + meta + "}", q.toCollections());
+ org.junit.Assert.assertEquals("{\"collections\":" + meta + "}", q.toCollections(CollectionQuery.RELATION.AND, CollectionQuery.RELATION.AND));
}
@Test
public void testA00() throws IOException {
CollectionQuery q = new CollectionQuery().addMetaExtend("corpusID", "A00").addMetaExtend("corpusID", "A01");
- System.out.println("A meta: " + q.buildString());
+ System.out.println("A meta: " + q.buildString(CollectionQuery.RELATION.AND, CollectionQuery.RELATION.AND));
System.out.println();
}
@@ -181,8 +182,8 @@
String meta = "[{\"@type\":\"korap:meta-filter\",\"@value\":{\"@type\":\"korap:term\",\"@field\":\"korap:field#corpusID\",\"@value\":\"WPD\"}}]";
CollectionQuery q = new CollectionQuery().addResource(meta);
q.addMetaFilter("textClass", "wissenschaft");
- System.out.println("stringified meta " + q.buildString());
- System.out.println("meta string " + q.toCollections());
+ System.out.println("stringified meta " + q.buildString(CollectionQuery.RELATION.AND, CollectionQuery.RELATION.AND));
+ System.out.println("meta string " + q.toCollections(CollectionQuery.RELATION.AND, CollectionQuery.RELATION.AND));
}
}