cql serialization compilation fixes
diff --git a/pom.xml b/pom.xml
index 35aa352..a8675f3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,6 +13,12 @@
     <packaging>jar</packaging>
     <name>KorAP-querySerialization</name>
     <url>http://maven.apache.org</url>
+    <repositories>
+        <repository>
+            <id>id-maven-repo</id>
+            <url>http://maven.indexdata.com</url>
+        </repository>
+    </repositories>
     <dependencies>
         <dependency>
             <groupId>org.antlr</groupId>
@@ -60,6 +66,11 @@
             <artifactId>commons-lang</artifactId>
             <version>2.6</version>
         </dependency>
+        <dependency>
+            <groupId>org.z3950.zing</groupId>
+            <artifactId>cql-java</artifactId>
+            <version>1.12</version>
+        </dependency>
     </dependencies>
     <build>
         <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/CQLTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/CQLTree.java
index 84f97e3..459c2ed 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/CQLTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/CQLTree.java
@@ -1,185 +1,170 @@
 package de.ids_mannheim.korap.query.serialize;
 
+import de.ids_mannheim.korap.util.QueryException;
+import org.z3950.zing.cql.*;
+
 import java.io.IOException;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.z3950.zing.cql.CQLAndNode;
-import org.z3950.zing.cql.CQLBooleanNode;
-import org.z3950.zing.cql.CQLNode;
-import org.z3950.zing.cql.CQLOrNode;
-import org.z3950.zing.cql.CQLParseException;
-import org.z3950.zing.cql.CQLParser;
-import org.z3950.zing.cql.CQLRelation;
-import org.z3950.zing.cql.CQLTermNode;
-import org.z3950.zing.cql.Modifier;
-
-import de.ids_mannheim.korap.util.QueryException;
-
 /**
- * 	@author margaretha
- *  
- * */
+ * @author margaretha
+ */
 public class CQLTree extends AbstractSyntaxTree {
-	
-	private static final String VERSION_1_1 = "1.1";
+
+    private static final String VERSION_1_1 = "1.1";
     private static final String VERSION_1_2 = "1.2";
     private static final String INDEX_CQL_SERVERCHOICE = "cql.serverChoice";
-	private static final String INDEX_WORDS = "words";
-	private static final String TERM_RELATION_CQL_1_1 = "scr";
+    private static final String INDEX_WORDS = "words";
+    private static final String TERM_RELATION_CQL_1_1 = "scr";
     private static final String TERM_RELATION_CQL_1_2 = "=";
     private static final String SUPPORTED_RELATION_EXACT = "exact"; // not in the doc    
     private static final String OPERATION_OR = "operation:or";
     private static final String OPERATION_SEQUENCE = "operation:sequence";
     private static final String KORAP_CONTEXT = "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld";
-    
-	private LinkedHashMap<String,Object> requestMap;
-	private String version;
-	private boolean isCaseSensitive; // default true
-	private StringBuilder sb;
-	
-	/*public CQLTree(String query) throws QueryException {
-		this(query, VERSION_1_2, true);
-	}*/
-	
-	public CQLTree(String query, String version) throws QueryException {
-		this(query, version, true);
-	} 
-	
-	public CQLTree(String query, String version, boolean isCaseSensitive) throws QueryException {
-		this.sb = new StringBuilder();
-		this.version = version;
-		this.isCaseSensitive = isCaseSensitive;
-		this.requestMap = new LinkedHashMap<String,Object>();		
-		requestMap.put("@context", KORAP_CONTEXT);
-		process(query);
-	}
-	
-	
-	@Override
-	public Map<String, Object> getRequestMap() {		
-		return this.requestMap;		
-	}
 
-	@Override
-	public void process(String query) throws QueryException {
-		CQLNode cqlNode = parseQuerytoCQLNode(query);
-		parseCQLNode(cqlNode);
-		String serializedQuery = sb.toString();	
-		requestMap.put("query", serializedQuery);		
-	}
-	
-	private CQLNode parseQuerytoCQLNode(String query) throws QueryException{		
-		try {
-			int compat = -1;
-			switch (version) {
-	            case VERSION_1_1:
-	                compat = CQLParser.V1POINT1;
-	                break;
-	            case VERSION_1_2:
-	                compat = CQLParser.V1POINT2;
-            }			
-			return new CQLParser(compat).parse(query);			
-			
-		} catch (CQLParseException | IOException e) {
-			throw new QueryException("Error parsing CQL");			
-		}
-	}
-	
-	private void parseCQLNode(CQLNode node) throws QueryException {		
-		if (node instanceof CQLTermNode){			
-			parseTermNode((CQLTermNode) node);
-		}
-		else if (node instanceof CQLAndNode ){			
-			parseAndNode((CQLAndNode) node);
-		}
-		else if (node instanceof CQLOrNode){
-			parseOrNode((CQLOrNode) node);
-		}
-		else {
-			throw new QueryException(48, "Only basic search including term-only " +
-				"and boolean operator queries (AND and OR) are currently supported.");
-		}
-	}
-	
-	private void parseTermNode(CQLTermNode node) throws QueryException {		
-		checkTermNode(node);        
+    private LinkedHashMap<String, Object> requestMap;
+    private String version;
+    private boolean isCaseSensitive; // default true
+    private StringBuilder sb;
+
+    public CQLTree(String query) throws QueryException {
+        this(query, VERSION_1_2, true);
+    }
+
+    public CQLTree(String query, String version) throws QueryException {
+        this(query, version, true);
+    }
+
+    public CQLTree(String query, String version, boolean isCaseSensitive) throws QueryException {
+        this.sb = new StringBuilder();
+        this.version = version;
+        this.isCaseSensitive = isCaseSensitive;
+        this.requestMap = new LinkedHashMap<String, Object>();
+        requestMap.put("@context", KORAP_CONTEXT);
+        process(query);
+    }
+
+
+    @Override
+    public Map<String, Object> getRequestMap() {
+        return this.requestMap;
+    }
+
+    @Override
+    public void process(String query) throws QueryException {
+        CQLNode cqlNode = parseQuerytoCQLNode(query);
+        parseCQLNode(cqlNode);
+        String serializedQuery = sb.toString();
+        requestMap.put("query", serializedQuery);
+    }
+
+    private CQLNode parseQuerytoCQLNode(String query) throws QueryException {
+        try {
+            int compat = -1;
+            switch (version) {
+                case VERSION_1_1:
+                    compat = CQLParser.V1POINT1;
+                    break;
+                case VERSION_1_2:
+                    compat = CQLParser.V1POINT2;
+            }
+            return new CQLParser(compat).parse(query);
+
+        } catch (CQLParseException | IOException e) {
+            throw new QueryException("Error parsing CQL");
+        }
+    }
+
+    private void parseCQLNode(CQLNode node) throws QueryException {
+        if (node instanceof CQLTermNode) {
+            parseTermNode((CQLTermNode) node);
+        } else if (node instanceof CQLAndNode) {
+            parseAndNode((CQLAndNode) node);
+        } else if (node instanceof CQLOrNode) {
+            parseOrNode((CQLOrNode) node);
+        } else {
+            throw new QueryException(48, "Only basic search including term-only " +
+                    "and boolean operator queries (AND and OR) are currently supported.");
+        }
+    }
+
+    private void parseTermNode(CQLTermNode node) throws QueryException {
+        checkTermNode(node);
         final String term = node.getTerm();
         if ((term == null) || term.isEmpty()) {
             throw new QueryException(27, "An empty term is unsupported.");
+        } else if (term.contains(" ")) {
+            writeSequence(term);
+        } else {
+            writeTerm(term);
         }
-        else if (term.contains(" ")){	           
-        	writeSequence(term);
-        }
-        else {
-        	writeTerm(term);
-        }
-	}
-	
-	private void parseAndNode(CQLAndNode node) throws QueryException {
-		checkBooleanModifier(node);
-		sb.append("{@type=korap:group, operation=");
-		sb.append(OPERATION_SEQUENCE);
-		sb.append(", distances=[{@type=korap:distance, key=t, min=0, max=0}]");
-		sb.append(", operands=[");
-		parseCQLNode(node.getLeftOperand());
-		sb.append(", ");
+    }
+
+    private void parseAndNode(CQLAndNode node) throws QueryException {
+        checkBooleanModifier(node);
+        sb.append("{@type=korap:group, operation=");
+        sb.append(OPERATION_SEQUENCE);
+        sb.append(", distances=[{@type=korap:distance, key=t, min=0, max=0}]");
+        sb.append(", operands=[");
+        parseCQLNode(node.getLeftOperand());
+        sb.append(", ");
         parseCQLNode(node.getRightOperand());
         sb.append("]}");
-	}
+    }
 
-	private void parseOrNode(CQLOrNode node) throws QueryException {
-		checkBooleanModifier(node);
+    private void parseOrNode(CQLOrNode node) throws QueryException {
+        checkBooleanModifier(node);
         sb.append("{@type=korap:group, operation=");
-		sb.append(OPERATION_OR);
-		sb.append(", operands=[");
-		parseCQLNode(node.getLeftOperand());
-		sb.append(", ");
+        sb.append(OPERATION_OR);
+        sb.append(", operands=[");
+        parseCQLNode(node.getLeftOperand());
+        sb.append(", ");
         parseCQLNode(node.getRightOperand());
-        sb.append("]}");      		
-	}
-	
-	private void writeSequence(String str){
-		String[] terms = str.split(" ");
-		sb.append("{@type=korap:group, operation=");
-		sb.append(OPERATION_SEQUENCE);
-		sb.append(", operands=[");
-		
-		int size = terms.length;
-	    for (int i = 0; i < size; i++) {
-	    	writeTerm(terms[i]);
-	    	if (i < size-1)
-	    		sb.append(", ");
-        }
-	    
-	    sb.append("]}");
-	}
-	
-	private void writeTerm(String term) {		
-		sb.append("{@type=korap:token, wrap={@type=korap:term");
-		if (!isCaseSensitive){
-			sb.append(", caseInsensitive=true");			
-		}		
-		sb.append(", key=");
-		sb.append(term);		
-		sb.append(", layer=orth, match=match:eq}}");		
-	}
+        sb.append("]}");
+    }
 
-	private void checkBooleanModifier(CQLBooleanNode node) throws QueryException {		
-		List<Modifier> modifiers = node.getModifiers();
-        if ((modifiers != null) && !modifiers.isEmpty()) {
-            Modifier modifier = modifiers.get(0);            
-            throw new QueryException(20, "Relation modifier \"" +
-            		modifier.toCQL() + "\" is not supported.");
+    private void writeSequence(String str) {
+        String[] terms = str.split(" ");
+        sb.append("{@type=korap:group, operation=");
+        sb.append(OPERATION_SEQUENCE);
+        sb.append(", operands=[");
+
+        int size = terms.length;
+        for (int i = 0; i < size; i++) {
+            writeTerm(terms[i]);
+            if (i < size - 1)
+                sb.append(", ");
         }
-	}
-	
-	private void checkTermNode(CQLTermNode node) throws QueryException {
-		// only allow "cql.serverChoice" and "words" index
+
+        sb.append("]}");
+    }
+
+    private void writeTerm(String term) {
+        sb.append("{@type=korap:token, wrap={@type=korap:term");
+        if (!isCaseSensitive) {
+            sb.append(", caseInsensitive=true");
+        }
+        sb.append(", key=");
+        sb.append(term);
+        sb.append(", layer=orth, match=match:eq}}");
+    }
+
+    private void checkBooleanModifier(CQLBooleanNode node) throws QueryException {
+        List<Modifier> modifiers = node.getModifiers();
+        if ((modifiers != null) && !modifiers.isEmpty()) {
+            Modifier modifier = modifiers.get(0);
+            throw new QueryException(20, "Relation modifier \"" +
+                    modifier.toCQL() + "\" is not supported.");
+        }
+    }
+
+    private void checkTermNode(CQLTermNode node) throws QueryException {
+        // only allow "cql.serverChoice" and "words" index
         if (!(INDEX_CQL_SERVERCHOICE.equals(node.getIndex()) ||
                 INDEX_WORDS.equals(node.getIndex()))) {
-            throw new QueryException(16, "Index \""+node.getIndex()+"\" is not supported.");
+            throw new QueryException(16, "Index \"" + node.getIndex() + "\" is not supported.");
         }
         // only allow "=" relation without any modifiers
         CQLRelation relation = node.getRelation();
@@ -188,14 +173,14 @@
                 TERM_RELATION_CQL_1_2.equals(baseRel) ||
                 SUPPORTED_RELATION_EXACT.equals(baseRel))) {
             throw new QueryException(19, "Relation \"" +
-                        relation.getBase() + "\" is not supported.");
+                    relation.getBase() + "\" is not supported.");
         }
         List<Modifier> modifiers = relation.getModifiers();
         if ((modifiers != null) && !modifiers.isEmpty()) {
             Modifier modifier = modifiers.get(0);
             throw new QueryException(20, "Relation modifier \"" +
-                            modifier.getValue() + "\" is not supported.");
+                    modifier.getValue() + "\" is not supported.");
         }
