Fix Koral serialization support for different distance types (2)

Change-Id: I195ef9613df3005478258e62f43f048e5c3fb193
diff --git a/src/test/resources/queries/bsp-boundary.jsonld b/src/test/resources/queries/bsp-boundary.jsonld
index 4f72f4a..8ec5786 100644
--- a/src/test/resources/queries/bsp-boundary.jsonld
+++ b/src/test/resources/queries/bsp-boundary.jsonld
@@ -1 +1,56 @@
-{"@context":"http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld","errors":[],"warnings":[],"announcements":["Deprecated 2014-07-24: 'min' and 'max' to be supported until 3 months from deprecation date."],"query":{"@type":"koral:group","operation":"operation:sequence","operands":[{"@type":"koral:token","wrap":{"@type":"koral:term","layer":"orth","key":"Tal","match":"match:eq"}},{"@type":"koral:token","wrap":{"@type":"koral:term","layer":"orth","key":"Wald","match":"match:eq"}}],"inOrder":true,"distances":[{"@type":"koral:distance","key":"w","boundary":{"@type":"koral:boundary","min":2},"min":2}]},"collections":[{"@type":"koral:meta-filter","@value":{"@type":"koral:term","@field":"koral:field#corpusID","@value":"WPD"}}],"meta":{"startPage":1,"itemsPerResource":1,"context":"paragraph"}}
+{
+  "@context":"http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+  "errors":[],
+  "warnings":[],
+  "announcements":["Deprecated 2014-07-24: 'min' and 'max' to be supported until 3 months from deprecation date."],
+  "query":{
+    "@type":"koral:group",
+    "operation":"operation:sequence",
+    "operands":[
+      {
+	"@type":"koral:token",
+	"wrap":{
+	  "@type":"koral:term",
+	  "layer":"orth",
+	  "key":"Tal",
+	  "match":"match:eq"
+	}
+      },{
+	"@type":"koral:token",
+	"wrap":{
+	  "@type":"koral:term",
+	  "layer":"orth",
+	  "key":"Wald",
+	  "match":"match:eq"
+	}
+      }
+    ],
+    "inOrder":true,
+    "distances":[
+      {
+	"@type":"koral:distance",
+	"key":"w",
+	"boundary":{
+	  "@type":"koral:boundary",
+	  "min":1
+	},
+	"min":1
+      }
+    ]
+  },
+  "collections":[
+    {
+      "@type":"koral:meta-filter",
+      "@value":{
+	"@type":"koral:term",
+	"@field":"koral:field#corpusID",
+	"@value":"WPD"
+      }
+    }
+  ],
+  "meta":{
+    "startPage":1,
+    "itemsPerResource":1,
+    "context":"paragraph"
+  }
+}
diff --git a/src/test/resources/queries/cosmas1.json b/src/test/resources/queries/cosmas1.json
index a1456d3..700205f 100644
--- a/src/test/resources/queries/cosmas1.json
+++ b/src/test/resources/queries/cosmas1.json
@@ -5,7 +5,7 @@
     "operation" : "operation:sequence",
     "inOrder" : false,
     "distances" : [ {
-      "@type" : "koral:distance",
+      "@type" : "cosmas:distance",
       "key" : "s",
       "min" : 0,
       "max" : 0
diff --git a/src/test/resources/queries/cosmas3.json b/src/test/resources/queries/cosmas3.json
index 2dd75ac..05fcd42 100644
--- a/src/test/resources/queries/cosmas3.json
+++ b/src/test/resources/queries/cosmas3.json
@@ -5,7 +5,7 @@
     "operation" : "operation:sequence",
     "inOrder" : true,
     "distances" : [ {
-      "@type" : "koral:distance",
+      "@type" : "cosmas:distance",
       "key" : "w",
       "min" : 1,
       "max" : 3
diff --git a/src/test/resources/queries/cosmas4.json b/src/test/resources/queries/cosmas4.json
index d9bd77c..92163af 100644
--- a/src/test/resources/queries/cosmas4.json
+++ b/src/test/resources/queries/cosmas4.json
@@ -8,12 +8,12 @@
       "@type" : "koral:group",
       "operation" : "operation:and",
       "operands" : [ {
-        "@type" : "koral:distance",
+        "@type" : "cosmas:distance",
         "key" : "w",
         "min" : 1,
         "max" : 3
       }, {
-        "@type" : "koral:distance",
+        "@type" : "cosmas:distance",
         "key" : "s",
         "min" : 1,
         "max" : 1
diff --git a/src/test/resources/queries/cosmas4b.json b/src/test/resources/queries/cosmas4b.json
index fac3101..15a0999 100644
--- a/src/test/resources/queries/cosmas4b.json
+++ b/src/test/resources/queries/cosmas4b.json
@@ -5,12 +5,12 @@
     "operation" : "operation:sequence",
     "inOrder" : true,
     "distances" : [ {
-      "@type" : "koral:distance",
+      "@type" : "cosmas:distance",
       "key" : "w",
       "min" : 1,
       "max" : 3
     }, {
-      "@type" : "koral:distance",
+      "@type" : "cosmas:distance",
       "key" : "s",
       "min" : 0,
       "max" : 1
diff --git a/src/test/resources/queries/reference/bug-multiple-distance-simple.jsonld b/src/test/resources/queries/reference/bug-multiple-distance-simple.jsonld
index 72af003..8ffafaa 100644
--- a/src/test/resources/queries/reference/bug-multiple-distance-simple.jsonld
+++ b/src/test/resources/queries/reference/bug-multiple-distance-simple.jsonld
@@ -22,11 +22,11 @@
       "key": "w",
       "boundary": {
         "@type": "koral:boundary",
-        "min": 1,
-        "max": 1
+        "min": 0,
+        "max": 0
       },
-      "min": 1,
-      "max": 1
+      "min": 0,
+      "max": 0
     }]                                
   },
   "meta": {}
diff --git a/src/test/resources/queries/reference/bug-multiple-distance.jsonld b/src/test/resources/queries/reference/bug-multiple-distance.jsonld
index 056d8c6..de9bee6 100644
--- a/src/test/resources/queries/reference/bug-multiple-distance.jsonld
+++ b/src/test/resources/queries/reference/bug-multiple-distance.jsonld
@@ -43,11 +43,11 @@
                   "key": "w",
                   "boundary": {
                     "@type": "koral:boundary",
-                    "min": 1,
-                    "max": 1
+                    "min": 0,
+                    "max": 0
                   },
-                  "min": 1,
-                  "max": 1
+                  "min": 0,
+                  "max": 0
                 }]                                
               }]
             },
