date update, field fix
diff --git a/src/test/java/MetaQuerySerializationTest.java b/src/test/java/MetaQuerySerializationTest.java
index 99fb774..ccd0011 100644
--- a/src/test/java/MetaQuerySerializationTest.java
+++ b/src/test/java/MetaQuerySerializationTest.java
@@ -1,3 +1,6 @@
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import de.ids_mannheim.korap.query.serialize.JsonGenerator;
import de.ids_mannheim.korap.query.serialize.MetaCollectionSerializer;
import de.ids_mannheim.korap.query.serialize.MetaQuerySerializer;
import org.joda.time.DateTime;
@@ -41,29 +44,29 @@
Map<String, String> j = new HashMap();
j.put("textClass", "wissenschaft");
String s = querySerializer.stringify(j, MetaQuerySerializer.TYPE.FILTER);
-// System.out.println("value reference test single " + s);
+ System.out.println("------ TEXT SINGLE " + s);
}
@Test
public void testResourceMeta() throws IOException {
String s = collSerializer.serialize("25");
-// System.out.println(" --- RESULT JSON " + s);
+ System.out.println(" --- RESULT JSON " + s);
}
@Test
public void testDates() throws IOException {
Map<String, String> queries = new LinkedHashMap<>();
- queries.put("<pubDate", String.valueOf(new DateTime().getMillis()));
- queries.put(">pubDate", String.valueOf(new DateTime().getMillis() + 2));
+ queries.put("pubDate", String.valueOf(new DateTime().getMillis()) + "~"
+ + String.valueOf(new DateTime().getMillis() + 2));
queries.put("author", "Goethe");
String f = querySerializer.stringify(queries, MetaQuerySerializer.TYPE.FILTER);
-// System.out.println("value : "+ f);
+ System.out.println("value until/since : " + f);
}
@Test
public void testUntil() throws IOException {
Map<String, String> queries = new LinkedHashMap<>();
- queries.put(">pubDate", String.valueOf(new DateTime().getMillis()));
+ queries.put("pubDate", ">" + String.valueOf(new DateTime().getMillis()));
queries.put("author", "Hesse");
String f = querySerializer.stringify(queries, MetaQuerySerializer.TYPE.FILTER);
System.out.println("value until : " + f);
@@ -72,10 +75,43 @@
@Test
public void testSince() throws IOException {
Map<String, String> queries = new LinkedHashMap<>();
- queries.put("<pubDate", String.valueOf(new DateTime().getMillis()));
+ queries.put("pubDate", "<" + String.valueOf(new DateTime().getMillis()));
queries.put("author", "Kafka");
String f = querySerializer.stringify(queries, MetaQuerySerializer.TYPE.FILTER);
System.out.println("value since : " + f);
}
+ //@Test
+ public void testGenerator() {
+ /*
+ * just for testing...
+ */
+ JsonGenerator jg = new JsonGenerator();
+ int i = 0;
+ String[] queries;
+ queries = new String[]{
+ "shrink({[base=foo]})",
+ "shrink({[base=foo]}[orth=bar])",
+ "shrink(1:[base=Der]{1:[base=Mann]})",
+ };
+
+ for (String q : queries) {
+ i++;
+ try {
+ System.out.println(q);
+ jg.run(q, "poliqarp", System.getProperty("user.home") + "/bsp" + i + ".json");
+ System.out.println();
+ } catch (NullPointerException npe) {
+ npe.printStackTrace();
+ System.out.println("null\n");
+ } catch (JsonGenerationException e) {
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
}