Cleanup and initial position frames
diff --git a/src/main/java/de/ids_mannheim/korap/KorapQuery.java b/src/main/java/de/ids_mannheim/korap/KorapQuery.java
index 9ad167c..027161f 100644
--- a/src/main/java/de/ids_mannheim/korap/KorapQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/KorapQuery.java
@@ -333,9 +333,10 @@
 
         case "operation:or": // Deprecated in favor of operation:junction
             return this._operationJunctionFromJson(operands);
-
+            /*
         case "operation:submatch": // Deprecated in favor of korap:reference
             return this._operationSubmatchFromJson(json, operands);
+            */
         };
 
         // Unknown
@@ -360,7 +361,7 @@
         if (operands.size() != 2)
             throw new QueryException(705, "Number of operands is not acceptable");
 
-        String frame = "contains";
+        String frame = "isAround";
         // Temporary workaround for wrongly set overlaps
         if (json.has("frames")) {
             JsonNode frameN = json.get("frames");
@@ -372,6 +373,8 @@
         }
         // <legacyCode>
         else if (json.has("frame")) {
+            this.addMessage(0, "Frame is deprecated");
+
             JsonNode frameN = json.get("frame");
             if (frameN != null && frameN.isValueNode())
                 frame = frameN.asText().substring(6);
@@ -383,17 +386,17 @@
         // Byte flag - should cover all 13 cases, i.e. two bytes long
         byte flag = WITHIN;
         switch (frame) {
-        case "contains":
+        case "isAround":
             break;
         case "strictlyContains":
             flag = REAL_WITHIN;
             break;
-        case "within":
+        case "isWithin":
             break;
-        case "startswith":
+        case "startsWith":
             flag = STARTSWITH;
             break;
-        case "endswith":
+        case "endsWith":
             flag = ENDSWITH;
             break;
         case "matches":
@@ -401,6 +404,10 @@
             break;
         case "overlaps":
             flag = OVERLAP;
+            this.addWarning(
+                769,
+                "Overlap variant currently interpreted as overlap"
+            );
             break;
         case "overlapsLeft":
             // Temporary workaround
@@ -421,6 +428,9 @@
         case "strictlyOverlaps":
             flag = REAL_OVERLAP;
             break;
+
+            // alignsLeft
+
         default:
             throw new QueryException(706, "Frame type is unknown");
         };
@@ -551,6 +561,7 @@
         }
         // <legacyCode>
         else if (json.has("class")) {
+            this.addMessage(0, "Class is deprecated");
             number = json.get("class").asInt(0);
         };
         // </legacyCode>
diff --git a/src/main/java/de/ids_mannheim/korap/query/FrameConstraint.java b/src/main/java/de/ids_mannheim/korap/query/FrameConstraint.java
new file mode 100644
index 0000000..d035463
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/query/FrameConstraint.java
@@ -0,0 +1,202 @@
+package de.ids_mannheim.korap.query;
+import de.ids_mannheim.korap.util.QueryException;
+import java.util.*;
+
+/**
+ * Class representing a frame constraint as a bit vector.
+ *
+ * @author diewald
+ */
+public class FrameConstraint {
+
+    public static final Integer FRAME_ALL = 1024 * 8 - 1;
+    private static final Map<String,Integer> FRAME;
+    static {
+        Map<String, Integer> FRAME_t = new HashMap<>();
+
+        /*
+         * A precedes B
+         *
+         * |-A-|
+         *       |-B-|
+         *
+         * A.end < B.start
+         */
+        FRAME_t.put("precedes", 1);
+
+        /*
+         * A precedes B directly
+         *
+         * |-A-|
+         *     |-B-|
+         *
+         * A.end == b.start
+         */
+        FRAME_t.put("precedesDirectly", 1 << 1);
+
+        /*
+         * A overlaps B to the left
+         *
+         * |-A-|
+         *    |-B-|
+         *
+         * a.end < b.end && a.end > b.start && a.start < b.start
+         */
+        FRAME_t.put("overlapsLeft", 1 << 2);
+
+        /*
+         * A aligns B to the left
+         *
+         * |-A-|
+         * |-B--|
+         *
+         * a.end < b.end && a.start == b.start
+         */
+        FRAME_t.put("alignsLeft", 1 << 3);
+        
+        /*
+         * A starts with B
+         *
+         * |-A--|
+         * |-B-|
+         *
+         * a.end > b.end && a.start == b.start
+         */
+        FRAME_t.put("startsWith", 1 << 4);
+        
+        /*
+         * A matches B
+         *
+         * |-A-|
+         * |-B-|
+         *
+         * a.end = b.end && a.start = b.start
+         */
+        FRAME_t.put("matches", 1 << 5);
+        
+        /*
+         * A is within B
+         *
+         *  |-A-|
+         * |--B--|
+         *
+         * a.end < b.end && a.start > b.start
+         */
+        FRAME_t.put("isWithin", 1 << 6);
+
+        /*
+         * A is around B
+         *
+         * |--A--|
+         *  |-B-|
+         *
+         * a.start < b.start && a.end > b.end
+         */
+        FRAME_t.put("isAround", 1 << 7);
+
+        /*
+         * A ends with B
+         *
+         * |-A--|
+         *  |-B-|
+         *
+         * a.start < b.start && a.end == b.end
+         */
+        FRAME_t.put("endsWith", 1 << 8);
+
+        /*
+         * A aligns B to the right
+         *
+         *  |-A-|
+         * |--B-|
+         *
+         * a.start > b.start && a.end == b.end
+         */
+        FRAME_t.put("alignsRight", 1 << 9);
+
+        /*
+         * A overlaps B to the right
+         *
+         *  |-A-|
+         * |-B-|
+         *
+         * a.start > b.start && a.start < b.end && && a.end > b.end
+         */
+        FRAME_t.put("overlapsRight", 1 << 10);
+
+        /*
+         * A succeeds B directly
+         *
+         *     |-A-|
+         * |-B-|
+         *
+         * a.start == b.end
+         */
+        FRAME_t.put("succeedsDirectly", 1 << 11);
+
+        /*
+         * A succeeds B
+         *
+         *       |-A-|
+         * |-B-|
+         *
+         * a.start > b.end
+         */
+        FRAME_t.put("succeeds", 1 << 12);
+        FRAME = Collections.unmodifiableMap(FRAME_t);
+    };
+
+    // Bitvector representing the frame constraint
+    public int vector;
+
+    public FrameConstraint () {
+        this.vector = 0;
+    };
+
+    public FrameConstraint or (String constraint) throws QueryException {
+        int or = FRAME.get(constraint);
+        if (or == 0)
+            throw new QueryException(706, "Frame type is unknown");
+
+        this.vector |= or;
+        return this;
+    };
+
+    public FrameConstraint or (FrameConstraint constraint) {
+        this.vector |= constraint.vector;
+        return this;
+    };
+
+    public FrameConstraint invert () {
+        this.vector ^= FRAME_ALL;
+        return this;
+    };
+
+
+    /**
+     * Check for constraint per bit vector.
+     */
+    public boolean check (int check) {
+        return (this.vector & check) != 0;
+    };
+
+
+    /**
+     * Check for constraint per FrameConstraint.
+     */
+    public boolean check (FrameConstraint check) {
+        return (this.vector & check.vector) != 0;
+    };
+
+
+    /**
+     * Check for constraint per string.
+     */
+    public boolean check (String constraint) throws QueryException {
+        int check = FRAME.get(constraint);
+        if (check == 0)
+            throw new QueryException(706, "Frame type is unknown");
+
+        return this.check(check);
+    };
+};
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanWithinQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanWithinQuery.java
index e0d23cd..c25b187 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanWithinQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanWithinQuery.java
@@ -13,17 +13,18 @@
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermContext;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.util.Bits;
-import org.apache.lucene.util.ToStringUtils;
-import org.apache.lucene.search.spans.SpanQuery;
 import org.apache.lucene.index.AtomicReaderContext;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.spans.SpanQuery;
 import org.apache.lucene.search.spans.Spans;
 import org.apache.lucene.search.spans.SpanTermQuery;
