previously introduced collection query bug fix
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java b/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
index a4a978b..ff11926 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
@@ -1,8 +1,6 @@
package de.ids_mannheim.korap.query.serialize;
-import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import de.ids_mannheim.korap.query.serialize.util.KoralObjectGenerator;
import de.ids_mannheim.korap.query.serialize.util.StatusCodes;
@@ -40,7 +38,7 @@
public static String queryLanguageVersion;
private AbstractQueryProcessor ast;
- private Map<String, Object> collection = new LinkedHashMap<String, Object>();
+ private Map<String, Object> collection = new LinkedHashMap<>();
private Map<String, Object> meta;
private List<Object> errors;
private List<Object> warnings;
@@ -82,10 +80,6 @@
}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();
}
@@ -180,20 +174,21 @@
List warnings = (List) requestMap.get("warnings");
List messages = (List) requestMap.get("messages");
this.collection = mergeCollection(collection, this.collection);
- requestMap.put("collection", this.collection);
+ if (this.collection != null && !this.collection.isEmpty())
+ requestMap.put("collection", this.collection);
if (this.meta != null) {
meta.putAll(this.meta);
requestMap.put("meta", meta);
}
- if (this.errors != null) {
+ if (this.errors != null && !this.errors.isEmpty()) {
errors.addAll(this.errors);
requestMap.put("errors", errors);
}
- if (this.warnings != null) {
+ if (this.warnings != null && !this.warnings.isEmpty()) {
warnings.addAll(this.warnings);
requestMap.put("warnings", warnings);
}
- if (this.messages != null) {
+ if (this.messages != null && !this.messages.isEmpty()) {
messages.addAll(this.messages);
requestMap.put("messages", messages);
}
@@ -205,15 +200,15 @@
private Map<String, Object> mergeCollection(Map<String, Object> collection1,
Map<String, Object> collection2) {
- LinkedHashMap<String, Object> docGroup = KoralObjectGenerator
- .makeDocGroup("and");
- ArrayList<Object> operands = (ArrayList<Object>) docGroup
- .get("operands");
if (collection1 == null || collection1.isEmpty()) {
return collection2;
}else if (collection2 == null || collection2.isEmpty()) {
return collection1;
}else {
+ LinkedHashMap<String, Object> docGroup = KoralObjectGenerator
+ .makeDocGroup("and");
+ ArrayList<Object> operands = (ArrayList<Object>) docGroup
+ .get("operands");
operands.add(collection1);
operands.add(collection2);
return docGroup;
@@ -243,14 +238,16 @@
public QuerySerializer setCollection(String collection) {
CollectionQueryProcessor tree = new CollectionQueryProcessor();
- Map<String, Object> collectionRequest = tree.getRequestMap();
tree.process(collection);
+ Map<String, Object> collectionRequest = tree.getRequestMap();
if (collectionRequest.get("errors") != null)
this.errors.addAll((List) collectionRequest.get("errors"));
if (collectionRequest.get("warnings") != null)
this.warnings.addAll((List) collectionRequest.get("warnings"));
if (collectionRequest.get("messages") != null)
this.messages.addAll((List) collectionRequest.get("messages"));
+ this.collection = (Map<String, Object>) collectionRequest
+ .get("collection");
return this;
}
}
diff --git a/src/test/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessorTest.java b/src/test/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessorTest.java
index 62e6d1f..d7d3cf7 100644
--- a/src/test/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessorTest.java
+++ b/src/test/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessorTest.java
@@ -1,17 +1,15 @@
package de.ids_mannheim.korap.query.serialize;
-import static org.junit.Assert.*;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Test;
import java.io.IOException;
import java.util.ArrayList;
-import de.ids_mannheim.korap.query.serialize.QuerySerializer;
-
-import org.junit.Test;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
public class CollectionQueryProcessorTest {
@@ -24,9 +22,8 @@
ObjectMapper mapper = new ObjectMapper();
JsonNode res;
-
@Test
- public void testContext () throws JsonProcessingException, IOException {
+ public void testContext() throws JsonProcessingException, IOException {
collection = "textClass=politik";
String contextString = "http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld";
qs.setQuery(query, ql);
@@ -35,9 +32,8 @@
assertEquals(contextString, res.get("@context").asText());
}
-
@Test
- public void testSimple () throws JsonProcessingException, IOException {
+ public void testSimple() throws JsonProcessingException, IOException {
collection = "textClass=politik";
qs.setQuery(query, ql);
qs.setCollection(collection);
@@ -57,9 +53,8 @@
assertEquals("match:ne", res.at("/collection/match").asText());
}
-
@Test
- public void testContains () throws JsonProcessingException, IOException {
+ public void testContains() throws JsonProcessingException, IOException {
collection = "title~Mannheim";
qs.setQuery(query, ql);
qs.setCollection(collection);
@@ -79,29 +74,29 @@
assertEquals("match:contains", res.at("/collection/match").asText());
}
-
@Test
- public void testTwoConjuncts () throws JsonProcessingException, IOException {
+ public void testTwoConjuncts() throws JsonProcessingException, IOException {
collection = "textClass=Sport & pubDate in 2014";
qs.setQuery(query, ql);
qs.setCollection(collection);
res = mapper.readTree(qs.toJSON());
assertEquals("koral:docGroup", res.at("/collection/@type").asText());
assertEquals("operation:and", res.at("/collection/operation").asText());
- assertEquals("koral:doc", res.at("/collection/operands/0/@type")
- .asText());
- assertEquals("textClass", res.at("/collection/operands/0/key").asText());
+ assertEquals("koral:doc",
+ res.at("/collection/operands/0/@type").asText());
+ assertEquals("textClass",
+ res.at("/collection/operands/0/key").asText());
assertEquals("Sport", res.at("/collection/operands/0/value").asText());
- assertEquals("match:eq", res.at("/collection/operands/0/match")
- .asText());
- assertEquals("koral:doc", res.at("/collection/operands/1/@type")
- .asText());
+ assertEquals("match:eq",
+ res.at("/collection/operands/0/match").asText());
+ assertEquals("koral:doc",
+ res.at("/collection/operands/1/@type").asText());
assertEquals("pubDate", res.at("/collection/operands/1/key").asText());
assertEquals("2014", res.at("/collection/operands/1/value").asText());
- assertEquals("type:date", res.at("/collection/operands/1/type")
- .asText());
- assertEquals("match:eq", res.at("/collection/operands/1/match")
- .asText());
+ assertEquals("type:date",
+ res.at("/collection/operands/1/type").asText());
+ assertEquals("match:eq",
+ res.at("/collection/operands/1/match").asText());
collection = "textClass=Sport & pubDate=2014";
qs.setQuery(query, ql);
@@ -109,167 +104,165 @@
res = mapper.readTree(qs.toJSON());
assertEquals("koral:docGroup", res.at("/collection/@type").asText());
assertEquals("operation:and", res.at("/collection/operation").asText());
- assertEquals("koral:doc", res.at("/collection/operands/0/@type")
- .asText());
- assertEquals("textClass", res.at("/collection/operands/0/key").asText());
+ assertEquals("koral:doc",
+ res.at("/collection/operands/0/@type").asText());
+ assertEquals("textClass",
+ res.at("/collection/operands/0/key").asText());
assertEquals("Sport", res.at("/collection/operands/0/value").asText());
- assertEquals("match:eq", res.at("/collection/operands/0/match")
- .asText());
- assertEquals("koral:doc", res.at("/collection/operands/1/@type")
- .asText());
+ assertEquals("match:eq",
+ res.at("/collection/operands/0/match").asText());
+ assertEquals("koral:doc",
+ res.at("/collection/operands/1/@type").asText());
assertEquals("pubDate", res.at("/collection/operands/1/key").asText());
assertEquals("2014", res.at("/collection/operands/1/value").asText());
- assertEquals(true, res.at("/collection/operands/1/type")
- .isMissingNode());
- assertEquals("match:eq", res.at("/collection/operands/1/match")
- .asText());
- assertTrue(res
- .at("/warnings/0/0")
- .asText()
- .startsWith(
- "The collection query contains a value that looks like a date"));
+ assertEquals(true,
+ res.at("/collection/operands/1/type").isMissingNode());
+ assertEquals("match:eq",
+ res.at("/collection/operands/1/match").asText());
+ assertTrue(res.at("/warnings/0/0").asText().startsWith(
+ "The collection query contains a value that looks like a date"));
}
-
@Test
- public void testThreeConjuncts () throws JsonProcessingException,
- IOException {
+ public void testThreeConjuncts()
+ throws JsonProcessingException, IOException {
collection = "textClass=Sport & pubDate in 2014 & corpusId=WPD";
qs.setQuery(query, ql);
qs.setCollection(collection);
res = mapper.readTree(qs.toJSON());
assertEquals("koral:docGroup", res.at("/collection/@type").asText());
assertEquals("operation:and", res.at("/collection/operation").asText());
- assertEquals("koral:doc", res.at("/collection/operands/0/@type")
- .asText());
- assertEquals("textClass", res.at("/collection/operands/0/key").asText());
+ assertEquals("koral:doc",
+ res.at("/collection/operands/0/@type").asText());
+ assertEquals("textClass",
+ res.at("/collection/operands/0/key").asText());
assertEquals("Sport", res.at("/collection/operands/0/value").asText());
- assertEquals("match:eq", res.at("/collection/operands/0/match")
- .asText());
- assertEquals("koral:docGroup", res.at("/collection/operands/1/@type")
- .asText());
- assertEquals("operation:and", res
- .at("/collection/operands/1/operation").asText());
+ assertEquals("match:eq",
+ res.at("/collection/operands/0/match").asText());
+ assertEquals("koral:docGroup",
+ res.at("/collection/operands/1/@type").asText());
+ assertEquals("operation:and",
+ res.at("/collection/operands/1/operation").asText());
assertEquals("koral:doc",
res.at("/collection/operands/1/operands/0/@type").asText());
- assertEquals("pubDate", res.at("/collection/operands/1/operands/0/key")
- .asText());
- assertEquals("2014", res.at("/collection/operands/1/operands/0/value")
- .asText());
+ assertEquals("pubDate",
+ res.at("/collection/operands/1/operands/0/key").asText());
+ assertEquals("2014",
+ res.at("/collection/operands/1/operands/0/value").asText());
assertEquals("type:date",
res.at("/collection/operands/1/operands/0/type").asText());
assertEquals("match:eq",
res.at("/collection/operands/1/operands/0/match").asText());
assertEquals("koral:doc",
res.at("/collection/operands/1/operands/1/@type").asText());
- assertEquals("corpusId", res
- .at("/collection/operands/1/operands/1/key").asText());
- assertEquals("WPD", res.at("/collection/operands/1/operands/1/value")
- .asText());
+ assertEquals("corpusId",
+ res.at("/collection/operands/1/operands/1/key").asText());
+ assertEquals("WPD",
+ res.at("/collection/operands/1/operands/1/value").asText());
assertEquals("match:eq",
res.at("/collection/operands/1/operands/1/match").asText());
}
-
@Test
- public void testTwoDisjuncts () throws JsonProcessingException, IOException {
+ public void testTwoDisjuncts() throws JsonProcessingException, IOException {
collection = "textClass=Sport | pubDate in 2014";
qs.setQuery(query, ql);
qs.setCollection(collection);
res = mapper.readTree(qs.toJSON());
assertEquals("koral:docGroup", res.at("/collection/@type").asText());
assertEquals("operation:or", res.at("/collection/operation").asText());
- assertEquals("koral:doc", res.at("/collection/operands/0/@type")
- .asText());
- assertEquals("textClass", res.at("/collection/operands/0/key").asText());
+ assertEquals("koral:doc",
+ res.at("/collection/operands/0/@type").asText());
+ assertEquals("textClass",
+ res.at("/collection/operands/0/key").asText());
assertEquals("Sport", res.at("/collection/operands/0/value").asText());
- assertEquals("match:eq", res.at("/collection/operands/0/match")
- .asText());
- assertEquals("koral:doc", res.at("/collection/operands/1/@type")
- .asText());
+ assertEquals("match:eq",
+ res.at("/collection/operands/0/match").asText());
+ assertEquals("koral:doc",
+ res.at("/collection/operands/1/@type").asText());
assertEquals("pubDate", res.at("/collection/operands/1/key").asText());
assertEquals("2014", res.at("/collection/operands/1/value").asText());
- assertEquals("type:date", res.at("/collection/operands/1/type")
- .asText());
- assertEquals("match:eq", res.at("/collection/operands/1/match")
- .asText());
+ assertEquals("type:date",
+ res.at("/collection/operands/1/type").asText());
+ assertEquals("match:eq",
+ res.at("/collection/operands/1/match").asText());
}
-
@Test
- public void testThreeDisjuncts () throws JsonProcessingException,
- IOException {
+ public void testThreeDisjuncts()
+ throws JsonProcessingException, IOException {
collection = "textClass=Sport | pubDate in 2014 | corpusId=WPD";
qs.setQuery(query, ql);
qs.setCollection(collection);
res = mapper.readTree(qs.toJSON());
assertEquals("koral:docGroup", res.at("/collection/@type").asText());
assertEquals("operation:or", res.at("/collection/operation").asText());
- assertEquals("koral:doc", res.at("/collection/operands/0/@type")
- .asText());
- assertEquals("textClass", res.at("/collection/operands/0/key").asText());
+ assertEquals("koral:doc",
+ res.at("/collection/operands/0/@type").asText());
+ assertEquals("textClass",
+ res.at("/collection/operands/0/key").asText());
assertEquals("Sport", res.at("/collection/operands/0/value").asText());
- assertEquals("match:eq", res.at("/collection/operands/0/match")
- .asText());
- assertEquals("koral:docGroup", res.at("/collection/operands/1/@type")
- .asText());
- assertEquals("operation:or", res.at("/collection/operands/1/operation")
- .asText());
+ assertEquals("match:eq",
+ res.at("/collection/operands/0/match").asText());
+ assertEquals("koral:docGroup",
+ res.at("/collection/operands/1/@type").asText());
+ assertEquals("operation:or",
+ res.at("/collection/operands/1/operation").asText());
assertEquals("koral:doc",
res.at("/collection/operands/1/operands/0/@type").asText());
- assertEquals("pubDate", res.at("/collection/operands/1/operands/0/key")
- .asText());
- assertEquals("2014", res.at("/collection/operands/1/operands/0/value")
- .asText());
+ assertEquals("pubDate",
+ res.at("/collection/operands/1/operands/0/key").asText());
+ assertEquals("2014",
+ res.at("/collection/operands/1/operands/0/value").asText());
assertEquals("type:date",
res.at("/collection/operands/1/operands/0/type").asText());
assertEquals("match:eq",
res.at("/collection/operands/1/operands/0/match").asText());
assertEquals("koral:doc",
res.at("/collection/operands/1/operands/1/@type").asText());
- assertEquals("corpusId", res
- .at("/collection/operands/1/operands/1/key").asText());
- assertEquals("WPD", res.at("/collection/operands/1/operands/1/value")
- .asText());
+ assertEquals("corpusId",
+ res.at("/collection/operands/1/operands/1/key").asText());
+ assertEquals("WPD",
+ res.at("/collection/operands/1/operands/1/value").asText());
assertEquals("match:eq",
res.at("/collection/operands/1/operands/1/match").asText());
}
-
@Test
- public void testMixed () throws JsonProcessingException, IOException {
+ public void testMixed() throws JsonProcessingException, IOException {
collection = "textClass=Sport | (pubDate in 2014 & corpusId=WPD)";
qs.setQuery(query, ql);
qs.setCollection(collection);
res = mapper.readTree(qs.toJSON());
assertEquals("koral:docGroup", res.at("/collection/@type").asText());
assertEquals("operation:or", res.at("/collection/operation").asText());
- assertEquals("koral:doc", res.at("/collection/operands/0/@type")
- .asText());
- assertEquals("textClass", res.at("/collection/operands/0/key").asText());
+ assertEquals("koral:doc",
+ res.at("/collection/operands/0/@type").asText());
+ assertEquals("textClass",
+ res.at("/collection/operands/0/key").asText());
assertEquals("Sport", res.at("/collection/operands/0/value").asText());
- assertEquals("match:eq", res.at("/collection/operands/0/match")
- .asText());
- assertEquals("koral:docGroup", res.at("/collection/operands/1/@type")
- .asText());
- assertEquals("operation:and", res
- .at("/collection/operands/1/operation").asText());
+ assertEquals("match:eq",
+ res.at("/collection/operands/0/match").asText());
+ assertEquals("koral:docGroup",
+ res.at("/collection/operands/1/@type").asText());
+ assertEquals("operation:and",
+ res.at("/collection/operands/1/operation").asText());
assertEquals("koral:doc",
res.at("/collection/operands/1/operands/0/@type").asText());
- assertEquals("pubDate", res.at("/collection/operands/1/operands/0/key")
- .asText());
- assertEquals("2014", res.at("/collection/operands/1/operands/0/value")
- .asText());
+ assertEquals("pubDate",
+ res.at("/collection/operands/1/operands/0/key").asText());
+ assertEquals("2014",
+ res.at("/collection/operands/1/operands/0/value").asText());
assertEquals("type:date",
res.at("/collection/operands/1/operands/0/type").asText());
assertEquals("match:eq",
res.at("/collection/operands/1/operands/0/match").asText());
assertEquals("koral:doc",
res.at("/collection/operands/1/operands/1/@type").asText());
- assertEquals("corpusId", res
- .at("/collection/operands/1/operands/1/key").asText());
- assertEquals("WPD", res.at("/collection/operands/1/operands/1/value")
- .asText());
+ assertEquals("corpusId",
+ res.at("/collection/operands/1/operands/1/key").asText());
+ assertEquals("WPD",
+ res.at("/collection/operands/1/operands/1/value").asText());
assertEquals("match:eq",
res.at("/collection/operands/1/operands/1/match").asText());
@@ -279,32 +272,33 @@
res = mapper.readTree(qs.toJSON());
assertEquals("koral:docGroup", res.at("/collection/@type").asText());
assertEquals("operation:or", res.at("/collection/operation").asText());
- assertEquals("koral:doc", res.at("/collection/operands/0/@type")
- .asText());
- assertEquals("textClass", res.at("/collection/operands/0/key").asText());
+ assertEquals("koral:doc",
+ res.at("/collection/operands/0/@type").asText());
+ assertEquals("textClass",
+ res.at("/collection/operands/0/key").asText());
assertEquals("Sport", res.at("/collection/operands/0/value").asText());
- assertEquals("match:eq", res.at("/collection/operands/0/match")
- .asText());
- assertEquals("koral:docGroup", res.at("/collection/operands/1/@type")
- .asText());
- assertEquals("operation:and", res
- .at("/collection/operands/1/operation").asText());
+ assertEquals("match:eq",
+ res.at("/collection/operands/0/match").asText());
+ assertEquals("koral:docGroup",
+ res.at("/collection/operands/1/@type").asText());
+ assertEquals("operation:and",
+ res.at("/collection/operands/1/operation").asText());
assertEquals("koral:doc",
res.at("/collection/operands/1/operands/0/@type").asText());
- assertEquals("pubDate", res.at("/collection/operands/1/operands/0/key")
- .asText());
- assertEquals("2014", res.at("/collection/operands/1/operands/0/value")
- .asText());
+ assertEquals("pubDate",
+ res.at("/collection/operands/1/operands/0/key").asText());
+ assertEquals("2014",
+ res.at("/collection/operands/1/operands/0/value").asText());
assertEquals("type:date",
res.at("/collection/operands/1/operands/0/type").asText());
assertEquals("match:eq",
res.at("/collection/operands/1/operands/0/match").asText());
assertEquals("koral:doc",
res.at("/collection/operands/1/operands/1/@type").asText());
- assertEquals("corpusId", res
- .at("/collection/operands/1/operands/1/key").asText());
- assertEquals("WPD", res.at("/collection/operands/1/operands/1/value")
- .asText());
+ assertEquals("corpusId",
+ res.at("/collection/operands/1/operands/1/key").asText());
+ assertEquals("WPD",
+ res.at("/collection/operands/1/operands/1/value").asText());
assertEquals("match:eq",
res.at("/collection/operands/1/operands/1/match").asText());
@@ -314,16 +308,16 @@
res = mapper.readTree(qs.toJSON());
assertEquals("koral:docGroup", res.at("/collection/@type").asText());
assertEquals("operation:and", res.at("/collection/operation").asText());
- assertEquals("koral:docGroup", res.at("/collection/operands/0/@type")
- .asText());
- assertEquals("operation:or", res.at("/collection/operands/0/operation")
- .asText());
+ assertEquals("koral:docGroup",
+ res.at("/collection/operands/0/@type").asText());
+ assertEquals("operation:or",
+ res.at("/collection/operands/0/operation").asText());
assertEquals("koral:doc",
res.at("/collection/operands/0/operands/0/@type").asText());
assertEquals("koral:doc",
res.at("/collection/operands/0/operands/1/@type").asText());
- assertEquals("koral:doc", res.at("/collection/operands/1/@type")
- .asText());
+ assertEquals("koral:doc",
+ res.at("/collection/operands/1/@type").asText());
collection = "(textClass=Sport & pubDate in 2014) & corpusId=WPD";
qs.setQuery(query, ql);
@@ -331,16 +325,16 @@
res = mapper.readTree(qs.toJSON());
assertEquals("koral:docGroup", res.at("/collection/@type").asText());
assertEquals("operation:and", res.at("/collection/operation").asText());
- assertEquals("koral:docGroup", res.at("/collection/operands/0/@type")
- .asText());
- assertEquals("operation:and", res
- .at("/collection/operands/0/operation").asText());
+ assertEquals("koral:docGroup",
+ res.at("/collection/operands/0/@type").asText());
+ assertEquals("operation:and",
+ res.at("/collection/operands/0/operation").asText());
assertEquals("koral:doc",
res.at("/collection/operands/0/operands/0/@type").asText());
assertEquals("koral:doc",
res.at("/collection/operands/0/operands/1/@type").asText());
- assertEquals("koral:doc", res.at("/collection/operands/1/@type")
- .asText());
+ assertEquals("koral:doc",
+ res.at("/collection/operands/1/@type").asText());
collection = "(textClass=Sport & textClass=ausland) | (corpusID=WPD & author=White)";
qs.setQuery(query, ql);
@@ -348,30 +342,30 @@
res = mapper.readTree(qs.toJSON());
assertEquals("koral:docGroup", res.at("/collection/@type").asText());
assertEquals("operation:or", res.at("/collection/operation").asText());
- assertEquals("koral:docGroup", res.at("/collection/operands/0/@type")
- .asText());
- assertEquals("operation:and", res
- .at("/collection/operands/0/operation").asText());
- assertEquals("koral:docGroup", res.at("/collection/operands/1/@type")
- .asText());
- assertEquals("operation:and", res
- .at("/collection/operands/1/operation").asText());
+ assertEquals("koral:docGroup",
+ res.at("/collection/operands/0/@type").asText());
+ assertEquals("operation:and",
+ res.at("/collection/operands/0/operation").asText());
+ assertEquals("koral:docGroup",
+ res.at("/collection/operands/1/@type").asText());
+ assertEquals("operation:and",
+ res.at("/collection/operands/1/operation").asText());
assertEquals("koral:doc",
res.at("/collection/operands/0/operands/0/@type").asText());
- assertEquals("Sport", res.at("/collection/operands/0/operands/0/value")
- .asText());
+ assertEquals("Sport",
+ res.at("/collection/operands/0/operands/0/value").asText());
assertEquals("koral:doc",
res.at("/collection/operands/0/operands/1/@type").asText());
assertEquals("ausland",
res.at("/collection/operands/0/operands/1/value").asText());
assertEquals("koral:doc",
res.at("/collection/operands/1/operands/0/@type").asText());
- assertEquals("WPD", res.at("/collection/operands/1/operands/0/value")
- .asText());
+ assertEquals("WPD",
+ res.at("/collection/operands/1/operands/0/value").asText());
assertEquals("koral:doc",
res.at("/collection/operands/1/operands/1/@type").asText());
- assertEquals("White", res.at("/collection/operands/1/operands/1/value")
- .asText());
+ assertEquals("White",
+ res.at("/collection/operands/1/operands/1/value").asText());
collection = "(textClass=Sport & textClass=ausland) | (corpusID=WPD & author=White & pubDate in 2000)";
qs.setQuery(query, ql);
@@ -379,26 +373,26 @@
res = mapper.readTree(qs.toJSON());
assertEquals("koral:docGroup", res.at("/collection/@type").asText());
assertEquals("operation:or", res.at("/collection/operation").asText());
- assertEquals("koral:docGroup", res.at("/collection/operands/0/@type")
- .asText());
- assertEquals("operation:and", res
- .at("/collection/operands/0/operation").asText());
- assertEquals("koral:docGroup", res.at("/collection/operands/1/@type")
- .asText());
- assertEquals("operation:and", res
- .at("/collection/operands/1/operation").asText());
+ assertEquals("koral:docGroup",
+ res.at("/collection/operands/0/@type").asText());
+ assertEquals("operation:and",
+ res.at("/collection/operands/0/operation").asText());
+ assertEquals("koral:docGroup",
+ res.at("/collection/operands/1/@type").asText());
+ assertEquals("operation:and",
+ res.at("/collection/operands/1/operation").asText());
assertEquals("koral:doc",
res.at("/collection/operands/0/operands/0/@type").asText());
- assertEquals("Sport", res.at("/collection/operands/0/operands/0/value")
- .asText());
+ assertEquals("Sport",
+ res.at("/collection/operands/0/operands/0/value").asText());
assertEquals("koral:doc",
res.at("/collection/operands/0/operands/1/@type").asText());
assertEquals("ausland",
res.at("/collection/operands/0/operands/1/value").asText());
assertEquals("koral:doc",
res.at("/collection/operands/1/operands/0/@type").asText());
- assertEquals("WPD", res.at("/collection/operands/1/operands/0/value")
- .asText());
+ assertEquals("WPD",
+ res.at("/collection/operands/1/operands/0/value").asText());
assertEquals("koral:docGroup",
res.at("/collection/operands/1/operands/1/@type").asText());
assertEquals("operation:and",
@@ -411,9 +405,8 @@
.asText());
}
-
@Test
- public void testDateYear () throws JsonProcessingException, IOException {
+ public void testDateYear() throws JsonProcessingException, IOException {
collection = "pubDate in 2000";
qs.setQuery(query, ql);
qs.setCollection(collection);
@@ -455,9 +448,8 @@
assertEquals("match:leq", res.at("/collection/match").asText());
}
-
@Test
- public void testDateMonthDay () throws JsonProcessingException, IOException {
+ public void testDateMonthDay() throws JsonProcessingException, IOException {
collection = "pubDate in 2000-02";
qs.setQuery(query, ql);
qs.setCollection(collection);