Minor fix for subspan deserialization
diff --git a/src/test/resources/queries/submatch.jsonld b/src/test/resources/queries/submatch/1.jsonld
similarity index 100%
rename from src/test/resources/queries/submatch.jsonld
rename to src/test/resources/queries/submatch/1.jsonld
diff --git a/src/test/resources/queries/submatch2.jsonld b/src/test/resources/queries/submatch/2.jsonld
similarity index 100%
rename from src/test/resources/queries/submatch2.jsonld
rename to src/test/resources/queries/submatch/2.jsonld
diff --git a/src/test/resources/queries/submatch3.jsonld b/src/test/resources/queries/submatch/3.jsonld
similarity index 100%
rename from src/test/resources/queries/submatch3.jsonld
rename to src/test/resources/queries/submatch/3.jsonld
diff --git a/src/test/resources/queries/submatch/embedded-null.jsonld b/src/test/resources/queries/submatch/embedded-null.jsonld
new file mode 100644
index 0000000..4672473
--- /dev/null
+++ b/src/test/resources/queries/submatch/embedded-null.jsonld
@@ -0,0 +1,39 @@
+{
+  "@context":"http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld",
+  "collection":null,
+  "query" : {
+    "@type" : "korap:group",
+    "operation":"operation:sequence",
+    "operands" : [
+      {
+        "@type" : "korap:token",
+        "wrap" : {
+          "@type" : "korap:term",
+          "foundry" : "opennlp",
+          "key" : "die",
+          "layer" : "orth",
+          "match" : "match:eq"
+        }
+      },
+      {
+        "@type" : "korap:group",
+        "operands" : [
+          {
+            "@type" : "korap:reference",
+	    "operands" : [
+	      {
+		"@type" : "korap:token"
+	      }
+	    ],
+            "operation" : "operation:focus",
+            "spanRef" : [
+              5,
+              6
+            ]
+          }
+        ],
+        "operation" : "operation:class"
+      }
+    ]
+  }
+}
diff --git a/src/test/resources/queries/submatch/embedded-valid-empty.jsonld b/src/test/resources/queries/submatch/embedded-valid-empty.jsonld
new file mode 100644
index 0000000..a6f22bd
--- /dev/null
+++ b/src/test/resources/queries/submatch/embedded-valid-empty.jsonld
@@ -0,0 +1,40 @@
+{
+  "@context":"http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld",
+  "collection":null,
+  "query" : {
+    "@type" : "korap:group",
+    "operation":"operation:sequence",
+    "operands" : [
+      {
+        "@type" : "korap:token",
+        "wrap" : {
+          "@type" : "korap:term",
+          "foundry" : "opennlp",
+          "key" : "die",
+          "layer" : "orth",
+          "match" : "match:eq"
+        }
+      },
+      {
+        "@type" : "korap:reference",
+        "spanRef" : [2],
+	"operands" : [
+	  {
+	    "@type" : "korap:group",
+	    "operation" : "operation:repetition",
+	    "boundary" : {
+	      "@type" : "korap:boundary",
+	      "max" : 5,
+	      "min" : 0
+	    },
+	    "operands" : [
+	      {
+		"@type" : "korap:token"
+	      }
+	    ]
+	  }
+	]
+      }
+    ]
+  }
+}
diff --git a/src/test/resources/queries/submatch/embedded.jsonld b/src/test/resources/queries/submatch/embedded.jsonld
new file mode 100644
index 0000000..e09bef5
--- /dev/null
+++ b/src/test/resources/queries/submatch/embedded.jsonld
@@ -0,0 +1,71 @@
+{
+  "@context":"http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld",
+  "collection":null,
+  "query" : {
+    "@type" : "korap:group",
+    "operands" : [
+      {
+        "@type" : "korap:group",
+        "operands" : [
+          {
+            "@type" : "korap:token",
+            "wrap" : {
+              "@type" : "korap:term",
+              "foundry" : "opennlp",
+              "key" : "die",
+              "layer" : "orth",
+              "match" : "match:eq"
+            }
+          }
+        ],
+        "operation" : "operation:class"
+      },
+      {
+        "@type" : "korap:group",
+        "operands" : [
+          {
+            "@type" : "korap:reference",
+            "operands" : [
+	      {
+		"@type" : "korap:group",
+		"operands" : [
+		  {
+		    "@type" : "korap:token",
+		    "wrap" : {
+		      "@type" : "korap:term",
+		      "foundry" : "opennlp",
+		      "key" : "der",
+		      "layer" : "orth",
+		      "match" : "match:eq"
+		    }
+		  },
+		  {
+		    "@type" : "korap:group",
+		    "boundary" : {
+		      "@type" : "korap:boundary",
+		      "min" : 1
+		    },
+		    "operands" : [
+		      {
+			"@type" : "korap:token"
+		      }
+		    ],
+		    "operation" : "operation:repetition"
+		  }
+		],
+		"operation" : "operation:sequence"
+	      }
+            ],
+            "operation" : "operation:focus",
+            "spanRef" : [
+              2,
+              3
+            ]
+          }
+        ],
+        "operation" : "operation:class"
+      }
+    ],
+    "operation" : "operation:sequence"
+  }
+}
diff --git a/src/test/resources/queries/submatch/wrapped.jsonld b/src/test/resources/queries/submatch/wrapped.jsonld
new file mode 100644
index 0000000..8bc7b0c
--- /dev/null
+++ b/src/test/resources/queries/submatch/wrapped.jsonld
@@ -0,0 +1,73 @@
+{
+  "@context":"http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld",
+  "collection":null,
+  "query" : {
+    "@type" : "korap:reference",
+    "classRef" : [
+      129
+    ],
+    "operands" : [
+      {
+        "@type" : "korap:group",
+        "distances" : [
+          {
+            "@type" : "cosmas:distance",
+            "boundary" : {
+              "@type" : "korap:boundary",
+              "max" : 0,
+              "min" : 0
+            },
+            "key" : "s",
+            "max" : 0,
+            "min" : 0
+          }
+        ],
+        "inOrder" : true,
+        "operands" : [
+          {
+            "@type" : "korap:group",
+            "class" : 129,
+            "classOut" : 129,
+            "operands" : [
+              {
+                "@type" : "korap:token",
+                "wrap" : {
+                  "@type" : "korap:term",
+                  "foundry" : "opennlp",
+                  "key" : "der",
+                  "layer" : "orth",
+                  "match" : "match:eq"
+                }
+              }
+            ],
+            "operation" : "operation:class"
+          },
+          {
+            "@type" : "korap:group",
+            "class" : 129,
+            "classOut" : 129,
+            "operands" : [
+              {
+                "@type" : "korap:reference",
+                "operands" : [
+                  {
+                    "@type" : "korap:span",
+                    "key" : "s"
+                  }
+                ],
+                "operation" : "operation:focus",
+                "spanRef" : [
+                  0,
+                  1
+                ]
+              }
+            ],
+            "operation" : "operation:class"
+          }
+        ],
+        "operation" : "operation:sequence"
+      }
+    ],
+    "operation" : "operation:focus"
+  }
+}