-	}
+    }
 
 }
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQuery.java b/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQuery.java
index c17bdc2..d6ec238 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQuery.java
@@ -1,7 +1,6 @@
 package de.ids_mannheim.korap.query.serialize;
 
 import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonParser;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -37,14 +36,22 @@
 
     public CollectionQuery addResource(String query) {
         try {
-            JsonParser jp = factory.createParser(query);
-            JsonNode m = jp.readValueAsTree();
-            for (JsonNode n : m)
-                this.rq.add(serialzer.treeToValue(n, Map.class));
+            List v = serialzer.readValue(query, LinkedList.class);
+            this.rq.addAll(v);
         } catch (IOException e) {
-            e.printStackTrace();
             throw new IllegalArgumentException("Conversion went wrong!");
         }
+
+
+//        try {
+//            JsonParser jp = factory.createParser(query);
+//            JsonNode m = jp.readValueAsTree();
+//            for (JsonNode n : m)
+//                this.rq.add(serialzer.treeToValue(n, Map.class));
+//        } catch (IOException e) {
+//            e.printStackTrace();
+//            throw new IllegalArgumentException("Conversion went wrong!");
+//        }
         return this;
     }
 
@@ -65,8 +72,8 @@
         return this;
     }
 
-    public CollectionQuery addMetaExtend(String attr, String val) {
-        this.mextension.put(attr, val);
+    public CollectionQuery addMetaExtend(String key, String value) {
+        this.mextension.put(key, value);
         return this;
     }
 
@@ -78,7 +85,7 @@
 
     private List<Map> createFilter() {
         List<Map> mfil = new ArrayList();
-        boolean multypes = this.mfilter.keys().size() > 1;
+        boolean multypes = this.mfilter.keySet().size() > 1;
         String def_key = null;
 
         if (!multypes) {
@@ -87,6 +94,7 @@
         }
 
         List value = this.createValue(this.mfilter);
+
         if (mfilter.values().size() == 1)
             Collections.addAll(mfil, types.createMetaFilter((Map) value.get(0)));
         else {
@@ -142,16 +150,22 @@
             }
 
             if (map.get(key).size() == 1) {
-                Map term = types.createTerm(key, null, map.get(key).toArray(new String[0])[0], null);
+                Map term = types.createTerm(key, null,
+                        map.get(key).toArray(new String[0])[0], null);
                 value.add(term);
             } else {
+                boolean multypes = map.keySet().size() > 1;
                 List g = new ArrayList();
                 for (String v : map.get(key))
                     g.add(types.createTerm(null, v, null));
-                Map group = types.createGroup("and", key, g);
-                value.add(group);
-            }
 
+                if (multypes) {
+                    Map group = types.createGroup("and", key, g);
+                    value.add(group);
+                } else
+                    value.addAll(g);
+
+            }
         }
 
         int idx = 3;
