diff --git a/src/main/antlr/annis/AqlParser.g4 b/src/main/antlr/annis/AqlParser.g4
index 6ef84fe..a55abcc 100644
--- a/src/main/antlr/annis/AqlParser.g4
+++ b/src/main/antlr/annis/AqlParser.g4
@@ -57,6 +57,10 @@
 :	(foundry '/')? layer
 ;
 
+edgeType
+:	((foundry '/')? layer eqOperator)? textSpec
+;
+
 edgeAnno
 :	((foundry '/')? (layer COLON)? key eqOperator)? textSpec
 ;
@@ -76,18 +80,18 @@
 | PRECEDENCE (layer COMMA?)? rangeSpec #RangePrecedence
 ;
 
-// EM: it seems that dominance does not have qName
+// EM: dominance may have a type. Is qName appropriate for the dominance type?
 dominance
 : DOMINANCE (qName)? (LEFT_CHILD | RIGHT_CHILD)? (anno=edgeSpec)? # DirectDominance
 | DOMINANCE (qName)? STAR # IndirectDominance
 | DOMINANCE (qName)? rangeSpec? # RangeDominance
 ;
 
-// EM: qName is edgeAnno
+// EM: qName is edgeType
 pointing
-: POINTING (qName | edgeAnno) (anno=edgeSpec)? # DirectPointing
-| POINTING (qName | edgeAnno) (anno=edgeSpec)? STAR # IndirectPointing
-| POINTING (qName | edgeAnno) (anno=edgeSpec)? COMMA? rangeSpec # RangePointing
+: POINTING (qName | edgeType) (anno=edgeSpec)? # DirectPointing
+| POINTING (qName | edgeType) (anno=edgeSpec)? STAR # IndirectPointing
+| POINTING (qName | edgeType) (anno=edgeSpec)? COMMA? rangeSpec # RangePointing
 
 //: POINTING qName (anno=edgeSpec)? # DirectPointing
 //| POINTING qName (anno=edgeSpec)? STAR # IndirectPointing
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessor.java
index c193300..f076255 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessor.java
@@ -188,8 +188,8 @@
             if (!queuedRelations.isEmpty()) {
                 ParseTree queued = queuedRelations.pop();
                 if (verbose)
-                    System.out.println("Taking off queue (last rel): "
-                            + queued.getText());
+                    System.out.println(
+                            "Taking off queue (last rel): " + queued.getText());
                 if (checkOperandsProcessedPreviously(queued)) {
                     processNode(queued);
                 }
@@ -197,8 +197,7 @@
                     addError(StatusCodes.UNBOUND_ANNIS_RELATION,
                             "The relation " + queued.getText()
                                     + " is not bound to any other relations.");
-                    requestMap
-                            .put("query", new HashMap<String, Object>());
+                    requestMap.put("query", new HashMap<String, Object>());
                 }
             }
         }
@@ -235,8 +234,8 @@
                 ParseTree queued = queuedRelations.getFirst();
                 if (checkOperandsProcessedPreviously(queued)) {
                     if (verbose)
-                        System.out.println("Taking off queue: "
-                                + queued.getText());
+                        System.out.println(
+                                "Taking off queue: " + queued.getText());
                     queuedRelations.removeFirst();
                     processNode(queued);
                 }
