switched to new notation, cosmas2 automatic build
diff --git a/src/test/java/PoliqarpPlusTreeTest.java b/src/test/java/PoliqarpPlusTreeTest.java
index 1837a1b..5a69053 100644
--- a/src/test/java/PoliqarpPlusTreeTest.java
+++ b/src/test/java/PoliqarpPlusTreeTest.java
@@ -2,6 +2,7 @@
 
 import org.junit.Test;
 
+import de.ids_mannheim.korap.query.serialize.CosmasTree;
 import de.ids_mannheim.korap.query.serialize.PoliqarpPlusTree;
 import de.ids_mannheim.korap.util.QueryException;
 
@@ -25,39 +26,53 @@
 	
 //	@Test
 	public void testContext() throws QueryException {
-		String contextString = "{korap=http://korap.ids-mannheim.de/ns/query, @language=de, operands={@id=korap:operands, @container=@list}, operation={@id=korap:relation, type=korap:relation#types}, class={@id=korap:class, type=xsd:integer}, query=korap:query, filter=korap:filter, meta=korap:meta}";
-		ppt = new PoliqarpPlusTree("[base=test]");
-//		assertTrue(equalsContent(contextString, ppt.getRequestMap().get("@context")));
-		assertEquals(contextString, ppt.getRequestMap().get("@context"));
+		String contextString = "{korap = http://korap.ids-mannheim.de/ns/KorAP/json-ld/v0.1/, " +
+							"boundary = korap:boundary/,"+
+							"group = korap:group/,"+ 
+							"operation = {@id = group:operation/, @type = @id},"+
+							"class = {@id = group:class, @type = xsd:integer},"+
+							"operands = {@id = group:operands, @container = @list},"+
+							"frame = {@id = group:frame/, @type = @id},"+
+							"classRef = {@id = group:classRef, @type = xsd:integer},"+
+							"spanRef = {@id = group:spanRef, @type = xsd:integer},"+
+							"classRefOp = {@id = group:classRefOp, @type = @id},"+
+							"min = {@id = boundary:min, @type = xsd:integer},"+
+							"max = {@id = boundary:max, @type = xsd:integer},"+
+							"exclude = {@id = group:exclude, @type = xsd:boolean},"+
+							"distances = {@id = group:distances, @container = @list},"+
+							"inOrder = {@id = group:inOrder, @type = xsd:boolean}"+
+							"}";
+		ppt = new PoliqarpPlusTree("Test");
+		assertEquals(contextString.replaceAll(" ", ""), ppt.getRequestMap().get("@context").toString().replaceAll(" ", ""));
 	}
 	
 	@Test
 	public void testSingleTokens() throws QueryException {
 		// [base=Mann]
-		String token1 = "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}";
+		String token1 = "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}";
 		assertTrue(equalsQueryContent(token1, "[base=Mann]"));
 		
 		// [orth!=Frau]
-		String token2 = "{type=token, key={type=term, key=Frau, layer=orth, match=ne}}";
+		String token2 = "{@type=korap:token, wrap={@type=korap:term, key=Frau, layer=orth, match=ne}}";
 		assertTrue(equalsQueryContent(token2, "[orth!=Frau]"));
 		
 		// [!p=NN]
-		String token3 = "{type=token, key={type=term, key=NN, layer=p, match=ne}}";
+		String token3 = "{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, match=ne}}";
 		assertTrue(equalsQueryContent(token3, "[!p=NN]"));
 		
 		// [!p!=NN]
-		String token4 = "{type=token, key={type=term, key=NN, layer=p, match=eq}}";
+		String token4 = "{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, match=eq}}";
 		assertTrue(equalsQueryContent(token4, "[!p!=NN]"));
 	}
 	
 	@Test
 	public void testElements() throws QueryException {
 		// <s>
-		String elem1 = "{type=span, key=s}";
+		String elem1 = "{@type=korap:span, key=s}";
 		assertTrue(equalsQueryContent(elem1, "<s>"));
 		
 		// <vp>
-		String elem2 = "{type=span, key=vp}";
+		String elem2 = "{@type=korap:span, key=vp}";
 		assertTrue(equalsQueryContent(elem2, "<vp>"));
 	}
 	
@@ -65,12 +80,12 @@
 	public void testEmptyTokens() throws QueryException {
 		// [base=der][][base=Mann]
 		String et1 = 
-			"{type=group, operation=sequence, inOrder=true, distances=[" +
-				"{type=distance, measure=w, min=1, max=1}" +
+			"{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
+				"{@type=korap:distance, key=w, min=1, max=1}" +
 			"], " +
 			"operands=[" +
-				"{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
-				"{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" +
+				"{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+				"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}" +
 			"]}";
 		ppt = new PoliqarpPlusTree("[base=der][][base=Mann]");
 		map = ppt.getRequestMap().get("query").toString();
@@ -78,12 +93,12 @@
 		
 		// [base=der][][][base=Mann]
 		String et2 = 
-			"{type=group, operation=sequence, inOrder=true, distances=[" +
-				"{type=distance, measure=w, min=2, max=2}" +
+			"{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
+				"{@type=korap:distance, key=w, min=2, max=2}" +
 			"], " +
 			"operands=[" +
-				"{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
-				"{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" +
+				"{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+				"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}" +
 			"]}";
 		ppt = new PoliqarpPlusTree("[base=der][][][base=Mann]");
 		map = ppt.getRequestMap().get("query").toString();
@@ -91,12 +106,12 @@
 		
 		// [base=der][][]?[base=Mann]
 		String et3 = 
-			"{type=group, operation=sequence, inOrder=true, distances=[" +
-				"{type=distance, measure=w, min=1, max=2}" +
+			"{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
+				"{@type=korap:distance, key=w, min=1, max=2}" +
 			"], " +
 			"operands=[" +
-				"{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
-				"{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" +
+				"{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+				"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}" +
 			"]}";
 		ppt = new PoliqarpPlusTree("[base=der][][]?[base=Mann]");
 		map = ppt.getRequestMap().get("query").toString();
@@ -105,10 +120,10 @@
 		
 		// startswith(<s>, [][base=Mann]
 		String et4 = 
-			"{type=group, operation=position, frame=startswith, operands=[" +	
-				"{type=span, key=s}," +
-				"{type=group, operation=sequence, offset-min=1, offset-max=1, operands=[" +
-					"{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" +
+			"{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +	
+				"{@type=korap:span, key=s}," +
+				"{@type=korap:group, operation=operation:sequence, offset-min=1, offset-max=1, operands=[" +
+					"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}" +
 				"]}" +
 			"]}";
 		ppt = new PoliqarpPlusTree("startswith(<s>, [][base=Mann])");