diff --git a/src/test/resources/queries/sequence/distance-multiple.jsonld b/src/test/resources/queries/sequence/distance-multiple.jsonld
index 0696440..6000d58 100644
--- a/src/test/resources/queries/sequence/distance-multiple.jsonld
+++ b/src/test/resources/queries/sequence/distance-multiple.jsonld
@@ -7,12 +7,12 @@
         "@type" : "koral:distance",
         "boundary" : {
           "@type" : "koral:boundary",
-          "max" : 11,
-          "min" : 1
+          "max" : 10,
+          "min" : 0
         },
         "key" : "w",
-        "max" : 11,
-        "min" : 1
+        "max" : 10,
+        "min" : 0
       }
     ],
     "inOrder" : true,
@@ -33,12 +33,12 @@
             "@type" : "koral:distance",
             "boundary" : {
               "@type" : "koral:boundary",
-              "max" : 11,
-              "min" : 2
+              "max" : 10,
+              "min" : 1
             },
             "key" : "w",
-            "max" : 11,
-            "min" : 2
+            "max" : 10,
+            "min" : 1
           }
         ],
         "inOrder" : true,
diff --git a/src/test/resources/queries/sequence/distance-simple.jsonld b/src/test/resources/queries/sequence/distance-simple.jsonld
new file mode 100644
index 0000000..9beeabb
--- /dev/null
+++ b/src/test/resources/queries/sequence/distance-simple.jsonld
@@ -0,0 +1,41 @@
+{
+  "@context": "http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld",
+  "query": {
+    "inOrder": true,
+    "operands": [
+      {
+        "@type": "koral:token",
+        "wrap": {
+          "match": "match:eq",
+          "layer": "orth",
+          "key": "der",
+          "@type": "koral:term"
+        }
+      },
+      {
+        "wrap": {
+          "match": "match:eq",
+          "layer": "orth",
+          "key": "Baum",
+          "@type": "koral:term"
+        },
+        "@type": "koral:token"
+      }
+    ],
+    "operation": "operation:sequence",
+    "distances": [
+      {
+        "key": "w",
+        "@type": "koral:distance",
+        "max": 1,
+        "boundary": {
+          "@type": "koral:boundary",
+          "max": 1,
+          "min": 1
+        },
+        "min": 1
+      }
+    ],
+    "@type": "koral:group"
+  }
+}