+import org.apache.lucene.util.Bits;
+import org.apache.lucene.util.ToStringUtils;
 
 import de.ids_mannheim.korap.query.spans.WithinSpans;
 import de.ids_mannheim.korap.query.SpanElementQuery;
 
+
 /**
  * Matches spans that are within certain elements.
  */
@@ -35,75 +36,80 @@
     private boolean collectPayloads;
 
     public static final byte
-	OVERLAP      = WithinSpans.OVERLAP,
-	REAL_OVERLAP = WithinSpans.REAL_OVERLAP,
-	WITHIN       = WithinSpans.WITHIN,
-	REAL_WITHIN  = WithinSpans.REAL_WITHIN,
-	ENDSWITH     = WithinSpans.ENDSWITH,
-	STARTSWITH   = WithinSpans.STARTSWITH,
-	MATCH        = WithinSpans.MATCH;
+        OVERLAP      = WithinSpans.OVERLAP,
+        REAL_OVERLAP = WithinSpans.REAL_OVERLAP,
+        WITHIN       = WithinSpans.WITHIN,
+        REAL_WITHIN  = WithinSpans.REAL_WITHIN,
+        ENDSWITH     = WithinSpans.ENDSWITH,
+        STARTSWITH   = WithinSpans.STARTSWITH,
+        MATCH        = WithinSpans.MATCH;
 
     // may support "starting" and "ending"
 
+
     // Constructor
     public SpanWithinQuery (SpanQuery wrap,
-			    SpanQuery embedded,
-			    byte flag,
-			    boolean collectPayloads) {
+                            SpanQuery embedded,
+                            byte flag,
+                            boolean collectPayloads) {
 
-	this.field = embedded.getField();
-	this.embedded = embedded;
-	this.wrap = wrap;
-	this.flag = flag;
-	this.collectPayloads = collectPayloads;
-    };
-
-    // Constructor
-    public SpanWithinQuery(String element,
-			   SpanQuery embedded) {
-	this(element, embedded, WITHIN, true);
-    };
-
-    // Constructor
-    public SpanWithinQuery (String element,
-			    SpanQuery embedded,
-			    byte flag,
-			    boolean collectPayloads) {
-	this(
-	     (SpanQuery) new SpanElementQuery(embedded.getField(), element),
-	     embedded,
-	     flag,
-	     collectPayloads
-	);
+        this.field = embedded.getField();
+        this.embedded = embedded;
+        this.wrap = wrap;
+        this.flag = flag;
+        this.collectPayloads = collectPayloads;
     };
 
 
     // Constructor
     public SpanWithinQuery(String element,
-			   SpanQuery embedded,
-			   byte flag) {
-	this(element, embedded, flag, true);
+                           SpanQuery embedded) {
+        this(element, embedded, WITHIN, true);
     };
 
+
     // Constructor
     public SpanWithinQuery (String element,
-			    SpanQuery embedded,
-			    boolean collectPayloads) {
-	this(element, embedded, WITHIN, collectPayloads);
+                            SpanQuery embedded,
+                            byte flag,
+                            boolean collectPayloads) {
+        this(
+             (SpanQuery) new SpanElementQuery(embedded.getField(), element),
+             embedded,
+             flag,
+             collectPayloads
+             );
+    };
+
+
+    // Constructor
+    public SpanWithinQuery(String element,
+                           SpanQuery embedded,
+                           byte flag) {
+        this(element, embedded, flag, true);
+    };
+
+
+    // Constructor
+    public SpanWithinQuery (String element,
+                            SpanQuery embedded,
+                            boolean collectPayloads) {
+        this(element, embedded, WITHIN, collectPayloads);
     };
 
 
     // Constructor
     public SpanWithinQuery(SpanQuery wrap,
-			   SpanQuery embedded,
-			   byte flag) {
-	this(wrap, embedded, flag, true);
+                           SpanQuery embedded,
+                           byte flag) {
+        this(wrap, embedded, flag, true);
     };
 
+
     // Constructor
     public SpanWithinQuery(SpanQuery wrap,
-			   SpanQuery embedded) {
-	this(wrap, embedded, WITHIN, true);
+                           SpanQuery embedded) {
+        this(wrap, embedded, WITHIN, true);
     };
 
 
@@ -112,122 +118,130 @@
     public SpanQuery wrap()     { return wrap;     };
     public SpanQuery embedded() { return embedded; };
     public byte flag()          { return flag; };
-  
+
+    
     @Override
     public void extractTerms(Set<Term> terms) {
-	embedded.extractTerms(terms);
+        embedded.extractTerms(terms);
     };
   
+
     @Override
     public String toString(String field) {
-	StringBuilder buffer = new StringBuilder();
-	buffer.append("span");
-	buffer.append(flagToString());
-	buffer.append("(");
+        StringBuilder buffer = new StringBuilder();
+        buffer.append("span");
+        buffer.append(flagToString());
+        buffer.append("(");
         buffer.append(wrap.toString());
         buffer.append(", ");
-	buffer.append(embedded.toString(field));
-	buffer.append(")");
-	buffer.append(ToStringUtils.boost(getBoost()));
-	return buffer.toString();
+        buffer.append(embedded.toString(field));
+        buffer.append(")");
+        buffer.append(ToStringUtils.boost(getBoost()));
+        return buffer.toString();
     };
     
+
     private String flagToString () {
-	switch (flag) {
-	case OVERLAP:
-	    return "Overlap";
-	case REAL_OVERLAP:
-	    return "OverlapStrict";
-	case WITHIN:
-	    return "Contain";
-	case REAL_WITHIN:
-	    return "ContainStrict";
-	case ENDSWITH:
-	    return "EndsWith";
-	case STARTSWITH:
-	    return "StartsWith";
-	case MATCH:
-	    return "Match";
-	};
-	return "Contains";
+        switch (flag) {
+        case OVERLAP:
+            return "Overlap";
+        case REAL_OVERLAP:
+            return "OverlapStrict";
+        case WITHIN:
+            return "Contain";
+        case REAL_WITHIN:
+            return "ContainStrict";
+        case ENDSWITH:
+            return "EndsWith";
+        case STARTSWITH:
+            return "StartsWith";
+        case MATCH:
+            return "Match";
+        };
+        return "Contains";
     };
 
+
     @Override
     public Spans getSpans (final AtomicReaderContext context,
-			   Bits acceptDocs,
-			   Map<Term,TermContext> termContexts) throws IOException {
-	return (Spans) new WithinSpans (
+                           Bits acceptDocs,
+                           Map<Term,TermContext> termContexts) throws IOException {
+        return (Spans) new WithinSpans (
             this, context, acceptDocs, termContexts, this.flag
-	);
+        );
     };
