Added test for deserialization of negative-optional-classed query in sequence
Change-Id: Ibfd5b279e9a84331fc9b212a7ce83617c6315d18
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 1360e41..81c9744 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
@@ -381,6 +381,13 @@
};
+ @Test
+ public void queryJSONseqEmptyNegativeOptionalClass () throws QueryException {
+ SpanQueryWrapper sqwi = jsonQueryFile("empty-negative-optional.jsonld");
+ // der {[pos!=ADJA]*} Mann
+ assertEquals(sqwi.toQuery().toString(),"spanNext(tokens:s:der, spanExpansion(tokens:s:Mann, !tokens:tt/p:ADJA{0, 100}, left, class:1))");
+ };
+
// get query wrapper based on json file
public SpanQueryWrapper jsonQueryFile (String filename) throws QueryException {
diff --git a/src/test/resources/queries/sequence/empty-negative-optional.jsonld b/src/test/resources/queries/sequence/empty-negative-optional.jsonld
new file mode 100644
index 0000000..bf2f5b2
--- /dev/null
+++ b/src/test/resources/queries/sequence/empty-negative-optional.jsonld
@@ -0,0 +1,80 @@
+{
+ "@context": "http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld",
+ "query": {
+ "@type": "koral:group",
+ "operands": [
+ {
+ "@type": "koral:token",
+ "wrap": {
+ "@type": "koral:term",
+ "foundry": "opennlp",
+ "key": "der",
+ "layer": "orth",
+ "match": "match:eq",
+ "rewrites": [
+ {
+ "@type": "koral:rewrite",
+ "operation": "operation:injection",
+ "scope": "foundry",
+ "src": "Kustvakt"
+ }
+ ]
+ }
+ },
+ {
+ "@type": "koral:group",
+ "boundary": {
+ "@type": "koral:boundary",
+ "min": 0
+ },
+ "operands": [
+ {
+ "@type": "koral:group",
+ "classOut": 1,
+ "operation": "operation:class",
+ "operands": [
+ {
+ "@type": "koral:token",
+ "wrap": {
+ "@type": "koral:term",
+ "foundry": "tt",
+ "key": "ADJA",
+ "layer": "pos",
+ "match": "match:ne",
+ "rewrites": [
+ {
+ "@type": "koral:rewrite",
+ "operation": "operation:injection",
+ "scope": "foundry",
+ "src": "Kustvakt"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "operation": "operation:repetition"
+ },
+ {
+ "@type": "koral:token",
+ "wrap": {
+ "@type": "koral:term",
+ "foundry": "opennlp",
+ "key": "Mann",
+ "layer": "orth",
+ "match": "match:eq",
+ "rewrites": [
+ {
+ "@type": "koral:rewrite",
+ "operation": "operation:injection",
+ "scope": "foundry",
+ "src": "Kustvakt"
+ }
+ ]
+ }
+ }
+ ],
+ "operation": "operation:sequence"
+ }
+}