Fix wrong optimization of %+w1:1

Change-Id: I3eee8373776dadc1812c18a7882c3b8a96ebbfb9
diff --git a/src/test/resources/queries/cosmas21.json b/src/test/resources/queries/cosmas21.json
new file mode 100644
index 0000000..8a6262c
--- /dev/null
+++ b/src/test/resources/queries/cosmas21.json
@@ -0,0 +1,72 @@
+{
+  "context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+  "query" : {
+    "@type": "koral:group",
+    "distances": [
+      {
+        "@type": "cosmas:distance",
+        "boundary": {
+          "@type": "koral:boundary",
+          "max": 1,
+          "min": 1
+        },
+        "exclude": true,
+        "key": "w"
+      }
+    ],
+    "inOrder": true,
+    "operands": [
+      {
+        "@type": "koral:group",
+        "classOut": 129,
+        "operands": [
+          {
+            "@type": "koral:token",
+            "wrap": {
+              "@type": "koral:term",
+              "foundry": "opennlp",
+              "key": "die",
+              "layer": "orth",
+              "match": "match:eq",
+              "rewrites": [
+                {
+                  "@type": "koral:rewrite",
+                  "operation": "operation:injection",
+                  "scope": "foundry",
+                  "src": "Kustvakt"
+                }
+              ]
+            }
+          }
+        ],
+        "operation": "operation:class"
+      },
+      {
+        "@type": "koral:group",
+        "classOut": 129,
+        "operands": [
+          {
+            "@type": "koral:token",
+            "wrap": {
+              "@type": "koral:term",
+              "foundry": "opennlp",
+              "key": "Gegenwart",
+              "layer": "orth",
+              "match": "match:eq",
+              "rewrites": [
+                {
+                  "@type": "koral:rewrite",
+                  "operation": "operation:injection",
+                  "scope": "foundry",
+                  "src": "Kustvakt"
+                }
+              ]
+            }
+          }
+        ],
+        "operation": "operation:class"
+      }
+    ],
+    "operation": "operation:sequence"
+  }
+}