+    
 
     /*
      * Rewrite query in case it includes regular expressions or wildcards
      */
     @Override
     public Query rewrite (IndexReader reader) throws IOException {
-	SpanWithinQuery clone = null;
+        SpanWithinQuery clone = null;
 
-	// Does the embedded query needs a rewrite?
-	SpanQuery query = (SpanQuery) embedded.rewrite(reader);
-	if (query != embedded) {
-	    if (clone == null)
-		clone = this.clone();
-	    clone.embedded = query;
-	};
+        // Does the embedded query needs a rewrite?
+        SpanQuery query = (SpanQuery) embedded.rewrite(reader);
+        if (query != embedded) {
+            if (clone == null)
+                clone = this.clone();
+            clone.embedded = query;
+        };
 
-	// Does the wrap query needs a rewrite?
-	query = (SpanQuery) wrap.rewrite(reader);
-	if (query != wrap) {
-	    if (clone == null)
-		clone = this.clone();
-	    clone.wrap = query;
-	};
+        // Does the wrap query needs a rewrite?
+        query = (SpanQuery) wrap.rewrite(reader);
+        if (query != wrap) {
+            if (clone == null)
+                clone = this.clone();
+            clone.wrap = query;
+        };
 
-	// There is a clone and it is important
-	if (clone != null)
-	    return clone;
+        // There is a clone and it is important
+        if (clone != null)
+            return clone;
 
-	return this;
+        return this;
     };
   
 
     @Override
     public SpanWithinQuery clone () {
-	SpanWithinQuery spanWithinQuery = new SpanWithinQuery(
+        SpanWithinQuery spanWithinQuery = new SpanWithinQuery(
             (SpanQuery) wrap.clone(),
-	    (SpanQuery) embedded.clone(),
-	    this.flag,
-	    this.collectPayloads
+            (SpanQuery) embedded.clone(),
+            this.flag,
+            this.collectPayloads
         );
-	spanWithinQuery.setBoost(getBoost());
-	return spanWithinQuery;
+        spanWithinQuery.setBoost(getBoost());
+        return spanWithinQuery;
     };
 
 
-    /** Returns true iff <code>o</code> is equal to this. */
+    /**
+     * Returns true iff <code>o</code> is equal to this.
+     */
     @Override
     public boolean equals(Object o) {
-	if (this == o) return true;
-	if (!(o instanceof SpanWithinQuery)) return false;
-	
-	final SpanWithinQuery spanWithinQuery = (SpanWithinQuery) o;
-	
-	if (collectPayloads != spanWithinQuery.collectPayloads) return false;
-	if (!wrap.equals(spanWithinQuery.wrap)) return false;
-	if (!embedded.equals(spanWithinQuery.embedded)) return false;
-
-	return getBoost() == spanWithinQuery.getBoost();
+        if (this == o) return true;
+        if (!(o instanceof SpanWithinQuery)) return false;
+        
+        final SpanWithinQuery spanWithinQuery = (SpanWithinQuery) o;
+        
+        if (collectPayloads != spanWithinQuery.collectPayloads) return false;
+        if (!wrap.equals(spanWithinQuery.wrap)) return false;
+        if (!embedded.equals(spanWithinQuery.embedded)) return false;
+        
+        return getBoost() == spanWithinQuery.getBoost();
     };
 
+
     // I don't know what I am doing here
     @Override
     public int hashCode() {
-	int result = flag;
-	result = embedded.hashCode();
-	result += wrap.hashCode();
-	result ^= (result << 4) | (result >>> 29);
-	result += Float.floatToRawIntBits(getBoost());
-	return result;
+        int result = flag;
+        result = embedded.hashCode();
+        result += wrap.hashCode();
+        result ^= (result << 4) | (result >>> 29);
+        result += Float.floatToRawIntBits(getBoost());
+        return result;
     };
 };
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestFrameConstraint.java b/src/test/java/de/ids_mannheim/korap/query/TestFrameConstraint.java
new file mode 100644
index 0000000..37f038d
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/query/TestFrameConstraint.java
@@ -0,0 +1,201 @@
+package de.ids_mannheim.korap.query;
+
+import de.ids_mannheim.korap.query.FrameConstraint;
+import de.ids_mannheim.korap.util.QueryException;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Ignore;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * @author diewald
+ */
+@RunWith(JUnit4.class)
+public class TestFrameConstraint {
+
+    @Test
+    public void testInitialization () throws QueryException {
+        FrameConstraint fc = new FrameConstraint();
+        assertEquals(fc.check(1), false);
+    };
+
+    @Test
+    public void testBitVector () throws QueryException {
+        int a = 1;
+        int b = 1 << 1;
+
+        assertEquals(3, a ^ b);
+    };
+
+    @Test
+    public void testOr () throws QueryException {
+        FrameConstraint fc = new FrameConstraint();
+
+        // Nothing set
+        assertEquals(fc.check("precedes"),         false);
+        assertEquals(fc.check("precedesDirectly"), false);
+        assertEquals(fc.check("overlapsLeft"),     false);
+        assertEquals(fc.check("alignsLeft"),       false);
+        assertEquals(fc.check("startsWith"),       false);
+        assertEquals(fc.check("matches"),          false);
+        assertEquals(fc.check("isWithin"),         false);
+        assertEquals(fc.check("isAround"),         false);
+        assertEquals(fc.check("endsWith"),         false);
+        assertEquals(fc.check("alignsRight"),      false);
+        assertEquals(fc.check("overlapsRight"),    false);
+        assertEquals(fc.check("succeedsDirectly"), false);
+        assertEquals(fc.check("succeeds"),         false);
+
+        // Some or
+        fc.or("succeeds").or("succeedsDirectly");
+        assertEquals(fc.check("precedes"),         false);
+        assertEquals(fc.check("precedesDirectly"), false);
+        assertEquals(fc.check("overlapsLeft"),     false);
+        assertEquals(fc.check("alignsLeft"),       false);
+        assertEquals(fc.check("startsWith"),       false);
+        assertEquals(fc.check("matches"),          false);
+        assertEquals(fc.check("isWithin"),         false);
+        assertEquals(fc.check("isAround"),         false);
+        assertEquals(fc.check("endsWith"),         false);
+        assertEquals(fc.check("alignsRight"),      false);
+        assertEquals(fc.check("overlapsRight"),    false);
+        assertEquals(fc.check("succeedsDirectly"), true);
+        assertEquals(fc.check("succeeds"),         true);
+
+        // Moar or
+        fc.or("precedes").or("precedesDirectly");
+        assertEquals(fc.check("precedes"),         true);
+        assertEquals(fc.check("precedesDirectly"), true);
+        assertEquals(fc.check("overlapsLeft"),     false);
+        assertEquals(fc.check("alignsLeft"),       false);
+        assertEquals(fc.check("startsWith"),       false);
+        assertEquals(fc.check("matches"),          false);
+        assertEquals(fc.check("isWithin"),         false);
+        assertEquals(fc.check("isAround"),         false);
+        assertEquals(fc.check("endsWith"),         false);
+        assertEquals(fc.check("alignsRight"),      false);
+        assertEquals(fc.check("overlapsRight"),    false);
+        assertEquals(fc.check("succeedsDirectly"), true);
+        assertEquals(fc.check("succeeds"),         true);
+
+        // Moar or
+        fc.or("matches").or("startsWith");
+        assertEquals(fc.check("precedes"),         true);
+        assertEquals(fc.check("precedesDirectly"), true);
+        assertEquals(fc.check("overlapsLeft"),     false);
+        assertEquals(fc.check("alignsLeft"),       false);
+        assertEquals(fc.check("startsWith"),       true);
+        assertEquals(fc.check("matches"),          true);
+        assertEquals(fc.check("isWithin"),         false);
+        assertEquals(fc.check("isAround"),         false);
+        assertEquals(fc.check("endsWith"),         false);
+        assertEquals(fc.check("alignsRight"),      false);
+        assertEquals(fc.check("overlapsRight"),    false);
+        assertEquals(fc.check("succeedsDirectly"), true);
+        assertEquals(fc.check("succeeds"),         true);
+
+        // Invert
+        fc.invert();
+        assertEquals(fc.check("precedes"),         false);
+        assertEquals(fc.check("precedesDirectly"), false);
+        assertEquals(fc.check("overlapsLeft"),     true);
+        assertEquals(fc.check("alignsLeft"),       true);
+        assertEquals(fc.check("startsWith"),       false);
+        assertEquals(fc.check("matches"),          false);
+        assertEquals(fc.check("isWithin"),         true);
+        assertEquals(fc.check("isAround"),         true);
+        assertEquals(fc.check("endsWith"),         true);
+        assertEquals(fc.check("alignsRight"),      true);
+        assertEquals(fc.check("overlapsRight"),    true);
+        assertEquals(fc.check("succeedsDirectly"), false);
+        assertEquals(fc.check("succeeds"),         false);
+
+
+        fc.or("precedes").
+            or("precedesDirectly").
+            or("startsWith").
+            or("matches");
+        assertEquals(fc.check("precedes"),         true);
+        assertEquals(fc.check("precedesDirectly"), true);
+        assertEquals(fc.check("overlapsLeft"),     true);
+        assertEquals(fc.check("alignsLeft"),       true);
+        assertEquals(fc.check("startsWith"),       true);
+        assertEquals(fc.check("matches"),          true);
+        assertEquals(fc.check("isWithin"),         true);
+        assertEquals(fc.check("isAround"),         true);
+        assertEquals(fc.check("endsWith"),         true);
+        assertEquals(fc.check("alignsRight"),      true);
+        assertEquals(fc.check("overlapsRight"),    true);
+        assertEquals(fc.check("succeedsDirectly"), false);
+        assertEquals(fc.check("succeeds"),         false);
+
+        fc.or("succeeds").
+            or("succeedsDirectly");
+        assertEquals(fc.check("precedes"),         true);
+        assertEquals(fc.check("precedesDirectly"), true);
+        assertEquals(fc.check("overlapsLeft"),     true);
+        assertEquals(fc.check("alignsLeft"),       true);
+        assertEquals(fc.check("startsWith"),       true);
+        assertEquals(fc.check("matches"),          true);
+        assertEquals(fc.check("isWithin"),         true);
+        assertEquals(fc.check("isAround"),         true);
+        assertEquals(fc.check("endsWith"),         true);
+        assertEquals(fc.check("alignsRight"),      true);
+        assertEquals(fc.check("overlapsRight"),    true);
+        assertEquals(fc.check("succeedsDirectly"), true);
+        assertEquals(fc.check("succeeds"),         true);
+    };
+
+    @Test
+    public void testOrVector () throws QueryException {
+        FrameConstraint fc1 = new FrameConstraint();
+        // Some or
+        fc1.or("succeeds").or("succeedsDirectly");
+        assertEquals(fc1.check("precedes"),         false);
+        assertEquals(fc1.check("precedesDirectly"), false);
+        assertEquals(fc1.check("overlapsLeft"),     false);
+        assertEquals(fc1.check("alignsLeft"),       false);
+        assertEquals(fc1.check("startsWith"),       false);
+        assertEquals(fc1.check("matches"),          false);
+        assertEquals(fc1.check("isWithin"),         false);
+        assertEquals(fc1.check("isAround"),         false);
+        assertEquals(fc1.check("endsWith"),         false);
+        assertEquals(fc1.check("alignsRight"),      false);
+        assertEquals(fc1.check("overlapsRight"),    false);
+        assertEquals(fc1.check("succeedsDirectly"), true);
+        assertEquals(fc1.check("succeeds"),         true);
+
+        FrameConstraint fc2 = new FrameConstraint();
+        fc2.or("precedes").or("precedesDirectly");
+        assertEquals(fc2.check("precedes"),         true);
+        assertEquals(fc2.check("precedesDirectly"), true);
+        assertEquals(fc2.check("overlapsLeft"),     false);
+        assertEquals(fc2.check("alignsLeft"),       false);
+        assertEquals(fc2.check("startsWith"),       false);
+        assertEquals(fc2.check("matches"),          false);
+        assertEquals(fc2.check("isWithin"),         false);
+        assertEquals(fc2.check("isAround"),         false);
+        assertEquals(fc2.check("endsWith"),         false);
+        assertEquals(fc2.check("alignsRight"),      false);
+        assertEquals(fc2.check("overlapsRight"),    false);
+        assertEquals(fc2.check("succeedsDirectly"), false);
+        assertEquals(fc2.check("succeeds"),         false);
+
+        fc1.or(fc2);
+        assertEquals(fc1.check("precedes"),         true);
+        assertEquals(fc1.check("precedesDirectly"), true);
+        assertEquals(fc1.check("overlapsLeft"),     false);
+        assertEquals(fc1.check("alignsLeft"),       false);
+        assertEquals(fc1.check("startsWith"),       false);
+        assertEquals(fc1.check("matches"),          false);
+        assertEquals(fc1.check("isWithin"),         false);
+        assertEquals(fc1.check("isAround"),         false);
+        assertEquals(fc1.check("endsWith"),         false);
+        assertEquals(fc1.check("alignsRight"),      false);
+        assertEquals(fc1.check("overlapsRight"),    false);
+        assertEquals(fc1.check("succeedsDirectly"), true);
+        assertEquals(fc1.check("succeeds"),         true);
+    };
+};
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestKorapSearch.java b/src/test/java/de/ids_mannheim/korap/search/TestKorapSearch.java
index 87dc893..a4bbf12 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestKorapSearch.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestKorapSearch.java
@@ -1154,7 +1154,7 @@
 
         assertEquals(
             kr.getError(0).getMessage(),
-            "Number of operands is not acceptable"
+            "Operation needs operand list"
         );
     };
 
