- more tests for cosmas
- corrected classRefCheck: always a list
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractSyntaxTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractSyntaxTree.java
index 32897f7..81efa6e 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractSyntaxTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractSyntaxTree.java
@@ -244,11 +244,7 @@
 		LinkedHashMap<String, Object> group = new LinkedHashMap<String, Object>();
 		group.put("@type", "korap:group");
 		group.put("operation", "operation:class");
-		if (check.size()==1) {
-			group.put("classRefCheck", check.get(0));
-		} else {
-			group.put("classRefCheck", check);
-		}
+		group.put("classRefCheck", check);
 		group.put("classIn", Arrays.asList(classIn));
 		group.put("classOut", classOut);
 		group.put("class", classOut);
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java
index c3c72ca..42b5775 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java
@@ -1095,6 +1095,7 @@
 				"#ELEM(W ANA=N)",
 				 "#ELEM(W ANA=N FOO=BAR)",
 				 "#ELEM(W ANA='N V')",
+				 "#NHIT(a %w10 b)"
 		};
 //		CosmasTree.verbose=true;
 		for (String q : queries) {
diff --git a/src/test/java/CosmasTreeTest.java b/src/test/java/CosmasTreeTest.java
index 6085218..308f777 100644
--- a/src/test/java/CosmasTreeTest.java
+++ b/src/test/java/CosmasTreeTest.java
@@ -5,7 +5,6 @@
 
 import org.junit.Test;
 
-import de.ids_mannheim.korap.query.serialize.CosmasTree;
 import de.ids_mannheim.korap.query.serialize.QuerySerializer;
 import de.ids_mannheim.korap.util.QueryException;
 
@@ -20,7 +19,7 @@
  */
 
 public class CosmasTreeTest {
-	
+
 
 	String query;
 	ArrayList<JsonNode> operands;
@@ -28,7 +27,7 @@
 	QuerySerializer qs = new QuerySerializer();
 	ObjectMapper mapper = new ObjectMapper();
 	JsonNode res;
-	
+
 	@Test
 	public void testContext() throws QueryException, JsonProcessingException, IOException {
 		String contextString = "http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld";
@@ -37,8 +36,8 @@
 		res = mapper.readTree(qs.toJSON());
 		assertEquals(contextString, res.get("@context").asText());
 	}
-	
-	
+
+
 	@Test
 	public void testSingleToken() throws QueryException, JsonProcessingException, IOException {
 		query = "der";
@@ -49,7 +48,7 @@
 		assertEquals("der", 				res.at("/query/wrap/key").asText());
 		assertEquals("orth", 				res.at("/query/wrap/layer").asText());
 		assertEquals("match:eq",			res.at("/query/wrap/match").asText());
-		
+
 		query = "&Mann";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -59,9 +58,9 @@
 		assertEquals("lemma", 				res.at("/query/wrap/layer").asText());
 		assertEquals("match:eq",			res.at("/query/wrap/match").asText());
 	}
-		
 
-	
+
+
 	@Test
 	public void testWildcardToken() throws QueryException, JsonProcessingException, IOException {
 		query = "*der";
@@ -72,13 +71,13 @@
 		assertEquals("*der", 				res.at("/query/wrap/key").asText());
 		assertEquals("orth", 				res.at("/query/wrap/layer").asText());
 		assertEquals("match:eq",			res.at("/query/wrap/match").asText());
-		
+
 		query = "*de*?r";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
 		assertEquals("*de*?r", 				res.at("/query/wrap/key").asText());
 	}
-//	
+	//	
 	@Test
 	public void testCaseSensitivityFlag() throws QueryException, JsonProcessingException, IOException {
 		query = "$deutscher";
@@ -89,7 +88,7 @@
 		assertEquals(true,					res.at("/query/wrap/caseInsensitive").asBoolean());
 		assertEquals("orth", 				res.at("/query/wrap/layer").asText());
 		assertEquals("match:eq",			res.at("/query/wrap/match").asText());
-		
+
 		query = "$deutscher Bundestag";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -103,7 +102,7 @@
 		assertEquals("Bundestag",			res.at("/query/operands/1/wrap/key").asText());
 		assertEquals(true,					res.at("/query/operands/1/wrap/caseInsensitive").isMissingNode());
 	}
-	
+
 	@Test
 	public void testMORPH() throws QueryException, JsonProcessingException, IOException {
 		query = "MORPH(p=V)";
@@ -114,7 +113,7 @@
 		assertEquals("V",					res.at("/query/wrap/key").asText());
 		assertEquals("p",					res.at("/query/wrap/layer").asText());
 		assertEquals("match:eq",			res.at("/query/wrap/match").asText());
-		
+
 		query = "MORPH(V)";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -122,7 +121,7 @@
 		assertEquals("korap:term", 			res.at("/query/wrap/@type").asText());
 		assertEquals("V",					res.at("/query/wrap/key").asText());
 		assertEquals("match:eq",			res.at("/query/wrap/match").asText());
-		
+
 		query = "MORPH(tt/p=V)";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -132,7 +131,7 @@
 		assertEquals("p",					res.at("/query/wrap/layer").asText());
 		assertEquals("tt",					res.at("/query/wrap/foundry").asText());
 		assertEquals("match:eq",			res.at("/query/wrap/match").asText());
-		
+
 		query = "MORPH(mate/m=temp:pres)";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -143,7 +142,7 @@
 		assertEquals("m",					res.at("/query/wrap/layer").asText());
 		assertEquals("mate",				res.at("/query/wrap/foundry").asText());
 		assertEquals("match:eq",			res.at("/query/wrap/match").asText());
-		
+
 		query = "MORPH(tt/p=V & mate/m!=temp:pres)";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -159,7 +158,7 @@
 		assertEquals("mate",				res.at("/query/wrap/operands/1/foundry").asText());
 		assertEquals("match:ne",			res.at("/query/wrap/operands/1/match").asText());
 	}
-	
+
 	@Test
 	public void testSequence() throws QueryException, JsonProcessingException, IOException {
 		query = "der Mann";
@@ -170,7 +169,7 @@
 		assertEquals("der",					res.at("/query/operands/0/wrap/key").asText());
 		assertEquals("Mann",				res.at("/query/operands/1/wrap/key").asText());
 		assertEquals(true,					res.at("/query/operands/2").isMissingNode());
-		
+
 		query = "der Mann schläft";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -180,7 +179,7 @@
 		assertEquals("Mann",				res.at("/query/operands/1/wrap/key").asText());
 		assertEquals("schläft",				res.at("/query/operands/2/wrap/key").asText());
 		assertEquals(true,					res.at("/query/operands/3").isMissingNode());
-		
+
 		query = "der Mann schläft lang";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -191,7 +190,7 @@
 		assertEquals("schläft",				res.at("/query/operands/2/wrap/key").asText());
 		assertEquals("lang",				res.at("/query/operands/3/wrap/key").asText());
 		assertEquals(true,					res.at("/query/operands/4").isMissingNode());
-		
+
 		query = "der #ELEM(W)";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -201,7 +200,7 @@
 		assertEquals("w",					res.at("/query/operands/1/key").asText());
 		assertEquals("korap:span",			res.at("/query/operands/1/@type").asText());
 		assertEquals(true,					res.at("/query/operands/2").isMissingNode());
-		
+
 		query = "der #ELEM(W) Mann";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -212,7 +211,7 @@
 		assertEquals("korap:span",			res.at("/query/operands/1/@type").asText());
 		assertEquals("Mann",				res.at("/query/operands/2/wrap/key").asText());
 		assertEquals(true,					res.at("/query/operands/3").isMissingNode());
-		
+
 		query = "der MORPH(p=ADJA) Mann";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -235,7 +234,7 @@
 		assertEquals("Sonne",				res.at("/query/operands/0/wrap/key").asText());
 		assertEquals("Mond",				res.at("/query/operands/1/wrap/key").asText());
 		assertEquals(true,					res.at("/query/operands/2").isMissingNode());
-		
+
 		query = "(Sonne scheint) oder Mond";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -247,7 +246,7 @@
 		assertEquals("scheint",				res.at("/query/operands/0/operands/1/wrap/key").asText());
 		assertEquals("Mond",				res.at("/query/operands/1/wrap/key").asText());
 		assertEquals(true,					res.at("/query/operands/2").isMissingNode());
-		
+
 		query = "(Sonne scheint) oder (Mond scheint)";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -281,7 +280,7 @@
 		assertEquals("Mond",				res.at("/query/operands/0/operands/1/wrap/key").asText());
 		assertEquals("korap:token",			res.at("/query/operands/1/@type").asText());
 		assertEquals("scheint",				res.at("/query/operands/1/wrap/key").asText());
-		
+
 		query = "scheint und (Sonne oder Mond)";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -297,7 +296,7 @@
 		assertEquals("operation:or",		res.at("/query/operands/1/operation").asText());
 		assertEquals("Sonne",				res.at("/query/operands/1/operands/0/wrap/key").asText());
 		assertEquals("Mond",				res.at("/query/operands/1/operands/1/wrap/key").asText());
-		
+
 		query = "Regen und scheint und (Sonne oder Mond)";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -321,7 +320,7 @@
 		assertEquals("Sonne",				res.at("/query/operands/1/operands/1/operands/0/wrap/key").asText());
 		assertEquals("Mond",				res.at("/query/operands/1/operands/1/operands/1/wrap/key").asText());
 	}
-	
+
 	@Test
 	public void testOPNOT() throws QueryException, JsonProcessingException, IOException {
 		query = "Sonne nicht Mond";
@@ -337,7 +336,7 @@
 		assertEquals("korap:token",			res.at("/query/operands/0/@type").asText());
 		assertEquals("Sonne",				res.at("/query/operands/0/wrap/key").asText());
 		assertEquals("Mond",				res.at("/query/operands/1/wrap/key").asText());
-		
+
 		query = "Sonne nicht Mond nicht Sterne";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -359,7 +358,7 @@
 		assertEquals(true,					res.at("/query/operands/1/distances/0/exclude").asBoolean());
 		assertEquals("Mond",				res.at("/query/operands/1/operands/0/wrap/key").asText());
 		assertEquals("Sterne",				res.at("/query/operands/1/operands/1/wrap/key").asText());
-		
+
 		query = "(Sonne nicht Mond) nicht Sterne";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -382,7 +381,7 @@
 		assertEquals("korap:token",			res.at("/query/operands/1/@type").asText());
 		assertEquals("Sterne",				res.at("/query/operands/1/wrap/key").asText());
 	}
-	
+
 	@Test
 	public void testOPPROX() throws QueryException, JsonProcessingException, IOException {
 		query = "Sonne /+w1:4 Mond";
@@ -405,7 +404,7 @@
 		assertEquals("korap:token",			res.at("/query/operands/0/operands/0/operands/0/@type").asText());
 		assertEquals("Sonne",				res.at("/query/operands/0/operands/0/operands/0/wrap/key").asText());
 		assertEquals("Mond",				res.at("/query/operands/0/operands/1/operands/0/wrap/key").asText());
-		
+
 		query = "Sonne /+w1:4,s0,p1:3 Mond";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -431,7 +430,7 @@
 		assertEquals("korap:token",			res.at("/query/operands/0/operands/0/operands/0/@type").asText());
 		assertEquals("Sonne",				res.at("/query/operands/0/operands/0/operands/0/wrap/key").asText());
 		assertEquals("Mond",				res.at("/query/operands/0/operands/1/operands/0/wrap/key").asText());
-		
+
 		query = "Sonne /+w4 Mond";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -439,7 +438,7 @@
 		assertEquals("w",					res.at("/query/operands/0/distances/0/key").asText());
 		assertEquals(0,						res.at("/query/operands/0/distances/0/boundary/min").asInt());
 		assertEquals(4,						res.at("/query/operands/0/distances/0/boundary/max").asInt());
-		
+
 		query = "Sonne /-w4 Mond";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -449,7 +448,7 @@
 		assertEquals(4,						res.at("/query/operands/0/distances/0/boundary/max").asInt());
 		assertEquals("Mond",				res.at("/query/operands/0/operands/0/operands/0/wrap/key").asText());
 		assertEquals("Sonne",				res.at("/query/operands/0/operands/1/operands/0/wrap/key").asText());
-		
+
 		query = "Sonne /w4 Mond";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -461,7 +460,7 @@
 		assertEquals("Mond",				res.at("/query/operands/0/operands/1/operands/0/wrap/key").asText());
 		assertEquals(false,					res.at("/query/operands/0/inOrder").asBoolean());
 	}
-	
+
 	@Test
 	public void testOPPROXNested() throws QueryException, JsonProcessingException, IOException {	
 		query = "Sonne /+w1:4 Mond /+w1:7 Sterne";
@@ -493,14 +492,14 @@
 		assertEquals("Mond",				res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/0/operands/0/wrap/key").asText());
 		assertEquals(130,					res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/1/classOut").asInt());
 		assertEquals("Sterne",				res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
-		
+
 		query = "Sonne /+w1:4 Mond /-w1:7 Sterne";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
 		assertEquals("Sonne",				res.at("/query/operands/0/operands/0/operands/0/wrap/key").asText());
 		assertEquals("Sterne",				res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/0/operands/0/wrap/key").asText());
 		assertEquals("Mond",				res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
-		
+
 		query = "Sonne /-w4 Mond /+w2 Sterne";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -532,7 +531,7 @@
 		assertEquals("Sterne",				res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
 
 	}
-	
+
 	@Test
 	public void testOPIN() throws QueryException, JsonProcessingException, IOException {
 		query = "wegen #IN <s>";
@@ -543,7 +542,7 @@
 		assertEquals(130,							res.at("/query/classRef/0").asInt());
 		assertEquals("korap:group",					res.at("/query/operands/0/@type").asText());
 		assertEquals("operation:class",				res.at("/query/operands/0/operation").asText());
-		assertEquals("classRefCheck:includes",		res.at("/query/operands/0/classRefCheck").asText());
+		assertEquals("classRefCheck:includes",		res.at("/query/operands/0/classRefCheck/0").asText());
 		assertEquals("korap:group",					res.at("/query/operands/0/operands/0/@type").asText());
 		assertEquals("operation:position",			res.at("/query/operands/0/operands/0/operation").asText());
 		assertEquals(true,							res.at("/query/operands/0/operands/0/frames/0").isMissingNode());
@@ -559,21 +558,21 @@
 		assertEquals(130,							res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
 		assertEquals("korap:token",					res.at("/query/operands/0/operands/0/operands/1/operands/0/@type").asText());
 		assertEquals("wegen",						res.at("/query/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
-		
+
 		query = "wegen #IN(L) <s>";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
-		assertEquals("classRefCheck:includes",		res.at("/query/operands/0/classRefCheck").asText());
+		assertEquals("classRefCheck:includes",		res.at("/query/operands/0/classRefCheck/0").asText());
 		assertEquals("frames:startswith",			res.at("/query/operands/0/operands/0/frames/0").asText());
 		assertEquals(true,							res.at("/query/operands/0/operands/0/frames/1").isMissingNode());
-		
+
 		query = "wegen #IN(F) <s>";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
-		assertEquals("classRefCheck:includes",		res.at("/query/operands/0/classRefCheck").asText());
+		assertEquals("classRefCheck:includes",		res.at("/query/operands/0/classRefCheck/0").asText());
 		assertEquals("frames:matches",				res.at("/query/operands/0/operands/0/frames/0").asText());
 		assertEquals(true,							res.at("/query/operands/0/operands/0/frames/1").isMissingNode());
-		
+
 		query = "wegen #IN(FI) <s>";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -581,32 +580,32 @@
 		assertEquals("classRefCheck:includes",		res.at("/query/operands/0/classRefCheck/1").asText());
 		assertEquals("frames:matches",				res.at("/query/operands/0/operands/0/frames/0").asText());
 		assertEquals(true,							res.at("/query/operands/0/operands/0/frames/1").isMissingNode());
-		
+
 		query = "wegen #IN(FE) <s>";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
-		assertEquals("classRefCheck:equals",		res.at("/query/operands/0/classRefCheck").asText());
+		assertEquals("classRefCheck:equals",		res.at("/query/operands/0/classRefCheck/0").asText());
 		assertEquals("frames:matches",				res.at("/query/operands/0/operands/0/frames/0").asText());
 		assertEquals(true,							res.at("/query/operands/0/operands/0/frames/1").isMissingNode());
-		
+
 		query = "wegen #IN(%, L) <s>";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
-		assertEquals("classRefCheck:includes",		res.at("/query/operands/0/classRefCheck").asText());
+		assertEquals("classRefCheck:includes",		res.at("/query/operands/0/classRefCheck/0").asText());
 		assertEquals("frames:startswith",			res.at("/query/operands/0/operands/0/frames/0").asText());
 		assertEquals(true,							res.at("/query/operands/0/operands/0/frames/1").isMissingNode());
 		assertEquals(true,							res.at("/query/operands/0/operands/0/exclude").asBoolean());
-		
+
 		query = "wegen #IN(FE,ALL,%,MIN) <s>";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
 		assertEquals(true,							res.at("/query/reset").asBoolean());
-		assertEquals("classRefCheck:equals",		res.at("/query/operands/0/classRefCheck").asText());
+		assertEquals("classRefCheck:equals",		res.at("/query/operands/0/classRefCheck/0").asText());
 		assertEquals("frames:matches",				res.at("/query/operands/0/operands/0/frames/0").asText());
 		assertEquals(true,							res.at("/query/operands/0/operands/0/exclude").asBoolean());
-		
+
 	}
-	
+
 	@Test
 	public void testOPOV() throws QueryException, JsonProcessingException, IOException {
 		query = "wegen #OV <s>";
@@ -617,7 +616,7 @@
 		assertEquals(130,							res.at("/query/classRef/0").asInt());
 		assertEquals("korap:group",					res.at("/query/operands/0/@type").asText());
 		assertEquals("operation:class",				res.at("/query/operands/0/operation").asText());
-		assertEquals("classRefCheck:intersects",	res.at("/query/operands/0/classRefCheck").asText());
+		assertEquals("classRefCheck:intersects",	res.at("/query/operands/0/classRefCheck/0").asText());
 		assertEquals("korap:group",					res.at("/query/operands/0/operands/0/@type").asText());
 		assertEquals("operation:position",			res.at("/query/operands/0/operands/0/operation").asText());
 		assertEquals(true,							res.at("/query/operands/0/operands/0/frames/0").isMissingNode());
@@ -633,35 +632,35 @@
 		assertEquals(130,							res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
 		assertEquals("korap:token",					res.at("/query/operands/0/operands/0/operands/1/operands/0/@type").asText());
 		assertEquals("wegen",						res.at("/query/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
-		
+
 		query = "wegen #OV(L) <s>";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
-		assertEquals("classRefCheck:intersects",	res.at("/query/operands/0/classRefCheck").asText());
+		assertEquals("classRefCheck:intersects",	res.at("/query/operands/0/classRefCheck/0").asText());
 		assertEquals("frames:startswith",			res.at("/query/operands/0/operands/0/frames/0").asText());
 		assertEquals("frames:overlapsLeft",			res.at("/query/operands/0/operands/0/frames/1").asText());
-		
+
 		query = "wegen #OV(F) <s>";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
-		assertEquals("classRefCheck:intersects",	res.at("/query/operands/0/classRefCheck").asText());
+		assertEquals("classRefCheck:intersects",	res.at("/query/operands/0/classRefCheck/0").asText());
 		assertEquals("frames:matches",				res.at("/query/operands/0/operands/0/frames/0").asText());
 		assertEquals(true,							res.at("/query/operands/0/operands/0/frames/1").isMissingNode());
-		
+
 		query = "wegen #OV(FI) <s>";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
-		assertEquals("classRefCheck:unequals",		res.at("/query/operands/0/classRefCheck").asText());
+		assertEquals("classRefCheck:unequals",		res.at("/query/operands/0/classRefCheck/0").asText());
 		assertEquals("frames:matches",				res.at("/query/operands/0/operands/0/frames/0").asText());
-		
+
 		query = "wegen #OV(FE) <s>";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
-		assertEquals("classRefCheck:equals",		res.at("/query/operands/0/classRefCheck").asText());
+		assertEquals("classRefCheck:equals",		res.at("/query/operands/0/classRefCheck/0").asText());
 		assertEquals("frames:matches",				res.at("/query/operands/0/operands/0/frames/0").asText());
 	}
 
-	
+
 	@Test
 	public void testBEG_END() throws QueryException, JsonProcessingException, IOException {
 		query = "#BEG(der /w3:5 Mann)";
@@ -681,7 +680,7 @@
 		assertEquals("korap:token",			res.at("/query/operands/0/operands/0/@type").asText());
 		assertEquals("der",					res.at("/query/operands/0/operands/0/wrap/key").asText());
 		assertEquals("Mann",				res.at("/query/operands/0/operands/1/wrap/key").asText());
-		
+
 		query = "#BEG(der /w3:5 Mann) /+w10 kommt";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -716,7 +715,7 @@
 		assertEquals(129,					res.at("/query/operands/0/operands/1/classOut").asInt());
 		assertEquals("korap:token",			res.at("/query/operands/0/operands/1/operands/0/@type").asText());
 		assertEquals("kommt",				res.at("/query/operands/0/operands/1/operands/0/wrap/key").asText());
-		
+
 		query = "kommt /+w10 #BEG(der /w3:5 Mann)";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -751,7 +750,7 @@
 		assertEquals(129,					res.at("/query/operands/0/operands/0/classOut").asInt());
 		assertEquals("korap:token",			res.at("/query/operands/0/operands/0/operands/0/@type").asText());
 		assertEquals("kommt",				res.at("/query/operands/0/operands/0/operands/0/wrap/key").asText());
-		
+
 		query = "#END(der /w3:5 Mann)";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -770,7 +769,7 @@
 		assertEquals("der",					res.at("/query/operands/0/operands/0/wrap/key").asText());
 		assertEquals("Mann",				res.at("/query/operands/0/operands/1/wrap/key").asText());
 	}
-	
+
 	@Test
 	public void testELEM() throws QueryException, JsonProcessingException, IOException {
 		query = "#ELEM(S)";
@@ -778,7 +777,7 @@
 		res = mapper.readTree(qs.toJSON());
 		assertEquals("korap:span",		res.at("/query/@type").asText());
 		assertEquals("s",				res.at("/query/key").asText());
-		
+
 		query = "#ELEM(W ANA=N)";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -788,7 +787,7 @@
 		assertEquals("N",				res.at("/query/attr/key").asText());
 		assertEquals("p",				res.at("/query/attr/layer").asText());
 		assertEquals("match:eq",		res.at("/query/attr/match").asText());
-		
+
 		query = "#ELEM(W ANA != 'N V')";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -804,7 +803,7 @@
 		assertEquals("V",				res.at("/query/attr/operands/1/key").asText());
 		assertEquals("p",				res.at("/query/attr/operands/1/layer").asText());
 		assertEquals("match:ne",		res.at("/query/attr/operands/1/match").asText());
-		
+
 		query = "#ELEM(W ANA != 'N A V' Genre = Sport)";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -819,7 +818,7 @@
 		assertEquals("V",				res.at("/query/attr/operands/0/operands/2/key").asText());
 		assertEquals("Genre",			res.at("/query/attr/operands/1/layer").asText());
 		assertEquals("Sport",			res.at("/query/attr/operands/1/key").asText());
-		
+
 		query = "#ELEM(W ANA != 'N A V' Genre != 'Sport Politik')";
 		qs.setQuery(query, "cosmas2");
 		res = mapper.readTree(qs.toJSON());
@@ -841,305 +840,283 @@
 		assertEquals("Politik",			res.at("/query/attr/operands/1/operands/1/key").asText());
 		assertEquals("match:ne",		res.at("/query/attr/operands/1/operands/1/match").asText());
 	}
-//	@Test
-//	public void testOPALL() throws QueryException {
-//		query="#ALL(gehen /w1:10 voran)";
-//		String all1 =
-//				"{@type=korap:group, operation=operation:sequence, " +
-//					"operands=[" +
-//						"{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}," +
-//						"{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}" +
-//					"], inOrder=false, " +
-//					"distances=[" +
-//						"{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" +
-//					"]" +
-//				"}";
-//		ct = new CosmasTree(query);
-//		map = ct.getRequestMap().get("query").toString();
-//		assertEquals(all1.replaceAll(" ", ""), map.replaceAll(" ", ""));
-//		
-//		query="#ALL(gehen /w1:10 (voran /w1:4 schnell))";
-//		String all2 =
-//				"{@type=korap:group, operation=operation:sequence, " +
-//					"operands=[" +
-//						"{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}," +
-//							"{@type=korap:group, operation=operation:sequence, operands=[" +
-//									"{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}," +
-//									"{@type=korap:token, wrap={@type=korap:term, key=schnell, layer=orth, match=match:eq}}" +
-//								"], inOrder=false, " +
-//								"distances=[" +
-//									"{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4}" +
-//								"]" +
-//							"}" +
-//					"], inOrder=false, " +
-//					"distances=[" +
-//						"{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" +
-//					"]" +
-//				"}";
-//		ct = new CosmasTree(query);
-//		map = ct.getRequestMap().get("query").toString();
-//		assertEquals(all2.replaceAll(" ", ""), map.replaceAll(" ", ""));
-//	}
-//	
-//	@Test
-//	public void testOPNHIT() throws QueryException {
-//		query="#NHIT(gehen /w1:10 voran)";
-//		String nhit1 = 
-//				"{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" +
-//					"{@type=korap:group, operation=operation:class, classRefOp=classRefOp:inversion, classIn=[130,131], classOut=129, operands=[" +
-//						"{@type=korap:group, operation=operation:sequence, " +
-//							"operands=[" +
-//								"{@type=korap:group, operation=operation:class, class=130 , classOut=130, operands=[" +
-//									"{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}" +
-//								"]}," +	
-//								"{@type=korap:group, operation=operation:class, class=131 , classOut=131, operands=[" +
-//									"{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}" +
-//								"]}" +	
-//							"], inOrder=false, " +
-//							"distances=[" +
-//								"{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" +
-//							"]" +
-//						"}" +
-//					"]}" +
-//				"]}";
-//		ct = new CosmasTree(query);
-//		map = ct.getRequestMap().get("query").toString();
-//		assertEquals(nhit1.replaceAll(" ", ""), map.replaceAll(" ", ""));
-//
-////		query="#NHIT(gehen %w1:10 voran)";
-////		String nhit2 = 
-////				"{@type=korap:reference, operation=operation:focus, classRef=129, operands=[" +
-////					"{@type=korap:group, operation=operation:sequence, " +
-////						"operands=[" +
-////							"{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}" +
-////							"{@type=korap:group, operation=operation:class, class= , classOut=129, operands=[" +
-////								"{@type=korap:group, operation=operation:repetition, operands=[" +
-////									"{@type=korap:token}" +
-////								"], boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}}" +
-////							"]}," +	
-////							"{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}" +
-////						"], inOrder=false, " +
-////						"distances=[" +
-////							"{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" +
-////						"]" +
-////					"}" +
-////				"]}";
-////		ct = new CosmasTree(query);
-////		map = ct.getRequestMap().get("query").toString();
-////		assertEquals(nhit2.replaceAll(" ", ""), map.replaceAll(" ", ""));
-//		
-//		query="#NHIT(gehen /+w1:10 voran /w1:10 Beispiel)";
-//		String nhit3 = 
-//				"{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" +
-//					"{@type=korap:group, operation=operation:class, classRefOp=classRefOp:inversion, classIn=[130,131], classOut=129, operands=[" +
-//						"{@type=korap:group, operation=operation:sequence, " +
-//							"operands=[" +
-//								"{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" +
-//									"{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}" +
-//								"]}," +
-//								"{@type=korap:group, operation=operation:class, class=131, classOut=131, operands=[" +
-//									"{@type=korap:reference, operation=operation:focus, classRef=[132], operands=[" +
-//										"{@type=korap:group, operation=operation:sequence, " +
-//											"operands=[" +
-//												"{@type=korap:group, operation=operation:class, class=132, classOut=132, operands=[" +
-//													"{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}" +
-//												"]}," +
-//												"{@type=korap:group, operation=operation:class, class=132, classOut=132, operands=[" +	
-//													"{@type=korap:token, wrap={@type=korap:term, key=Beispiel, layer=orth, match=match:eq}}" +
-//												"]}" +
-//											"], inOrder=false, " +
-//											"distances=[" +
-//												"{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" +
-//											"]" +
-//										"}" +
-//									"]}" +
-//								"]}" +
-//							"], inOrder=true, " +
-//							"distances=[" +
-//								"{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" +
-//							"]" +
-//						"}" +
-//					"]}" +
-//				"]}";
-//		ct = new CosmasTree(query);
-//		map = ct.getRequestMap().get("query").toString();
-//		assertEquals(nhit3.replaceAll(" ", ""), map.replaceAll(" ", ""));
-//	}
-//	
-//	@Test
-//	public void testOPBED() throws QueryException {
-//		query = "#BED(der , sa)";
-//		String bed1 = 
-//				"{@type=korap:reference, operation=operation:focus, classRef=[129], operands= [" +
-//					"{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" +
-//						"{@type=korap:span, key=s}," +
-//						"{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" +
-//							"{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}" +
-//						"]}" +
-//					"], frame=frame:startswith}" +
-//				"]}";
-//		ct = new CosmasTree(query);
-//		map = ct.getRequestMap().get("query").toString();
-//		assertEquals(bed1.replaceAll(" ", ""), map.replaceAll(" ", ""));
-//		
-//		query = "#BED(der Mann , +pe)";
-//		String bed2 = 
-//				"{@type=korap:reference, operation=operation:focus, classRef=[129], operands= [" +
-//						"{@type=korap:group, operation=operation:position, frames=[frames:matches], operands=[" +
-//							"{@type=korap:reference, operation=operation:focus, spanRef=[-1,1], operands=[" +
-//								"{@type=korap:span, key=p}" +
-//							"]}," +
-//							"{@type=korap:reference, operation=operation:focus, spanRef=[0,1], operands=[" +
-//								"{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" +
-//									"{@type=korap:group, operation=operation:sequence, operands=[" +
-//										"{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
-//										"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
-//									"]}" +
-//								"]}" +
-//							"]}" +
-//						"], frame=frame:matches}" +
-//					"]}";
-//		ct = new CosmasTree(query);
-//		map = ct.getRequestMap().get("query").toString();
-//		assertEquals(bed2.replaceAll(" ", ""), map.replaceAll(" ", ""));
-//		
-//		query = "#BED(der Mann , sa,-pa)";
-//		String bed3 = 
-//				"{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" +
-//					"{@type=korap:group, operation=operation:position, frames=[frames:matches], operands=[" +
-//						"{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" +
-//							"{@type=korap:span, key=s}," +
-//							"{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" +
-//								"{@type=korap:group, operation=operation:sequence, operands=[" +
-//									"{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
-//									"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
-//								"]}" +
-//							"]}" +
-//						"], frame=frame:startswith}," +
-//						"{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" +
-//							"{@type=korap:span, key=p}," +
-//							"{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" +
-//								"{@type=korap:group, operation=operation:sequence, operands=[" +
-//									"{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
-//									"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
-//								"]}" +
-//							"]}" +
-//						"], frame=frame:startswith, exclude=true}" +
-//					"], frame=frame:matches}" +
-//				"]}";
-//		ct = new CosmasTree(query);
-//		map = ct.getRequestMap().get("query").toString();
-//		assertEquals(bed3.replaceAll(" ", ""), map.replaceAll(" ", ""));
-//	}
-//	
-//	@Test
-//	public void testColonSeparatedConditions() throws QueryException {
-//		
-//		query = "Der:sa";
-//		String col1 = 
-//				"{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" +
-//					"{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" +
-//						"{@type=korap:span, key=s}," +
-//						"{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" +
-//							"{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=match:eq}}" +
-//						"]}" +
-//					"], frame=frame:startswith}" +
-//				"]}";
-//		ct = new CosmasTree(query);
-//		map = ct.getRequestMap().get("query").toString();
-//		assertEquals(col1.replaceAll(" ", ""), map.replaceAll(" ", ""));
-//		
-//		query = "Mann:sa,-pa,+te";
-//		String col2 = 
-//				"{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" +
-//					"{@type=korap:group, operation=operation:position, frames=[frames:matches], operands=[" +
-//						"{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" +
-//							"{@type=korap:span, key=s}," +
-//							"{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" +
-//									"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
-//							"]}" +
-//						"], frame=frame:startswith}," +
-//						"{@type=korap:reference, operation=operation:focus, classRef=[130], operands=[" +
-//							"{@type=korap:group, operation=operation:position, frames=[frames:matches], operands=[" +	
-//								"{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" +
-//									"{@type=korap:span, key=p}," +
-//									"{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" +
-//											"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
-//									"]}" +
-//								"], frame=frame:startswith, exclude=true}," +
-//								"{@type=korap:group, operation=operation:position, frames=[frames:matches], operands=[" +
-//									"{@type=korap:reference, operation=operation:focus, spanRef=[-1,1], operands=[" +
-//										"{@type=korap:span, key=t}" +
-//									"]}," +
-//									"{@type=korap:reference, operation=operation:focus, spanRef=[0,1], operands=[" +
-//										"{@type=korap:group, operation=operation:class, class=131, classOut=131, operands=[" +
-//												"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
-//										"]}" +
-//									"]}" +
-//								"], frame=frame:matches}" +
-//							"], frame=frame:matches}" +
-//						"]}" +
-//					"], frame=frame:matches}" +
-//				"]}";
-//		ct = new CosmasTree(query);
-//		map = ct.getRequestMap().get("query").toString();
-//		assertEquals(col2.replaceAll(" ", ""), map.replaceAll(" ", ""));
-//		
-//		query = "Mann:sa,-pa,+te,se";
-//		expected = 
-//				"{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" +
-//					"{@type=korap:group, operation=operation:position, frames=[frames:matches], operands=[" +
-//						"{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" +
-//							"{@type=korap:span, key=s}," +
-//							"{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" +
-//									"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
-//							"]}" +
-//						"], frame=frame:startswith}," +
-//						"{@type=korap:reference, operation=operation:focus, classRef=[130], operands=[" +
-//							"{@type=korap:group, operation=operation:position, frames=[frames:matches], operands=[" +	
-//								"{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" +
-//									"{@type=korap:span, key=p}," +
-//									"{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" +
-//											"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
-//									"]}" +
-//								"], frame=frame:startswith, exclude=true}," +
-//								"{@type=korap:reference, operation=operation:focus, classRef=[131], operands=[" +
-//									"{@type=korap:group, operation=operation:position, frames=[frames:matches], operands=[" +	
-//										"{@type=korap:group, operation=operation:position, frames=[frames:matches], operands=[" +
-//											"{@type=korap:reference, operation=operation:focus, spanRef=[-1,1], operands=[" +
-//												"{@type=korap:span, key=t}" +
-//											"]}," +
-//											"{@type=korap:reference, operation=operation:focus, spanRef=[0,1], operands=[" +
-//												"{@type=korap:group, operation=operation:class, class=131, classOut=131, operands=[" +
-//														"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
-//												"]}" +
-//											"]}" +
-//										"], frame=frame:matches}," +
-//										"{@type=korap:group, operation=operation:position, frames=[frames:matches], operands=[" +
-//											"{@type=korap:reference, operation=operation:focus, spanRef=[-1,1], operands=[" +
-//												"{@type=korap:span, key=s}" +
-//											"]}," +
-//											"{@type=korap:reference, operation=operation:focus, spanRef=[0,1], operands=[" +
-//												"{@type=korap:group, operation=operation:class, class=132, classOut=132, operands=[" +
-//														"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
-//												"]}" +
-//											"]}" +
-//										"], frame=frame:matches}" +
-//									"], frame=frame:matches}" +
-//								"]}" +
-//							"], frame=frame:matches}" +
-//						"]}" +
-//					"], frame=frame:matches}" +
-//				"]}";
-//		ct = new CosmasTree(query);
-//		map = ct.getRequestMap().get("query").toString();
-//		assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", ""));
-//	}
-}
-	
+	@Test
+	public void testOPALL() throws QueryException, JsonProcessingException, IOException {
+		query = "#ALL(gehen /w1:10 voran)";
+		qs.setQuery(query, "cosmas2");
+		res = mapper.readTree(qs.toJSON());
+		assertEquals("korap:group",			res.at("/query/@type").asText());
+		assertEquals("operation:sequence",	res.at("/query/operation").asText());
+		assertEquals("gehen",				res.at("/query/operands/0/wrap/key").asText());
+		assertEquals("voran",				res.at("/query/operands/1/wrap/key").asText());
+		assertEquals("korap:distance",		res.at("/query/distances/0/@type").asText());
+		assertEquals("w",					res.at("/query/distances/0/key").asText());
+		assertEquals(1,						res.at("/query/distances/0/boundary/min").asInt());
+		assertEquals(10,					res.at("/query/distances/0/boundary/max").asInt());
+
+		query = "#ALL(gehen /w1:10 (voran /w1:4 schnell))";
+		qs.setQuery(query, "cosmas2");
+		res = mapper.readTree(qs.toJSON());
+		assertEquals("korap:group",			res.at("/query/@type").asText());
+		assertEquals("operation:sequence",	res.at("/query/operation").asText());
+		assertEquals("korap:distance",		res.at("/query/distances/0/@type").asText());
+		assertEquals("w",					res.at("/query/distances/0/key").asText());
+		assertEquals(1,						res.at("/query/distances/0/boundary/min").asInt());
+		assertEquals(10,					res.at("/query/distances/0/boundary/max").asInt());
+		assertEquals("gehen",				res.at("/query/operands/0/wrap/key").asText());
+		assertEquals("korap:group",			res.at("/query/operands/1/@type").asText());
+		assertEquals("operation:sequence",	res.at("/query/operands/1/operation").asText());
+		assertEquals("korap:distance",		res.at("/query/operands/1/distances/0/@type").asText());
+		assertEquals("w",					res.at("/query/operands/1/distances/0/key").asText());
+		assertEquals(1,						res.at("/query/operands/1/distances/0/boundary/min").asInt());
+		assertEquals(4,						res.at("/query/operands/1/distances/0/boundary/max").asInt());
+		assertEquals("voran",				res.at("/query/operands/1/operands/0/wrap/key").asText());
+		assertEquals("schnell",				res.at("/query/operands/1/operands/1/wrap/key").asText());
 
 
+	}
 
+	@Test
+	public void testOPNHIT() throws QueryException, JsonProcessingException, IOException {
+		query = "#NHIT(gehen /w1:10 voran)";
+		qs.setQuery(query, "cosmas2");
+		res = mapper.readTree(qs.toJSON());
+		assertEquals("korap:reference",		res.at("/query/@type").asText());
+		assertEquals("operation:focus",		res.at("/query/operation").asText());
+		assertEquals(129,					res.at("/query/classRef/0").asInt());
+		assertEquals("korap:group",			res.at("/query/operands/0/@type").asText());
+		assertEquals("operation:class",		res.at("/query/operands/0/operation").asText());
+		assertEquals("classRefOp:inversion",res.at("/query/operands/0/classRefOp").asText());
+		assertEquals(130,					res.at("/query/operands/0/classIn/0").asInt());
+		assertEquals(131,					res.at("/query/operands/0/classIn/1").asInt());
+		assertEquals(129,					res.at("/query/operands/0/classOut").asInt());
+		assertEquals("korap:group",			res.at("/query/operands/0/operands/0/@type").asText());
+		assertEquals("operation:sequence",	res.at("/query/operands/0/operands/0/operation").asText());
+		assertEquals("korap:distance",		res.at("/query/operands/0/operands/0/distances/0/@type").asText());
+		assertEquals("w",					res.at("/query/operands/0/operands/0/distances/0/key").asText());
+		assertEquals(1,						res.at("/query/operands/0/operands/0/distances/0/boundary/min").asInt());
+		assertEquals(10,					res.at("/query/operands/0/operands/0/distances/0/boundary/max").asInt());
+		assertEquals("korap:group",			res.at("/query/operands/0/operands/0/operands/0/@type").asText());
+		assertEquals("operation:class",		res.at("/query/operands/0/operands/0/operands/0/operation").asText());
+		assertEquals(130,					res.at("/query/operands/0/operands/0/operands/0/classOut").asInt());
+		assertEquals(131,					res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
+		assertEquals("korap:token",			res.at("/query/operands/0/operands/0/operands/0/operands/0/@type").asText());
+		assertEquals("gehen",				res.at("/query/operands/0/operands/0/operands/0/operands/0/wrap/key").asText());
+		assertEquals("voran",				res.at("/query/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
 
+		query = "#NHIT(gehen /w1:10 voran /w1:10 Beispiel)";
+		qs.setQuery(query, "cosmas2");
+		res = mapper.readTree(qs.toJSON());
+		assertEquals("korap:reference",		res.at("/query/@type").asText());
+		assertEquals("operation:focus",		res.at("/query/operation").asText());
+		assertEquals(129,					res.at("/query/classRef/0").asInt());
+		assertEquals("korap:group",			res.at("/query/operands/0/@type").asText());
+		assertEquals("operation:class",		res.at("/query/operands/0/operation").asText());
+		assertEquals("classRefOp:inversion",res.at("/query/operands/0/classRefOp").asText());
+		assertEquals(130,					res.at("/query/operands/0/classIn/0").asInt());
+		assertEquals(131,					res.at("/query/operands/0/classIn/1").asInt());
+		assertEquals(129,					res.at("/query/operands/0/classOut").asInt());
+		assertEquals("korap:group",			res.at("/query/operands/0/operands/0/@type").asText());
+		assertEquals("operation:sequence",	res.at("/query/operands/0/operands/0/operation").asText());
+		assertEquals("korap:distance",		res.at("/query/operands/0/operands/0/distances/0/@type").asText());
+		assertEquals("w",					res.at("/query/operands/0/operands/0/distances/0/key").asText());
+		assertEquals(1,						res.at("/query/operands/0/operands/0/distances/0/boundary/min").asInt());
+		assertEquals(10,					res.at("/query/operands/0/operands/0/distances/0/boundary/max").asInt());
+		assertEquals("korap:group",			res.at("/query/operands/0/operands/0/operands/0/@type").asText());
+		assertEquals("operation:class",		res.at("/query/operands/0/operands/0/operands/0/operation").asText());
+		assertEquals(130,					res.at("/query/operands/0/operands/0/operands/0/classOut").asInt());
+		assertEquals(131,					res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
+		assertEquals("gehen",				res.at("/query/operands/0/operands/0/operands/0/operands/0/wrap/key").asText());
+		assertEquals("operation:focus",		res.at("/query/operands/0/operands/0/operands/1/operands/0/operation").asText());
+		assertEquals(132,					res.at("/query/operands/0/operands/0/operands/1/operands/0/classRef/0").asInt());
+		assertEquals("operation:sequence",	res.at("/query/operands/0/operands/0/operands/1/operands/0/operands/0/operation").asText());
+		assertEquals(132,					res.at("/query/operands/0/operands/0/operands/1/operands/0/operands/0/operands/0/classOut").asInt());
+		assertEquals("voran",				res.at("/query/operands/0/operands/0/operands/1/operands/0/operands/0/operands/0/operands/0/wrap/key").asText());
+		assertEquals(132,					res.at("/query/operands/0/operands/0/operands/1/operands/0/operands/0/operands/1/classOut").asInt());
+		assertEquals("Beispiel",			res.at("/query/operands/0/operands/0/operands/1/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
 
+	}
 
+	@Test
+	public void testOPBED() throws QueryException, JsonProcessingException, IOException {
+		query = "#BED(der , sa)";
+		qs.setQuery(query, "cosmas2");
+		res = mapper.readTree(qs.toJSON());
+		assertEquals("korap:reference",				res.at("/query/@type").asText());
+		assertEquals("operation:focus",				res.at("/query/operation").asText());
+		assertEquals(129,							res.at("/query/classRef/0").asInt());
+		assertEquals("korap:group",					res.at("/query/operands/0/@type").asText());
+		assertEquals("operation:position",			res.at("/query/operands/0/operation").asText());
+		assertEquals("frames:startswith",			res.at("/query/operands/0/frames/0").asText());
+		assertEquals("korap:group",					res.at("/query/operands/0/@type").asText());
+		assertEquals("operation:class",				res.at("/query/operands/0/operands/1/operation").asText());
+		assertEquals(129,							res.at("/query/operands/0/operands/1/classOut").asInt());
+		assertEquals("korap:token",					res.at("/query/operands/0/operands/1/operands/0/@type").asText());
+		assertEquals("der",							res.at("/query/operands/0/operands/1/operands/0/wrap/key").asText());
+		assertEquals("korap:span",					res.at("/query/operands/0/operands/0/@type").asText());
+		assertEquals("s",							res.at("/query/operands/0/operands/0/key").asText());
+
+		query = "#BED(der Mann , +pe)";
+		qs.setQuery(query, "cosmas2");
+		res = mapper.readTree(qs.toJSON());
+		assertEquals("korap:reference",				res.at("/query/@type").asText());
+		assertEquals("operation:focus",				res.at("/query/operation").asText());
+		assertEquals(129,							res.at("/query/classRef/0").asInt());
+		assertEquals("korap:group",					res.at("/query/operands/0/@type").asText());
+		assertEquals("operation:position",			res.at("/query/operands/0/operation").asText());
+		assertEquals("frames:matches",				res.at("/query/operands/0/frames/0").asText());
+		assertEquals("korap:reference",				res.at("/query/operands/0/operands/0/@type").asText());
+		assertEquals("operation:focus",				res.at("/query/operands/0/operands/0/operation").asText());
+		assertEquals(-1,							res.at("/query/operands/0/operands/0/spanRef/0").asInt());
+		assertEquals(1,								res.at("/query/operands/0/operands/0/spanRef/1").asInt());
+		assertEquals("korap:span",					res.at("/query/operands/0/operands/0/operands/0/@type").asText());
+		assertEquals("p",							res.at("/query/operands/0/operands/0/operands/0/key").asText());
+		assertEquals("korap:reference",				res.at("/query/operands/0/operands/1/@type").asText());
+		assertEquals("operation:focus",				res.at("/query/operands/0/operands/1/operation").asText());
+		assertEquals(0,								res.at("/query/operands/0/operands/1/spanRef/0").asInt());
+		assertEquals(1,								res.at("/query/operands/0/operands/1/spanRef/1").asInt());
+		assertEquals("korap:group",					res.at("/query/operands/0/operands/1/operands/0/@type").asText());
+		assertEquals("operation:class",				res.at("/query/operands/0/operands/1/operands/0/operation").asText());
+		assertEquals(129,							res.at("/query/operands/0/operands/1/operands/0/classOut").asInt());
+		assertEquals("operation:sequence",			res.at("/query/operands/0/operands/1/operands/0/operands/0/operation").asText());
+		assertEquals("der",							res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/0/wrap/key").asText());
+		assertEquals("Mann",						res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/1/wrap/key").asText());
+
+		query = "#BED(der Mann , sa,-pa)";
+		qs.setQuery(query, "cosmas2");
+		res = mapper.readTree(qs.toJSON());
+		assertEquals("korap:reference",				res.at("/query/@type").asText());
+		assertEquals("operation:focus",				res.at("/query/operation").asText());
+		assertEquals(129,							res.at("/query/classRef/0").asInt());
+		assertEquals("korap:group",					res.at("/query/operands/0/@type").asText());
+		assertEquals("operation:position",			res.at("/query/operands/0/operation").asText());
+		assertEquals("frames:matches",				res.at("/query/operands/0/frames/0").asText());
+
+		assertEquals("korap:group",					res.at("/query/operands/0/operands/0/@type").asText());
+		assertEquals("operation:position",			res.at("/query/operands/0/operands/0/operation").asText());
+		assertEquals("frames:startswith",			res.at("/query/operands/0/operands/0/frames/0").asText());
+		assertEquals("korap:span",					res.at("/query/operands/0/operands/0/operands/0/@type").asText());
+		assertEquals("s",							res.at("/query/operands/0/operands/0/operands/0/key").asText());
+		assertEquals("korap:group",					res.at("/query/operands/0/operands/0/operands/1/@type").asText());
+		assertEquals("operation:class",				res.at("/query/operands/0/operands/0/operands/1/operation").asText());
+		assertEquals(129,							res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
+		assertEquals("operation:sequence",			res.at("/query/operands/0/operands/0/operands/1/operands/0/operation").asText());
+		assertEquals("der",							res.at("/query/operands/0/operands/0/operands/1/operands/0/operands/0/wrap/key").asText());
+		assertEquals("Mann",						res.at("/query/operands/0/operands/0/operands/1/operands/0/operands/1/wrap/key").asText());
+
+		assertEquals("korap:group",					res.at("/query/operands/0/operands/1/@type").asText());
+		assertEquals("operation:position",			res.at("/query/operands/0/operands/1/operation").asText());
+		assertEquals("frames:startswith",			res.at("/query/operands/0/operands/1/frames/0").asText());
+		assertEquals(true,							res.at("/query/operands/0/operands/1/exclude").asBoolean());
+		assertEquals("korap:span",					res.at("/query/operands/0/operands/1/operands/0/@type").asText());
+		assertEquals("p",							res.at("/query/operands/0/operands/1/operands/0/key").asText());
+		assertEquals("korap:group",					res.at("/query/operands/0/operands/1/operands/1/@type").asText());
+		assertEquals("operation:class",				res.at("/query/operands/0/operands/1/operands/1/operation").asText());
+		assertEquals(130,							res.at("/query/operands/0/operands/1/operands/1/classOut").asInt());
+		assertEquals("operation:sequence",			res.at("/query/operands/0/operands/1/operands/1/operands/0/operation").asText());
+		assertEquals("der",							res.at("/query/operands/0/operands/1/operands/1/operands/0/operands/0/wrap/key").asText());
+		assertEquals("Mann",						res.at("/query/operands/0/operands/1/operands/1/operands/0/operands/1/wrap/key").asText());
+
+	}
+
+	@Test
+	public void testColonSeparatedConditions() throws QueryException, JsonProcessingException, IOException {
+		query = "der:sa";
+		qs.setQuery(query, "cosmas2");
+		res = mapper.readTree(qs.toJSON());
+		assertEquals("korap:reference",				res.at("/query/@type").asText());
+		assertEquals("operation:focus",				res.at("/query/operation").asText());
+		assertEquals(129,							res.at("/query/classRef/0").asInt());
+		assertEquals("korap:group",					res.at("/query/operands/0/@type").asText());
+		assertEquals("operation:position",			res.at("/query/operands/0/operation").asText());
+		assertEquals("frames:startswith",			res.at("/query/operands/0/frames/0").asText());
+		assertEquals("korap:group",					res.at("/query/operands/0/@type").asText());
+		assertEquals("operation:class",				res.at("/query/operands/0/operands/1/operation").asText());
+		assertEquals(129,							res.at("/query/operands/0/operands/1/classOut").asInt());
+		assertEquals("korap:token",					res.at("/query/operands/0/operands/1/operands/0/@type").asText());
+		assertEquals("der",							res.at("/query/operands/0/operands/1/operands/0/wrap/key").asText());
+		assertEquals("korap:span",					res.at("/query/operands/0/operands/0/@type").asText());
+		assertEquals("s",							res.at("/query/operands/0/operands/0/key").asText());
+
+		query = "der:sa,-pa";
+		qs.setQuery(query, "cosmas2");
+		res = mapper.readTree(qs.toJSON());
+		assertEquals("korap:reference",				res.at("/query/@type").asText());
+		assertEquals("operation:focus",				res.at("/query/operation").asText());
+		assertEquals(129,							res.at("/query/classRef/0").asInt());
+		assertEquals("korap:group",					res.at("/query/operands/0/@type").asText());
+		assertEquals("operation:position",			res.at("/query/operands/0/operation").asText());
+		assertEquals("frames:matches",				res.at("/query/operands/0/frames/0").asText());
+		assertEquals("korap:group",					res.at("/query/operands/0/operands/0/@type").asText());
+		assertEquals("operation:position",			res.at("/query/operands/0/operands/0/operation").asText());
+		assertEquals("frames:startswith",			res.at("/query/operands/0/operands/0/frames/0").asText());
+		assertEquals("korap:span",					res.at("/query/operands/0/operands/0/operands/0/@type").asText());
+		assertEquals("s",							res.at("/query/operands/0/operands/0/operands/0/key").asText());
+		assertEquals("korap:group",					res.at("/query/operands/0/operands/0/operands/1/@type").asText());
+		assertEquals("operation:class",				res.at("/query/operands/0/operands/0/operands/1/operation").asText());
+		assertEquals(129,							res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
+		assertEquals("der",							res.at("/query/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
+		assertEquals("korap:group",					res.at("/query/operands/0/operands/1/@type").asText());
+		assertEquals("operation:position",			res.at("/query/operands/0/operands/1/operation").asText());
+		assertEquals("frames:startswith",			res.at("/query/operands/0/operands/1/frames/0").asText());
+		assertEquals(true,							res.at("/query/operands/0/operands/1/exclude").asBoolean());
+		assertEquals("korap:span",					res.at("/query/operands/0/operands/1/operands/0/@type").asText());
+		assertEquals("p",							res.at("/query/operands/0/operands/1/operands/0/key").asText());
+		assertEquals("korap:group",					res.at("/query/operands/0/operands/1/operands/1/@type").asText());
+		assertEquals("operation:class",				res.at("/query/operands/0/operands/1/operands/1/operation").asText());
+		assertEquals(130,							res.at("/query/operands/0/operands/1/operands/1/classOut").asInt());
+		assertEquals("der",							res.at("/query/operands/0/operands/1/operands/1/operands/0/wrap/key").asText());
+
+		query = "der:sa,-pa,+te";
+		qs.setQuery(query, "cosmas2");
+		res = mapper.readTree(qs.toJSON());
+		assertEquals("korap:reference",				res.at("/query/@type").asText());
+		assertEquals("operation:focus",				res.at("/query/operation").asText());
+		assertEquals(129,							res.at("/query/classRef/0").asInt());
+		assertEquals("korap:group",					res.at("/query/operands/0/@type").asText());
+		assertEquals("operation:position",			res.at("/query/operands/0/operation").asText());
+		assertEquals("frames:matches",				res.at("/query/operands/0/frames/0").asText());
+		assertEquals("korap:group",					res.at("/query/operands/0/operands/0/@type").asText());
+		assertEquals("operation:position",			res.at("/query/operands/0/operands/0/operation").asText());
+		assertEquals("frames:startswith",			res.at("/query/operands/0/operands/0/frames/0").asText());
+		assertEquals("korap:span",					res.at("/query/operands/0/operands/0/operands/0/@type").asText());
+		assertEquals("s",							res.at("/query/operands/0/operands/0/operands/0/key").asText());
+		assertEquals("korap:group",					res.at("/query/operands/0/operands/0/operands/1/@type").asText());
+		assertEquals("operation:class",				res.at("/query/operands/0/operands/0/operands/1/operation").asText());
+		assertEquals(129,							res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
+		assertEquals("der",							res.at("/query/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
+		assertEquals("korap:reference",				res.at("/query/operands/0/operands/1/@type").asText());
+		assertEquals("operation:focus",				res.at("/query/operands/0/operands/1/operation").asText());
+		assertEquals(130,							res.at("/query/operands/0/operands/1/classRef/0").asInt());
+		assertEquals("korap:group",					res.at("/query/operands/0/operands/1/operands/0/@type").asText());
+		assertEquals("operation:position",			res.at("/query/operands/0/operands/1/operands/0/operation").asText());
+		assertEquals("frames:matches",				res.at("/query/operands/0/operands/1/operands/0/frames/0").asText());
+		assertEquals("korap:group",					res.at("/query/operands/0/operands/1/operands/0/operands/0/@type").asText());
+		assertEquals("operation:position",			res.at("/query/operands/0/operands/1/operands/0/operands/0/operation").asText());
+		assertEquals("frames:startswith",			res.at("/query/operands/0/operands/1/operands/0/operands/0/frames/0").asText());
+		assertEquals(true,							res.at("/query/operands/0/operands/1/operands/0/operands/0/exclude").asBoolean());
+		assertEquals("korap:span",					res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/0/@type").asText());
+		assertEquals("p",							res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/0/key").asText());
+		assertEquals("korap:group",					res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/1/@type").asText());
+		assertEquals("operation:class",				res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/1/operation").asText());
+		assertEquals(130,							res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/1/classOut").asInt());
+		assertEquals("der",							res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
+		assertEquals("korap:group",					res.at("/query/operands/0/operands/1/operands/0/operands/1/@type").asText());
+		assertEquals("operation:position",			res.at("/query/operands/0/operands/1/operands/0/operands/1/operation").asText());
+		assertEquals("frames:matches",				res.at("/query/operands/0/operands/1/operands/0/operands/1/frames/0").asText());
+		assertEquals("korap:reference",				res.at("/query/operands/0/operands/1/operands/0/operands/1/operands/0/@type").asText());
+		assertEquals("operation:focus",				res.at("/query/operands/0/operands/1/operands/0/operands/1/operands/0/operation").asText());
+		assertEquals(-1,							res.at("/query/operands/0/operands/1/operands/0/operands/1/operands/0/spanRef/0").asInt());
+		assertEquals(1,								res.at("/query/operands/0/operands/1/operands/0/operands/1/operands/0/spanRef/1").asInt());
+		assertEquals("korap:span",					res.at("/query/operands/0/operands/1/operands/0/operands/1/operands/0/operands/0/@type").asText());
+		assertEquals("t",							res.at("/query/operands/0/operands/1/operands/0/operands/1/operands/0/operands/0/key").asText());
+		assertEquals("korap:reference",				res.at("/query/operands/0/operands/1/operands/0/operands/1/operands/1/@type").asText());
+		assertEquals("operation:focus",				res.at("/query/operands/0/operands/1/operands/0/operands/1/operands/1/operation").asText());
+		assertEquals(0,								res.at("/query/operands/0/operands/1/operands/0/operands/1/operands/1/spanRef/0").asInt());
+		assertEquals(1,								res.at("/query/operands/0/operands/1/operands/0/operands/1/operands/1/spanRef/1").asInt());
+		assertEquals("korap:group",					res.at("/query/operands/0/operands/1/operands/0/operands/1/operands/1/operands/0/@type").asText());
+		assertEquals("operation:class",				res.at("/query/operands/0/operands/1/operands/0/operands/1/operands/1/operands/0/operation").asText());
+		assertEquals(131,							res.at("/query/operands/0/operands/1/operands/0/operands/1/operands/1/operands/0/classOut").asInt());
+		assertEquals("der",							res.at("/query/operands/0/operands/1/operands/0/operands/1/operands/1/operands/0/operands/0/wrap/key").asText());
+	}
+}
\ No newline at end of file
diff --git a/src/test/java/PoliqarpPlusTreeTest.java b/src/test/java/PoliqarpPlusTreeTest.java
index 8abb911..3dc2429 100644
--- a/src/test/java/PoliqarpPlusTreeTest.java
+++ b/src/test/java/PoliqarpPlusTreeTest.java
@@ -923,20 +923,20 @@
 		assertEquals("operation:class", 	res.at("/query/operands/0/operands/1/operation").asText());
 		assertEquals(1, 					res.at("/query/operands/0/operands/1/classOut").asInt());
 		assertEquals("Mann", 				res.at("/query/operands/0/operands/1/operands/0/wrap/key").asText());
-		
+
 		query = "focus([orth=Der]{[orth=Mann][orth=geht]})";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
 		assertEquals("operation:sequence", 	res.at("/query/operands/0/operands/1/operands/0/operation").asText());
 		assertEquals("Mann", 				res.at("/query/operands/0/operands/1/operands/0/operands/0/wrap/key").asText());
 		assertEquals("geht", 				res.at("/query/operands/0/operands/1/operands/0/operands/1/wrap/key").asText());
-		
+
 		query = "focus(2:[orth=Der]{2:[orth=Mann][orth=geht]})";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
 		assertEquals(2, 					res.at("/query/classRef/0").asInt());
 		assertEquals(2, 					res.at("/query/operands/0/operands/1/classOut").asInt());
-		
+
 		query = "focus(3:startswith(<s>,{3:<np>}))";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -947,13 +947,13 @@
 		assertEquals("operation:class", 	res.at("/query/operands/0/operands/1/operation").asText());
 		assertEquals(3, 					res.at("/query/operands/0/operands/1/classOut").asInt());
 		assertEquals("frames:startswith", 	res.at("/query/operands/0/frames/0").asText());
-		
+
 		query = "focus(1000:startswith(<s>,{1000:<np>}))";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
 		assertEquals(127, 					res.at("/query/classRef/0").asInt());
 		assertEquals(127, 					res.at("/query/operands/0/operands/1/classOut").asInt());
-		
+
 		query = "focus(3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}}))";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -970,7 +970,7 @@
 		assertEquals("operation:sequence", 	res.at("/query/operands/0/operands/1/operands/0/operands/1/operands/0/operation").asText());
 		assertEquals("operation:class", 	res.at("/query/operands/0/operands/1/operands/0/operands/1/operands/0/operands/1/operation").asText());
 		assertEquals(2, 					res.at("/query/operands/0/operands/1/operands/0/operands/1/operands/0/operands/1/classOut").asInt());
-		
+
 		query = "split(3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}}))";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -978,7 +978,7 @@
 		assertEquals(true, 					res.at("/query/classRef/1").isMissingNode());
 		assertEquals("korap:reference", 	res.at("/query/@type").asText());
 		assertEquals("operation:split", 	res.at("/query/operation").asText());
-		
+
 		query = "split(2|3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}}))";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -987,7 +987,7 @@
 		assertEquals("classRefOp:intersection", res.at("/query/classRefOp").asText());
 		assertEquals("korap:reference", 		res.at("/query/@type").asText());
 		assertEquals("operation:split", 		res.at("/query/operation").asText());
-		
+
 		query = "focus(1:{[base=der]}{1:[pos=ADJA]})";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -995,7 +995,7 @@
 		assertEquals(1, 					res.at("/query/operands/0/operands/0/classOut").asInt());
 		assertEquals(1, 					res.at("/query/operands/0/operands/1/classOut").asInt());
 	}
-	
+
 	@Test
 	public void testSubmatch() throws QueryException, JsonProcessingException, IOException {
 		query = "submatch(1,:<s>)";
@@ -1006,7 +1006,7 @@
 		assertEquals(1, 					res.at("/query/spanRef/0").asInt());
 		assertEquals(true, 					res.at("/query/spanRef/1").isMissingNode());
 		assertEquals("s", 					res.at("/query/operands/0/key").asText());
-		
+
 		query = "submatch(1,4:<s>)";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -1014,7 +1014,7 @@
 		assertEquals("operation:focus", 	res.at("/query/operation").asText());
 		assertEquals(1, 					res.at("/query/spanRef/0").asInt());
 		assertEquals(4, 					res.at("/query/spanRef/1").asInt());
-		
+
 		query = "submatch(1,4:contains(<s>,[base=Haus]))";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -1036,7 +1036,7 @@
 		assertEquals("korap:relation", 		res.at("/query/relation/@type").asText());
 		assertEquals("s", 					res.at("/query/operands/0/key").asText());
 		assertEquals("np", 					res.at("/query/operands/1/key").asText());
-		
+
 		query = "relatesTo([base=Baum],<np>)";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -1045,13 +1045,13 @@
 		assertEquals("korap:relation", 		res.at("/query/relation/@type").asText());
 		assertEquals("Baum", 				res.at("/query/operands/0/wrap/key").asText());
 		assertEquals("np", 					res.at("/query/operands/1/key").asText());
-		
+
 		query = "relatesTo(Baum,<np>)";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
 		assertEquals("orth", 				res.at("/query/operands/0/wrap/layer").asText());
 		assertEquals("Baum", 				res.at("/query/operands/0/wrap/key").asText());
-		
+
 		query = "relatesTo(mate/d=HEAD:<np>,[base=Baum])";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -1061,7 +1061,7 @@
 		assertEquals("mate", 				res.at("/query/relation/foundry").asText());
 		assertEquals("d", 					res.at("/query/relation/layer").asText());
 		assertEquals("HEAD", 				res.at("/query/relation/key").asText());
-		
+
 		query = "dominates(Baum,<np>)";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -1069,13 +1069,13 @@
 		assertEquals("Baum", 				res.at("/query/operands/0/wrap/key").asText());
 		assertEquals("korap:relation", 		res.at("/query/relation/@type").asText());
 		assertEquals("c", 					res.at("/query/relation/layer").asText());
-		
+
 		query = "dominates(cnx/c:<vp>,<np>)";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
 		assertEquals("cnx", 				res.at("/query/relation/foundry").asText());
 		assertEquals("c", 					res.at("/query/relation/layer").asText());
-		
+
 		query = "dominates(cnx/c*:<vp>,<np>)";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -1083,26 +1083,26 @@
 		assertEquals("c", 					res.at("/query/relation/layer").asText());
 		assertEquals(0, 					res.at("/query/relation/boundary/min").asInt());
 		assertEquals(true, 					res.at("/query/relation/boundary/max").isMissingNode());
-		
+
 		query = "dominates(cnx/c{1,5}:<vp>,<np>)";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
 		assertEquals(1, 					res.at("/query/relation/boundary/min").asInt());
 		assertEquals(5, 					res.at("/query/relation/boundary/max").asInt());
-		
+
 		query = "dominates(cnx/c{,5}:<vp>,<np>)";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
 		assertEquals(0, 					res.at("/query/relation/boundary/min").asInt());
 		assertEquals(5, 					res.at("/query/relation/boundary/max").asInt());
-		
+
 		query = "dominates(cnx/c{5}:<vp>,<np>)";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
 		assertEquals(5, 					res.at("/query/relation/boundary/min").asInt());
 		assertEquals(5, 					res.at("/query/relation/boundary/max").asInt());
 	}
-	
+
 	@Test
 	public void testAlign() throws QueryException, JsonProcessingException, IOException {
 		query = "[orth=der]^[orth=Mann]";
@@ -1113,7 +1113,7 @@
 		assertEquals("operation:class", 	res.at("/query/operands/1/operation").asText());
 		assertEquals(129, 					res.at("/query/operands/1/classOut").asInt());
 		assertEquals(129, 					res.at("/meta/alignment").asInt());
-		
+
 		query = "[orth=der]^[orth=große][orth=Mann]";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -1124,7 +1124,7 @@
 		assertEquals("Mann", 				res.at("/query/operands/1/operands/0/operands/1/wrap/key").asText());
 		assertEquals(129, 					res.at("/query/operands/1/classOut").asInt());
 		assertEquals(129, 					res.at("/meta/alignment").asInt());
-		
+
 		query = "([base=a]^[base=b])|[base=c]";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -1136,7 +1136,7 @@
 		assertEquals("c", 					res.at("/query/operands/1/wrap/key").asText());
 		assertEquals(129, 					res.at("/query/operands/0/operands/1/classOut").asInt());
 		assertEquals(129, 					res.at("/meta/alignment").asInt());
-		
+
 		query = "([base=a]^[base=b][base=c])|[base=d]";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -1144,7 +1144,7 @@
 		assertEquals("b", 					res.at("/query/operands/0/operands/1/operands/0/operands/0/wrap/key").asText());
 		assertEquals("c", 					res.at("/query/operands/0/operands/1/operands/0/operands/1/wrap/key").asText());
 		assertEquals("d", 					res.at("/query/operands/1/wrap/key").asText());
-		
+
 		query = "([base=a]^[base=b]^[base=c])|[base=d]";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -1155,7 +1155,7 @@
 		assertEquals(129, 					res.at("/meta/alignment/0").asInt());
 		assertEquals(130, 					res.at("/meta/alignment/1").asInt());
 	}
-	
+
 	@Test
 	public void testSimpleQueries() throws QueryException, JsonProcessingException, IOException {
 		query = "Baum";
@@ -1166,7 +1166,7 @@
 		assertEquals("Baum",				res.at("/query/wrap/key").asText());
 		assertEquals("orth", 				res.at("/query/wrap/layer").asText());
 		assertEquals("match:eq",			res.at("/query/wrap/match").asText());
-		
+
 		query = "Der Baum";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -1180,14 +1180,14 @@
 		assertEquals("match:eq",			res.at("/query/operands/0/wrap/match").asText());
 		assertEquals("orth", 				res.at("/query/operands/1/wrap/layer").asText());
 		assertEquals("match:eq",			res.at("/query/operands/1/wrap/match").asText());
-		
+
 		query = "Der große Baum";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
 		assertEquals("Der",					res.at("/query/operands/0/wrap/key").asText());
 		assertEquals("große",				res.at("/query/operands/1/wrap/key").asText());
 		assertEquals("Baum",				res.at("/query/operands/2/wrap/key").asText());
-		
+
 		query = "Der (große|kleine) Baum";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -1196,7 +1196,7 @@
 		assertEquals("große",				res.at("/query/operands/1/operands/0/wrap/key").asText());
 		assertEquals("kleine",				res.at("/query/operands/1/operands/1/wrap/key").asText());
 		assertEquals("Baum",				res.at("/query/operands/2/wrap/key").asText());
-		
+
 		query = "der große Baum | der kleine Baum";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());
@@ -1207,7 +1207,7 @@
 		assertEquals("der",					res.at("/query/operands/1/operands/0/wrap/key").asText());
 		assertEquals("kleine",				res.at("/query/operands/1/operands/1/wrap/key").asText());
 		assertEquals("Baum",				res.at("/query/operands/1/operands/2/wrap/key").asText());
-		
+
 		query = "Der [p=ADJA] Baum";
 		qs.setQuery(query, "poliqarpplus");
 		res = mapper.readTree(qs.toJSON());