Wrapping of extension queries
diff --git a/src/test/resources/queries/sequence/empty-first-class.jsonld b/src/test/resources/queries/sequence/empty-first-class.jsonld
new file mode 100644
index 0000000..89f44e3
--- /dev/null
+++ b/src/test/resources/queries/sequence/empty-first-class.jsonld
@@ -0,0 +1,39 @@
+{
+   "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+   "collections" : [
+      {
+         "@type" : "korap:meta-filter",
+         "@value" : {
+            "@field" : "korap:field#corpusID",
+            "@type" : "korap:term",
+            "@value" : "WPD"
+         }
+      }
+   ],
+   "meta" : {},
+   "query" : {
+      "@type" : "korap:group",
+      "operands" : [
+	 {
+	     "@type" : "korap:group",
+	     "class" : 2,
+	     "operation" : "operation:class",
+	     "operands" : [
+             {
+               "@type" : "korap:token"
+             }]
+         },
+         {
+            "@type" : "korap:token",
+            "wrap" : {
+               "@type" : "korap:term",
+               "foundry" : "tt",
+               "key" : "NN",
+               "layer" : "p",
+               "match" : "match:eq"
+            }
+         }
+      ],
+      "operation" : "operation:sequence"
+   }
+}
\ No newline at end of file
diff --git a/src/test/resources/queries/sequence/empty-first-repetition.jsonld b/src/test/resources/queries/sequence/empty-first-repetition.jsonld
new file mode 100644
index 0000000..91c09ad
--- /dev/null
+++ b/src/test/resources/queries/sequence/empty-first-repetition.jsonld
@@ -0,0 +1,43 @@
+{
+   "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+   "collections" : [
+      {
+         "@type" : "korap:meta-filter",
+         "@value" : {
+            "@field" : "korap:field#corpusID",
+            "@type" : "korap:term",
+            "@value" : "WPD"
+         }
+      }
+   ],
+   "meta" : {},
+   "query" : {
+      "@type" : "korap:group",
+     "operands" : [
+       {
+	 "@type" : "korap:group",
+	 "operation" : "operation:repetition",
+	 "boundary": {
+	   "@type" : "korap:boundary",
+	   "min" : 2,
+	   "max" : 7
+	 },
+	 "operands" : [
+	   {
+             "@type" : "korap:token"
+	   }]	     
+         },
+         {
+            "@type" : "korap:token",
+            "wrap" : {
+               "@type" : "korap:term",
+               "foundry" : "tt",
+               "key" : "NN",
+               "layer" : "p",
+               "match" : "match:eq"
+            }
+         }
+      ],
+      "operation" : "operation:sequence"
+   }
+}
diff --git a/src/test/resources/queries/sequence/empty-first.jsonld b/src/test/resources/queries/sequence/empty-first.jsonld
new file mode 100644
index 0000000..0c7b7a5
--- /dev/null
+++ b/src/test/resources/queries/sequence/empty-first.jsonld
@@ -0,0 +1,33 @@
+{
+   "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+   "collections" : [
+      {
+         "@type" : "korap:meta-filter",
+         "@value" : {
+            "@field" : "korap:field#corpusID",
+            "@type" : "korap:term",
+            "@value" : "WPD"
+         }
+      }
+   ],
+   "meta" : {},
+   "query" : {
+      "@type" : "korap:group",
+      "operands" : [
+	 {
+             "@type" : "korap:token"
+         },
+         {
+            "@type" : "korap:token",
+            "wrap" : {
+               "@type" : "korap:term",
+               "foundry" : "tt",
+               "key" : "NN",
+               "layer" : "p",
+               "match" : "match:eq"
+            }
+         }
+      ],
+      "operation" : "operation:sequence"
+   }
+}
\ No newline at end of file
diff --git a/src/test/resources/queries/sequence/empty-last-class.jsonld b/src/test/resources/queries/sequence/empty-last-class.jsonld
new file mode 100644
index 0000000..e2591e7
--- /dev/null
+++ b/src/test/resources/queries/sequence/empty-last-class.jsonld
@@ -0,0 +1,38 @@
+{
+   "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+   "collections" : [
+      {
+         "@type" : "korap:meta-filter",
+         "@value" : {
+            "@field" : "korap:field#corpusID",
+            "@type" : "korap:term",
+            "@value" : "WPD"
+         }
+      }
+   ],
+   "meta" : {},
+   "query" : {
+      "@type" : "korap:group",
+      "operands" : [
+         {
+            "@type" : "korap:token",
+            "wrap" : {
+               "@type" : "korap:term",
+               "key" : "der",
+               "layer" : "orth",
+               "match" : "match:eq"
+            }
+         },
+	 {
+	     "@type" : "korap:group",
+	     "class" : 3,
+	     "operation" : "operation:class",
+	     "operands" : [
+             {
+             "@type" : "korap:token"
+	     }]
+         }
+      ],
+      "operation" : "operation:sequence"
+   }
+}
\ No newline at end of file
diff --git a/src/test/resources/queries/sequence/empty-last-repetition.jsonld b/src/test/resources/queries/sequence/empty-last-repetition.jsonld
new file mode 100644
index 0000000..c57d45a
--- /dev/null
+++ b/src/test/resources/queries/sequence/empty-last-repetition.jsonld
@@ -0,0 +1,43 @@
+{
+  "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+  "collections" : [
+    {
+      "@type" : "korap:meta-filter",
+      "@value" : {
+        "@field" : "korap:field#corpusID",
+        "@type" : "korap:term",
+        "@value" : "WPD"
+      }
+    }
+  ],
+  "meta" : {},
+  "query" : {
+    "@type" : "korap:group",
+    "operands" : [
+      {
+        "@type" : "korap:token",
+        "wrap" : {
+          "@type" : "korap:term",
+          "key" : "der",
+          "layer" : "orth",
+          "match" : "match:eq"
+        }
+      },
+      {
+	"@type" : "korap:group",
+	"operation" : "operation:repetition",
+	"boundary": {
+	  "@type" : "korap:boundary",
+	  "min" : 3,
+	  "max" : 5
+	},
+	"operands" : [
+	  {
+            "@type" : "korap:token"
+	  }
+	]
+      }
+    ],
+    "operation" : "operation:sequence"
+  }
+}
diff --git a/src/test/resources/queries/sequence/empty-last.jsonld b/src/test/resources/queries/sequence/empty-last.jsonld
new file mode 100644
index 0000000..395e8f8
--- /dev/null
+++ b/src/test/resources/queries/sequence/empty-last.jsonld
@@ -0,0 +1,32 @@
+{
+   "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+   "collections" : [
+      {
+         "@type" : "korap:meta-filter",
+         "@value" : {
+            "@field" : "korap:field#corpusID",
+            "@type" : "korap:term",
+            "@value" : "WPD"
+         }
+      }
+   ],
+   "meta" : {},
+   "query" : {
+      "@type" : "korap:group",
+      "operands" : [
+         {
+            "@type" : "korap:token",
+            "wrap" : {
+               "@type" : "korap:term",
+               "key" : "der",
+               "layer" : "orth",
+               "match" : "match:eq"
+            }
+         },
+	 {
+             "@type" : "korap:token"
+         }
+      ],
+      "operation" : "operation:sequence"
+   }
+}
\ No newline at end of file
diff --git a/src/test/resources/queries/sequence/empty-middle-class.jsonld b/src/test/resources/queries/sequence/empty-middle-class.jsonld
new file mode 100644
index 0000000..865bfa1
--- /dev/null
+++ b/src/test/resources/queries/sequence/empty-middle-class.jsonld
@@ -0,0 +1,49 @@
+{
+   "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+   "collections" : [
+      {
+         "@type" : "korap:meta-filter",
+         "@value" : {
+            "@field" : "korap:field#corpusID",
+            "@type" : "korap:term",
+            "@value" : "WPD"
+         }
+      }
+   ],
+   "meta" : {},
+   "query" : {
+      "@type" : "korap:group",
+      "operands" : [
+         {
+            "@type" : "korap:token",
+            "wrap" : {
+               "@type" : "korap:term",
+               "key" : "der",
+               "layer" : "orth",
+               "match" : "match:eq"
+            }
+         },
+	 {
+	     "@type" : "korap:group",
+	     "class" : 1,
+	     "operation" : "operation:class",
+	     "operands" : [
+	 	 {
+         	     "@type" : "korap:token"
+         	 }
+             ]
+         },
+         {
+            "@type" : "korap:token",
+            "wrap" : {
+               "@type" : "korap:term",
+               "foundry" : "tt",
+               "key" : "NN",
+               "layer" : "p",
+               "match" : "match:eq"
+            }
+         }
+      ],
+      "operation" : "operation:sequence"
+   }
+}
\ No newline at end of file
diff --git a/src/test/resources/queries/sequence/empty-middle-repetition.jsonld b/src/test/resources/queries/sequence/empty-middle-repetition.jsonld
new file mode 100644
index 0000000..22677c5
--- /dev/null
+++ b/src/test/resources/queries/sequence/empty-middle-repetition.jsonld
@@ -0,0 +1,52 @@
+{
+   "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+   "collections" : [
+      {
+         "@type" : "korap:meta-filter",
+         "@value" : {
+            "@field" : "korap:field#corpusID",
+            "@type" : "korap:term",
+            "@value" : "WPD"
+         }
+      }
+   ],
+   "meta" : {},
+   "query" : {
+      "@type" : "korap:group",
+      "operands" : [
+         {
+            "@type" : "korap:token",
+            "wrap" : {
+               "@type" : "korap:term",
+               "key" : "der",
+               "layer" : "orth",
+               "match" : "match:eq"
+            }
+         },
+	 {
+	 "@type" : "korap:group",
+	 "operation" : "operation:repetition",
+	 "boundary": {
+	   "@type" : "korap:boundary",
+	   "min" : 4,
+	   "max" : 8
+	 },
+	 "operands" : [
+	   {
+             "@type" : "korap:token"
+	     }]	     
+         },
+         {
+            "@type" : "korap:token",
+            "wrap" : {
+               "@type" : "korap:term",
+               "foundry" : "tt",
+               "key" : "NN",
+               "layer" : "p",
+               "match" : "match:eq"
+            }
+         }
+      ],
+      "operation" : "operation:sequence"
+   }
+}
\ No newline at end of file
diff --git a/src/test/resources/queries/sequence/empty-middle.jsonld b/src/test/resources/queries/sequence/empty-middle.jsonld
new file mode 100644
index 0000000..005bae4
--- /dev/null
+++ b/src/test/resources/queries/sequence/empty-middle.jsonld
@@ -0,0 +1,42 @@
+{
+   "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+   "collections" : [
+      {
+         "@type" : "korap:meta-filter",
+         "@value" : {
+            "@field" : "korap:field#corpusID",
+            "@type" : "korap:term",
+            "@value" : "WPD"
+         }
+      }
+   ],
+   "meta" : {},
+   "query" : {
+      "@type" : "korap:group",
+      "operands" : [
+         {
+            "@type" : "korap:token",
+            "wrap" : {
+               "@type" : "korap:term",
+               "key" : "der",
+               "layer" : "orth",
+               "match" : "match:eq"
+            }
+         },
+	 {
+             "@type" : "korap:token"
+         },
+         {
+            "@type" : "korap:token",
+            "wrap" : {
+               "@type" : "korap:term",
+               "foundry" : "tt",
+               "key" : "NN",
+               "layer" : "p",
+               "match" : "match:eq"
+            }
+         }
+      ],
+      "operation" : "operation:sequence"
+   }
+}
\ No newline at end of file
diff --git a/src/test/resources/queries/sequence/empty.jsonld b/src/test/resources/queries/sequence/empty.jsonld
new file mode 100644
index 0000000..473404d
--- /dev/null
+++ b/src/test/resources/queries/sequence/empty.jsonld
@@ -0,0 +1,17 @@
+{
+   "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+   "collections" : [
+      {
+         "@type" : "korap:meta-filter",
+         "@value" : {
+            "@field" : "korap:field#corpusID",
+            "@type" : "korap:term",
+            "@value" : "WPD"
+         }
+      }
+   ],
+   "meta" : {},
+   "query" : {
+     "@type" : "korap:token"
+   }
+}
\ No newline at end of file