Added test for deserialization of sentence exclusion
Change-Id: Id139e856ba6cb47ec2ca6036378dcef8292058a6
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 c04f2c7..ceed514 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
@@ -411,7 +411,16 @@
"(base/s:s[0:0], ordered, notExcluded)])");
};
+ @Test
+ public void queryJSONcosmas2Bug2 () throws QueryException {
+ SpanQueryWrapper sqwi = getJsonQuery(getClass().getResource("/queries/bugs/cosmas-exclude.jsonld").getFile());
+
+ SpanQuery sq = sqwi.toQuery();
+
+ // (Pop-up OR Pop-ups) %s0 (Internet OR Programm)
+ assertEquals(sq.toString(),"spanElementDistance({129: spanOr([tokens:s:Pop-up, tokens:s:Pop-ups])}, {129: spanOr([tokens:s:Internet, tokens:s:Programm])}, [(base/s:s[0:0], notOrdered, excluded)])");
+ };
// get query wrapper based on json file
diff --git a/src/test/resources/queries/bugs/cosmas-exclude.jsonld b/src/test/resources/queries/bugs/cosmas-exclude.jsonld
new file mode 100644
index 0000000..57f50bc
--- /dev/null
+++ b/src/test/resources/queries/bugs/cosmas-exclude.jsonld
@@ -0,0 +1,71 @@
+{
+ "query":{
+ "operands":[{
+ "operands":[{
+ "operands":[{
+ "@type":"koral:token",
+ "wrap":{
+ "@type":"koral:term",
+ "match":"match:eq",
+ "key":"Pop-up",
+ "layer":"orth"
+ }
+ },{
+ "@type":"koral:token",
+ "wrap":{
+ "@type":"koral:term",
+ "match":"match:eq",
+ "key":"Pop-ups",
+ "layer":"orth"
+ }
+ }],
+ "@type":"koral:group",
+ "inOrder":false,
+ "operation":"operation:disjunction"
+ }],
+ "classOut":129,
+ "@type":"koral:group",
+ "operation":"operation:class"
+ },{
+ "operands":[{
+ "operands":[{
+ "@type":"koral:token",
+ "wrap":{
+ "@type":"koral:term",
+ "match":"match:eq",
+ "key":"Internet",
+ "layer":"orth"
+ }
+ },{
+ "@type":"koral:token",
+ "wrap":{
+ "@type":"koral:term",
+ "match":"match:eq",
+ "key":"Programm",
+ "layer":"orth"
+ }
+ }],
+ "@type":"koral:group",
+ "inOrder":false,
+ "operation":"operation:disjunction"
+ }],
+ "classOut":129,
+ "@type":"koral:group",
+ "operation":"operation:class"
+ }],
+ "distances":[{
+ "boundary":{
+ "min":0,
+ "max":0,
+ "@type":"koral:boundary"
+ },
+ "@type":"cosmas:distance",
+ "exclude":true,
+ "key":"s"
+ }],
+ "@type":"koral:group",
+ "inOrder":false,
+ "operation":"operation:sequence"
+ },
+ "@context":"http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld"
+}