diff --git a/src/test/resources/queries/benchmark1.jsonld b/src/test/resources/queries/benchmark1.jsonld
index 79403b4..dccdeef 100644
--- a/src/test/resources/queries/benchmark1.jsonld
+++ b/src/test/resources/queries/benchmark1.jsonld
@@ -3,7 +3,7 @@
     "query": {
 	"@type": "korap:group", 
 	"operation": "operation:position", 
-	"frame": "frame:contains",
+	"frames": ["frames:isAround"],
 	"operands": [
 	    {
 		"@type": "korap:span",
diff --git a/src/test/resources/queries/benchmark1b.jsonld b/src/test/resources/queries/benchmark1b.jsonld
index aa1e729..5ee9791 100644
--- a/src/test/resources/queries/benchmark1b.jsonld
+++ b/src/test/resources/queries/benchmark1b.jsonld
@@ -3,7 +3,7 @@
     "query": {
 	"@type": "korap:group", 
 	"operation": "operation:position", 
-	"frame": "frame:contains",
+	"frames": ["frames:isAround"],
 	"operands": [
 	    {
 		"@type": "korap:span",
@@ -14,7 +14,7 @@
 	    {
 		"@type" : "korap:group",
 		"operation" : "operation:class",
-		"class" : 1,
+		"classOut" : 1,
 		"operands" : [
 		    {
 			"@type": "korap:token",
diff --git a/src/test/resources/queries/benchmark5-submatch.jsonld b/src/test/resources/queries/benchmark5-submatch.jsonld
index a9cad71..885b458 100644
--- a/src/test/resources/queries/benchmark5-submatch.jsonld
+++ b/src/test/resources/queries/benchmark5-submatch.jsonld
@@ -13,14 +13,13 @@
 		}
 	    },
 	    {
-		"@type" : "korap:group",
-		"operation" : "operation:submatch",
+		"@type" : "korap:reference",
 		"classRef" : [2],
 		"operands" : [
 		    {
 			"@type" : "korap:group",
 			"operation" : "operation:class",
-			"class" : 1,
+			"classOut" : 1,
 			"operands" : [
 			    {
 				"@type": "korap:group", 
@@ -37,7 +36,7 @@
 				    {
 					"@type" : "korap:group",
 					"operation" : "operation:class",
-					"class" : 2,
+					"classOut" : 2,
 					"operands" : [
 					    {
 						"@type": "korap:token",
diff --git a/src/test/resources/queries/benchmark5.jsonld b/src/test/resources/queries/benchmark5.jsonld
index 332d23f..1f64527 100644
--- a/src/test/resources/queries/benchmark5.jsonld
+++ b/src/test/resources/queries/benchmark5.jsonld
@@ -15,7 +15,7 @@
 	    {
 		"@type" : "korap:group",
 		"operation" : "operation:class",
-		"class" : 1,
+		"classOut" : 1,
 		"operands" : [
 		    {
 			"@type": "korap:group", 
@@ -32,7 +32,7 @@
 			    {
 				"@type" : "korap:group",
 				"operation" : "operation:class",
-				"class" : 2,
+				"classOut" : 2,
 				"operands" : [
 				    {
 					"@type": "korap:token",
diff --git a/src/test/resources/queries/bsp-bug.jsonld b/src/test/resources/queries/bsp-bug.jsonld
index 33bb904..e46374e 100644
--- a/src/test/resources/queries/bsp-bug.jsonld
+++ b/src/test/resources/queries/bsp-bug.jsonld
@@ -1,8 +1,7 @@
 {
   "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
   "query": {
-    "@type": "korap:group",
-    "operation" : "operation:submatch",
+    "@type": "korap:reference",
     "classRef" : [0],
     "operands" : []
   },
diff --git a/src/test/resources/queries/bsp-class-2.jsonld b/src/test/resources/queries/bsp-class-2.jsonld
index 162070f..4cccfa5 100644
--- a/src/test/resources/queries/bsp-class-2.jsonld
+++ b/src/test/resources/queries/bsp-class-2.jsonld
@@ -3,7 +3,7 @@
     "query" : {
       "@type" : "korap:group",
       "operation" : "operation:class",
-      "class" : 0,
+      "classOut" : 0,
       "operands" : [ {
         "@type" : "korap:token",
         "wrap" : {
diff --git a/src/test/resources/queries/bsp-class.jsonld b/src/test/resources/queries/bsp-class.jsonld
index b4fd65e..f095a47 100644
--- a/src/test/resources/queries/bsp-class.jsonld
+++ b/src/test/resources/queries/bsp-class.jsonld
@@ -3,7 +3,7 @@
   "query":{
     "@type":"korap:group",
     "operation" : "operation:class",
-   "class":1,
+   "classOut":1,
     "operands":[
       {
 	"@type":"korap:group",
diff --git a/src/test/resources/queries/bsp-fail1.jsonld b/src/test/resources/queries/bsp-fail1.jsonld
index 7425bc1..fc6fb51 100644
--- a/src/test/resources/queries/bsp-fail1.jsonld
+++ b/src/test/resources/queries/bsp-fail1.jsonld
@@ -2,7 +2,7 @@
   "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
     "query": {
         "@type": "korap:group", 
-        "frame": "frame:contains", 
+        "frames": ["frame:isAround"], 
         "operation": "operation:position"
         "operands": [
             {
diff --git a/src/test/resources/queries/bsp-fail2.jsonld b/src/test/resources/queries/bsp-fail2.jsonld
index dc4ace2..96a3bb5 100644
--- a/src/test/resources/queries/bsp-fail2.jsonld
+++ b/src/test/resources/queries/bsp-fail2.jsonld
@@ -3,7 +3,7 @@
   "query": {
     "@type": "korap:group", 
     "operation": "operation:position",
-    "frame": "frame:contains", 
+    "frames": ["frames:isAround"], 
     "operands": [
       {
         "@type": "korap:span", 
diff --git a/src/test/resources/queries/bsp-startswith.json b/src/test/resources/queries/bsp-startswith.json
index c986a5a..95df8b9 100644
--- a/src/test/resources/queries/bsp-startswith.json
+++ b/src/test/resources/queries/bsp-startswith.json
@@ -1 +1,13 @@
-{"@context":{"korap":"http://korap.ids-mannheim.de/ns/query","@language":"de","operands":{"@id":"korap:operands","@container":"@list"},"relation":{"@id":"korap:relation","@type":"korap:relation#types"},"class":{"@id":"korap:class","@type":"xsd:integer"},"query":"korap:query","filter":"korap:filter","meta":"korap:meta"},"query":{"@type":"korap:group","relation":"position","position":"startswith","operands":[{"@type":"korap:element","@value":"s"},{"@type":"korap:sequence","operands":[{"@type":"korap:group","class":"0","operands":[{"@type":"korap:token","@value":{"@type":"korap:term","@value":"tt_p:ADJA","relation":"="}}]},{"@type":"korap:token","@value":{"@type":"korap:term","@value":"mate_p:NN","relation":"="}}]}]},"meta":[{"@type":"korap:meta-filter","@value":{"@type":"korap:term","@field":"korap:field#corpusID","@value":"A00"}},{"@type":"korap:meta-extend","@value":{"@type":"korap:term","@field":"korap:field#corpusID","@value":"A01"}}],"startPage":1,"count":50,"context":{"left":["token",6],"right":["token",6]}}
+{
+  "@context":"http://korap.ids-mannheim.de/ns/query/context.json.ld",
+  "query":{
+    "@type":"korap:group",
+    "relation":"position",
+    "frames":[
+      "frames:startsWith"
+    ],
+    "operands":[
+      {
+	"@type":"korap:element",
+	"@value":"s"
+      },{"@type":"korap:sequence","operands":[{"@type":"korap:group","class":"0","operands":[{"@type":"korap:token","@value":{"@type":"korap:term","@value":"tt_p:ADJA","relation":"="}}]},{"@type":"korap:token","@value":{"@type":"korap:term","@value":"mate_p:NN","relation":"="}}]}]},"meta":[{"@type":"korap:meta-filter","@value":{"@type":"korap:term","@field":"korap:field#corpusID","@value":"A00"}},{"@type":"korap:meta-extend","@value":{"@type":"korap:term","@field":"korap:field#corpusID","@value":"A01"}}],"startPage":1,"count":50,"context":{"left":["token",6],"right":["token",6]}}
diff --git a/src/test/resources/queries/bsp10.jsonld b/src/test/resources/queries/bsp10.jsonld
index 643edc3..384175d 100644
--- a/src/test/resources/queries/bsp10.jsonld
+++ b/src/test/resources/queries/bsp10.jsonld
@@ -1,105 +1,5 @@
 {
-  "@context" : {
-    "korap" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/",
-    "query" : "korap:query",
-    "meta" : "korap:meta",
-    "collections" : {
-      "@id" : "korap:collections",
-      "@container" : "@list"
-    },
-    "token" : "korap:token/",
-    "distance" : "korap:distance/",
-    "boundary" : "korap:boundary/",
-    "group" : "korap:group/",
-    "span" : "korap:span/",
-    "term" : "korap:term/",
-    "termGroup" : "korap:termGroup/",
-    "wrap" : "token:wrap",
-    "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"
-    },
-    "exclude" : {
-      "@id" : "group:exclude",
-      "@type" : "xsd:boolean"
-    },
-    "key" : {
-      "@id" : "korap:key",
-      "@type" : "xsd:string"
-    },
-    "foundry" : {
-      "@id" : "korap:foundry",
-      "@type" : "xsd:string"
-    },
-    "layer" : {
-      "@id" : "korap:layer",
-      "@type" : "xsd:string"
-    },
-    "value" : {
-      "@id" : "korap:value",
-      "@type" : "xsd:string"
-    },
-    "caseInsensitive" : {
-      "@id" : "term:caseInsensitive",
-      "@type" : "xsd:boolean"
-    },
-    "type" : {
-      "@id" : "term:type/",
-      "@type" : "@id"
-    },
-    "match" : {
-      "@id" : "term:match/",
-      "@type" : "@id"
-    },
-    "relation" : {
-      "@id" : "korap:relation/",
-      "@type" : "@id"
-    }
-  },
+  "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
   "query": {
     "@type": "korap:group", 
     "operation" : "operation:sequence",
diff --git a/src/test/resources/queries/bsp12.jsonld b/src/test/resources/queries/bsp12.jsonld
index 4db4b95..6b7a7b5 100644
--- a/src/test/resources/queries/bsp12.jsonld
+++ b/src/test/resources/queries/bsp12.jsonld
@@ -1,109 +1,9 @@
 {
-  "@context" : {
-    "korap" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/",
-    "query" : "korap:query",
-    "meta" : "korap:meta",
-    "collections" : {
-      "@id" : "korap:collections",
-      "@container" : "@list"
-    },
-    "token" : "korap:token/",
-    "distance" : "korap:distance/",
-    "boundary" : "korap:boundary/",
-    "group" : "korap:group/",
-    "span" : "korap:span/",
-    "term" : "korap:term/",
-    "termGroup" : "korap:termGroup/",
-    "wrap" : "token:wrap",
-    "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"
-    },
-    "exclude" : {
-      "@id" : "group:exclude",
-      "@type" : "xsd:boolean"
-    },
-    "key" : {
-      "@id" : "korap:key",
-      "@type" : "xsd:string"
-    },
-    "foundry" : {
-      "@id" : "korap:foundry",
-      "@type" : "xsd:string"
-    },
-    "layer" : {
-      "@id" : "korap:layer",
-      "@type" : "xsd:string"
-    },
-    "value" : {
-      "@id" : "korap:value",
-      "@type" : "xsd:string"
-    },
-    "caseInsensitive" : {
-      "@id" : "term:caseInsensitive",
-      "@type" : "xsd:boolean"
-    },
-    "type" : {
-      "@id" : "term:type/",
-      "@type" : "@id"
-    },
-    "match" : {
-      "@id" : "term:match/",
-      "@type" : "@id"
-    },
-    "relation" : {
-      "@id" : "korap:relation/",
-      "@type" : "@id"
-    }
-  },
+  "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
   "query": {
     "@type": "korap:group", 
     "operation": "operation:position", 
-    "frame": "frame:contains",
+    "frames": ["frames:isAround"],
     "operands": [
       {
         "@type": "korap:span", 
diff --git a/src/test/resources/queries/bsp13.jsonld b/src/test/resources/queries/bsp13.jsonld
index bb177ee..879fbf5 100644
--- a/src/test/resources/queries/bsp13.jsonld
+++ b/src/test/resources/queries/bsp13.jsonld
@@ -1,108 +1,8 @@
 {
-  "@context" : {
-    "korap" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/",
-    "query" : "korap:query",
-    "meta" : "korap:meta",
-    "collections" : {
-      "@id" : "korap:collections",
-      "@container" : "@list"
-    },
-    "token" : "korap:token/",
-    "distance" : "korap:distance/",
-    "boundary" : "korap:boundary/",
-    "group" : "korap:group/",
-    "span" : "korap:span/",
-    "term" : "korap:term/",
-    "termGroup" : "korap:termGroup/",
-    "wrap" : "token:wrap",
-    "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"
-    },
-    "exclude" : {
-      "@id" : "group:exclude",
-      "@type" : "xsd:boolean"
-    },
-    "key" : {
-      "@id" : "korap:key",
-      "@type" : "xsd:string"
-    },
-    "foundry" : {
-      "@id" : "korap:foundry",
-      "@type" : "xsd:string"
-    },
-    "layer" : {
-      "@id" : "korap:layer",
-      "@type" : "xsd:string"
-    },
-    "value" : {
-      "@id" : "korap:value",
-      "@type" : "xsd:string"
-    },
-    "caseInsensitive" : {
-      "@id" : "term:caseInsensitive",
-      "@type" : "xsd:boolean"
-    },
-    "type" : {
-      "@id" : "term:type/",
-      "@type" : "@id"
-    },
-    "match" : {
-      "@id" : "term:match/",
-      "@type" : "@id"
-    },
-    "relation" : {
-      "@id" : "korap:relation/",
-      "@type" : "@id"
-    }
-  },
+  "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
   "query": {
     "@type": "korap:group", 
-    "frame": "frame:startswith", 
+    "frames": ["frames:startsWith", "frames:alignsLeft", "frames:matches"], 
     "operation": "operation:position",
     "operands": [
       {
diff --git a/src/test/resources/queries/bsp13b.jsonld b/src/test/resources/queries/bsp13b.jsonld
index 6a4b19e..077aeff 100644
--- a/src/test/resources/queries/bsp13b.jsonld
+++ b/src/test/resources/queries/bsp13b.jsonld
@@ -1,108 +1,8 @@
 {
-  "@context" : {
-    "korap" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/",
-    "query" : "korap:query",
-    "meta" : "korap:meta",
-    "collections" : {
-      "@id" : "korap:collections",
-      "@container" : "@list"
-    },
-    "token" : "korap:token/",
-    "distance" : "korap:distance/",
-    "boundary" : "korap:boundary/",
-    "group" : "korap:group/",
-    "span" : "korap:span/",
-    "term" : "korap:term/",
-    "termGroup" : "korap:termGroup/",
-    "wrap" : "token:wrap",
-    "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"
-    },
-    "exclude" : {
-      "@id" : "group:exclude",
-      "@type" : "xsd:boolean"
-    },
-    "key" : {
-      "@id" : "korap:key",
-      "@type" : "xsd:string"
-    },
-    "foundry" : {
-      "@id" : "korap:foundry",
-      "@type" : "xsd:string"
-    },
-    "layer" : {
-      "@id" : "korap:layer",
-      "@type" : "xsd:string"
-    },
-    "value" : {
-      "@id" : "korap:value",
-      "@type" : "xsd:string"
-    },
-    "caseInsensitive" : {
-      "@id" : "term:caseInsensitive",
-      "@type" : "xsd:boolean"
-    },
-    "type" : {
-      "@id" : "term:type/",
-      "@type" : "@id"
-    },
-    "match" : {
-      "@id" : "term:match/",
-      "@type" : "@id"
-    },
-    "relation" : {
-      "@id" : "korap:relation/",
-      "@type" : "@id"
-    }
-  },
+  "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
   "query": {
     "@type": "korap:group", 
-    "frame": "frame:startswith", 
+    "frames": ["frames:startsWith", "frames:alignsLeft", "frames:matches"],
     "operation": "operation:position",
     "operands": [
       {
diff --git a/src/test/resources/queries/bsp17.jsonld b/src/test/resources/queries/bsp17.jsonld
index 2df7268..8d9eca8 100644
--- a/src/test/resources/queries/bsp17.jsonld
+++ b/src/test/resources/queries/bsp17.jsonld
@@ -1,109 +1,9 @@
 {
-  "@context" : {
-    "korap" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/",
-    "query" : "korap:query",
-    "meta" : "korap:meta",
-    "collections" : {
-      "@id" : "korap:collections",
-      "@container" : "@list"
-    },
-    "token" : "korap:token/",
-    "distance" : "korap:distance/",
-    "boundary" : "korap:boundary/",
-    "group" : "korap:group/",
-    "span" : "korap:span/",
-    "term" : "korap:term/",
-    "termGroup" : "korap:termGroup/",
-    "wrap" : "token:wrap",
-    "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"
-    },
-    "exclude" : {
-      "@id" : "group:exclude",
-      "@type" : "xsd:boolean"
-    },
-    "key" : {
-      "@id" : "korap:key",
-      "@type" : "xsd:string"
-    },
-    "foundry" : {
-      "@id" : "korap:foundry",
-      "@type" : "xsd:string"
-    },
-    "layer" : {
-      "@id" : "korap:layer",
-      "@type" : "xsd:string"
-    },
-    "value" : {
-      "@id" : "korap:value",
-      "@type" : "xsd:string"
-    },
-    "caseInsensitive" : {
-      "@id" : "term:caseInsensitive",
-      "@type" : "xsd:boolean"
-    },
-    "type" : {
-      "@id" : "term:type/",
-      "@type" : "@id"
-    },
-    "match" : {
-      "@id" : "term:match/",
-      "@type" : "@id"
-    },
-    "relation" : {
-      "@id" : "korap:relation/",
-      "@type" : "@id"
-    }
-  },
+  "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
   "query": {
     "@type": "korap:group", 
     "operation": "operation:position",
-    "frame": "frame:within", 
+    "frames": ["frames:isWithin"], 
     "operands": [
       {
         "@type": "korap:span", 
diff --git a/src/test/resources/queries/bsp18.jsonld b/src/test/resources/queries/bsp18.jsonld
index 99afb29..f0c2fc2 100644
--- a/src/test/resources/queries/bsp18.jsonld
+++ b/src/test/resources/queries/bsp18.jsonld
@@ -13,7 +13,7 @@
     "operands" : [ {
       "@type" : "korap:group",
       "operation" : "operation:class",
-      "class" : 1,
+      "classOut" : 1,
       "operands" : [ {
         "@type" : "korap:token",
         "wrap" : {
diff --git a/src/test/resources/queries/bsp3.jsonld b/src/test/resources/queries/bsp3.jsonld
index 0e76838..b662b72 100644
--- a/src/test/resources/queries/bsp3.jsonld
+++ b/src/test/resources/queries/bsp3.jsonld
@@ -1,114 +1,13 @@
 {
-  "@context" : {
-    "korap" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/",
-    "query" : "korap:query",
-    "meta" : "korap:meta",
-    "collections" : {
-      "@id" : "korap:collections",
-      "@container" : "@list"
-    },
-    "token" : "korap:token/",
-    "distance" : "korap:distance/",
-    "boundary" : "korap:boundary/",
-    "group" : "korap:group/",
-    "span" : "korap:span/",
-    "term" : "korap:term/",
-    "termGroup" : "korap:termGroup/",
-    "wrap" : "token:wrap",
-    "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"
-    },
-    "exclude" : {
-      "@id" : "group:exclude",
-      "@type" : "xsd:boolean"
-    },
-    "key" : {
-      "@id" : "korap:key",
-      "@type" : "xsd:string"
-    },
-    "foundry" : {
-      "@id" : "korap:foundry",
-      "@type" : "xsd:string"
-    },
-    "layer" : {
-      "@id" : "korap:layer",
-      "@type" : "xsd:string"
-    },
-    "value" : {
-      "@id" : "korap:value",
-      "@type" : "xsd:string"
-    },
-    "caseInsensitive" : {
-      "@id" : "term:caseInsensitive",
-      "@type" : "xsd:boolean"
-    },
-    "type" : {
-      "@id" : "term:type/",
-      "@type" : "@id"
-    },
-    "match" : {
-      "@id" : "term:match/",
-      "@type" : "@id"
-    },
-    "relation" : {
-      "@id" : "korap:relation/",
-      "@type" : "@id"
-    }
-  },
+  "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
   "query": {
-    "@type": "korap:group", 
-    "operation": "operation:submatch", 
+    "@type": "korap:reference", 
     "classRef": [1],
     "operands": [
       {
         "@type": "korap:group", 
         "operation" : "operation:class",
-        "class": 1, 
+        "classOut": 1, 
         "operands": [
           {
             "@type": "korap:token", 
diff --git a/src/test/resources/queries/bsp4.jsonld b/src/test/resources/queries/bsp4.jsonld
index 3a0c3c4..6cea948 100644
--- a/src/test/resources/queries/bsp4.jsonld
+++ b/src/test/resources/queries/bsp4.jsonld
@@ -1,108 +1,7 @@
 {
-  "@context" : {
-    "korap" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/",
-    "query" : "korap:query",
-    "meta" : "korap:meta",
-    "collections" : {
-      "@id" : "korap:collections",
-      "@container" : "@list"
-    },
-    "token" : "korap:token/",
-    "distance" : "korap:distance/",
-    "boundary" : "korap:boundary/",
-    "group" : "korap:group/",
-    "span" : "korap:span/",
-    "term" : "korap:term/",
-    "termGroup" : "korap:termGroup/",
-    "wrap" : "token:wrap",
-    "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"
-    },
-    "exclude" : {
-      "@id" : "group:exclude",
-      "@type" : "xsd:boolean"
-    },
-    "key" : {
-      "@id" : "korap:key",
-      "@type" : "xsd:string"
-    },
-    "foundry" : {
-      "@id" : "korap:foundry",
-      "@type" : "xsd:string"
-    },
-    "layer" : {
-      "@id" : "korap:layer",
-      "@type" : "xsd:string"
-    },
-    "value" : {
-      "@id" : "korap:value",
-      "@type" : "xsd:string"
-    },
-    "caseInsensitive" : {
-      "@id" : "term:caseInsensitive",
-      "@type" : "xsd:boolean"
-    },
-    "type" : {
-      "@id" : "term:type/",
-      "@type" : "@id"
-    },
-    "match" : {
-      "@id" : "term:match/",
-      "@type" : "@id"
-    },
-    "relation" : {
-      "@id" : "korap:relation/",
-      "@type" : "@id"
-    }
-  },
+  "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
   "query": {
-    "@type": "korap:group", 
-    "operation": "operation:submatch", 
+    "@type": "korap:reference", 
     "classRef": [1],
     "operands": [
       {
@@ -112,7 +11,7 @@
           {
             "@type": "korap:group", 
 	    "operation":"operation:class",
-            "class": 1, 
+            "classOut": 1, 
             "operands": [
               {
                 "@type": "korap:token", 
diff --git a/src/test/resources/queries/bsp5.jsonld b/src/test/resources/queries/bsp5.jsonld
index bebc438..b1dc6d8 100644
--- a/src/test/resources/queries/bsp5.jsonld
+++ b/src/test/resources/queries/bsp5.jsonld
@@ -1,108 +1,7 @@
 {
-  "@context" : {
-    "korap" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/",
-    "query" : "korap:query",
-    "meta" : "korap:meta",
-    "collections" : {
-      "@id" : "korap:collections",
-      "@container" : "@list"
-    },
-    "token" : "korap:token/",
-    "distance" : "korap:distance/",
-    "boundary" : "korap:boundary/",
-    "group" : "korap:group/",
-    "span" : "korap:span/",
-    "term" : "korap:term/",
-    "termGroup" : "korap:termGroup/",
-    "wrap" : "token:wrap",
-    "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"
-    },
-    "exclude" : {
-      "@id" : "group:exclude",
-      "@type" : "xsd:boolean"
-    },
-    "key" : {
-      "@id" : "korap:key",
-      "@type" : "xsd:string"
-    },
-    "foundry" : {
-      "@id" : "korap:foundry",
-      "@type" : "xsd:string"
-    },
-    "layer" : {
-      "@id" : "korap:layer",
-      "@type" : "xsd:string"
-    },
-    "value" : {
-      "@id" : "korap:value",
-      "@type" : "xsd:string"
-    },
-    "caseInsensitive" : {
-      "@id" : "term:caseInsensitive",
-      "@type" : "xsd:boolean"
-    },
-    "type" : {
-      "@id" : "term:type/",
-      "@type" : "@id"
-    },
-    "match" : {
-      "@id" : "term:match/",
-      "@type" : "@id"
-    },
-    "relation" : {
-      "@id" : "korap:relation/",
-      "@type" : "@id"
-    }
-  },
+  "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
   "query": {
-    "@type": "korap:group", 
-    "operation": "operation:submatch",
+    "@type": "korap:reference",
     "classRef": [1],
     "operands": [
       {
@@ -121,7 +20,7 @@
           {
             "@type": "korap:group", 
 	    "operation" : "operation:class",
-            "class": 1, 
+            "classOut": 1, 
             "operands": [
               {
                 "@type": "korap:token", 
diff --git a/src/test/resources/queries/cosmas16.json b/src/test/resources/queries/cosmas16.json
index b392098..852a964 100644
--- a/src/test/resources/queries/cosmas16.json
+++ b/src/test/resources/queries/cosmas16.json
@@ -1,20 +1,19 @@
 {
   "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
   "query" : {
-    "@type" : "korap:group",
-    "operation" : "operation:submatch",
+    "@type" : "korap:reference",
     "classRef" : [ 1 ],
     "operands" : [ {
       "@type" : "korap:group",
       "operation" : "operation:position",
-      "frame" : "frame:startswith",
+      "frames" : ["frames:startsWith"],
       "operands" : [ {
         "@type" : "korap:span",
         "key" : "s"
       }, {
         "@type" : "korap:group",
         "operation" : "operation:class",
-        "class" : 1,
+        "classOut" : 1,
         "operands" : [ {
           "@type" : "korap:token",
           "wrap" : {
diff --git a/src/test/resources/queries/cosmas17.json b/src/test/resources/queries/cosmas17.json
index 1eec888..c0d1f5c 100644
--- a/src/test/resources/queries/cosmas17.json
+++ b/src/test/resources/queries/cosmas17.json
@@ -3,7 +3,7 @@
   "query" : {
     "@type" : "korap:group",
     "operation" : "operation:position",
-    "frame" : "frame:startswith",
+    "frames" : ["frames:startsWith", "frames:matches", "frames:alignsLeft"],
     "operands" : [ {
       "@type" : "korap:span",
       "key" : "s"
diff --git a/src/test/resources/queries/cosmas20.json b/src/test/resources/queries/cosmas20.json
index 86a7df6..5a4b745 100644
--- a/src/test/resources/queries/cosmas20.json
+++ b/src/test/resources/queries/cosmas20.json
@@ -1,20 +1,19 @@
 {
   "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
   "query" : {
-    "@type" : "korap:group",
-    "operation" : "operation:submatch",
+    "@type" : "korap:reference",
     "classRef" : [ 1 ],
       "operands" : [ {
       "@type" : "korap:group",
       "operation" : "operation:position",
-      "frame" : "frame:endswith",
+      "frames" : ["frames:endsWith", "frames:matches", "frames:alignsRight"],
       "operands" : [ {
         "@type" : "korap:span",
         "key" : "s"
       }, {
         "@type" : "korap:group",
         "operation" : "operation:class",
-        "class" : 1,
+        "classOut" : 1,
         "operands" : [ {
           "@type" : "korap:token",
           "wrap" : {
diff --git a/src/test/resources/queries/poly1.json b/src/test/resources/queries/poly1.json
index bc1b138..77bc6b5 100644
--- a/src/test/resources/queries/poly1.json
+++ b/src/test/resources/queries/poly1.json
@@ -22,7 +22,6 @@
       "operands" : [
          {
             "@type" : "korap:group",
-            "class" : 1,
             "classOut" : 1,
             "operands" : [
                {
@@ -40,7 +39,6 @@
          },
          {
             "@type" : "korap:group",
-            "class" : 2,
             "classOut" : 2,
             "operands" : [
                {
diff --git a/src/test/resources/queries/poly2.json b/src/test/resources/queries/poly2.json
index 68bcadc..543da5e 100644
--- a/src/test/resources/queries/poly2.json
+++ b/src/test/resources/queries/poly2.json
@@ -18,9 +18,8 @@
    "meta" : {},
    "query" : {
       "@type" : "korap:group",
-      "frame" : "frame:contains",
       "frames" : [
-         "frames:contains"
+         "frames:isAround"
       ],
       "operands" : [
          {
@@ -88,4 +87,4 @@
    },
    "warnings" : []
 }
-  
\ No newline at end of file
+  
diff --git a/src/test/resources/queries/poly4.json b/src/test/resources/queries/poly4.json
index eb863e1..4d38ad4 100644
--- a/src/test/resources/queries/poly4.json
+++ b/src/test/resources/queries/poly4.json
@@ -42,7 +42,6 @@
             "operands" : [
                {
                   "@type" : "korap:group",
-                  "class" : 1,
                   "classOut" : 1,
                   "operands" : [
                      {
diff --git a/src/test/resources/queries/sequence/empty-first-class.jsonld b/src/test/resources/queries/sequence/empty-first-class.jsonld
index 89f44e3..f55d382 100644
--- a/src/test/resources/queries/sequence/empty-first-class.jsonld
+++ b/src/test/resources/queries/sequence/empty-first-class.jsonld
@@ -16,7 +16,7 @@
       "operands" : [
 	 {
 	     "@type" : "korap:group",
-	     "class" : 2,
+	     "classOut" : 2,
 	     "operation" : "operation:class",
 	     "operands" : [
              {
diff --git a/src/test/resources/queries/sequence/empty-last-class.jsonld b/src/test/resources/queries/sequence/empty-last-class.jsonld
index e2591e7..9a5ad5e 100644
--- a/src/test/resources/queries/sequence/empty-last-class.jsonld
+++ b/src/test/resources/queries/sequence/empty-last-class.jsonld
@@ -25,7 +25,7 @@
          },
 	 {
 	     "@type" : "korap:group",
-	     "class" : 3,
+	     "classOut" : 3,
 	     "operation" : "operation:class",
 	     "operands" : [
              {
diff --git a/src/test/resources/queries/sequence/empty-middle-class.jsonld b/src/test/resources/queries/sequence/empty-middle-class.jsonld
index 865bfa1..9203e5e 100644
--- a/src/test/resources/queries/sequence/empty-middle-class.jsonld
+++ b/src/test/resources/queries/sequence/empty-middle-class.jsonld
@@ -25,7 +25,7 @@
          },
 	 {
 	     "@type" : "korap:group",
-	     "class" : 1,
+	     "classOut" : 1,
 	     "operation" : "operation:class",
 	     "operands" : [
 	 	 {
diff --git a/src/test/resources/queries/sequence/empty-surround-class-2.jsonld b/src/test/resources/queries/sequence/empty-surround-class-2.jsonld
index 5f15478..f927e59 100644
--- a/src/test/resources/queries/sequence/empty-surround-class-2.jsonld
+++ b/src/test/resources/queries/sequence/empty-surround-class-2.jsonld
@@ -5,7 +5,7 @@
       "operands" : [
 	 {
 	     "@type" : "korap:group",
-	     "class" : 3,
+	     "classOut" : 3,
 	     "operation" : "operation:class",
 	     "operands" : [
 	     	 {
@@ -24,7 +24,7 @@
          },
 	 {
 	     "@type" : "korap:group",
-	     "class" : 2,
+	     "classOut" : 2,
 	     "operation" : "operation:class",
 	     "operands" : [
 	     	 {
diff --git a/src/test/resources/queries/sequence/empty-surround-class.jsonld b/src/test/resources/queries/sequence/empty-surround-class.jsonld
index 2c5846f..b9a44d0 100644
--- a/src/test/resources/queries/sequence/empty-surround-class.jsonld
+++ b/src/test/resources/queries/sequence/empty-surround-class.jsonld
@@ -18,7 +18,7 @@
          },
 	 {
 	     "@type" : "korap:group",
-	     "class" : 2,
+	     "classOut" : 2,
 	     "operation" : "operation:class",
 	     "operands" : [
 	     	 {
diff --git a/src/test/resources/queries/sequence/empty-surround-repetition-class.jsonld b/src/test/resources/queries/sequence/empty-surround-repetition-class.jsonld
index 8a584dc..ec34606 100644
--- a/src/test/resources/queries/sequence/empty-surround-repetition-class.jsonld
+++ b/src/test/resources/queries/sequence/empty-surround-repetition-class.jsonld
@@ -14,7 +14,7 @@
 	"operands" : [
 	  {
 	    "@type" : "korap:group",
-	    "class" : 1,
+	    "classOut" : 1,
 	    "operation" : "operation:class",
 	    "operands" : [
 	      {
@@ -36,7 +36,7 @@
       },
       {
 	"@type" : "korap:group",
-	"class" : 2,
+	"classOut" : 2,
 	"operation" : "operation:class",
 	"operands" : [
 	  {
diff --git a/src/test/resources/queries/sequence/negative-last-class-repetition-2.jsonld b/src/test/resources/queries/sequence/negative-last-class-repetition-2.jsonld
index 4d93449..0d7207a 100644
--- a/src/test/resources/queries/sequence/negative-last-class-repetition-2.jsonld
+++ b/src/test/resources/queries/sequence/negative-last-class-repetition-2.jsonld
@@ -24,7 +24,7 @@
 	"operands" : [
 	  {
 	    "@type" : "korap:group",
-	    "class" : 2,
+	    "classOut" : 2,
 	    "operation" : "operation:class",
 	    "operands" : [
 	      {
diff --git a/src/test/resources/queries/sequence/negative-last-class-repetition.jsonld b/src/test/resources/queries/sequence/negative-last-class-repetition.jsonld
index 372e390..71cc4f3 100644
--- a/src/test/resources/queries/sequence/negative-last-class-repetition.jsonld
+++ b/src/test/resources/queries/sequence/negative-last-class-repetition.jsonld
@@ -15,7 +15,7 @@
       },
       {
 	"@type" : "korap:group",
-	"class" : 2,
+	"classOut" : 2,
 	"operation" : "operation:class",
 	"operands" : [
 	  {
diff --git a/src/test/resources/queries/sequence/negative-last-class.jsonld b/src/test/resources/queries/sequence/negative-last-class.jsonld
index 41e0d45..b668db6 100644
--- a/src/test/resources/queries/sequence/negative-last-class.jsonld
+++ b/src/test/resources/queries/sequence/negative-last-class.jsonld
@@ -15,7 +15,7 @@
          },
         {
 	  "@type" : "korap:group",
-	  "class" : 2,
+	  "classOut" : 2,
 	  "operation" : "operation:class",
 	  "operands" : [
 	    {
diff --git a/src/test/resources/queries/submatch/1.jsonld b/src/test/resources/queries/submatch/1.jsonld
index 4baa073..cc4a529 100644
--- a/src/test/resources/queries/submatch/1.jsonld
+++ b/src/test/resources/queries/submatch/1.jsonld
@@ -15,9 +15,8 @@
       "operands" : [
          {
             "@type" : "korap:group",
-            "frame" : "frame:contains",
             "frames" : [
-               "frames:contains"
+               "frames:isAround"
             ],
             "operands" : [
                {