Cosmas positions, include frame for deprecation path
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 31a2ca5..ec93a84 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
@@ -153,34 +153,34 @@
 		group.put("operands", new ArrayList<Object>());
 		// DEPRECATED 'frame'
 		String frame = "";
-		if (allowedFrames.length==0 && sharedClasses[0]=="includes") {
-			frame = "contains";
-		} else if (allowedFrames.length==0 && sharedClasses[0]=="intersects") {
-			frame = "overlaps";
-		} else if (allowedFrames[0]=="startswith" && sharedClasses[0]=="includes") {
-			frame = "startswith";
-		} else if (allowedFrames[0]=="endswith" && sharedClasses[0]=="includes") {
-			frame = "endswith";
-		} else if (allowedFrames[0]=="matches" && sharedClasses[0]=="includes" && sharedClasses.length==1) {
-			frame = "endswith";
-		} else if (allowedFrames[0]=="matches" && sharedClasses[0]=="includes" && sharedClasses[1]=="unequals") {
-			frame = "matches";
-		} else if (allowedFrames[0]=="matches" && sharedClasses[0]=="equals") {
-			frame = "matches";			
-		} else if (allowedFrames[0]=="contains" && sharedClasses[0]=="includes") {
-			frame = "contains";
-		} else if (allowedFrames[0]=="startswith" && sharedClasses[0]=="intersects") {
-			frame = "overlapsLeft";
-		} else if (allowedFrames[0]=="endswith" && sharedClasses[0]=="intersects") {
-			frame = "overlapsRight";
-		} else if (allowedFrames[0]=="matches" && sharedClasses[0]=="intersects") {
-			frame = "matches";
-		} else if (allowedFrames[0]=="matches" && sharedClasses[0]=="unequals") {
-			frame = "matches";
-		} else if (allowedFrames[0]=="matches" && sharedClasses[0]=="equals") {
-			frame = "matches";
-		} else if (allowedFrames[0]=="contains" && sharedClasses[0]=="intersects") {
-			frame = "contains";
+		if (allowedFrames.length==0 && sharedClasses[0]=="sharedClasses:includes") {
+			frame = "frame:contains";
+		} else if (allowedFrames.length==0 && sharedClasses[0]=="sharedClasses:intersects") {
+			frame = "frame:overlaps";
+		} else if (allowedFrames[0]=="frame:startswith" && sharedClasses[0]=="sharedClasses:includes") {
+			frame = "frame:startswith";
+		} else if (allowedFrames[0]=="frame:endswith" && sharedClasses[0]=="sharedClasses:includes") {
+			frame = "frame:endswith";
+		} else if (allowedFrames[0]=="frame:matches" && sharedClasses[0]=="sharedClasses:includes" && sharedClasses.length==1) {
+			frame = "frame:endswith";
+		} else if (allowedFrames[0]=="frame:matches" && sharedClasses[0]=="sharedClasses:includes" && sharedClasses[1]=="sharedClasses:unequals") {
+			frame = "frame:matches";
+		} else if (allowedFrames[0]=="frame:matches" && sharedClasses[0]=="sharedClasses:equals") {
+			frame = "frame:matches";			
+		} else if (allowedFrames[0]=="frame:contains" && sharedClasses[0]=="sharedClasses:includes") {
+			frame = "frame:contains";
+		} else if (allowedFrames[0]=="frame:startswith" && sharedClasses[0]=="sharedClasses:intersects") {
+			frame = "frame:overlapsLeft";
+		} else if (allowedFrames[0]=="frame:endswith" && sharedClasses[0]=="sharedClasses:intersects") {
+			frame = "frame:overlapsRight";
+		} else if (allowedFrames[0]=="frame:matches" && sharedClasses[0]=="sharedClasses:intersects") {
+			frame = "frame:matches";
+		} else if (allowedFrames[0]=="frame:matches" && sharedClasses[0]=="sharedClasses:unequals") {
+			frame = "frame:matches";
+		} else if (allowedFrames[0]=="frame:matches" && sharedClasses[0]=="sharedClasses:equals") {
+			frame = "frame:matches";
+		} else if (allowedFrames[0]=="frame:contains" && sharedClasses[0]=="sharedClasses:intersects") {
+			frame = "frame:contains";
 		}
 		group.put("frame", frame);
 		announcements.add("Deprecated 2014-09-22: 'frame' only to be supported until 3 months from deprecation date. " +
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 0953e5c..e6c2a05 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
@@ -587,7 +587,7 @@
 
                 // create the group expressing the position constraint
                 String[] frames = new String[]{c.position};
-                String[] sharedClasses = new String[]{"includes"};  // OPBED only defines #IN-corresponding positions
+                String[] sharedClasses = new String[]{"sharedClasses:includes"};  // OPBED only defines #IN-corresponding positions
             	LinkedHashMap<String,Object> posgroup = makePosition(frames, sharedClasses);
 //                LinkedHashMap<String, Object> posgroup = makePosition(c.position);
                 ArrayList<Object> operands = (ArrayList<Object>) posgroup.get("operands");
@@ -625,7 +625,7 @@
                     // make position group
                     CosmasCondition c = new CosmasCondition(conditions.getChild(i));
                     String[] frames = new String[]{c.position};
-                    String[] sharedClasses = new String[]{"includes"};  // OPBED only defines #IN-corresponding positions
+                    String[] sharedClasses = new String[]{"sharedClasses:includes"};  // OPBED only defines #IN-corresponding positions
                 	LinkedHashMap<String,Object> posGroup = makePosition(frames, sharedClasses);
                     operands.add(posGroup);
                     if (c.negated) posGroup.put("exclude", "true");
@@ -747,41 +747,52 @@
 
         ArrayList<String> positions = new ArrayList<String>();
         ArrayList<String> sharedClasses = new ArrayList<String>();
+        String frame = "";
         String posOption = null; 
         if (posnode != null) {
             posOption = posnode.getChild(0).toStringTree();
             switch (posOption) {
             case "L":
-                positions.add("startswith");
-                sharedClasses.add("includes");
+                positions.add("frame:startswith");
+                sharedClasses.add("sharedClasses:includes");
+                frame = "startswith";
                 break;
             case "R":
-            	positions.add("endswith");
-                sharedClasses.add("includes");
+            	positions.add("frame:endswith");
+                sharedClasses.add("sharedClasses:includes");
+                frame = "endswith";
                 break;
             case "F":
-            	positions.add("matches");
-                sharedClasses.add("includes");
+            	positions.add("frame:matches");
+                sharedClasses.add("sharedClasses:includes");
+                frame = "matches";
                 break;
             case "FE":
-            	positions.add("matches");
-                sharedClasses.add("equals");
+            	positions.add("frame:matches");
+                sharedClasses.add("sharedClasses:equals");
+                frame = "matches";
                 break;
             case "FI":
-            	positions.add("matches");
-            	sharedClasses.add("unequals");
-                sharedClasses.add("includes");
+            	positions.add("frame:matches");
+            	sharedClasses.add("sharedClasses:unequals");
+                sharedClasses.add("sharedClasses:includes");
+                frame = "matches-noident";
                 break;
             case "N": 
-            	positions.add("contains");
-                sharedClasses.add("includes");
+            	positions.add("frame:contains");
+                sharedClasses.add("sharedClasses:includes");
+                frame = "contains";
                 break;
             }
         } else {
-        	sharedClasses.add("includes");
+        	sharedClasses.add("sharedClasses:includes");
+        	frame = "contains";
         }
         posgroup.put("frames", positions);
         posgroup.put("sharedClasses", sharedClasses);
+        posgroup.put("frame", "frame:"+frame);
+        announcements.add("Deprecated 2014-09-22: 'frame' only to be supported until 3 months from deprecation date. " +
+				"Position frames are now expressed through 'frames' and 'sharedClasses'");
         
         if (exclnode != null) {
             if (exclnode.getChild(0).toStringTree().equals("YES")) {
@@ -818,43 +829,54 @@
 
         ArrayList<String> positions = new ArrayList<String>();
         ArrayList<String> sharedClasses = new ArrayList<String>();
+        String frame = "";
         String posOption = null; 
         if (posnode != null) {
             posOption = posnode.getChild(0).toStringTree();
             switch (posOption) {
             case "L":
-                positions.add("startswith");
-                positions.add("overlapsLeft");
-                sharedClasses.add("intersects");
+                positions.add("frame:startswith");
+                positions.add("frame:overlapsLeft");
+                sharedClasses.add("sharedClasses:intersects");
+                frame = "overlapsLeft";
                 break;
             case "R":
-            	positions.add("endswith");
-            	positions.add("overlapsRight");
-                sharedClasses.add("intersects");
+            	positions.add("frame:endswith");
+            	positions.add("frame:overlapsRight");
+                sharedClasses.add("sharedClasses:intersects");
+                frame = "overlapsRight";
                 break;
             case "F":
-            	positions.add("matches");
-                sharedClasses.add("intersects");
+            	positions.add("frame:matches");
+                sharedClasses.add("sharedClasses:intersects");
+                frame = "matches";
                 break;
             case "FE":
-            	positions.add("matches");
-                sharedClasses.add("equals");
+            	positions.add("frame:matches");
+                sharedClasses.add("sharedClasses:equals");
+                frame = "matches";
                 break;
             case "FI":
-            	positions.add("matches");
-            	sharedClasses.add("unequals");
+            	positions.add("frame:matches");
+            	sharedClasses.add("sharedClasses:unequals");
+            	frame = "matches-noident";
                 break;
             case "X": 
-            	positions.add("contains");
-                sharedClasses.add("intersects");
+            	positions.add("frame:contains");
+                sharedClasses.add("sharedClasses:intersects");
+                frame = "overlaps";
                 break;
             }
         } else {
-        	sharedClasses.add("intersects");
+        	sharedClasses.add("sharedClasses:intersects");
+        	frame = "overlaps";
         }
         
         posgroup.put("frames", positions);
         posgroup.put("sharedClasses", sharedClasses);
+        posgroup.put("frame", "frame:"+frame);
+        announcements.add("Deprecated 2014-09-22: 'frame' only to be supported until 3 months from deprecation date. " +
+				"Position frames are now expressed through 'frames' and 'sharedClasses'");
 
         if (exclnode != null) {
             if (exclnode.getChild(0).toStringTree().equals("YES")) {
@@ -862,31 +884,6 @@
             }
         }
         
-//        if (posOption != null && (posOption.equals("F") || posOption.equals("FI")) && !negatePosition) {
-//        	LinkedHashMap<String, Object> endsWithPosition = makePosition("endswith");
-//        	((ArrayList<Object>) endsWithPosition.get("operands")).add(makeReference(classCounter+1));
-//        	LinkedHashMap<String,Object> innerFocus = makeReference(classCounter);
-//        	innerFocus.put("operands", new ArrayList<Object>());
-//        	LinkedHashMap<String,Object> outerFocus = makeReference(classCounter);
-//        	outerFocus.put("operands", new ArrayList<Object>());
-//        	LinkedHashMap[] toWrap = new LinkedHashMap[]{posgroup, innerFocus, endsWithPosition, outerFocus};
-//        	if (posOption.equals("FI")) {
-//        		LinkedHashMap<String, Object> noMatchPosition = makePosition("matches");
-//            	((ArrayList<Object>) noMatchPosition.get("operands")).add(makeReference(classCounter+1));
-//            	noMatchPosition.put("exclude", true);
-//        		LinkedHashMap<String,Object> outermostFocus = makeReference(classCounter);
-//        		outermostFocus.put("operands", new ArrayList<Object>());
-//        		toWrap = new LinkedHashMap[]{posgroup, innerFocus, endsWithPosition, outerFocus, noMatchPosition, outermostFocus};
-//        	}
-//        	
-//        	toWrapStack.push(toWrap);
-//        	stackedToWrap++;
-//        	wrapOperandInClass(node,1,classCounter+1);
-//        	wrapOperandInClass(node,2,classCounter);
-//        	wrapFirstOpInClass = classCounter+1;
-//        	wrapSecondOpInClass = classCounter;
-//        }
-        
         if (groupnode != null) {
             String grouping = groupnode.getChild(0).toStringTree().equals("@max") ? "true" : "false";
             posgroup.put("grouping", grouping);
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/util/CosmasCondition.java b/src/main/java/de/ids_mannheim/korap/query/serialize/util/CosmasCondition.java
index 24866d6..86428f8 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/util/CosmasCondition.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/util/CosmasCondition.java
@@ -20,6 +20,6 @@
 		elem = nodeString.substring(0, 1);
 		nodeString = nodeString.substring(1);
 		
-		position = nodeString.equals("a") ? "startswith" : "endswith";
+		position = nodeString.equals("a") ? "frame:startswith" : "frame:endswith";
 	}
 }
diff --git a/src/test/java/CosmasTreeTest.java b/src/test/java/CosmasTreeTest.java
index 0089727..e7eec87 100644
--- a/src/test/java/CosmasTreeTest.java
+++ b/src/test/java/CosmasTreeTest.java
@@ -293,14 +293,14 @@
 							"}" +
 						"]}";
 //					"{@type=korap:group, operation=operation:or, operands=[" +
-//						"{@type=korap:group, operation=operation:position, frames=[], sharedClasses=[intersects], operands=[" +
+//						"{@type=korap:group, operation=operation:position, frames=[frame:], sharedClasses=[sharedClasses:intersects], operands=[" +
 //							"{@type=korap:group, operation=operation:class, class=0, operands=[" +	
 //								"{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" +
 //							"]}," +
 //							"{@type=korap:group, operation=operation:class, class=0, operands=[" +	
 //								"{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
 //							"]}" +
-//						"], frame=overlaps}," +
+//						"], frame=frame:overlaps}," +
 //						"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
 //							"{@type=korap:group, operation=operation:sequence, " +
 //								"operands=[" +
@@ -341,14 +341,14 @@
 						"}" +
 					"]}";
 //				"{@type=korap:group, operation=operation:or, operands=[" +
-//					"{@type=korap:group, operation=operation:position, frames=[], sharedClasses=[intersects], operands=[" +
+//					"{@type=korap:group, operation=operation:position, frames=[frame:], sharedClasses=[sharedClasses:intersects], operands=[" +
 //						"{@type=korap:group, operation=operation:class, class=0, operands=[" +	
 //							"{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
 //						"]}," +
 //						"{@type=korap:group, operation=operation:class, class=0, operands=[" +	
 //							"{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" +
 //						"]}" +
-//					"], frame=overlaps}," +
+//					"], frame=frame:overlaps}," +
 //					"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
 //						"{@type=korap:group, operation=operation:sequence, " +
 //							"operands=[" +
@@ -387,14 +387,14 @@
 						"}" +
 					"]}";
 //				"{@type=korap:group, operation=operation:or, operands=[" +
-//					"{@type=korap:group, operation=operation:position, frames=[], sharedClasses=[intersects], operands=[" +
+//					"{@type=korap:group, operation=operation:position, frames=[frame:], sharedClasses=[sharedClasses:intersects], operands=[" +
 //						"{@type=korap:group, operation=operation:class, class=0, operands=[" +	
 //							"{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" +
 //						"]}," +
 //						"{@type=korap:group, operation=operation:class, class=0, operands=[" +	
 //							"{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
 //						"]}" +
-//					"], frame=overlaps}," +
+//					"], frame=frame:overlaps}," +
 //					"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
 //						"{@type=korap:group, operation=operation:sequence, " +
 //							"operands=[" +
@@ -482,13 +482,13 @@
 					"]}" +
 				"]}" ;
 //		String mondsterneOv =
-//					"{@type=korap:group, operation=operation:position, frames=[], sharedClasses=[intersects], operands=[" +
+//					"{@type=korap:group, operation=operation:position, frames=[frame:], sharedClasses=[sharedClasses:intersects], operands=[" +
 //						mondsterne +
 //					"]}";
 		String mondsterneClassesOv =
-				"{@type=korap:group, operation=operation:position, frames=[], sharedClasses=[intersects], operands=[" +
+				"{@type=korap:group, operation=operation:position, frames=[frame:], sharedClasses=[sharedClasses:intersects], operands=[" +
 					mondsterneClasses +
-				"], frame=overlaps}";
+				"], frame=frame:overlaps}";
 //		String mondsterneAll =
 //					"{@type=korap:group, operation=operation:or, operands=[" +
 //						mondsterneOv + "," + mondsterneClassesSeq +
@@ -503,7 +503,6 @@
 				"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
 						"{@type=korap:group, operation=operation:sequence, " +
 							"operands=[" +
-								
 								"{@type=korap:group, operation=operation:class, class=0, operands=[" +	
 									"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
 										"{@type=korap:group, operation=operation:sequence, " +
@@ -532,14 +531,14 @@
 					"]}" +
 					""	;
 //			"{@type=korap:group, operation=operation:or, operands=[" +
-//				"{@type=korap:group, operation=operation:position, frames=[], sharedClasses=[intersects], operands=[" +
+//				"{@type=korap:group, operation=operation:position, frames=[frame:], sharedClasses=[sharedClasses:intersects], operands=[" +
 //					"{@type=korap:group, operation=operation:class, class=0, operands=[" +	
 //						mondsterneAllClasses  + 
 //					"]}," +
 //					"{@type=korap:group, operation=operation:class, class=0, operands=[" +	
 //						"{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" +
 //					"]}" +
-//				"], frame=overlaps}," +
+//				"], frame=frame:overlaps}," +
 //				"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
 //					"{@type=korap:group, operation=operation:sequence, " +
 //						"operands=[" +
@@ -571,7 +570,7 @@
 							"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 								"{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
 							"]}" +
-						"], frames=[], sharedClasses=[includes]}" +
+						"], frames=[], sharedClasses=[sharedClasses:includes], frame=frame:contains}" +
 					"]}";
 		ct = new CosmasTree(query);
 		map = ct.getRequestMap().get("query").toString();
@@ -585,7 +584,7 @@
 							"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 								"{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
 							"]}" +
-						"], frames=[startswith], sharedClasses=[includes]}" +
+						"], frames=[frame:startswith], sharedClasses=[sharedClasses:includes], frame=frame:startswith}" +
 					"]}";
 		ct = new CosmasTree(query);
 		map = ct.getRequestMap().get("query").toString();
@@ -600,7 +599,7 @@
 							"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 								"{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
 							"]}" +
-						"], frames=[matches], sharedClasses=[includes]}" +
+						"], frames=[frame:matches], sharedClasses=[sharedClasses:includes], frame=frame:matches}" +
 					"]}" +
 					"";
 		ct = new CosmasTree(query);
@@ -615,7 +614,7 @@
 							"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 								"{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
 							"]}" +
-						"], frames=[matches], sharedClasses=[unequals,includes]}" +
+						"], frames=[frame:matches], sharedClasses=[sharedClasses:unequals,sharedClasses:includes], frame=frame:matches-noident}" +
 					"]}" +
 					"";
 		ct = new CosmasTree(query);
@@ -630,7 +629,7 @@
 							"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 								"{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
 							"]}" +
-						"], frames=[matches], sharedClasses=[equals]}" +
+						"], frames=[frame:matches], sharedClasses=[sharedClasses:equals], frame=frame:matches}" +
 					"]}" +
 					"";
 		ct = new CosmasTree(query);
@@ -645,7 +644,7 @@
 							"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 								"{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
 							"]}" +
-						"], frames=[startswith], sharedClasses=[includes], exclude=true}" +
+						"], frames=[frame:startswith], sharedClasses=[sharedClasses:includes], frame=frame:startswith, exclude=true}" +
 					"]}";
 		ct = new CosmasTree(query);
 		map = ct.getRequestMap().get("query").toString();
@@ -661,7 +660,7 @@
 							"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 								"{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
 							"]}" +
-						"], frames=[matches], sharedClasses=[equals], exclude=true, grouping=false}" +
+						"], frames=[frame:matches], sharedClasses=[sharedClasses:equals], frame=frame:matches, exclude=true, grouping=false}" +
 					"]}";
 		ct = new CosmasTree(query);
 		map = ct.getRequestMap().get("query").toString();
@@ -678,7 +677,7 @@
 							"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 								"{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
 							"]}" +
-						"], frames=[], sharedClasses=[intersects]}" +
+						"], frames=[], sharedClasses=[sharedClasses:intersects], frame=frame:overlaps}" +
 					"]}";
 		ct = new CosmasTree(query);
 		map = ct.getRequestMap().get("query").toString();
@@ -692,7 +691,7 @@
 							"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 								"{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
 							"]}" +
-						"], frames=[startswith,overlapsLeft], sharedClasses=[intersects]}" +
+						"], frames=[frame:startswith,frame:overlapsLeft], sharedClasses=[sharedClasses:intersects], frame=frame:overlapsLeft}" +
 					"]}";
 		ct = new CosmasTree(query);
 		map = ct.getRequestMap().get("query").toString();
@@ -706,7 +705,7 @@
 							"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 								"{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
 							"]}" +
-						"], frames=[matches], sharedClasses=[intersects]}" +
+						"], frames=[frame:matches], sharedClasses=[sharedClasses:intersects], frame=frame:matches}" +
 					"]}";
 		ct = new CosmasTree(query);
 		map = ct.getRequestMap().get("query").toString();
@@ -720,7 +719,7 @@
 							"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 								"{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
 							"]}" +
-						"], frames=[matches], sharedClasses=[unequals]}" +
+						"], frames=[frame:matches], sharedClasses=[sharedClasses:unequals], frame=frame:matches-noident}" +
 					"]}";
 		ct = new CosmasTree(query);
 		map = ct.getRequestMap().get("query").toString();
@@ -734,7 +733,7 @@
 									"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 										"{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
 									"]}" +
-								"], frames=[matches], sharedClasses=[equals]}" +
+								"], frames=[frame:matches], sharedClasses=[sharedClasses:equals], frame=frame:matches}" +
 							"]}" +
 					"";
 		ct = new CosmasTree(query);
@@ -805,14 +804,14 @@
 		query="#BEG(der /w3:5 Mann) /+w10 kommt"; // nesting #BEG() in a distance group
 		String beg2 = 
 //					"{@type=korap:group, operation=operation:or, operands=[" +
-//						"{@type=korap:group, operation=operation:position, frames=[], sharedClasses=[intersects], operands=[" +
+//						"{@type=korap:group, operation=operation:position, frames=[frame:], sharedClasses=[sharedClasses:intersects], operands=[" +
 //							"{@type=korap:group, operation=operation:class, class=0, operands=[" +
 //								beg1 +
 //							"]}" + "," +
 //							"{@type=korap:group, operation=operation:class, class=0, operands=[" +
 //								kommt +
 //							"]}" +
-//						"], frame=overlaps}," +
+//						"], frame=frame:overlaps}," +
 //						"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
 //							"{@type=korap:group, operation=operation:sequence, operands=[" +
 //								"{@type=korap:group, operation=operation:class, class=0, operands=[" +
@@ -846,7 +845,7 @@
 		query="kommt /+w10 #BEG(der /w3:5 Mann)";
 		String beg3 = 
 //				"{@type=korap:group, operation=operation:or, operands=[" +
-//						"{@type=korap:group, operation=operation:position, frames=[], sharedClasses=[intersects], operands=[" +
+//						"{@type=korap:group, operation=operation:position, frames=[frame:], sharedClasses=[sharedClasses:intersects], operands=[" +
 //							"{@type=korap:group, operation=operation:class, class=0, operands=[" +
 //								kommt + 
 ////							"," +
@@ -854,7 +853,7 @@
 //							"{@type=korap:group, operation=operation:class, class=0, operands=[" +
 //								beg1+
 //							"]}" +
-//						"], frame=overlaps}," +
+//						"], frame=frame:overlaps}," +
 //						"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
 //							"{@type=korap:group, operation=operation:sequence, operands=[" +
 //								"{@type=korap:group, operation=operation:class, class=0, operands=[" +
@@ -908,9 +907,9 @@
 	public void testSentenceDistance() throws QueryException {
 		query="Sonne /s0 Mond";   // contains(focus(1:contains({1:<s>},Sonne)),Mond)
 		expected = 
-					"{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+					"{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" +
 						"{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" +
-							"{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+							"{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" +
 								"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 									"{@type=korap:span, key=s}" +
 								"]}," +
@@ -925,9 +924,9 @@
 		
 		query="Sonne /s0,w5 Mond";   
 		expected = 
-					"{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+					"{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" +
 						"{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" +
-							"{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+							"{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" +
 								"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 									"{@type=korap:span, key=s}" +
 								"]}," +
@@ -943,12 +942,12 @@
 		query="Sonne /s2:2 Mond";   // contains(<s>,Sonne)<s>contains(<s>,Mond)
 		expected = 
 						"{@type=korap:group, operation=operation:sequence, operands=[" +
-							"{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+							"{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" +
 								"{@type=korap:span, key=s}," +
 								"{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" +
 							"]}," +
 							"{@type=korap:span, key=s}," +
-							"{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+							"{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" +
 								"{@type=korap:span, key=s}," +
 								"{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
 							"]}" +
@@ -960,14 +959,14 @@
 		query="Sonne /s2:3 Mond";   // contains(<s>,Sonne)<s>contains(<s>,Mond)
 		expected = 
 						"{@type=korap:group, operation=operation:sequence, operands=[" +
-							"{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+							"{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" +
 								"{@type=korap:span, key=s}," +
 								"{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" +
 							"]}," +
 							"{@type=korap:group, operation=operation:repetition, operands=[" +
 								"{@type=korap:span, key=s}" +
 							"], boundary={@type=korap:boundary, min=1, max=2}, min=1, max=2}," +
-							"{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+							"{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" +
 								"{@type=korap:span, key=s}," +
 								"{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
 							"]}" +
@@ -979,9 +978,9 @@
 		query="Sonne /s2 Mond";   // contains(focus(1:contains({1:<s>},Sonne)),Mond) | contains(<s>,Sonne)<s>?contains(<s>,Mond)
 		expected = 
 					"{@type=korap:group, operation=operation:or, operands=[" +
-						"{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+						"{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" +
 							"{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" +
-								"{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+								"{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" +
 									"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 										"{@type=korap:span, key=s}" +
 									"]}," +
@@ -991,14 +990,14 @@
 							"{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
 						"]}," +
 						"{@type=korap:group, operation=operation:sequence, operands=[" +
-							"{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+							"{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" +
 								"{@type=korap:span, key=s}," +
 								"{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" +
 							"]}," +
 							"{@type=korap:group, operation=operation:repetition, operands=[" +
 								"{@type=korap:span, key=s}" +
 							"], boundary={@type=korap:boundary, min=0, max=1}, min=0, max=1}," +
-							"{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+							"{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" +
 								"{@type=korap:span, key=s}," +
 								"{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
 							"]}" +
@@ -1125,12 +1124,12 @@
 		query = "#BED(der , sa)";
 		String bed1 = 
 				"{@type=korap:reference, operation=operation:focus, classRef=[1], operands= [" +
-					"{@type=korap:group, operation=operation:position, frames=[startswith], sharedClasses=[includes], operands=[" +
+					"{@type=korap:group, operation=operation:position, frames=[frame:startswith], sharedClasses=[sharedClasses:includes], operands=[" +
 						"{@type=korap:span, key=s}," +
 						"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 							"{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}" +
 						"]}" +
-					"], frame=startswith}" +
+					"], frame=frame:startswith}" +
 				"]}";
 		ct = new CosmasTree(query);
 		map = ct.getRequestMap().get("query").toString();
@@ -1139,7 +1138,7 @@
 		query = "#BED(der Mann , +pe)";
 		String bed2 = 
 				"{@type=korap:reference, operation=operation:focus, classRef=[1], operands= [" +
-						"{@type=korap:group, operation=operation:position, frames=[endswith], sharedClasses=[includes], operands=[" +
+						"{@type=korap:group, operation=operation:position, frames=[frame:endswith], sharedClasses=[sharedClasses:includes], operands=[" +
 							"{@type=korap:span, key=p}," +
 							"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 								"{@type=korap:group, operation=operation:sequence, operands=[" +
@@ -1147,7 +1146,7 @@
 									"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
 								"]}" +
 							"]}" +
-						"], frame=endswith}" +
+						"], frame=frame:endswith}" +
 					"]}";
 		ct = new CosmasTree(query);
 		map = ct.getRequestMap().get("query").toString();
@@ -1157,7 +1156,7 @@
 		String bed3 = 
 				"{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" +
 					"{@type=korap:group, operation=operation:sequence, operands=[" +
-						"{@type=korap:group, operation=operation:position, frames=[startswith], sharedClasses=[includes], operands=[" +
+						"{@type=korap:group, operation=operation:position, frames=[frame:startswith], sharedClasses=[sharedClasses:includes], operands=[" +
 							"{@type=korap:span, key=s}," +
 							"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 								"{@type=korap:group, operation=operation:sequence, operands=[" +
@@ -1165,8 +1164,8 @@
 									"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
 								"]}" +
 							"]}" +
-						"], frame=startswith}," +
-						"{@type=korap:group, operation=operation:position, frames=[startswith], sharedClasses=[includes], operands=[" +
+						"], frame=frame:startswith}," +
+						"{@type=korap:group, operation=operation:position, frames=[frame:startswith], sharedClasses=[sharedClasses:includes], operands=[" +
 							"{@type=korap:span, key=p}," +
 							"{@type=korap:group, operation=operation:class, class=2, operands=[" +
 								"{@type=korap:group, operation=operation:sequence, operands=[" +
@@ -1174,7 +1173,7 @@
 									"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
 								"]}" +
 							"]}" +
-						"], frame=startswith, exclude=true}" +
+						"], frame=frame:startswith, exclude=true}" +
 					"], distances=[" +
 						"{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=0, max=0}, min=0, max=0}" +
 					"]}" +
@@ -1190,12 +1189,12 @@
 		query = "Der:sa";
 		String col1 = 
 				"{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" +
-					"{@type=korap:group, operation=operation:position, frames=[startswith], sharedClasses=[includes], operands=[" +
+					"{@type=korap:group, operation=operation:position, frames=[frame:startswith], sharedClasses=[sharedClasses:includes], operands=[" +
 						"{@type=korap:span, key=s}," +
 						"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 							"{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=match:eq}}" +
 						"]}" +
-					"], frame=startswith}" +
+					"], frame=frame:startswith}" +
 				"]}";
 		ct = new CosmasTree(query);
 		map = ct.getRequestMap().get("query").toString();
@@ -1205,24 +1204,24 @@
 		String col2 = 
 				"{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" +
 					"{@type=korap:group, operation=operation:sequence, operands=[" +
-						"{@type=korap:group, operation=operation:position, frames=[startswith], sharedClasses=[includes], operands=[" +
+						"{@type=korap:group, operation=operation:position, frames=[frame:startswith], sharedClasses=[sharedClasses:includes], operands=[" +
 							"{@type=korap:span, key=s}," +
 							"{@type=korap:group, operation=operation:class, class=1, operands=[" +
 									"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
 							"]}" +
-						"], frame=startswith}," +
-						"{@type=korap:group, operation=operation:position, frames=[startswith], sharedClasses=[includes], operands=[" +
+						"], frame=frame:startswith}," +
+						"{@type=korap:group, operation=operation:position, frames=[frame:startswith], sharedClasses=[sharedClasses:includes], operands=[" +
 							"{@type=korap:span, key=p}," +
 							"{@type=korap:group, operation=operation:class, class=2, operands=[" +
 									"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
 							"]}" +
-						"], frame=startswith, exclude=true}," +
-						"{@type=korap:group, operation=operation:position, frames=[endswith], sharedClasses=[includes], operands=[" +
+						"], frame=frame:startswith, exclude=true}," +
+						"{@type=korap:group, operation=operation:position, frames=[frame:endswith], sharedClasses=[sharedClasses:includes], operands=[" +
 							"{@type=korap:span, key=t}," +
 							"{@type=korap:group, operation=operation:class, class=3, operands=[" +
 									"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
 							"]}" +
-						"], frame=endswith}" +
+						"], frame=frame:endswith}" +
 					"], distances=[" +
 						"{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=0, max=0}, min=0, max=0}" +
 					"]}" +