@@ -117,17 +132,17 @@
 		
 		// [base=der][]{2,5}[base=Mann][]?[][base=Frau]   nested distances=
 		String et5 = 
-				"{type=group, operation=sequence, inOrder=true, distances=[" +
-					"{type=distance, measure=w, min=2, max=5}" +
+				"{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
+					"{@type=korap:distance, key=w, min=2, max=5}" +
 				"], " +
 				"operands=[" +
-					"{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
-					"{type=group, operation=sequence, inOrder=true, distances=[" +
-						"{type=distance, measure=w, min=1, max=2}" +
+					"{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+					"{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
+						"{@type=korap:distance, key=w, min=1, max=2}" +
 					"], " +
 					"operands=[" +
-						"{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}," +
-						"{type=token, key={type=term, key=Frau, layer=lemma, match=eq}}" +
+						"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}," +
+						"{@type=korap:token, wrap={@type=korap:term, key=Frau, layer=lemma, match=eq}}" +
 					"]}" +
 				"]}";
 		ppt = new PoliqarpPlusTree("[base=der][]{2,5}[base=Mann][]?[][base=Frau]");
@@ -140,14 +155,14 @@
 	public void testCoordinatedFields() throws QueryException {
 		// [base=Mann&(cas=N|cas=A)]
 		String cof1 = 
-			"{type=token, key=" +
-				"{type=group, operands=[" +
-					"{type=term, key=Mann, layer=lemma, match=eq}," +
-					"{type=group, operands=[" +
-						"{type=term, key=N, layer=cas, match=eq}," +
-						"{type=term, key=A, layer=cas, match=eq}" +
-					"], operation=or}" +
-				"], operation=and}" +
+			"{@type=korap:token, wrap=" +
+				"{@type=korap:group, operands=[" +
+					"{@type=korap:term, key=Mann, layer=lemma, match=eq}," +
+					"{@type=korap:group, operands=[" +
+						"{@type=korap:term, key=N, layer=cas, match=eq}," +
+						"{@type=korap:term, key=A, layer=cas, match=eq}" +
+					"], operation=operation:or}" +
+				"], operation=operation:and}" +
 			"}";
 		ppt = new PoliqarpPlusTree("[base=Mann&(cas=N|cas=A)]");
 		map = ppt.getRequestMap().get("query").toString();
@@ -161,12 +176,12 @@
 		
 		// [base=Mann&cas=N&gen=m]
 		String cof2 = 
-			"{type=token, key=" +
-				"{type=group, operands=[" +
-					"{type=term, key=Mann, layer=lemma, match=eq}," +
-					"{type=term, key=N, layer=cas, match=eq}," +
-					"{type=term, key=m, layer=gen, match=eq}" +
-				"], operation=and}" +
+			"{@type=korap:token, wrap=" +
+				"{@type=korap:group, operands=[" +
+					"{@type=korap:term, key=Mann, layer=lemma, match=eq}," +
+					"{@type=korap:term, key=N, layer=cas, match=eq}," +
+					"{@type=korap:term, key=m, layer=gen, match=eq}" +
+				"], operation=operation:and}" +
 			"}";
 		ppt = new PoliqarpPlusTree("[base=Mann&cas=N&gen=m]");
 		map = ppt.getRequestMap().get("query").toString();
@@ -176,20 +191,20 @@
 	@Test
 	public void testOccurrence() throws QueryException {
 		// [base=foo]*
-		String occ1 = "{type=group, operands=[" +
-					     "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
-					  "], operation=repetition, @min=0, @max=100}"; 
+		String occ1 = "{@type=korap:group, operands=[" +
+					     "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
+					  "], operation=operation:repetition, min=0, max=100}"; 
 		ppt = new PoliqarpPlusTree("[base=foo]*");
 		map = ppt.getRequestMap().get("query").toString();
 		assertEquals(occ1.replaceAll(" ", ""), map.replaceAll(" ", ""));
 		
 		// [base=foo]*[base=bar]
 		String occ2 = 
-				"{type=group, operation=sequence, operands=[" +
-					"{type=group, operands=[" +
-					     "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
-					"], operation=repetition, @min=0, @max=100 }," +
-					"{type=token, key={type=term, key=bar, layer=lemma, match=eq}}" +
+				"{@type=korap:group, operation=operation:sequence, operands=[" +
+					"{@type=korap:group, operands=[" +
+					     "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
+					"], operation=operation:repetition, min=0, max=100 }," +
+					"{@type=korap:token, wrap={@type=korap:term, key=bar, layer=lemma, match=eq}}" +
 				"]}"; 
 		ppt = new PoliqarpPlusTree("[base=foo]*[base=bar]");
 		map = ppt.getRequestMap().get("query").toString();
@@ -197,11 +212,11 @@
 		
 		// [base=bar][base=foo]*
 		String occ3 = 
-				"{type=group, operation=sequence, operands=[" +
-					"{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," +
-					"{type=group, operands=[" +
-					     "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
-					"], operation=repetition, @min=0, @max=100 }" +
+				"{@type=korap:group, operation=operation:sequence, operands=[" +
+					"{@type=korap:token, wrap={@type=korap:term, key=bar, layer=lemma, match=eq}}," +
+					"{@type=korap:group, operands=[" +
+					     "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
+					"], operation=operation:repetition, min=0, max=100 }" +
 				"]}"; 
 		ppt = new PoliqarpPlusTree("[base=bar][base=foo]*");
 		map = ppt.getRequestMap().get("query").toString();
@@ -209,26 +224,26 @@
 		
 		// ([base=bar][base=foo])*
 		String occ4 = 
-				"{type=group, operands=[" +	
-					"{type=group, operation=sequence, operands=[" +
-						"{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," +
-						"{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
+				"{@type=korap:group, operands=[" +	
+					"{@type=korap:group, operation=operation:sequence, operands=[" +
+						"{@type=korap:token, wrap={@type=korap:term, key=bar, layer=lemma, match=eq}}," +
+						"{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
 					"]}" +
-				"], operation=repetition, @min=0, @max=100 }" ;
+				"], operation=operation:repetition, min=0, max=100 }" ;
 		ppt = new PoliqarpPlusTree("([base=bar][base=foo])*");
 		map = ppt.getRequestMap().get("query").toString();
 		assertEquals(occ4.replaceAll(" ", ""), map.replaceAll(" ", ""));
 		
 		// <s>([base=bar][base=foo])*
 		String occ5 = 
-				"{type=group, operation=sequence, operands=[" +
-					"{type=span, key=s}," +
-					"{type=group, operands=[" +	
-						"{type=group, operation=sequence, operands=[" +
-							"{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," +
-							"{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
+				"{@type=korap:group, operation=operation:sequence, operands=[" +
+					"{@type=korap:span, key=s}," +
+					"{@type=korap:group, operands=[" +	
+						"{@type=korap:group, operation=operation:sequence, operands=[" +
+							"{@type=korap:token, wrap={@type=korap:term, key=bar, layer=lemma, match=eq}}," +
+							"{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
 						"]}" +
-					"], operation=repetition, @min=0, @max=100 }" +
+					"], operation=operation:repetition, min=0, max=100 }" +
 				"]}" ;
 		ppt = new PoliqarpPlusTree("<s>([base=bar][base=foo])*");
 		map = ppt.getRequestMap().get("query").toString();
@@ -236,15 +251,15 @@
 		
 		// <s><np>([base=bar][base=foo])*
 		String occ6 = 
-				"{type=group, operation=sequence, operands=[" +
-					"{type=span, key=s}," +
-					"{type=span, key=np}," +
-					"{type=group, operands=[" +	
-						"{type=group, operation=sequence, operands=[" +
-							"{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," +
-							"{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
+				"{@type=korap:group, operation=operation:sequence, operands=[" +
+					"{@type=korap:span, key=s}," +
+					"{@type=korap:span, key=np}," +
+					"{@type=korap:group, operands=[" +	
+						"{@type=korap:group, operation=operation:sequence, operands=[" +
+							"{@type=korap:token, wrap={@type=korap:term, key=bar, layer=lemma, match=eq}}," +
+							"{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
 						"]}" +
-					"], operation=repetition, @min=0, @max=100 }" +
+					"], operation=operation:repetition, min=0, max=100 }" +
 				"]}" ;
 		ppt = new PoliqarpPlusTree("<s><np>([base=bar][base=foo])*");
 		map = ppt.getRequestMap().get("query").toString();
@@ -254,16 +269,16 @@
 		// comment: embedded sequence shouldn't really be here, but does not really hurt, either. (?)
 		// really hard to get this behaviour out of the PQPlus grammar...
 		String occ7 = 
-				"{type=group, operation=sequence, operands=[" +
-					"{type=span, key=s}," +
-					"{type=span, key=np}," +
-					"{type=group, operands=[" +	
-						"{type=group, operation=sequence, operands=[" +
-							"{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," +
-							"{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
+				"{@type=korap:group, operation=operation:sequence, operands=[" +
+					"{@type=korap:span, key=s}," +
+					"{@type=korap:span, key=np}," +
+					"{@type=korap:group, operands=[" +	
+						"{@type=korap:group, operation=operation:sequence, operands=[" +
+							"{@type=korap:token, wrap={@type=korap:term, key=bar, layer=lemma, match=eq}}," +
+							"{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
 						"]}" +
-					"], operation=repetition, @min=0, @max=100 }," +
-					"{type=token, key={type=term, key=NN, layer=p, match=eq}}" +
+					"], operation=operation:repetition, min=0, max=100 }," +
+					"{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, match=eq}}" +
 				"]}" ;
 		ppt = new PoliqarpPlusTree("<s><np>([base=bar][base=foo])*[p=NN]");
 		map = ppt.getRequestMap().get("query").toString();
@@ -271,39 +286,39 @@
 		
 		// ([base=bar][base=foo])*[p=NN]
 		String occ8 = 
-				"{type=group, operation=sequence, operands=[" +
-					"{type=group, operands=[" +	
-						"{type=group, operation=sequence, operands=[" +
-							"{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," +
-							"{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
+				"{@type=korap:group, operation=operation:sequence, operands=[" +
+					"{@type=korap:group, operands=[" +	
+						"{@type=korap:group, operation=operation:sequence, operands=[" +
+							"{@type=korap:token, wrap={@type=korap:term, key=bar, layer=lemma, match=eq}}," +
+							"{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
 						"]}" +
-					"], operation=repetition, @min=0, @max=100 }," +
-					"{type=token, key={type=term, key=NN, layer=p, match=eq}}" +
+					"], operation=operation:repetition, min=0, max=100 }," +
+					"{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, match=eq}}" +
 				"]}" ;
 		ppt = new PoliqarpPlusTree("([base=bar][base=foo])*[p=NN]");
 		map = ppt.getRequestMap().get("query").toString();
 		assertEquals(occ8.replaceAll(" ", ""), map.replaceAll(" ", ""));
 		
 		// [base=foo]+
-		String occ9 = "{type=group, operands=[" +
-					     "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
-					  "], operation=repetition, @min=1, @max=100}"; 
+		String occ9 = "{@type=korap:group, operands=[" +
+					     "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
+					  "], operation=operation:repetition, min=1, max=100}"; 
 		ppt = new PoliqarpPlusTree("[base=foo]+");
 		map = ppt.getRequestMap().get("query").toString();
 		assertEquals(occ9.replaceAll(" ", ""), map.replaceAll(" ", ""));
 		
 		// [base=foo]?
-		String occ10 = "{type=group, operands=[" +
-					     "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
-					  "], operation=repetition, @min=0, @max=1}"; 
+		String occ10 = "{@type=korap:group, operands=[" +
+					     "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
+					  "], operation=operation:repetition, min=0, max=1}"; 
 		ppt = new PoliqarpPlusTree("[base=foo]?");
 		map = ppt.getRequestMap().get("query").toString();
 		assertEquals(occ10.replaceAll(" ", ""), map.replaceAll(" ", ""));
 		
 		// [base=foo]{2,5}
-		String occ11 = "{type=group, operands=[" +
-					     "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
-					  "], operation=repetition, @min=2, @max=5}"; 
+		String occ11 = "{@type=korap:group, operands=[" +
+					     "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
+					  "], operation=operation:repetition, min=2, max=5}"; 
 		ppt = new PoliqarpPlusTree("[base=foo]{2,5}");
 		map = ppt.getRequestMap().get("query").toString();
 		assertEquals(occ11.replaceAll(" ", ""), map.replaceAll(" ", ""));
@@ -312,17 +327,17 @@
 	@Test
 	public void testTokenSequence() throws QueryException {
 		// [base=Mann][orth=Frau]
-		String seq1 = "{type=group, operation=sequence, operands=[" +
-				"{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}, " +
-				"{type=token, key={type=term, key=Frau, layer=orth, match=eq}}" +
+		String seq1 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+				"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}, " +
+				"{@type=korap:token, wrap={@type=korap:term, key=Frau, layer=orth, match=eq}}" +
 				"]}";
 		assertTrue(equalsQueryContent(seq1, "[base=Mann][orth=Frau]"));
 		
 		// [base=Mann][orth=Frau][p=NN]
-		String seq2 = "{type=group, operation=sequence, operands=[" +
-				"{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}, " +
-				"{type=token, key={type=term, key=Frau, layer=orth, match=eq}}, " +
-				"{type=token, key={type=term, key=NN,layer=p, match=eq}}" +
+		String seq2 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+				"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}, " +
+				"{@type=korap:token, wrap={@type=korap:term, key=Frau, layer=orth, match=eq}}, " +
+				"{@type=korap:token, wrap={@type=korap:term, key=NN,layer=p, match=eq}}" +
 				"]}";
 		assertTrue(equalsQueryContent(seq2, "[base=Mann][orth=Frau][p=NN]"));
 	}
@@ -331,12 +346,12 @@
 	public void testDisjSegments() throws QueryException {
 		// ([base=der]|[base=das])[base=Schild]
 		String disj1 = 
-				"{type=group, operation=sequence, operands=[" +
-					"{type=group, operation=or, operands=[" +
-						"{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
-						"{type=token, key={type=term, key=das, layer=lemma, match=eq}}" +
+				"{@type=korap:group, operation=operation:sequence, operands=[" +
+					"{@type=korap:group, operation=operation:or, operands=[" +
+						"{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+						"{@type=korap:token, wrap={@type=korap:term, key=das, layer=lemma, match=eq}}" +
 					"]}," +
-					"{type=token, key={type=term, key=Schild, layer=lemma, match=eq}}" +
+					"{@type=korap:token, wrap={@type=korap:term, key=Schild, layer=lemma, match=eq}}" +
 				"]}";
 		ppt = new PoliqarpPlusTree("([base=der]|[base=das])[base=Schild]");
 		map = ppt.getRequestMap().get("query").toString();
@@ -344,11 +359,11 @@
 		
 		// [base=Schild]([base=der]|[base=das])
 		String disj2 = 
-				"{type=group, operation=sequence, operands=[" +
-					"{type=token, key={type=term, key=Schild, layer=lemma, match=eq}}," +
-					"{type=group, operation=or, operands=[" +
-						"{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
-						"{type=token, key={type=term, key=das, layer=lemma, match=eq}}" +
+				"{@type=korap:group, operation=operation:sequence, operands=[" +
+					"{@type=korap:token, wrap={@type=korap:term, key=Schild, layer=lemma, match=eq}}," +
+					"{@type=korap:group, operation=operation:or, operands=[" +
+						"{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+						"{@type=korap:token, wrap={@type=korap:term, key=das, layer=lemma, match=eq}}" +
 					"]}" +
 				"]}";
 		ppt = new PoliqarpPlusTree("[base=Schild]([base=der]|[base=das])");
@@ -359,24 +374,24 @@
 	@Test
 	public void testTokenElemSequence() throws QueryException {
 		// [base=Mann]<vp>
-		String seq1 = "{type=group, operation=sequence, operands=[" +
-				"{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}, " +
-				"{type=span, key=vp}" +
+		String seq1 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+				"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}, " +
+				"{@type=korap:span, key=vp}" +
 				"]}";
 		assertTrue(equalsQueryContent(seq1, "[base=Mann]<vp>"));
 		
 		// <vp>[base=Mann]
-		String seq2 = "{type=group, operation=sequence, operands=[" +
-				"{type=span, key=vp}, "+
-				"{type=token, key={type=term, key=Mann, layer=lemma, match=eq}} " +
+		String seq2 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+				"{@type=korap:span, key=vp}, "+
+				"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}} " +
 				"]}";
 		assertTrue(equalsQueryContent(seq2, "<vp>[base=Mann]"));
 		
 		// <vp>[base=Mann]<pp>
-		String seq3 = "{type=group, operation=sequence, operands=[" +
-				"{type=span, key=vp}, "+
-				"{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}, " +
-				"{type=span, key=pp} "+
+		String seq3 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+				"{@type=korap:span, key=vp}, "+
+				"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}, " +
+				"{@type=korap:span, key=pp} "+
 				"]}";
 		assertTrue(equalsQueryContent(seq3, "<vp>[base=Mann]<pp>"));
 	}
@@ -384,17 +399,17 @@
 	@Test
 	public void testElemSequence() throws QueryException {
 		// <np><vp>
-		String seq1 = "{type=group, operation=sequence, operands=[" +
-				"{type=span, key=np}," +
-				"{type=span, key=vp}" +
+		String seq1 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+				"{@type=korap:span, key=np}," +
+				"{@type=korap:span, key=vp}" +
 				"]}";
 		assertTrue(equalsQueryContent(seq1, "<np><vp>"));
 		
 		// <np><vp><pp>
-		String seq2 = "{type=group, operation=sequence, operands=[" +
-				"{type=span, key=np}," +
-				"{type=span, key=vp}," +
-				"{type=span, key=pp}" +
+		String seq2 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+				"{@type=korap:span, key=np}," +
+				"{@type=korap:span, key=vp}," +
+				"{@type=korap:span, key=pp}" +
 				"]}";
 		assertTrue(equalsQueryContent(seq2, "<np><vp><pp>"));
 	}
@@ -402,55 +417,55 @@
 	@Test 
 	public void testClasses() throws QueryException {
 		// {[base=Mann]}
-		String cls1 = "{type=group, operation=class, class=0, operands=[" +
-				"{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" +
+		String cls1 = "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+				"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}" +
 				"]}";
 		ppt = new PoliqarpPlusTree("{[base=Mann]}");
 		map = ppt.getRequestMap().get("query").toString();
 		assertEquals(cls1.replaceAll(" ", ""), map.replaceAll(" ", ""));
 		
 		// {[base=Mann][orth=Frau]}
-		String cls2 = "{type=group, operation=class, class=0, operands=[" +
-				 "{type=group, operation=sequence, operands=[" +
-				  "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}," +
-				  "{type=token, key={type=term, key=Frau, layer=orth, match=eq}}" +
+		String cls2 = "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+				 "{@type=korap:group, operation=operation:sequence, operands=[" +
+				  "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}," +
+				  "{@type=korap:token, wrap={@type=korap:term, key=Frau, layer=orth, match=eq}}" +
 				 "]}" +
 				"]}";
 		assertTrue(equalsQueryContent(cls2, "{[base=Mann][orth=Frau]}"));
 		
 		// [p=NN]{[base=Mann][orth=Frau]}
-		String cls3 = "{type=group, operation=sequence, operands=[" +
-						"{type=token, key={type=term, key=NN, layer=p, match=eq}}," +
-						"{type=group, operation=class, class=0, operands=[" +
-							"{type=group, operation=sequence, operands=[" +
-								"{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}," +
-								"{type=token, key={type=term, key=Frau, layer=orth, match=eq}}" +
+		String cls3 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+						"{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, match=eq}}," +
+						"{@type=korap:group, operation=operation:class, class=0, operands=[" +
+							"{@type=korap:group, operation=operation:sequence, operands=[" +
+								"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}," +
+								"{@type=korap:token, wrap={@type=korap:term, key=Frau, layer=orth, match=eq}}" +
 							"]}" +
 						"]}" +
 					  "]}";
 		assertTrue(equalsQueryContent(cls3, "[p=NN]{[base=Mann][orth=Frau]}"));
 		
 		// {[base=Mann][orth=Frau]}[p=NN]
-		String cls4 = "{type=group, operation=sequence, operands=[" +
-						"{type=group, operation=class, class=0, operands=[" +
-						   "{type=group, operation=sequence, operands=[" +
-						     "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}," +
-						     "{type=token, key={type=term, key=Frau, layer=orth, match=eq}}" +
+		String cls4 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+						"{@type=korap:group, operation=operation:class, class=0, operands=[" +
+						   "{@type=korap:group, operation=operation:sequence, operands=[" +
+						     "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}," +
+						     "{@type=korap:token, wrap={@type=korap:term, key=Frau, layer=orth, match=eq}}" +
 						   "]}" +
 						"]}," +
-						"{type=token, key={type=term, key=NN, layer=p, match=eq}}" +
+						"{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, match=eq}}" +
 					  "]}";
 		ppt = new PoliqarpPlusTree("{[base=Mann][orth=Frau]}[p=NN]");
 		map = ppt.getRequestMap().get("query").toString();
 		assertEquals(cls4.replaceAll(" ", ""), map.replaceAll(" ", ""));
 
 		// {2:{1:[tt/p=ADJA]}[mate/p=NN]}"
-		String cls5 = "{type=group, operation=class, class=2, operands=[" +
-						"{type=group, operation=sequence, operands=[" +
-						   "{type=group, operation=class, class=1, operands=[" +
-						     "{type=token, key={type=term, key=ADJA, layer=p, foundry=tt, match=eq}}" +
+		String cls5 = "{@type=korap:group, operation=operation:class, class=2, operands=[" +
+						"{@type=korap:group, operation=operation:sequence, operands=[" +
+						   "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+						     "{@type=korap:token, wrap={@type=korap:term, key=ADJA, layer=p, foundry=tt, match=eq}}" +
 						   "]}," +
-						   "{type=token, key={type=term, key=NN, layer=p, foundry=mate, match=eq}}" + 
+						   "{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, foundry=mate, match=eq}}" + 
 						"]}" +
 					  "]}";
 		ppt = new PoliqarpPlusTree("{2: {1:[tt/p=ADJA]}[mate/p=NN]}");
@@ -461,25 +476,25 @@
 	@Test
 	public void testPositions() throws QueryException {
 		// contains(<s>,<np>)
-		String pos1 = "{type=group, operation=position, frame=contains, operands=[" +
-				  "{type=span, key=s}," +
-				  "{type=span, key=np}" +
+		String pos1 = "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+				  "{@type=korap:span, key=s}," +
+				  "{@type=korap:span, key=np}" +
 				"]}";
 		assertTrue(equalsQueryContent(pos1, "contains(<s>,<np>)"));
 		
 		// contains(<s>,[base=Mann])
-		String pos2 = "{type=group, operation=position, frame=contains, operands=[" +
-				  "{type=span, key=s}," +
-				  "{type=token, key= {type=term, key=Mann, layer=lemma, match=eq}}" +
+		String pos2 = "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+				  "{@type=korap:span, key=s}," +
+				  "{@type=korap:token, wrap= {@type=korap:term, key=Mann, layer=lemma, match=eq}}" +
 				"]}";
 		assertTrue(equalsQueryContent(pos2, "contains(<s>,[base=Mann])"));
 		
 		// contains(<s>,[orth=der][orth=Mann])
-		String pos3 = "{type=group, operation=position, frame=contains, operands=[" +
-				  	"{type=span, key=s}," +
-				  	"{type=group, operation=sequence, operands=[" +
-				  		"{type=token, key={type=term, key=der, layer=orth, match=eq}}," +
-				  		"{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" +
+		String pos3 = "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+				  	"{@type=korap:span, key=s}," +
+				  	"{@type=korap:group, operation=operation:sequence, operands=[" +
+				  		"{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=eq}}," +
+				  		"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}" +
 				  	"]}" +
 				  "]}";
 		ppt = new PoliqarpPlusTree("contains(<s>,[orth=der][orth=Mann])");
@@ -488,11 +503,11 @@
 		
 		// [base=Auto]contains(<s>,[base=Mann])
 		String pos4 = 
-				"{type=group, operation=sequence, operands=[" +
-					"{type=token, key={type=term, key=Auto, layer=lemma, match=eq}}," +
-					"{type=group, operation=position, frame=contains, operands=[" +
-				  		"{type=span, key=s}," +
-				  		"{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" +
+				"{@type=korap:group, operation=operation:sequence, operands=[" +
+					"{@type=korap:token, wrap={@type=korap:term, key=Auto, layer=lemma, match=eq}}," +
+					"{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+				  		"{@type=korap:span, key=s}," +
+				  		"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}" +
 				  	"]}" +
 				"]}";
 		ppt = new PoliqarpPlusTree("[base=Auto]contains(<s>,[base=Mann])");
@@ -504,11 +519,11 @@
 	public void testNestedPositions() throws QueryException {
 		// contains(<s>,startswith(<np>,[orth=Der]))
 		String npos1 = 
-			"{type=group, operation=position, frame=contains, operands=[" +
-				"{type=span, key=s}," +
-				"{type=group, operation=position, frame=startswith, operands=[" +
-					"{type=span, key=np}," +
-					"{type=token, key={type=term, key=Der, layer=orth, match=eq}}" +
+			"{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+				"{@type=korap:span, key=s}," +
+				"{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
+					"{@type=korap:span, key=np}," +
+					"{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=eq}}" +
 				"]}" +
 			"]}";
 		ppt = new PoliqarpPlusTree("contains(<s>, startswith(<np>,[orth=Der]))");
@@ -520,11 +535,11 @@
 	public void testShrinkSplit() throws QueryException {
 		// shrink([orth=Der]{[orth=Mann]})
 		String shr1 = 
-			"{type=group, operation=submatch, classRef=[0], operands=[" +
-				"{type=group, operation=sequence, operands=[" +
-					"{type=token, key={type=term, key=Der, layer=orth, match=eq}}," +
-					"{type=group, operation=class, class=0, operands=[" +
-						"{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" +
+			"{@type=korap:group, operation=operation:submatch, classRef=[0], operands=[" +
+				"{@type=korap:group, operation=operation:sequence, operands=[" +
+					"{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=eq}}," +
+					"{@type=korap:group, operation=operation:class, class=0, operands=[" +
+						"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}" +
 					"]}" +
 				"]}" +
 			"]}";
@@ -534,13 +549,13 @@
 		
 		// shrink([orth=Der]{[orth=Mann][orth=geht]})
 		String shr2 = 
-			"{type=group, operation=submatch, classRef=[0], operands=[" +
-				"{type=group, operation=sequence, operands=[" +
-					"{type=token, key={type=term, key=Der, layer=orth, match=eq}}," +
-					"{type=group, operation=class, class=0, operands=[" +
-						"{type=group, operation=sequence, operands=[" +
-							"{type=token, key={type=term, key=Mann, layer=orth, match=eq}}," +
-							"{type=token, key={type=term, key=geht, layer=orth, match=eq}}" +
+			"{@type=korap:group, operation=operation:submatch, classRef=[0], operands=[" +
+				"{@type=korap:group, operation=operation:sequence, operands=[" +
+					"{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=eq}}," +
+					"{@type=korap:group, operation=operation:class, class=0, operands=[" +
+						"{@type=korap:group, operation=operation:sequence, operands=[" +
+							"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}," +
+							"{@type=korap:token, wrap={@type=korap:term, key=geht, layer=orth, match=eq}}" +
 						"]}" +
 					"]}" +
 				"]}" +
@@ -551,13 +566,13 @@
 		
 		// shrink(1:[orth=Der]{1:[orth=Mann][orth=geht]})
 		String shr3 = 
-			"{type=group, operation=submatch, classRef=[1], operands=[" +
-				"{type=group, operation=sequence, operands=[" +
-					"{type=token, key={type=term, key=Der, layer=orth, match=eq}}," +
-					"{type=group, operation=class, class=1, operands=[" +
-						"{type=group, operation=sequence, operands=[" +
-							"{type=token, key={type=term, key=Mann, layer=orth, match=eq}}," +
-							"{type=token, key={type=term, key=geht, layer=orth, match=eq}}" +
+			"{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
+				"{@type=korap:group, operation=operation:sequence, operands=[" +
+					"{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=eq}}," +
+					"{@type=korap:group, operation=operation:class, class=1, operands=[" +
+						"{@type=korap:group, operation=operation:sequence, operands=[" +
+							"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}," +
+							"{@type=korap:token, wrap={@type=korap:term, key=geht, layer=orth, match=eq}}" +
 						"]}" +
 					"]}" +
 				"]}" +
@@ -568,11 +583,11 @@
 		
 		// shrink(1:startswith(<s>,{1:<np>}))
 		String shr4 = 
-			"{type=group, operation=submatch, classRef=[1], operands=[" +
-				"{type=group, operation=position, frame=startswith, operands=[" +
-					"{type=span, key=s}," +
-					"{type=group, operation=class, class=1, operands=[" +
-						"{type=span, key=np}" +
+			"{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
+				"{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
+					"{@type=korap:span, key=s}," +
+					"{@type=korap:group, operation=operation:class, class=1, operands=[" +
+						"{@type=korap:span, key=np}" +
 					"]}" +
 				"]}" +
 			"]}";
@@ -582,17 +597,17 @@
 		
 		// shrink(3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}})) 
 		String shr5 = 
-			"{type=group, operation=submatch, classRef=[3], operands=[" +
-				"{type=group, operation=position, frame=startswith, operands=[" +
-					"{type=span, key=s}," +
-					"{type=group, operation=class, class=3, operands=[" +
-						"{type=group, operation=sequence, operands=[" +
-							"{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
-							"{type=group, operation=class, class=1, operands=[" +
-								"{type=group, operation=sequence, operands=[" +
-									"{type=token, key={type=term, key=ADJA, layer=p, foundry=mate, match=eq}}," +
-									"{type=group, operation=class, class=2, operands=[" +
-										"{type=token, key={type=term, key=NN, layer=p, foundry=tt, match=eq}}" +
+			"{@type=korap:group, operation=operation:submatch, classRef=[3], operands=[" +
+				"{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
+					"{@type=korap:span, key=s}," +
+					"{@type=korap:group, operation=operation:class, class=3, operands=[" +
+						"{@type=korap:group, operation=operation:sequence, operands=[" +
+							"{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+							"{@type=korap:group, operation=operation:class, class=1, operands=[" +
+								"{@type=korap:group, operation=operation:sequence, operands=[" +
+									"{@type=korap:token, wrap={@type=korap:term, key=ADJA, layer=p, foundry=mate, match=eq}}," +
+									"{@type=korap:group, operation=operation:class, class=2, operands=[" +
+										"{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, foundry=tt, match=eq}}" +
 									"]}" + 
 								"]}" +
 							"]}" +
@@ -606,17 +621,17 @@
 		
 		// split(3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}})) 
 		String shr6 = 
-			"{type=group, operation=split, classRef=[3], operands=[" +
-				"{type=group, operation=position, frame=startswith, operands=[" +
-					"{type=span, key=s}," +
-					"{type=group, operation=class, class=3, operands=[" +
-						"{type=group, operation=sequence, operands=[" +
-							"{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
-							"{type=group, operation=class, class=1, operands=[" +
-								"{type=group, operation=sequence, operands=[" +
-									"{type=token, key={type=term, key=ADJA, layer=p, foundry=mate, match=eq}}," +
-									"{type=group, operation=class, class=2, operands=[" +
-										"{type=token, key={type=term, key=NN, layer=p, foundry=tt, match=eq}}" +
+			"{@type=korap:group, operation=operation:split, classRef=[3], operands=[" +
+				"{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
+					"{@type=korap:span, key=s}," +
+					"{@type=korap:group, operation=operation:class, class=3, operands=[" +
+						"{@type=korap:group, operation=operation:sequence, operands=[" +
+							"{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+							"{@type=korap:group, operation=operation:class, class=1, operands=[" +
+								"{@type=korap:group, operation=operation:sequence, operands=[" +
+									"{@type=korap:token, wrap={@type=korap:term, key=ADJA, layer=p, foundry=mate, match=eq}}," +
+									"{@type=korap:group, operation=operation:class, class=2, operands=[" +
+										"{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, foundry=tt, match=eq}}" +
 									"]}" + 
 								"]}" +
 							"]}" +
@@ -630,17 +645,17 @@
 		
 		// split(2|3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}})) 
 		String shr7 = 
-			"{type=group, operation=split, classRef=[2, 3], classRefOp=intersection, operands=[" +
-				"{type=group, operation=position, frame=startswith, operands=[" +
-					"{type=span, key=s}," +
-					"{type=group, operation=class, class=3, operands=[" +
-						"{type=group, operation=sequence, operands=[" +
-							"{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
-							"{type=group, operation=class, class=1, operands=[" +
-								"{type=group, operation=sequence, operands=[" +
-									"{type=token, key={type=term, key=ADJA, layer=p, foundry=mate, match=eq}}," +
-									"{type=group, operation=class, class=2, operands=[" +
-										"{type=token, key={type=term, key=NN, layer=p, foundry=tt, match=eq}}" +
+			"{@type=korap:group, operation=operation:split, classRef=[2, 3], classRefOp=classRefOp:intersection, operands=[" +
+				"{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
+					"{@type=korap:span, key=s}," +
+					"{@type=korap:group, operation=operation:class, class=3, operands=[" +
+						"{@type=korap:group, operation=operation:sequence, operands=[" +
+							"{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+							"{@type=korap:group, operation=operation:class, class=1, operands=[" +
+								"{@type=korap:group, operation=operation:sequence, operands=[" +
+									"{@type=korap:token, wrap={@type=korap:term, key=ADJA, layer=p, foundry=mate, match=eq}}," +
+									"{@type=korap:group, operation=operation:class, class=2, operands=[" +
+										"{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, foundry=tt, match=eq}}" +
 									"]}" + 
 								"]}" +
 							"]}" +
@@ -657,7 +672,7 @@
 	@Test
 	public void testFoundries() throws QueryException {
 		// [tt/base=Mann]
-		String layer1 = "{type=token, key={type=term, key=Mann, layer=base, foundry=tt, match=eq}}";
+		String layer1 = "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=base, foundry=tt, match=eq}}";
 		ppt = new PoliqarpPlusTree("[tt/base=Mann]");
 		map = ppt.getRequestMap().get("query").toString();
 		assertEquals(layer1.replaceAll(" ", ""), map.replaceAll(" ", ""));
@@ -668,10 +683,10 @@
 	public void testAlign() throws QueryException {
 		// [orth=der]^[orth=Mann]
 		String align1 = 
-				"{type=group, operation=sequence, operands=[" +
-					"{type=token, key={type=term, key=der, layer=orth, match=eq}}," +
-					"{type=group, alignment=left, operands=[" +
-						"{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" +
+				"{@type=korap:group, operation=operation:sequence, operands=[" +
+					"{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=eq}}," +
+					"{@type=korap:group, alignment=left, operands=[" +
+						"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}" +
 					"]}" +
 				"]}";
 		ppt = new PoliqarpPlusTree("[orth=der]^[orth=Mann]");
@@ -681,12 +696,12 @@
 		// [orth=der]^[orth=große][orth=Mann]
 		String query = "[orth=der]^[orth=große][orth=Mann]";
 		String align1b = 
-				"{type=group, operation=sequence, operands=[" +
-					"{type=token, key={type=term, key=der, layer=orth, match=eq}}," +
-					"{type=group, alignment=left, operands=[" +
-						"{type=group, operation=sequence, operands=[" +
-							"{type=token, key={type=term, key=große, layer=orth, match=eq}}," +
-							"{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" +
+				"{@type=korap:group, operation=operation:sequence, operands=[" +
+					"{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=eq}}," +
+					"{@type=korap:group, alignment=left, operands=[" +
+						"{@type=korap:group, operation=operation:sequence, operands=[" +
+							"{@type=korap:token, wrap={@type=korap:term, key=große, layer=orth, match=eq}}," +
+							"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}" +
 						"]}" +
 					"]}" +
 				"]}";
@@ -696,14 +711,14 @@
 		
 		// "([base=a]^[base=b])|[base=c]",
 		String align2 = 
-				"{type=group, operation=or, operands=[" +
-						"{type=group, operation=sequence, operands=[" +
-							"{type=token, key={type=term, key=a, layer=lemma, match=eq}}," +
-							"{type=group, alignment=left, operands=[" +
-								"{type=token, key={type=term, key=b, layer=lemma, match=eq}}" +
+				"{@type=korap:group, operation=operation:or, operands=[" +
+						"{@type=korap:group, operation=operation:sequence, operands=[" +
+							"{@type=korap:token, wrap={@type=korap:term, key=a, layer=lemma, match=eq}}," +
+							"{@type=korap:group, alignment=left, operands=[" +
+								"{@type=korap:token, wrap={@type=korap:term, key=b, layer=lemma, match=eq}}" +
 							"]}" +
 						"]}," +
-						"{type=token, key={type=term, key=c, layer=lemma, match=eq}}" +
+						"{@type=korap:token, wrap={@type=korap:term, key=c, layer=lemma, match=eq}}" +
 				"]}";
 		ppt = new PoliqarpPlusTree("([base=a]^[base=b])|[base=c]");
 		map = ppt.getRequestMap().get("query").toString();
@@ -711,17 +726,17 @@
 		
 		// "([base=a]^[base=b][base=c])|[base=d]",
 		String align3 = 
-				"{type=group, operation=or, operands=[" +
-						"{type=group, operation=sequence, operands=[" +
-							"{type=token, key={type=term, key=a, layer=lemma, match=eq}}," +
-							"{type=group, alignment=left, operands=[" +
-								"{type=group, operation=sequence, operands=[" +
-									"{type=token, key={type=term, key=b, layer=lemma, match=eq}}," +
-									"{type=token, key={type=term, key=c, layer=lemma, match=eq}}" +
+				"{@type=korap:group, operation=operation:or, operands=[" +
+						"{@type=korap:group, operation=operation:sequence, operands=[" +
+							"{@type=korap:token, wrap={@type=korap:term, key=a, layer=lemma, match=eq}}," +
+							"{@type=korap:group, alignment=left, operands=[" +
+								"{@type=korap:group, operation=operation:sequence, operands=[" +
+									"{@type=korap:token, wrap={@type=korap:term, key=b, layer=lemma, match=eq}}," +
+									"{@type=korap:token, wrap={@type=korap:term, key=c, layer=lemma, match=eq}}" +
 								"]}" +
 							"]}" +
 						"]}," +
-						"{type=token, key={type=term, key=d, layer=lemma, match=eq}}" +
+						"{@type=korap:token, wrap={@type=korap:term, key=d, layer=lemma, match=eq}}" +
 				"]}";
 		ppt = new PoliqarpPlusTree("([base=a]^[base=b][base=c])|[base=d]");
 		map = ppt.getRequestMap().get("query").toString();
@@ -729,19 +744,19 @@
 		
 		// "([base=a]^[base=b]^[base=c])|[base=d]",
 		String align4 = 
-				"{type=group, operation=or, operands=[" +
-						"{type=group, operation=sequence, operands=[" +
-							"{type=token, key={type=term, key=a, layer=lemma, match=eq}}," +
-							"{type=group, alignment=left, operands=[" +
-								"{type=group, operation=sequence, operands=[" +
-									"{type=token, key={type=term, key=b, layer=lemma, match=eq}}," +
-									"{type=group, alignment=left, operands=[" +
-										"{type=token, key={type=term, key=c, layer=lemma, match=eq}}" +
+				"{@type=korap:group, operation=operation:or, operands=[" +
+						"{@type=korap:group, operation=operation:sequence, operands=[" +
+							"{@type=korap:token, wrap={@type=korap:term, key=a, layer=lemma, match=eq}}," +
+							"{@type=korap:group, alignment=left, operands=[" +
+								"{@type=korap:group, operation=operation:sequence, operands=[" +
+									"{@type=korap:token, wrap={@type=korap:term, key=b, layer=lemma, match=eq}}," +
+									"{@type=korap:group, alignment=left, operands=[" +
+										"{@type=korap:token, wrap={@type=korap:term, key=c, layer=lemma, match=eq}}" +
 									"]}" +
 								"]}" +
 							"]}" +
 						"]}," +
-						"{type=token, key={type=term, key=d, layer=lemma, match=eq}}" +
+						"{@type=korap:token, wrap={@type=korap:term, key=d, layer=lemma, match=eq}}" +
 				"]}";
 		ppt = new PoliqarpPlusTree("([base=a]^[base=b]^[base=c])|[base=d]");
 		map = ppt.getRequestMap().get("query").toString();
@@ -754,16 +769,16 @@
 	public void testSimpleQueries() throws QueryException {
 		// Baum
 		String simple1 = 
-				"{type=token, key={type=term, key=Baum, layer=orth, match=eq}}";
+				"{@type=korap:token, wrap={@type=korap:term, key=Baum, layer=orth, match=eq}}";
 		ppt = new PoliqarpPlusTree("Baum");
 		map = ppt.getRequestMap().get("query").toString();
 		assertEquals(simple1.replaceAll(" ", ""), map.replaceAll(" ", ""));
 		
 		// Der Baum
 		String simple2 = 
-				"{type=group, operation=sequence, operands=[" +
-					"{type=token, key={type=term, key=Der, layer=orth, match=eq}}, " +
-					"{type=token, key={type=term, key=Baum, layer=orth, match=eq}}" +
+				"{@type=korap:group, operation=operation:sequence, operands=[" +
+					"{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=eq}}, " +
+					"{@type=korap:token, wrap={@type=korap:term, key=Baum, layer=orth, match=eq}}" +
 				"]}";
 		ppt = new PoliqarpPlusTree("Der Baum");
 		map = ppt.getRequestMap().get("query").toString();
@@ -771,10 +786,10 @@
 		
 		// Der große Baum
 		String simple3 = 
-				"{type=group, operation=sequence, operands=[" +
-					"{type=token, key={type=term, key=Der, layer=orth, match=eq}}, " +
-					"{type=token, key={type=term, key=große, layer=orth, match=eq}}, " +						
-					"{type=token, key={type=term, key=Baum, layer=orth, match=eq}}" +
+				"{@type=korap:group, operation=operation:sequence, operands=[" +
+					"{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=eq}}, " +
+					"{@type=korap:token, wrap={@type=korap:term, key=große, layer=orth, match=eq}}, " +						
+					"{@type=korap:token, wrap={@type=korap:term, key=Baum, layer=orth, match=eq}}" +
 				"]}";
 		ppt = new PoliqarpPlusTree("Der große Baum");
 		map = ppt.getRequestMap().get("query").toString();
@@ -782,9 +797,9 @@
 		
 		// Baum | Stein
 		String simple4 = 
-				"{type=group, operation=or, operands=[" +
-					"{type=token, key={type=term, key=Baum, layer=orth, match=eq}}, " +						
-					"{type=token, key={type=term, key=Stein, layer=orth, match=eq}}" +
+				"{@type=korap:group, operation=operation:or, operands=[" +
+					"{@type=korap:token, wrap={@type=korap:term, key=Baum, layer=orth, match=eq}}, " +						
+					"{@type=korap:token, wrap={@type=korap:term, key=Stein, layer=orth, match=eq}}" +
 				"]}";
 		ppt = new PoliqarpPlusTree("Baum | Stein");
 		map = ppt.getRequestMap().get("query").toString();
@@ -793,12 +808,12 @@
 		// Baum | Stein Haus
 		String query = "(Baum | Stein) Haus";
 		String simple5 = 
-				"{type=group, operation=sequence, operands=[" +
-					"{type=group, operation=or, operands=[" +
-						"{type=token, key={type=term, key=Baum, layer=orth, match=eq}}, " +						
-						"{type=token, key={type=term, key=Stein, layer=orth, match=eq}}" +
+				"{@type=korap:group, operation=operation:sequence, operands=[" +
+					"{@type=korap:group, operation=operation:or, operands=[" +
+						"{@type=korap:token, wrap={@type=korap:term, key=Baum, layer=orth, match=eq}}, " +						
+						"{@type=korap:token, wrap={@type=korap:term, key=Stein, layer=orth, match=eq}}" +
 					"]}," +
-					"{type=token, key={type=term, key=Haus, layer=orth, match=eq}} " +			
+					"{@type=korap:token, wrap={@type=korap:term, key=Haus, layer=orth, match=eq}} " +			
 				"]}";
 		ppt = new PoliqarpPlusTree(query);
 		map = ppt.getRequestMap().get("query").toString();