Add test for longer sequence with distances
Change-Id: I05e64a9ae8d4465d03c2869a2b16bf178533ff9d
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
index 62b5f7e..d0e952c 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
@@ -411,6 +411,16 @@
"(base/s:s[0:0], ordered, notExcluded)])");
};
+
+ @Test
+ public void queryJSONdistanceMultipleOps () throws QueryException {
+
+ SpanQueryWrapper sqwi = getJsonQuery(getClass().getResource("/queries/sequence/distance-with-multiple-ops.jsonld").getFile());
+ SpanQuery sq = sqwi.toQuery();
+ assertEquals(sq.toString(),"spanDistance(spanDistance(tokens:s:der, tokens:s:alte, [(w[2:2], ordered, notExcluded)]), tokens:s:Baum, [(w[2:2], ordered, notExcluded)])");
+ };
+
+
@Test
public void queryJSONcosmas2Bug2 () throws QueryException {
diff --git a/src/test/resources/queries/reference/bug-class-in-reference.jsonld b/src/test/resources/queries/reference/bug-class-in-reference.jsonld
new file mode 100644
index 0000000..a7d58e7
--- /dev/null
+++ b/src/test/resources/queries/reference/bug-class-in-reference.jsonld
@@ -0,0 +1,70 @@
+{
+ "query":{
+ "operands":[
+ {
+ "operands":[
+ {
+ "operands":[
+ {
+ "operands":[
+ {
+ "@type":"koral:token",
+ "wrap":{
+ "@type":"koral:term",
+ "match":"match:eq",
+ "layer":"orth",
+ "key":"ich"
+ }
+ }
+ ],
+ "classOut":129,
+ "@type":"koral:group",
+ "operation":"operation:class"
+ },
+ {
+ "operands":[
+ {
+ "@type":"koral:token",
+ "wrap":{
+ "@type":"koral:term",
+ "match":"match:eq",
+ "layer":"p",
+ "key":"VVFIN"
+ }
+ }
+ ],
+ "classOut":130,
+ "@type":"koral:group",
+ "operation":"operation:class"
+ }
+ ],
+ "@type":"koral:group",
+ "relType":{
+ "@type":"koral:relation",
+ "wrap":{
+ "foundry":"malt",
+ "@type":"koral:term",
+ "match":"match:eq",
+ "layer":"d",
+ "key":"SUBJ"
+ }
+ },
+ "operation":"operation:relation"
+ }
+ ],
+ "@type":"koral:reference",
+ "operation":"operation:focus",
+ "classRef":[129]
+ },
+ {
+ "@type":"koral:reference",
+ "operation":"operation:focus",
+ "classRef":[130]
+ }
+ ],
+ "@type":"koral:group",
+ "inOrder":true,
+ "operation":"operation:sequence"
+ },
+ "@context":"http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld"
+}
diff --git a/src/test/resources/queries/sequence/distance-with-multiple-ops.jsonld b/src/test/resources/queries/sequence/distance-with-multiple-ops.jsonld
new file mode 100644
index 0000000..224711b
--- /dev/null
+++ b/src/test/resources/queries/sequence/distance-with-multiple-ops.jsonld
@@ -0,0 +1,48 @@
+{
+ "@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"
+ }
+ },
+ {
+ "@type": "koral:token",
+ "wrap": {
+ "match": "match:eq",
+ "layer": "orth",
+ "key": "alte",
+ "@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",
+ "boundary": {
+ "@type": "koral:boundary",
+ "max": 1,
+ "min": 1
+ }
+ }
+ ],
+ "@type": "koral:group"
+ }
+}