@@ -225,13 +239,18 @@
      *
      * @return
      */
-    public String build() {
+    public JsonNode buildNode() {
+        return serialzer.valueToTree(join());
+    }
+
+    public String buildString() {
         try {
             return serialzer.writeValueAsString(join());
         } catch (JsonProcessingException e) {
             e.printStackTrace();
             return "";
         }
+
     }
 
 
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 75041de..61682bc 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
@@ -9,7 +9,6 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -17,8 +16,8 @@
  */
 public class QuerySerializer {
 
-	public static String queryLanguageVersion;
-	
+    public static String queryLanguageVersion;
+
     private ObjectMapper mapper;
     private AbstractSyntaxTree ast;
     private org.slf4j.Logger log = LoggerFactory
@@ -118,11 +117,9 @@
             ast = new CosmasTree(query);
         } else if (queryLanguage.toLowerCase().equals("poliqarpplus")) {
             ast = new PoliqarpPlusTree(query);
-        }
-        else if (queryLanguage.toLowerCase().equals("cql")) {
+        } else if (queryLanguage.toLowerCase().equals("cql")) {
             ast = new CQLTree(query);
-        }
-        else {
+        } else {
             throw new QueryException(queryLanguage + " is not a supported query language!");
         }
         Map<String, Object> requestMap = ast.getRequestMap();
@@ -140,12 +137,10 @@
                 ast = new CosmasTree(query);
             } else if (ql.toLowerCase().equals("poliqarpplus")) {
                 ast = new PoliqarpPlusTree(query);
-            } 
-            else if (ql.toLowerCase().equals("cql")){
-            	queryLanguageVersion = "1.2"; // set me
-            	ast = new CQLTree(query);
-            }
-            else {
+            } else if (ql.toLowerCase().equals("cql")) {
+                queryLanguageVersion = "1.2"; // set me
+                ast = new CQLTree(query);
+            } else {
                 throw new QueryException(ql + " is not a supported query language!");
             }
         } catch (QueryException e) {
@@ -166,16 +161,16 @@
             requestMap.put("collections", collection);
             requestMap.put("meta", meta.raw());
             return mapper.writeValueAsString(requestMap);
-        } catch (IOException e){
+        } catch (IOException e) {
             return "";
         }
     }
 
