Some debug flags inserted
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestRealIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestRealIndex.java
index aead247..74a827b 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestRealIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestRealIndex.java
@@ -108,8 +108,10 @@
// Create a container for virtual collections:
KorapCollection kc = new KorapCollection(ki);
- String json = getString(getClass().getResource("/queries/bsp-class-2.jsonld").getFile());
+ // String json = getString(getClass().getResource("/queries/bsp-class-2.jsonld").getFile());
+ String json = getString(getClass().getResource("/queries/bsp-repetition.jsonld").getFile());
+ System.err.println(new KorapSearch(json).getQuery().toString());
KorapResult kr = new KorapSearch(json).run(ki);
System.err.println(kr.toJSON());
@@ -117,6 +119,7 @@
// assertEquals(14, kc.numberOf("documents"));
};
+
public static String getString (String path) {
StringBuilder contentBuilder = new StringBuilder();
try {
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java
index 2ed6e06..ae5365d 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java
@@ -262,6 +262,15 @@
assertEquals(sqwi.toQuery().toString(), "shrink(1: spanEndsWith(<tokens:s />, {1: tokens:mate/p:V}))");
};
+
+ @Test
+ public void queryJSONrepetition () {
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp-repetition.jsonld").getFile());
+
+ // der[cnx/p=A]{0,2}[tt/p=NN]
+ assertEquals(sqwi.toQuery().toString(), "spanNext(spanOr([tokens:s:der, spanNext(tokens:s:der, spanQuantifier(tokens:cnx/p:A[1:2]))]), tokens:tt/p:NN)");
+ };
+
public static String getString (String path) {
StringBuilder contentBuilder = new StringBuilder();
try {
diff --git a/src/test/resources/queries/bsp-repetition.jsonld b/src/test/resources/queries/bsp-repetition.jsonld
new file mode 100644
index 0000000..342b7d5
--- /dev/null
+++ b/src/test/resources/queries/bsp-repetition.jsonld
@@ -0,0 +1,62 @@
+{
+ "@context" : "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "collections" : [
+ {
+ "@type" : "korap:meta-filter",
+ "@value" : {
+ "@field" : "korap:field#corpusID",
+ "@type" : "korap:term",
+ "@value" : "WPD"
+ }
+ }
+ ],
+ "meta" : {},
+ "query" : {
+ "@type" : "korap:group",
+ "operands" : [
+ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "key" : "der",
+ "layer" : "orth",
+ "match" : "match:eq"
+ }
+ },
+ {
+ "@type" : "korap:group",
+ "boundary" : {
+ "@type" : "korap:boundary",
+ "max" : 2,
+ "min" : 0
+ },
+ "max" : 2,
+ "min" : 0,
+ "operands" : [
+ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "foundry" : "cnx",
+ "key" : "A",
+ "layer" : "p",
+ "match" : "match:eq"
+ }
+ }
+ ],
+ "operation" : "operation:repetition"
+ },
+ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "foundry" : "tt",
+ "key" : "NN",
+ "layer" : "p",
+ "match" : "match:eq"
+ }
+ }
+ ],
+ "operation" : "operation:sequence"
+ }
+}
\ No newline at end of file