Annis pointing relations
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/AqlTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/AqlTree.java
index 327f585..489a00d 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/AqlTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/AqlTree.java
@@ -345,9 +345,9 @@
 			if (leftChildSpec != null) relation.put("index", 0);
 			if (rightChildSpec != null) relation.put("index", -1);
 			if (qName != null) relation.putAll(parseQNameNode(qName));
-			if (edgeSpec != null) relation.put("edges", parseEdgeSpec(edgeSpec)) ;
-			if (star != null) relation.put("boundary", makeBoundary(0, 100));
-			if (rangeSpec != null) relation.put("boundary", parseRangeSpec(rangeSpec));
+			if (edgeSpec != null) relation.put("wrap", parseEdgeSpec(edgeSpec)) ;
+			if (star != null) relation.put("distance", makeDistance("r", 0, 100));
+			if (rangeSpec != null) relation.put("distance", distanceFromRangeSpec("r", rangeSpec));
 			
 		}
 		else if (operator.equals("pointing")) {
@@ -358,10 +358,11 @@
 			ParseTree edgeSpec = getFirstChildWithCat(operatorNode, "edgeSpec");
 			ParseTree star = getFirstChildWithCat(operatorNode, "*");
 			ParseTree rangeSpec = getFirstChildWithCat(operatorNode, "rangeSpec");
-			if (qName != null) relation.putAll(parseQNameNode(qName));
-			if (edgeSpec != null) relation.put("edges", parseEdgeSpec(edgeSpec)) ;
-			if (star != null) relation.put("boundary", makeBoundary(0, 100));
-			if (rangeSpec != null) relation.put("boundary", parseRangeSpec(rangeSpec));
+//			if (qName != null) relation.putAll(parseQNameNode(qName));
+			if (qName != null) relation.put("reltype", qName.getText());
+			if (edgeSpec != null) relation.put("wrap", parseEdgeSpec(edgeSpec)) ;
+			if (star != null) relation.put("distance", makeDistance("r", 0, 100));
+			if (rangeSpec != null) relation.put("distance", distanceFromRangeSpec("r", rangeSpec));
 			
 		}
 		else if (operator.equals("precedence")) {
@@ -412,23 +413,31 @@
 	private LinkedHashMap<String, Object> parseEdgeAnno(
 			ParseTree edgeAnnoSpec) {
 		LinkedHashMap<String, Object> edgeAnno = new LinkedHashMap<String, Object>();
-		edgeAnno.put("@type", "korap:edge");
+		edgeAnno.put("@type", "korap:term");
 		ParseTree labelNode = edgeAnnoSpec.getChild(0);
 		ParseTree matchOperatorNode = edgeAnnoSpec.getChild(1);
 		ParseTree textSpecNode = edgeAnnoSpec.getChild(2);
-		edgeAnno.put("label", labelNode.getChild(0).toStringTree(parser));
+		edgeAnno.put("layer", labelNode.getChild(0).toStringTree(parser));
 		edgeAnno.putAll(parseTextSpec(textSpecNode));
 		edgeAnno.put("match", parseMatchOperator(matchOperatorNode));
 		return edgeAnno;
 	}
 
-	private LinkedHashMap<String, Object> parseRangeSpec(ParseTree rangeSpec) {
+	private LinkedHashMap<String, Object> boundaryFromRangeSpec(ParseTree rangeSpec) {
 		Integer min = Integer.parseInt(rangeSpec.getChild(0).toStringTree(parser));
 		Integer max = MAXIMUM_DISTANCE;
 		if (rangeSpec.getChildCount()==3) 
 			max = Integer.parseInt(rangeSpec.getChild(2).toStringTree(parser));
 		return makeBoundary(min, max);
 	}
+
+	private LinkedHashMap<String, Object> distanceFromRangeSpec(String key, ParseTree rangeSpec) {
+		Integer min = Integer.parseInt(rangeSpec.getChild(0).toStringTree(parser));
+		Integer max = MAXIMUM_DISTANCE;
+		if (rangeSpec.getChildCount()==3) 
+			max = Integer.parseInt(rangeSpec.getChild(2).toStringTree(parser));
+		return makeDistance(key, min, max);
+	}
 	
 	private LinkedHashMap<String, Object> parseDistance(ParseTree rangeSpec) {
 		Integer min = Integer.parseInt(rangeSpec.getChild(0).toStringTree(parser));
diff --git a/src/test/java/AqlTreeTest.java b/src/test/java/AqlTreeTest.java
index 922ca27..15a5c0b 100644
--- a/src/test/java/AqlTreeTest.java
+++ b/src/test/java/AqlTreeTest.java
@@ -106,7 +106,7 @@
 				"{@type=korap:group, operation=operation:relation, operands=[" +
 						"{@type=korap:span}," +
 						"{@type=korap:token, wrap={@type=korap:term, key=Mann, match=match:eq}}" +
-				"], relation={@type=korap:treeRelation, reltype=dominance, edges=[{@type=korap:edge, label=cat, key=NP, match=match:eq}]}" +
+				"], relation={@type=korap:treeRelation, reltype=dominance, wrap=[{@type=korap:term, layer=cat, key=NP, match=match:eq}]}" +
 				"}";
 		aqlt = new AqlTree(query);
 		map = aqlt.getRequestMap().get("query").toString();
@@ -117,7 +117,7 @@
 				"{@type=korap:group, operation=operation:relation, operands=[" +
 						"{@type=korap:span}," +
 						"{@type=korap:token, wrap={@type=korap:term, key=Mann, match=match:eq}}" +
-				"], relation={@type=korap:treeRelation, reltype=dominance, index=0, edges=[{@type=korap:edge, label=cat, key=NP, match=match:eq}]}" +
+				"], relation={@type=korap:treeRelation, reltype=dominance, index=0, wrap=[{@type=korap:term, layer=cat, key=NP, match=match:eq}]}" +
 				"}";
 		aqlt = new AqlTree(query);
 		map = aqlt.getRequestMap().get("query").toString();
@@ -129,7 +129,7 @@
 						"{@type=korap:span}," +
 						"{@type=korap:token, wrap={@type=korap:term, key=Mann, match=match:eq}}" +
 				"], relation={@type=korap:treeRelation, reltype=dominance, " +
-						"boundary={@type=korap:boundary, min=2, max=4}}" +
+						"distance={@type=korap:distance, key=r, min=2, max=4}}" +
 				"}";
 		aqlt = new AqlTree(query);
 		map = aqlt.getRequestMap().get("query").toString();
@@ -143,7 +143,7 @@
 				"{@type=korap:group, operation=operation:relation, operands=[" +
 						"{@type=korap:span}," +
 						"{@type=korap:span}" +
-				"], relation={@type=korap:relation, layer=coref, label=label, key=true}" +
+				"], relation={@type=korap:relation, reltype=label, wrap=[{@type=korap:term, layer=coref, key=true, match=match:eq}]}" +
 				"}";
 		aqlt = new AqlTree(query);
 		map = aqlt.getRequestMap().get("query").toString();