Added support for group:disjunction in deserialization
Change-Id: Ib30ef0225a430e40920c02a42c0850add53dc37e
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
index df00673..4ffbb78 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
@@ -32,6 +32,19 @@
assertTrue(sqwi.isOptional());
};
+ @Test
+ public void queryJSONBsp1Disjunction () throws QueryException {
+ SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
+ "/queries/bsp1c.jsonld").getFile());
+
+ // There is a repetition in here
+ // ([base=foo]|[base=bar])[base=foobar]
+ assertEquals(
+ sqwi.toQuery().toString(),
+ "spanOr([tokens:base:foo, spanRepetition(spanNext(tokens:base:foo, tokens:base:bar){1,100})])");
+ assertTrue(sqwi.isOptional());
+ };
+
@Test
public void queryJSONBsp1b () throws QueryException {
diff --git a/src/test/resources/queries/bsp1c.jsonld b/src/test/resources/queries/bsp1c.jsonld
new file mode 100644
index 0000000..7b0b48f
--- /dev/null
+++ b/src/test/resources/queries/bsp1c.jsonld
@@ -0,0 +1,46 @@
+{
+ "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query": {
+ "@type": "koral:group",
+ "operation": "operation:disjunction",
+ "operands": [
+ {
+ "@type": "koral:token",
+ "wrap": {
+ "@type": "koral:term",
+ "layer": "base",
+ "key": "foo"
+ }
+ },
+ {
+ "@type": "koral:group",
+ "min" : 0,
+ "operation": "operation:repetition",
+ "operands": [
+ {
+ "@type": "koral:group",
+ "operation" : "operation:sequence",
+ "operands": [
+ {
+ "@type": "koral:token",
+ "wrap": {
+ "@type": "koral:term",
+ "key": "foo",
+ "layer" : "base"
+ }
+ },
+ {
+ "@type": "koral:token",
+ "wrap": {
+ "@type": "koral:term",
+ "layer": "base",
+ "key" : "bar"
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}