Annis QL: foundry and layer in edgeAnno
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 489a00d..11f15bc 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
@@ -414,10 +414,14 @@
 			ParseTree edgeAnnoSpec) {
 		LinkedHashMap<String, Object> edgeAnno = new LinkedHashMap<String, Object>();
 		edgeAnno.put("@type", "korap:term");
-		ParseTree labelNode = edgeAnnoSpec.getChild(0);
+		ParseTree qNameNode = edgeAnnoSpec.getChild(0);
 		ParseTree matchOperatorNode = edgeAnnoSpec.getChild(1);
 		ParseTree textSpecNode = edgeAnnoSpec.getChild(2);
-		edgeAnno.put("layer", labelNode.getChild(0).toStringTree(parser));
+		System.err.println(edgeAnnoSpec.toStringTree(parser));
+		ParseTree layerNode = getFirstChildWithCat(qNameNode, "layer");
+		ParseTree foundryNode = getFirstChildWithCat(qNameNode, "foundry");
+		if (foundryNode!=null) edgeAnno.put("foundry", foundryNode.getChild(0).toStringTree(parser));
+		if (layerNode!=null) edgeAnno.put("layer", layerNode.getChild(0).toStringTree(parser));
 		edgeAnno.putAll(parseTextSpec(textSpecNode));
 		edgeAnno.put("match", parseMatchOperator(matchOperatorNode));
 		return edgeAnno;
@@ -592,7 +596,8 @@
 //			 "\"Mann\" & node & #2 >[cat=\"NP\"] #1",
 			 "node & node & #1 . #2",
 			 "node & node & #1 .2,6 #2",
-			 "node & node & #1 .* #2"
+			 "node & node & #1 .* #2",
+			 "node & node & #2 ->label[mate/coref=\"true\"] #1"
 
 //			"node & node & #2 ->[foundry/layer=\"key\"],2,4 #1",
 			};
diff --git a/src/test/java/AqlTreeTest.java b/src/test/java/AqlTreeTest.java
index 15a5c0b..00be416 100644
--- a/src/test/java/AqlTreeTest.java
+++ b/src/test/java/AqlTreeTest.java
@@ -149,6 +149,17 @@
 		map = aqlt.getRequestMap().get("query").toString();
 		assertEquals(dom1.replaceAll(" ", ""), map.replaceAll(" ", ""));
 		
+		query = "node & node & #2 ->label[mate/coref=\"true\"] #1";
+		String dom2 = 
+				"{@type=korap:group, operation=operation:relation, operands=[" +
+						"{@type=korap:span}," +
+						"{@type=korap:span}" +
+				"], relation={@type=korap:relation, reltype=label, wrap=[{@type=korap:term, foundry=mate, layer=coref, key=true, match=match:eq}]}" +
+				"}";
+		aqlt = new AqlTree(query);
+		map = aqlt.getRequestMap().get("query").toString();
+		assertEquals(dom2.replaceAll(" ", ""), map.replaceAll(" ", ""));
+		
 	}
 	
 	@Test