-	public static String getQueryLanguageVersion() {
-		return queryLanguageVersion;
-	}
+    public static String getQueryLanguageVersion() {
+        return queryLanguageVersion;
+    }
 
-	public static void setQueryLanguageVersion(String queryLanguageVersion) {
-		QuerySerializer.queryLanguageVersion = queryLanguageVersion;
-	}
+    public static void setQueryLanguageVersion(String queryLanguageVersion) {
+        QuerySerializer.queryLanguageVersion = queryLanguageVersion;
+    }
 }
diff --git a/src/test/java/MetaQuerySerializationTest.java b/src/test/java/MetaQuerySerializationTest.java
index c5d1fbd..7e430fa 100644
--- a/src/test/java/MetaQuerySerializationTest.java
+++ b/src/test/java/MetaQuerySerializationTest.java
@@ -31,7 +31,7 @@
         b.append("textClass:wissenschaft");
 //        CollectionQuery qu = new CollectionQuery().addMetaFilter(b.toString());
         CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString());
-        System.out.println(query.build());
+        System.out.println(query.buildString());
         System.out.println(query.toCollections());
 //        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.build());
+        System.out.println(query.buildString());
     }
 
     @Test
@@ -53,9 +53,9 @@
         b.append(" AND ");
         b.append("author:Goethe");
         CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString());