@@ -326,8 +325,8 @@
                 "n_ary_linguistic_term")) {
             for (ParseTree refOrNode : getChildrenWithCat(lingTermNode,
                     "refOrNode")) {
-                String refOrNodeString = refOrNode.getChild(0).toStringTree(
-                        parser);
+                String refOrNodeString = refOrNode.getChild(0)
+                        .toStringTree(parser);
                 if (refOrNodeString.startsWith("#")) {
                     String ref = refOrNode.getChild(0).toStringTree(parser)
                             .substring(1);
@@ -367,8 +366,8 @@
             // objects must still be available for later reference, handle this 
             // here. Direct declaration relation is present when grandparent is
             // n_ary_linguistic_term node.
-            if (getNodeCat(variableExprNode.getParent().getParent()).equals(
-                    "n_ary_linguistic_term")) {
+            if (getNodeCat(variableExprNode.getParent().getParent())
+                    .equals("n_ary_linguistic_term")) {
                 if (nodeReferencesTotal.containsKey(ref)) {
                     nodeReferencesTotal.put(ref,
                             nodeReferencesTotal.get(ref) + 1);
@@ -413,8 +412,7 @@
         else if (firstChildNodeCat.equals("tok")) {
             object = KoralObjectGenerator.makeToken();
             if (node.getChildCount() > 1) { // empty tokens do not wrap a term
-                Map<String, Object> term = KoralObjectGenerator
-                        .makeTerm();
+                Map<String, Object> term = KoralObjectGenerator.makeTerm();
                 term.put("layer", "orth");
                 object.put("wrap", term);
             }
@@ -425,13 +423,11 @@
             // (e.g. cnx/cat=NP vs mate/pos=NN)
             // TODO generalize the list below -> look up layers associated with
             // tokens rather than spans somewhere
-            Map<String, Object> qNameParse = parseQNameNode(node
-                    .getChild(0));
+            Map<String, Object> qNameParse = parseQNameNode(node.getChild(0));
             if (Arrays.asList(new String[] { "p", "lemma", "m", "orth" })
                     .contains(qNameParse.get("layer"))) {
                 object = KoralObjectGenerator.makeToken();
-                Map<String, Object> term = KoralObjectGenerator
-                        .makeTerm();
+                Map<String, Object> term = KoralObjectGenerator.makeTerm();
                 object.put("wrap", term);
                 term.putAll(qNameParse);
             }
@@ -442,8 +438,7 @@
         }
         else if (firstChildNodeCat.equals("textSpec")) {
             object = KoralObjectGenerator.makeToken();
-            Map<String, Object> term = KoralObjectGenerator
-                    .makeTerm();
+            Map<String, Object> term = KoralObjectGenerator.makeTerm();
             object.put("wrap", term);
             term.put("layer", "orth");
             term.putAll(parseTextSpec(node.getChild(0)));
@@ -454,17 +449,13 @@
                 HashMap<String, Object> term = (HashMap<String, Object>) object
                         .get("wrap");
                 term.putAll(parseTextSpec(node.getChild(2)));
-                term.put(
-                        "match",
-                        parseMatchOperator(getFirstChildWithCat(node,
-                                "eqOperator")));
+                term.put("match", parseMatchOperator(
+                        getFirstChildWithCat(node, "eqOperator")));
             }
             else {
                 object.putAll(parseTextSpec(node.getChild(2)));
-                object.put(
-                        "match",
-                        parseMatchOperator(getFirstChildWithCat(node,
-                                "eqOperator")));
+                object.put("match", parseMatchOperator(
+                        getFirstChildWithCat(node, "eqOperator")));
             }
         }
 
@@ -642,8 +633,7 @@
                         .makeGroup(KoralOperation.RELATION);
                 Map<String, Object> relation = KoralObjectGenerator
                         .makeRelation();
-                Map<String, Object> term = KoralObjectGenerator
-                        .makeTerm();
+                Map<String, Object> term = KoralObjectGenerator.makeTerm();
                 term.put("layer", "c");
                 relation.put("wrap", term);
                 // commonancestor is an indirect commonparent relation
@@ -661,15 +651,14 @@
                 // for lowest level, add the underspecified node as first 
                 // operand and wrap it in a class group
                 if (i == 1) {
-                    innerOperands
-                            .add(KoralObjectGenerator.wrapInClass(
-                                    KoralObjectGenerator.makeSpan(),
-                                    classCounter + 128));
+                    innerOperands.add(KoralObjectGenerator.wrapInClass(
+                            KoralObjectGenerator.makeSpan(),
+                            classCounter + 128));
                     // add the first operand and wrap the whole group in a 
                     // focusing reference 
                     innerOperands.add(operand1);
-                    innerGroup = KoralObjectGenerator.wrapInReference(
-                            innerGroup, classCounter + 128);
+                    innerGroup = KoralObjectGenerator
+                            .wrapInReference(innerGroup, classCounter + 128);
                     outerOperands.add(innerGroup);
                 }
                 else {
@@ -694,8 +683,8 @@
                 // attributes defined in KoralQ. and can be handled more easily
             }
             else {
-                Map<String, Object> operatorGroup = parseOperatorNode(node
-                        .getChild(i).getChild(0));
+                Map<String, Object> operatorGroup = parseOperatorNode(
+                        node.getChild(i).getChild(0));
                 String groupType;
                 try {
                     groupType = (String) operatorGroup.get("groupType");
@@ -704,19 +693,22 @@
                     groupType = "relation";
                 }
                 if (groupType.equals("relation")
-//                        || groupType.equals("treeRelation")
-                    ) {
-                    group = KoralObjectGenerator.makeGroup(KoralOperation.RELATION);
+                //                        || groupType.equals("treeRelation")
+                ) {
+                    group = KoralObjectGenerator
+                            .makeGroup(KoralOperation.RELATION);
                     Map<String, Object> relation = new HashMap<String, Object>();
                     putAllButGroupType(relation, operatorGroup);
                     group.put("relType", relation);
                 }
                 else if (groupType.equals("sequence")) {
-                    group = KoralObjectGenerator.makeGroup(KoralOperation.SEQUENCE);
+                    group = KoralObjectGenerator
+                            .makeGroup(KoralOperation.SEQUENCE);
                     putAllButGroupType(group, operatorGroup);
                 }
                 else if (groupType.equals("hierarchy")) {
-                    group = KoralObjectGenerator.makeGroup(KoralOperation.HIERARCHY);
+                    group = KoralObjectGenerator
+                            .makeGroup(KoralOperation.HIERARCHY);
                     putAllButGroupType(group, operatorGroup);
                 }
                 else if (groupType.equals("position")) {
@@ -728,13 +720,13 @@
                 // (see following 'if')
                 operands = (ArrayList<Object>) group.get("operands");
 
-                ParseTree leftChildSpec = getFirstChildWithCat(node.getChild(i)
-                        .getChild(0), "@l");
-                ParseTree rightChildSpec = getFirstChildWithCat(node
-                        .getChild(i).getChild(0), "@r");
+                ParseTree leftChildSpec = getFirstChildWithCat(
+                        node.getChild(i).getChild(0), "@l");
+                ParseTree rightChildSpec = getFirstChildWithCat(
+                        node.getChild(i).getChild(0), "@r");
                 if (leftChildSpec != null || rightChildSpec != null) {
-                    KoralFrame frame = (leftChildSpec != null) ? KoralFrame.STARTS_WITH
-                            : KoralFrame.ENDS_WITH;
+                    KoralFrame frame = (leftChildSpec != null)
+                            ? KoralFrame.STARTS_WITH : KoralFrame.ENDS_WITH;
                     ArrayList<KoralFrame> frames = new ArrayList<KoralFrame>();
                     frames.add(frame);
                     Map<String, Object> positionGroup = KoralObjectGenerator
@@ -849,46 +841,45 @@
 
 
     @SuppressWarnings("unchecked")
-    private Map<String, Object> parseOperatorNode (
-            ParseTree operatorNode) {
+    private Map<String, Object> parseOperatorNode (ParseTree operatorNode) {
         Map<String, Object> relation = null;
         String operator = getNodeCat(operatorNode);
         // DOMINANCE
         if (operator.equals("dominance")) {
-//            relation = KoralObjectGenerator.makeRelation();
+            //            relation = KoralObjectGenerator.makeRelation();
             relation = new HashMap<String, Object>();
             relation.put("groupType", "hierarchy");
-//            ParseTree qName = getFirstChildWithCat(operatorNode, "qName");
+            //            ParseTree qName = getFirstChildWithCat(operatorNode, "qName");
             ParseTree edgeSpecNode = getFirstChildWithCat(operatorNode,
                     "edgeSpec");
             ParseTree star = getFirstChildWithCat(operatorNode, "*");
             ParseTree rangeSpec = getFirstChildWithCat(operatorNode,
                     "rangeSpec");
-            
-//            term.put("layer", "c");
-//            if (qName != null)
-//                term = parseQNameNode(qName);
+
+            //            term.put("layer", "c");
+            //            if (qName != null)
+            //                term = parseQNameNode(qName);
             if (edgeSpecNode != null) {
-                Map<String, Object> term = KoralObjectGenerator
-                        .makeTerm();
+                Map<String, Object> term = KoralObjectGenerator.makeTerm();
                 Map<String, Object> edgeSpec = parseEdgeSpec(edgeSpecNode);
                 String edgeSpecType = (String) edgeSpec.get("@type");
                 if (edgeSpecType.equals("koral:termGroup")) {
                     ((ArrayList<Object>) edgeSpec.get("operands")).add(term);
-//                    term = edgeSpec;
+                    //                    term = edgeSpec;
                 }
-//                else {
-//                    term = KoralObjectGenerator.makeTermGroup(KoralTermGroupRelation.AND);
-//                    ArrayList<Object> termGroupOperands = (ArrayList<Object>) term
-//                            .get("operands");
-//                    termGroupOperands.add(edgeSpec);
-//                    Map<String, Object> constTerm = KoralObjectGenerator
-//                            .makeTerm();
-//                    constTerm.put("layer", "c");
-//                    termGroupOperands.add(constTerm);
-//                }
+                //                else {
+                //                    term = KoralObjectGenerator.makeTermGroup(KoralTermGroupRelation.AND);
+                //                    ArrayList<Object> termGroupOperands = (ArrayList<Object>) term
+                //                            .get("operands");
+                //                    termGroupOperands.add(edgeSpec);
+                //                    Map<String, Object> constTerm = KoralObjectGenerator
+                //                            .makeTerm();
+                //                    constTerm.put("layer", "c");
+                //                    termGroupOperands.add(constTerm);
+                //                }
                 term = edgeSpec;
-                Map<String, Object> relType = KoralObjectGenerator.makeRelation();
+                Map<String, Object> relType = KoralObjectGenerator
+                        .makeRelation();
                 relType.put("wrap", term);
                 relation.put("relType", relType);
             }
@@ -902,28 +893,49 @@
             relation = KoralObjectGenerator.makeRelation();
             relation.put("groupType", "relation");
             ParseTree qName = getFirstChildWithCat(operatorNode, "qName");
-            ParseTree edgeSpec = getFirstChildWithCat(operatorNode, "edgeAnno");
+            ParseTree edgeType = getFirstChildWithCat(operatorNode, "edgeType");
+            ParseTree edgeSpec = getFirstChildWithCat(operatorNode, "edgeSpec");
             ParseTree star = getFirstChildWithCat(operatorNode, "*");
             ParseTree rangeSpec = getFirstChildWithCat(operatorNode,
                     "rangeSpec");
-            Map<String, Object> term = KoralObjectGenerator
-                    .makeTerm();
-            if (qName != null){
-                term.putAll(parseQNameNode(qName));
-                relation.put("wrap", term);
+            Map<String, Object> type = KoralObjectGenerator.makeTerm();
+            if (qName != null) {
+                type.putAll(parseQNameNode(qName));
             }
-            if (edgeSpec != null){
-                term.putAll(parseEdgeSpec(edgeSpec));
-                Map<String, Object> relType = KoralObjectGenerator.makeRelation();
-                relType.put("wrap", term);
-                relation.put("relType", relType);
+            else if (edgeType != null) {
+                type.putAll(parseEdgeAnno(edgeType, "key"));
             }
+
+            Map<String, Object> label = KoralObjectGenerator.makeTerm();
+            if (edgeSpec != null) {
+                label.putAll(parseEdgeSpec(edgeSpec));
+                relation.put("wrap", label);
+            }
+
+            if (qName != null || edgeType != null) {
+                if (edgeSpec == null) {
+                    relation.put("wrap", type);
+                }
+                else {
+                    Map<String, Object> termgroup = KoralObjectGenerator
+                            .makeTermGroup(KoralTermGroupRelation.AND);
+                    ArrayList<Object> termGroupOperands = (ArrayList<Object>) termgroup
+                            .get("operands");
+                    termGroupOperands.add(type);
+                    termGroupOperands.add(label);
+                    relation.put("wrap", termgroup);
+                }
+            }
+            else if (!label.isEmpty()) {
+                relation.put("wrap", label);
+            }
+
             if (star != null)
                 relation.put("boundary",
                         KoralObjectGenerator.makeBoundary(0, null));
             if (rangeSpec != null)
                 relation.put("boundary", boundaryFromRangeSpec(rangeSpec));
-            
+
         }
         else if (operator.equals("precedence")) {
             relation = new HashMap<String, Object>();
@@ -1021,9 +1033,10 @@
         }
     }
 
-    private Map<String, Object> parseEdgeAnno (ParseTree edgeAnnoSpec) {
-        Map<String, Object> edgeAnno = KoralObjectGenerator
-                .makeTerm();
+
+    private Map<String, Object> parseEdgeAnno (ParseTree edgeAnnoSpec,
+            String name) {
+        Map<String, Object> edgeAnno = KoralObjectGenerator.makeTerm();
         ParseTree textSpecNode = getFirstChildWithCat(edgeAnnoSpec, "textSpec");
         ParseTree keyNode = getFirstChildWithCat(edgeAnnoSpec, "key");
         ParseTree layerNode = getFirstChildWithCat(edgeAnnoSpec, "layer");
@@ -1031,28 +1044,32 @@
         ParseTree matchOperatorNode = getFirstChildWithCat(edgeAnnoSpec,
                 "eqOperator");
         if (foundryNode != null)
-            edgeAnno.put("foundry", foundryNode.getChild(0)
-                    .toStringTree(parser));
+            edgeAnno.put("foundry",
+                    foundryNode.getChild(0).toStringTree(parser));
         if (layerNode != null)
             edgeAnno.put("layer", layerNode.getChild(0).toStringTree(parser));
         if (keyNode != null)
             edgeAnno.put("key", keyNode.getChild(0).toStringTree(parser));
-        edgeAnno.putAll(parseTextSpec(textSpecNode, "value"));
+        edgeAnno.putAll(parseTextSpec(textSpecNode, name));
         edgeAnno.put("match", parseMatchOperator(matchOperatorNode));
         return edgeAnno;
     }
 
 
-    private Map<String, Object> boundaryFromRangeSpec (
-            ParseTree rangeSpec) {
+    private Map<String, Object> parseEdgeAnno (ParseTree edgeAnnoSpec) {
+        return parseEdgeAnno(edgeAnnoSpec, "value");
+    }
+
+
+    private Map<String, Object> boundaryFromRangeSpec (ParseTree rangeSpec) {
         return boundaryFromRangeSpec(rangeSpec, true);
     }
 
 
-    private Map<String, Object> boundaryFromRangeSpec (
-            ParseTree rangeSpec, boolean expandToMax) {
-        Integer min = Integer.parseInt(rangeSpec.getChild(0).toStringTree(
-                parser));
+    private Map<String, Object> boundaryFromRangeSpec (ParseTree rangeSpec,
+            boolean expandToMax) {
+        Integer min = Integer
+                .parseInt(rangeSpec.getChild(0).toStringTree(parser));
         Integer max = min;
         if (expandToMax)
             max = null;
@@ -1080,10 +1097,12 @@
         return KoralObjectGenerator.makeDistance("w", min, max);
     }
 
+
     private Map<String, Object> parseTextSpec (ParseTree node) {
         return parseTextSpec(node, "key");
     }
-    
+
+
     private Map<String, Object> parseTextSpec (ParseTree node, String name) {
         Map<String, Object> term = new HashMap<String, Object>();
         if (hasChild(node, "regex")) {
@@ -1184,8 +1203,8 @@
             parser.addErrorListener(errorListener);
             // Get starting rule from parser
             Method startRule = AqlParser.class.getMethod("start");
-            tree = (ParserRuleContext) startRule
-                    .invoke(parser, (Object[]) null);
+            tree = (ParserRuleContext) startRule.invoke(parser,
+                    (Object[]) null);
         }
         // Some things went wrong ...
         catch (Exception e) {
diff --git a/src/test/java/de/ids_mannheim/korap/query/test/annis/DominanceTests.java b/src/test/java/de/ids_mannheim/korap/query/test/annis/DominanceTests.java
index 11d0a3b..5a85703 100644
--- a/src/test/java/de/ids_mannheim/korap/query/test/annis/DominanceTests.java
+++ b/src/test/java/de/ids_mannheim/korap/query/test/annis/DominanceTests.java
@@ -147,7 +147,7 @@
         query = "node & node & #1 >2,4 #2";
         qs.setQuery(query, "annis");
         res = mapper.readTree(qs.toJSON());
-        System.out.println(res.asText());
+
         assertEquals("koral:group", res.at("/query/@type").asText());
         assertEquals("operation:hierarchy",
                 res.at("/query/operation").asText());
@@ -166,7 +166,7 @@
 
 
     @Test
-    public void testDominanceWithType ()
+    public void testDominanceWithLabel ()
             throws JsonProcessingException, IOException {
         query = "\"Mann\" & node & #2 >[func=\"SBJ\"] #1";
         //coordinates the func=SB term and requires a "c"-layer term (consituency relation/dominance)
@@ -184,7 +184,7 @@
 
 
     @Test
-    public void testDominanceWithLayerAndType ()
+    public void testDominanceWithLayerAndLabel ()
             throws JsonProcessingException, IOException {
         query = "\"Mann\" & node & #2 >[c:func=\"SBJ\"] #1";
         qs.setQuery(query, "annis");
@@ -201,7 +201,7 @@
 
 
     @Test
-    public void testDominanceWithMultipleTypes ()
+    public void testDominanceWithMultipleLabels ()
             throws JsonProcessingException, IOException {
         query = "corenlp/c=\"VP\" & corenlp/c=\"NP\" & #1 >[corenlp/c:func=\"PP\" corenlp/c:func=\"PN\"] #2";
         qs.setQuery(query, "annis");
diff --git a/src/test/java/de/ids_mannheim/korap/query/test/annis/RelationTests.java b/src/test/java/de/ids_mannheim/korap/query/test/annis/RelationTests.java
index 544f94b..fb243d9 100644
--- a/src/test/java/de/ids_mannheim/korap/query/test/annis/RelationTests.java
+++ b/src/test/java/de/ids_mannheim/korap/query/test/annis/RelationTests.java
@@ -1,5 +1,8 @@
 package de.ids_mannheim.korap.query.test.annis;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import java.io.IOException;
 
 import org.junit.Test;
@@ -17,32 +20,159 @@
     private ObjectMapper mapper = new ObjectMapper();
     private JsonNode res;
 
+
     @Test
     public void testTypedRelationWithArbritraryNodes ()
             throws JsonProcessingException, IOException {
         query = "node & node & #1 ->malt/d=\"PP\" #2";
         qs.setQuery(query, "annis");
         res = mapper.readTree(qs.toJSON());
-        System.out.println(res.asText());
+        //        System.out.println(res.asText());
+
+        assertEquals("koral:group", res.at("/query/@type").asText());
+        assertEquals("operation:relation", res.at("/query/operation").asText());
+        assertEquals("koral:span", res.at("/query/operands/0/@type").asText());
+        assertEquals("koral:span", res.at("/query/operands/1/@type").asText());
+
+        assertEquals("koral:relation", res.at("/query/relType/@type").asText());
+        assertEquals("koral:term",
+                res.at("/query/relType/wrap/@type").asText());
+        assertEquals("malt", res.at("/query/relType/wrap/foundry").asText());
+        assertEquals("d", res.at("/query/relType/wrap/layer").asText());
+        assertEquals("match:eq", res.at("/query/relType/wrap/match").asText());
+        assertEquals("PP", res.at("/query/relType/wrap/key").asText());
+        assertTrue(res.at("/query/relType/wrap/value").isMissingNode());
     }
-    
+
+
+    @Test
+    public void testFoundryLayerTypedRelationWithArbritraryNodes ()
+            throws JsonProcessingException, IOException {
+        query = "node & node & #1 ->malt/d #2";
+        qs.setQuery(query, "annis");
+        res = mapper.readTree(qs.toJSON());
+
+        assertEquals("koral:group", res.at("/query/@type").asText());
+        assertEquals("operation:relation", res.at("/query/operation").asText());
+
+        assertEquals("koral:relation", res.at("/query/relType/@type").asText());
+        assertEquals("koral:term",
+                res.at("/query/relType/wrap/@type").asText());
+        assertEquals("malt", res.at("/query/relType/wrap/foundry").asText());
+        assertEquals("d", res.at("/query/relType/wrap/layer").asText());
+        assertTrue(res.at("/query/relType/wrap/key").isMissingNode());
+        assertTrue(res.at("/query/relType/wrap/value").isMissingNode());
+    }
+
+
     @Test
     public void testTypedRelation ()
             throws JsonProcessingException, IOException {
         query = "corenlp/c=\"VP\" & corenlp/c=\"NP\" & #1 ->malt/d=\"PP\" #2";
         qs.setQuery(query, "annis");
         res = mapper.readTree(qs.toJSON());
+
+        assertEquals("koral:group", res.at("/query/@type").asText());
+        assertEquals("operation:relation", res.at("/query/operation").asText());
+        assertEquals("koral:span", res.at("/query/operands/0/@type").asText());
+        assertEquals("VP", res.at("/query/operands/0/key").asText());
+        assertEquals("c", res.at("/query/operands/0/layer").asText());
+        assertEquals("koral:span", res.at("/query/operands/1/@type").asText());
+        assertEquals("NP", res.at("/query/operands/1/key").asText());
+        assertEquals("c", res.at("/query/operands/1/layer").asText());
+
+        assertEquals("koral:relation", res.at("/query/relType/@type").asText());
+        assertEquals("koral:term",
+                res.at("/query/relType/wrap/@type").asText());
+        assertEquals("malt", res.at("/query/relType/wrap/foundry").asText());
+        assertEquals("d", res.at("/query/relType/wrap/layer").asText());
+        assertEquals("match:eq", res.at("/query/relType/wrap/match").asText());
+        assertEquals("PP", res.at("/query/relType/wrap/key").asText());
+        assertTrue(res.at("/query/relType/wrap/value").isMissingNode());
     }
 
+    @Test
+    public void testIndirectTypedRelation ()
+            throws JsonProcessingException, IOException {
+        query = "corenlp/c=\"VP\" & corenlp/c=\"NP\" & #1 ->malt/d=\"PP\" * #2";
+        qs.setQuery(query, "annis");
+        res = mapper.readTree(qs.toJSON());
+        
+        assertEquals("koral:relation", res.at("/query/relType/@type").asText());
+        assertEquals("koral:term",
+                res.at("/query/relType/wrap/@type").asText());
+        assertEquals("malt", res.at("/query/relType/wrap/foundry").asText());
+        assertEquals("d", res.at("/query/relType/wrap/layer").asText());
+        assertEquals("match:eq", res.at("/query/relType/wrap/match").asText());
+        assertEquals("PP", res.at("/query/relType/wrap/key").asText());
+        assertTrue(res.at("/query/relType/wrap/value").isMissingNode());
+        
+        assertEquals("koral:boundary", res.at("/query/relType/boundary/@type").asText());
+        assertEquals(0, res.at("/query/relType/boundary/min").asInt());
+        assertTrue(res.at("/query/relType/boundary/max").isMissingNode());
+    }
+    
+    @Test
+    public void testSpecificIndirectTypedRelation ()
+            throws JsonProcessingException, IOException {
+        query = "corenlp/c=\"VP\" & corenlp/c=\"NP\" & #1 ->malt/d=\"PP\" 2,4 #2";
+        qs.setQuery(query, "annis");
+        res = mapper.readTree(qs.toJSON());
+        
+        assertEquals("koral:boundary", res.at("/query/relType/boundary/@type").asText());
+        assertEquals(2, res.at("/query/relType/boundary/min").asInt());
+        assertEquals(4, res.at("/query/relType/boundary/max").asInt());
+    }
 
     @Test
     public void testTypedRelationWithLabel ()
             throws JsonProcessingException, IOException {
-        query = "corenlp/c=\"VP\" & corenlp/c=\"NP\" & #1 ->malt/d=\"PP\"[func=\"SB\"] #2";
+        query = "corenlp/c=\"VP\" & corenlp/c=\"NP\" & "
+                + "#1 ->malt/d=\"PP\"[func=\"SBJ\"] #2";
         qs.setQuery(query, "annis");
         res = mapper.readTree(qs.toJSON());
+        
+        assertEquals("koral:relation", res.at("/query/relType/@type").asText());
+        assertEquals("koral:termGroup",
+                res.at("/query/relType/wrap/@type").asText());
+        assertEquals("relation:and",
+                res.at("/query/relType/wrap/relation").asText());
+        assertEquals("malt", res.at("/query/relType/wrap/operands/0/foundry").asText());
+        assertEquals("d", res.at("/query/relType/wrap/operands/0/layer").asText());
+        assertEquals("PP", res.at("/query/relType/wrap/operands/0/key").asText());
+        assertTrue(res.at("/query/relType/wrap/operands/0/value").isMissingNode());
+        
+        assertEquals("match:eq", res.at("/query/relType/wrap/operands/1/match").asText());
+        assertTrue(res.at("/query/relType/wrap/operands/1/layer").isMissingNode());
+        assertEquals("func", res.at("/query/relType/wrap/operands/1/key").asText());
+        assertEquals("SBJ", res.at("/query/relType/wrap/operands/1/value").asText());
     }
 
+    // fix me
+    @Test
+    public void testTypedRelationWithMultipleLabels ()
+            throws JsonProcessingException, IOException {
+        query = "corenlp/c=\"VP\" & corenlp/c=\"NP\" & "
+                + "#1 ->malt/d=\"PP\"[func=\"SBJ\" func!=\"ADV\"] #2";
+        qs.setQuery(query, "annis");
+        res = mapper.readTree(qs.toJSON());
+        
+//        assertEquals("koral:relation", res.at("/query/relType/@type").asText());
+//        assertEquals("koral:termGroup",
+//                res.at("/query/relType/wrap/@type").asText());
+//        assertEquals("relation:and",
+//                res.at("/query/relType/wrap/relation").asText());
+//        assertEquals("malt", res.at("/query/relType/wrap/operands/0/foundry").asText());
+//        assertEquals("d", res.at("/query/relType/wrap/operands/0/layer").asText());
+//        assertEquals("PP", res.at("/query/relType/wrap/operands/0/key").asText());
+//        assertTrue(res.at("/query/relType/wrap/operands/0/value").isMissingNode());
+//        
+//        assertEquals("match:eq", res.at("/query/relType/wrap/operands/1/match").asText());
+//        assertTrue(res.at("/query/relType/wrap/operands/1/layer").isMissingNode());
+//        assertEquals("func", res.at("/query/relType/wrap/operands/1/key").asText());
+//        assertEquals("SBJ", res.at("/query/relType/wrap/operands/1/value").asText());
+    }
+    
     //  
     //  @Test
     //  public void testPointingRelations() throws Exception {