-        System.out.println("value until/since : " + query.build());
+        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.build());
+        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());
 //        System.out.println();
     }
 
@@ -67,7 +67,7 @@
         b.append("author:Hesse");
         CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString());
         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.build());
+        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());
 //        System.out.println("value until : " + query.stringify());
 //        System.out.println();
     }
@@ -79,11 +79,11 @@
         b.append(" AND ");
         b.append("author:Kafka");
         CollectionQuery query = new CollectionQuery().addMetaFilter(b.toString());
-        System.out.println("value since : " + query.build());
+        System.out.println("value since : " + query.buildString());
         System.out.println("meta value since " + query.toCollections());
 //        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.build());
+        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());
     }
 
     @Test
@@ -129,7 +129,7 @@
         CollectionQuery q = new CollectionQuery().addMetaFilter(b.toString());
         q.addMetaExtend("author", "Hesse");
 
-        System.out.println("--- ALL " + q.build());
+        System.out.println("--- ALL " + q.buildString());
         System.out.println();
 
     }
@@ -141,7 +141,7 @@
         b.append(" AND ");
         b.append("author:Kafka");
         CollectionQuery q = new CollectionQuery().addMetaExtend(b.toString());
-        System.out.println("array repres " + q.build());
+        System.out.println("array repres " + q.buildString());
         System.out.println();
     }
 
@@ -150,7 +150,7 @@
         CollectionQuery q = new CollectionQuery().addMetaFilter("corpusID", "A00");
         q.addMetaExtend("corpusID", "A01");
 
-        System.out.println("results stringified " + q.build());
+        System.out.println("results stringified " + q.buildString());
         System.out.println("results to meta" + q.toCollections());
         System.out.println();
     }
@@ -172,7 +172,7 @@
     @Test
     public void testA00() throws IOException {
         CollectionQuery q = new CollectionQuery().addMetaExtend("corpusID", "A00").addMetaExtend("corpusID", "A01");
-        System.out.println("A meta: " + q.build());
+        System.out.println("A meta: " + q.buildString());
         System.out.println();
     }
 
@@ -181,7 +181,7 @@
         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.build());
+        System.out.println("stringified meta " + q.buildString());
         System.out.println("meta string " + q.toCollections());
     }