removed Cosmas references around distances: only set classes on operands
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessor.java
index d0490b0..4aeed1e 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessor.java
@@ -498,7 +498,8 @@
}
else { // match only first argument
focusGroup = KoralObjectGenerator.wrapInReference(classRefCheck,
- classCounter);
+ classCounter-1);
+ classCounter++;
}
// wrap in 'merge' operation if grouping option is set
if (positionOptions.containsKey("grouping")) {
@@ -595,8 +596,10 @@
|| openNodeCats.get(1).equals("OPNHIT"))) {
wrapOperandInClass(node, 1, classCounter);
wrapOperandInClass(node, 2, classCounter);
- group = KoralObjectGenerator.wrapInReference(group,
- classCounter++);
+ // Deactivated, uncomment to wrap sequence in reference.
+// group = KoralObjectGenerator.wrapInReference(group,
+// classCounter++);
+ classCounter++;
}
else if (openNodeCats.get(1).equals("OPNHIT")) {
LinkedHashMap<String, Object> repetition = KoralObjectGenerator
diff --git a/src/test/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessorTest.java b/src/test/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessorTest.java
index 92f6a16..f86ee28 100644
--- a/src/test/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessorTest.java
+++ b/src/test/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessorTest.java
@@ -398,78 +398,72 @@
query = "Sonne /+w1:4 Mond";
qs.setQuery(query, "cosmas2");
res = mapper.readTree(qs.toJSON());
- assertEquals("korap:reference", res.at("/query/@type").asText());
- assertEquals("operation:focus", res.at("/query/operation").asText());
- assertEquals(1, res.at("/query/classRef/0").asInt());
+ assertEquals("korap:group", res.at("/query/@type").asText());
+ assertEquals("operation:sequence", res.at("/query/operation").asText());
+ assertEquals("korap:distance", res.at("/query/distances/0/@type").asText());
+ assertEquals("w", res.at("/query/distances/0/key").asText());
+ assertEquals(1, res.at("/query/distances/0/boundary/min").asInt());
+ assertEquals(4, res.at("/query/distances/0/boundary/max").asInt());
+ assertEquals(true, res.at("/query/inOrder").asBoolean());
assertEquals("korap:group", res.at("/query/operands/0/@type").asText());
- assertEquals("operation:sequence", res.at("/query/operands/0/operation").asText());
- assertEquals("korap:distance", res.at("/query/operands/0/distances/0/@type").asText());
- assertEquals("w", res.at("/query/operands/0/distances/0/key").asText());
- assertEquals(1, res.at("/query/operands/0/distances/0/boundary/min").asInt());
- assertEquals(4, res.at("/query/operands/0/distances/0/boundary/max").asInt());
- assertEquals(true, res.at("/query/operands/0/inOrder").asBoolean());
- assertEquals("korap:group", res.at("/query/operands/0/operands/0/@type").asText());
- assertEquals("operation:class", res.at("/query/operands/0/operands/0/operation").asText());
- assertEquals(1, res.at("/query/operands/0/operands/0/classOut").asInt());
- assertEquals(1, res.at("/query/operands/0/operands/1/classOut").asInt());
- assertEquals("korap:token", res.at("/query/operands/0/operands/0/operands/0/@type").asText());
- assertEquals("Sonne", res.at("/query/operands/0/operands/0/operands/0/wrap/key").asText());
- assertEquals("Mond", res.at("/query/operands/0/operands/1/operands/0/wrap/key").asText());
+ assertEquals("operation:class", res.at("/query/operands/0/operation").asText());
+ assertEquals(1, res.at("/query/operands/0/classOut").asInt());
+ assertEquals(1, res.at("/query/operands/1/classOut").asInt());
+ assertEquals("korap:token", res.at("/query/operands/0/operands/0/@type").asText());
+ assertEquals("Sonne", res.at("/query/operands/0/operands/0/wrap/key").asText());
+ assertEquals("Mond", res.at("/query/operands/1/operands/0/wrap/key").asText());
query = "Sonne /+w1:4,s0,p1:3 Mond";
qs.setQuery(query, "cosmas2");
res = mapper.readTree(qs.toJSON());
- assertEquals("korap:reference", res.at("/query/@type").asText());
- assertEquals("operation:focus", res.at("/query/operation").asText());
- assertEquals(1, res.at("/query/classRef/0").asInt());
+ assertEquals("korap:group", res.at("/query/@type").asText());
+ assertEquals("operation:sequence", res.at("/query/operation").asText());
+ assertEquals("korap:distance", res.at("/query/distances/0/@type").asText());
+ assertEquals("w", res.at("/query/distances/0/key").asText());
+ assertEquals(1, res.at("/query/distances/0/boundary/min").asInt());
+ assertEquals(4, res.at("/query/distances/0/boundary/max").asInt());
+ assertEquals("s", res.at("/query/distances/1/key").asText());
+ assertEquals(0, res.at("/query/distances/1/boundary/min").asInt());
+ assertEquals("p", res.at("/query/distances/2/key").asText());
+ assertEquals(1, res.at("/query/distances/2/boundary/min").asInt());
+ assertEquals(3, res.at("/query/distances/2/boundary/max").asInt());
+ assertEquals(true, res.at("/query/inOrder").asBoolean());
assertEquals("korap:group", res.at("/query/operands/0/@type").asText());
- assertEquals("operation:sequence", res.at("/query/operands/0/operation").asText());
- assertEquals("korap:distance", res.at("/query/operands/0/distances/0/@type").asText());
- assertEquals("w", res.at("/query/operands/0/distances/0/key").asText());
- assertEquals(1, res.at("/query/operands/0/distances/0/boundary/min").asInt());
- assertEquals(4, res.at("/query/operands/0/distances/0/boundary/max").asInt());
- assertEquals("s", res.at("/query/operands/0/distances/1/key").asText());
- assertEquals(0, res.at("/query/operands/0/distances/1/boundary/min").asInt());
- assertEquals("p", res.at("/query/operands/0/distances/2/key").asText());
- assertEquals(1, res.at("/query/operands/0/distances/2/boundary/min").asInt());
- assertEquals(3, res.at("/query/operands/0/distances/2/boundary/max").asInt());
- assertEquals(true, res.at("/query/operands/0/inOrder").asBoolean());
- assertEquals("korap:group", res.at("/query/operands/0/operands/0/@type").asText());
- assertEquals("operation:class", res.at("/query/operands/0/operands/0/operation").asText());
- assertEquals(1, res.at("/query/operands/0/operands/0/classOut").asInt());
- assertEquals(1, res.at("/query/operands/0/operands/1/classOut").asInt());
- assertEquals("korap:token", res.at("/query/operands/0/operands/0/operands/0/@type").asText());
- assertEquals("Sonne", res.at("/query/operands/0/operands/0/operands/0/wrap/key").asText());
- assertEquals("Mond", res.at("/query/operands/0/operands/1/operands/0/wrap/key").asText());
+ assertEquals("operation:class", res.at("/query/operands/0/operation").asText());
+ assertEquals(1, res.at("/query/operands/0/classOut").asInt());
+ assertEquals(1, res.at("/query/operands/1/classOut").asInt());
+ assertEquals("korap:token", res.at("/query/operands/0/operands/0/@type").asText());
+ assertEquals("Sonne", res.at("/query/operands/0/operands/0/wrap/key").asText());
+ assertEquals("Mond", res.at("/query/operands/1/operands/0/wrap/key").asText());
query = "Sonne /+w4 Mond";
qs.setQuery(query, "cosmas2");
res = mapper.readTree(qs.toJSON());
- assertEquals("korap:distance", res.at("/query/operands/0/distances/0/@type").asText());
- assertEquals("w", res.at("/query/operands/0/distances/0/key").asText());
- assertEquals(0, res.at("/query/operands/0/distances/0/boundary/min").asInt());
- assertEquals(4, res.at("/query/operands/0/distances/0/boundary/max").asInt());
+ assertEquals("korap:distance", res.at("/query/distances/0/@type").asText());
+ assertEquals("w", res.at("/query/distances/0/key").asText());
+ assertEquals(0, res.at("/query/distances/0/boundary/min").asInt());
+ assertEquals(4, res.at("/query/distances/0/boundary/max").asInt());
query = "Sonne /-w4 Mond";
qs.setQuery(query, "cosmas2");
res = mapper.readTree(qs.toJSON());
- assertEquals("korap:distance", res.at("/query/operands/0/distances/0/@type").asText());
- assertEquals("w", res.at("/query/operands/0/distances/0/key").asText());
- assertEquals(0, res.at("/query/operands/0/distances/0/boundary/min").asInt());
- assertEquals(4, res.at("/query/operands/0/distances/0/boundary/max").asInt());
- assertEquals("Mond", res.at("/query/operands/0/operands/0/operands/0/wrap/key").asText());
- assertEquals("Sonne", res.at("/query/operands/0/operands/1/operands/0/wrap/key").asText());
+ assertEquals("korap:distance", res.at("/query/distances/0/@type").asText());
+ assertEquals("w", res.at("/query/distances/0/key").asText());
+ assertEquals(0, res.at("/query/distances/0/boundary/min").asInt());
+ assertEquals(4, res.at("/query/distances/0/boundary/max").asInt());
+ assertEquals("Mond", res.at("/query/operands/0/operands/0/wrap/key").asText());
+ assertEquals("Sonne", res.at("/query/operands/1/operands/0/wrap/key").asText());
query = "Sonne /w4 Mond";
qs.setQuery(query, "cosmas2");
res = mapper.readTree(qs.toJSON());
- assertEquals("korap:distance", res.at("/query/operands/0/distances/0/@type").asText());
- assertEquals("w", res.at("/query/operands/0/distances/0/key").asText());
- assertEquals(0, res.at("/query/operands/0/distances/0/boundary/min").asInt());
- assertEquals(4, res.at("/query/operands/0/distances/0/boundary/max").asInt());
- assertEquals("Sonne", res.at("/query/operands/0/operands/0/operands/0/wrap/key").asText());
- assertEquals("Mond", res.at("/query/operands/0/operands/1/operands/0/wrap/key").asText());
- assertEquals(false, res.at("/query/operands/0/inOrder").asBoolean());
+ assertEquals("korap:distance", res.at("/query/distances/0/@type").asText());
+ assertEquals("w", res.at("/query/distances/0/key").asText());
+ assertEquals(0, res.at("/query/distances/0/boundary/min").asInt());
+ assertEquals(4, res.at("/query/distances/0/boundary/max").asInt());
+ assertEquals("Sonne", res.at("/query/operands/0/operands/0/wrap/key").asText());
+ assertEquals("Mond", res.at("/query/operands/1/operands/0/wrap/key").asText());
+ assertEquals(false, res.at("/query/inOrder").asBoolean());
}
@Test
@@ -477,69 +471,57 @@
query = "Sonne /+w1:4 Mond /+w1:7 Sterne";
qs.setQuery(query, "cosmas2");
res = mapper.readTree(qs.toJSON());
- assertEquals("korap:reference", res.at("/query/@type").asText());
- assertEquals("operation:focus", res.at("/query/operation").asText());
- assertEquals(1, res.at("/query/classRef/0").asInt());
+ assertEquals("korap:group", res.at("/query/@type").asText());
+ assertEquals("operation:sequence", res.at("/query/operation").asText());
+ assertEquals("korap:distance", res.at("/query/distances/0/@type").asText());
+ assertEquals("w", res.at("/query/distances/0/key").asText());
+ assertEquals(1, res.at("/query/distances/0/boundary/min").asInt());
+ assertEquals(4, res.at("/query/distances/0/boundary/max").asInt());
+ assertEquals(true, res.at("/query/inOrder").asBoolean());
assertEquals("korap:group", res.at("/query/operands/0/@type").asText());
- assertEquals("operation:sequence", res.at("/query/operands/0/operation").asText());
- assertEquals("korap:distance", res.at("/query/operands/0/distances/0/@type").asText());
- assertEquals("w", res.at("/query/operands/0/distances/0/key").asText());
- assertEquals(1, res.at("/query/operands/0/distances/0/boundary/min").asInt());
- assertEquals(4, res.at("/query/operands/0/distances/0/boundary/max").asInt());
- assertEquals(true, res.at("/query/operands/0/inOrder").asBoolean());
- assertEquals("korap:group", res.at("/query/operands/0/operands/0/@type").asText());
- assertEquals("operation:class", res.at("/query/operands/0/operands/0/operation").asText());
- assertEquals(1, res.at("/query/operands/0/operands/0/classOut").asInt());
- assertEquals("Sonne", res.at("/query/operands/0/operands/0/operands/0/wrap/key").asText());
- assertEquals(1, res.at("/query/operands/0/operands/1/classOut").asInt());
- assertEquals("korap:reference", res.at("/query/operands/0/operands/1/operands/0/@type").asText());
- assertEquals(2, res.at("/query/operands/0/operands/1/operands/0/classRef/0").asInt());
- assertEquals("operation:focus", res.at("/query/operands/0/operands/1/operands/0/operation").asText());
- assertEquals("operation:sequence", res.at("/query/operands/0/operands/1/operands/0/operands/0/operation").asText());
- assertEquals("w", res.at("/query/operands/0/operands/1/operands/0/operands/0/distances/0/key").asText());
- assertEquals(1, res.at("/query/operands/0/operands/1/operands/0/operands/0/distances/0/boundary/min").asInt());
- assertEquals(7, res.at("/query/operands/0/operands/1/operands/0/operands/0/distances/0/boundary/max").asInt());
- assertEquals(2, res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/0/classOut").asInt());
- assertEquals("Mond", res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/0/operands/0/wrap/key").asText());
- assertEquals(2, res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/1/classOut").asInt());
- assertEquals("Sterne", res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
+ assertEquals("operation:class", res.at("/query/operands/0/operation").asText());
+ assertEquals(1, res.at("/query/operands/0/classOut").asInt());
+ assertEquals("Sonne", res.at("/query/operands/0/operands/0/wrap/key").asText());
+ assertEquals(1, res.at("/query/operands/1/classOut").asInt());
+ assertEquals("operation:sequence", res.at("/query/operands/1/operands/0/operation").asText());
+ assertEquals("w", res.at("/query/operands/1/operands/0/distances/0/key").asText());
+ assertEquals(1, res.at("/query/operands/1/operands/0/distances/0/boundary/min").asInt());
+ assertEquals(7, res.at("/query/operands/1/operands/0/distances/0/boundary/max").asInt());
+ assertEquals(2, res.at("/query/operands/1/operands/0/operands/0/classOut").asInt());
+ assertEquals("Mond", res.at("/query/operands/1/operands/0/operands/0/operands/0/wrap/key").asText());
+ assertEquals(2, res.at("/query/operands/1/operands/0/operands/1/classOut").asInt());
+ assertEquals("Sterne", res.at("/query/operands/1/operands/0/operands/1/operands/0/wrap/key").asText());
query = "Sonne /+w1:4 Mond /-w1:7 Sterne";
qs.setQuery(query, "cosmas2");
res = mapper.readTree(qs.toJSON());
- assertEquals("Sonne", res.at("/query/operands/0/operands/0/operands/0/wrap/key").asText());
- assertEquals("Sterne", res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/0/operands/0/wrap/key").asText());
- assertEquals("Mond", res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
+ assertEquals("Sonne", res.at("/query/operands/0/operands/0/wrap/key").asText());
+ assertEquals("Sterne", res.at("/query/operands/1/operands/0/operands/0/operands/0/wrap/key").asText());
+ assertEquals("Mond", res.at("/query/operands/1/operands/0/operands/1/operands/0/wrap/key").asText());
query = "Sonne /-w4 Mond /+w2 Sterne";
qs.setQuery(query, "cosmas2");
res = mapper.readTree(qs.toJSON());
- assertEquals("korap:reference", res.at("/query/@type").asText());
- assertEquals("operation:focus", res.at("/query/operation").asText());
- assertEquals(1, res.at("/query/classRef/0").asInt());
- assertEquals("korap:group", res.at("/query/operands/0/@type").asText());
- assertEquals("operation:sequence", res.at("/query/operands/0/operation").asText());
- assertEquals("korap:distance", res.at("/query/operands/0/distances/0/@type").asText());
- assertEquals("w", res.at("/query/operands/0/distances/0/key").asText());
- assertEquals(0, res.at("/query/operands/0/distances/0/boundary/min").asInt());
- assertEquals(4, res.at("/query/operands/0/distances/0/boundary/max").asInt());
- assertEquals(true, res.at("/query/operands/0/inOrder").asBoolean());
- assertEquals("korap:group", res.at("/query/operands/0/operands/1/@type").asText());
- assertEquals("operation:class", res.at("/query/operands/0/operands/1/operation").asText());
- assertEquals(1, res.at("/query/operands/0/operands/1/classOut").asInt());
- assertEquals("Sonne", res.at("/query/operands/0/operands/1/operands/0/wrap/key").asText());
- assertEquals(1, res.at("/query/operands/0/operands/0/classOut").asInt());
- assertEquals("korap:reference", res.at("/query/operands/0/operands/0/operands/0/@type").asText());
- assertEquals(2, res.at("/query/operands/0/operands/0/operands/0/classRef/0").asInt());
- assertEquals("operation:focus", res.at("/query/operands/0/operands/0/operands/0/operation").asText());
- assertEquals("operation:sequence", res.at("/query/operands/0/operands/0/operands/0/operands/0/operation").asText());
- assertEquals("w", res.at("/query/operands/0/operands/0/operands/0/operands/0/distances/0/key").asText());
- assertEquals(0, res.at("/query/operands/0/operands/0/operands/0/operands/0/distances/0/boundary/min").asInt());
- assertEquals(2, res.at("/query/operands/0/operands/0/operands/0/operands/0/distances/0/boundary/max").asInt());
- assertEquals(2, res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/0/classOut").asInt());
- assertEquals("Mond", res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/0/operands/0/wrap/key").asText());
- assertEquals(2, res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/1/classOut").asInt());
- assertEquals("Sterne", res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
+ assertEquals("korap:group", res.at("/query/@type").asText());
+ assertEquals("operation:sequence", res.at("/query/operation").asText());
+ assertEquals("korap:distance", res.at("/query/distances/0/@type").asText());
+ assertEquals("w", res.at("/query/distances/0/key").asText());
+ assertEquals(0, res.at("/query/distances/0/boundary/min").asInt());
+ assertEquals(4, res.at("/query/distances/0/boundary/max").asInt());
+ assertEquals(true, res.at("/query/inOrder").asBoolean());
+ assertEquals("korap:group", res.at("/query/operands/1/@type").asText());
+ assertEquals("operation:class", res.at("/query/operands/1/operation").asText());
+ assertEquals(1, res.at("/query/operands/1/classOut").asInt());
+ assertEquals("Sonne", res.at("/query/operands/1/operands/0/wrap/key").asText());
+ assertEquals(1, res.at("/query/operands/0/classOut").asInt());
+ assertEquals("operation:sequence", res.at("/query/operands/0/operands/0/operation").asText());
+ assertEquals("w", res.at("/query/operands/0/operands/0/distances/0/key").asText());
+ assertEquals(0, res.at("/query/operands/0/operands/0/distances/0/boundary/min").asInt());
+ assertEquals(2, res.at("/query/operands/0/operands/0/distances/0/boundary/max").asInt());
+ assertEquals(2, res.at("/query/operands/0/operands/0/operands/0/classOut").asInt());
+ assertEquals("Mond", res.at("/query/operands/0/operands/0/operands/0/operands/0/wrap/key").asText());
+ assertEquals(2, res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
+ assertEquals("Sterne", res.at("/query/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
}
@@ -550,7 +532,7 @@
res = mapper.readTree(qs.toJSON());
assertEquals("korap:reference", res.at("/query/@type").asText());
assertEquals("operation:focus", res.at("/query/operation").asText());
- assertEquals(3, res.at("/query/classRef/0").asInt());
+ assertEquals(2, res.at("/query/classRef/0").asInt());
assertEquals("korap:group", res.at("/query/operands/0/@type").asText());
assertEquals("operation:class", res.at("/query/operands/0/operation").asText());
assertEquals("classRefCheck:includes", res.at("/query/operands/0/classRefCheck/0").asText());
@@ -644,7 +626,7 @@
res = mapper.readTree(qs.toJSON());
assertEquals("korap:reference", res.at("/query/@type").asText());
assertEquals("operation:focus", res.at("/query/operation").asText());
- assertEquals(3, res.at("/query/classRef/0").asInt());
+ assertEquals(2, res.at("/query/classRef/0").asInt());
assertEquals("korap:group", res.at("/query/operands/0/@type").asText());
assertEquals("operation:class", res.at("/query/operands/0/operation").asText());
assertEquals("classRefCheck:intersects", res.at("/query/operands/0/classRefCheck/0").asText());
@@ -717,72 +699,66 @@
query = "#BEG(der /w3:5 Mann) /+w10 kommt";
qs.setQuery(query, "cosmas2");
res = mapper.readTree(qs.toJSON());
- assertEquals("korap:reference", res.at("/query/@type").asText());
- assertEquals("operation:focus", res.at("/query/operation").asText());
- assertEquals(1, res.at("/query/classRef/0").asInt());
+ assertEquals("korap:group", res.at("/query/@type").asText());
+ assertEquals("operation:sequence", res.at("/query/operation").asText());
+ assertEquals("korap:distance", res.at("/query/distances/0/@type").asText());
+ assertEquals("w", res.at("/query/distances/0/key").asText());
+ assertEquals(0, res.at("/query/distances/0/boundary/min").asInt());
+ assertEquals(10, res.at("/query/distances/0/boundary/max").asInt());
+ assertEquals(true, res.at("/query/inOrder").asBoolean());
assertEquals("korap:group", res.at("/query/operands/0/@type").asText());
- assertEquals("operation:sequence", res.at("/query/operands/0/operation").asText());
- assertEquals("korap:distance", res.at("/query/operands/0/distances/0/@type").asText());
- assertEquals("w", res.at("/query/operands/0/distances/0/key").asText());
- assertEquals(0, res.at("/query/operands/0/distances/0/boundary/min").asInt());
- assertEquals(10, res.at("/query/operands/0/distances/0/boundary/max").asInt());
- assertEquals(true, res.at("/query/operands/0/inOrder").asBoolean());
- assertEquals("korap:group", res.at("/query/operands/0/operands/0/@type").asText());
- assertEquals("operation:class", res.at("/query/operands/0/operands/0/operation").asText());
- assertEquals(1, res.at("/query/operands/0/operands/0/classOut").asInt());
- assertEquals("korap:reference", res.at("/query/operands/0/operands/0/operands/0/@type").asText());
- assertEquals("operation:focus", res.at("/query/operands/0/operands/0/operands/0/operation").asText());
- assertEquals(0, res.at("/query/operands/0/operands/0/operands/0/spanRef/0").asInt());
- assertEquals(1, res.at("/query/operands/0/operands/0/operands/0/spanRef/1").asInt());
- assertEquals("korap:group", res.at("/query/operands/0/operands/0/operands/0/operands/0/@type").asText());
- assertEquals("operation:sequence", res.at("/query/operands/0/operands/0/operands/0/operands/0/operation").asText());
- assertEquals("korap:distance", res.at("/query/operands/0/operands/0/operands/0/operands/0/distances/0/@type").asText());
- assertEquals("w", res.at("/query/operands/0/operands/0/operands/0/operands/0/distances/0/key").asText());
- assertEquals(3, res.at("/query/operands/0/operands/0/operands/0/operands/0/distances/0/boundary/min").asInt());
- assertEquals(5, res.at("/query/operands/0/operands/0/operands/0/operands/0/distances/0/boundary/max").asInt());
- assertEquals(false, res.at("/query/operands/0/operands/0/operands/0/operands/0/inOrder").asBoolean());
- assertEquals("korap:token", res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/0/@type").asText());
- assertEquals("der", res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/0/wrap/key").asText());
- assertEquals("Mann", res.at("/query/operands/0/operands/0/operands/0/operands/0/operands/1/wrap/key").asText());
- assertEquals("operation:class", res.at("/query/operands/0/operands/1/operation").asText());
- assertEquals(1, res.at("/query/operands/0/operands/1/classOut").asInt());
- assertEquals("korap:token", res.at("/query/operands/0/operands/1/operands/0/@type").asText());
- assertEquals("kommt", res.at("/query/operands/0/operands/1/operands/0/wrap/key").asText());
+ assertEquals("operation:class", res.at("/query/operands/0/operation").asText());
+ assertEquals(1, res.at("/query/operands/0/classOut").asInt());
+ assertEquals("korap:reference", res.at("/query/operands/0/operands/0/@type").asText());
+ assertEquals("operation:focus", res.at("/query/operands/0/operands/0/operation").asText());
+ assertEquals(0, res.at("/query/operands/0/operands/0/spanRef/0").asInt());
+ assertEquals(1, res.at("/query/operands/0/operands/0/spanRef/1").asInt());
+ assertEquals("korap:group", res.at("/query/operands/0/operands/0/operands/0/@type").asText());
+ assertEquals("operation:sequence", res.at("/query/operands/0/operands/0/operands/0/operation").asText());
+ assertEquals("korap:distance", res.at("/query/operands/0/operands/0/operands/0/distances/0/@type").asText());
+ assertEquals("w", res.at("/query/operands/0/operands/0/operands/0/distances/0/key").asText());
+ assertEquals(3, res.at("/query/operands/0/operands/0/operands/0/distances/0/boundary/min").asInt());
+ assertEquals(5, res.at("/query/operands/0/operands/0/operands/0/distances/0/boundary/max").asInt());
+ assertEquals(false, res.at("/query/operands/0/operands/0/operands/0/inOrder").asBoolean());
+ assertEquals("korap:token", res.at("/query/operands/0/operands/0/operands/0/operands/0/@type").asText());
+ assertEquals("der", res.at("/query/operands/0/operands/0/operands/0/operands/0/wrap/key").asText());
+ assertEquals("Mann", res.at("/query/operands/0/operands/0/operands/0/operands/1/wrap/key").asText());
+ assertEquals("operation:class", res.at("/query/operands/1/operation").asText());
+ assertEquals(1, res.at("/query/operands/1/classOut").asInt());
+ assertEquals("korap:token", res.at("/query/operands/1/operands/0/@type").asText());
+ assertEquals("kommt", res.at("/query/operands/1/operands/0/wrap/key").asText());
query = "kommt /+w10 #BEG(der /w3:5 Mann)";
qs.setQuery(query, "cosmas2");
res = mapper.readTree(qs.toJSON());
- assertEquals("korap:reference", res.at("/query/@type").asText());
- assertEquals("operation:focus", res.at("/query/operation").asText());
- assertEquals(1, res.at("/query/classRef/0").asInt());
- assertEquals("korap:group", res.at("/query/operands/0/@type").asText());
- assertEquals("operation:sequence", res.at("/query/operands/0/operation").asText());
- assertEquals("korap:distance", res.at("/query/operands/0/distances/0/@type").asText());
- assertEquals("w", res.at("/query/operands/0/distances/0/key").asText());
- assertEquals(0, res.at("/query/operands/0/distances/0/boundary/min").asInt());
- assertEquals(10, res.at("/query/operands/0/distances/0/boundary/max").asInt());
- assertEquals(true, res.at("/query/operands/0/inOrder").asBoolean());
- assertEquals("korap:group", res.at("/query/operands/0/operands/1/@type").asText());
- assertEquals("operation:class", res.at("/query/operands/0/operands/1/operation").asText());
- assertEquals(1, res.at("/query/operands/0/operands/1/classOut").asInt());
- assertEquals("korap:reference", res.at("/query/operands/0/operands/1/operands/0/@type").asText());
- assertEquals("operation:focus", res.at("/query/operands/0/operands/1/operands/0/operation").asText());
- assertEquals(0, res.at("/query/operands/0/operands/1/operands/0/spanRef/0").asInt());
- assertEquals(1, res.at("/query/operands/0/operands/1/operands/0/spanRef/1").asInt());
- assertEquals("korap:group", res.at("/query/operands/0/operands/1/operands/0/operands/0/@type").asText());
- assertEquals("operation:sequence", res.at("/query/operands/0/operands/1/operands/0/operands/0/operation").asText());
- assertEquals("korap:distance", res.at("/query/operands/0/operands/1/operands/0/operands/0/distances/0/@type").asText());
- assertEquals("w", res.at("/query/operands/0/operands/1/operands/0/operands/0/distances/0/key").asText());
- assertEquals(3, res.at("/query/operands/0/operands/1/operands/0/operands/0/distances/0/boundary/min").asInt());
- assertEquals(5, res.at("/query/operands/0/operands/1/operands/0/operands/0/distances/0/boundary/max").asInt());
- assertEquals(false, res.at("/query/operands/0/operands/1/operands/0/operands/0/inOrder").asBoolean());
- assertEquals("korap:token", res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/0/@type").asText());
- assertEquals("der", res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/0/wrap/key").asText());
- assertEquals("Mann", res.at("/query/operands/0/operands/1/operands/0/operands/0/operands/1/wrap/key").asText());
- assertEquals("operation:class", res.at("/query/operands/0/operands/0/operation").asText());
- assertEquals(1, res.at("/query/operands/0/operands/0/classOut").asInt());
- assertEquals("korap:token", res.at("/query/operands/0/operands/0/operands/0/@type").asText());
- assertEquals("kommt", res.at("/query/operands/0/operands/0/operands/0/wrap/key").asText());
+ assertEquals("korap:group", res.at("/query/@type").asText());
+ assertEquals("operation:sequence", res.at("/query/operation").asText());
+ assertEquals("korap:distance", res.at("/query/distances/0/@type").asText());
+ assertEquals("w", res.at("/query/distances/0/key").asText());
+ assertEquals(0, res.at("/query/distances/0/boundary/min").asInt());
+ assertEquals(10, res.at("/query/distances/0/boundary/max").asInt());
+ assertEquals(true, res.at("/query/inOrder").asBoolean());
+ assertEquals("korap:group", res.at("/query/operands/1/@type").asText());
+ assertEquals("operation:class", res.at("/query/operands/1/operation").asText());
+ assertEquals(1, res.at("/query/operands/1/classOut").asInt());
+ assertEquals("korap:reference", res.at("/query/operands/1/operands/0/@type").asText());
+ assertEquals("operation:focus", res.at("/query/operands/1/operands/0/operation").asText());
+ assertEquals(0, res.at("/query/operands/1/operands/0/spanRef/0").asInt());
+ assertEquals(1, res.at("/query/operands/1/operands/0/spanRef/1").asInt());
+ assertEquals("korap:group", res.at("/query/operands/1/operands/0/operands/0/@type").asText());
+ assertEquals("operation:sequence", res.at("/query/operands/1/operands/0/operands/0/operation").asText());
+ assertEquals("korap:distance", res.at("/query/operands/1/operands/0/operands/0/distances/0/@type").asText());
+ assertEquals("w", res.at("/query/operands/1/operands/0/operands/0/distances/0/key").asText());
+ assertEquals(3, res.at("/query/operands/1/operands/0/operands/0/distances/0/boundary/min").asInt());
+ assertEquals(5, res.at("/query/operands/1/operands/0/operands/0/distances/0/boundary/max").asInt());
+ assertEquals(false, res.at("/query/operands/1/operands/0/operands/0/inOrder").asBoolean());
+ assertEquals("korap:token", res.at("/query/operands/1/operands/0/operands/0/operands/0/@type").asText());
+ assertEquals("der", res.at("/query/operands/1/operands/0/operands/0/operands/0/wrap/key").asText());
+ assertEquals("Mann", res.at("/query/operands/1/operands/0/operands/0/operands/1/wrap/key").asText());
+ assertEquals("operation:class", res.at("/query/operands/0/operation").asText());
+ assertEquals(1, res.at("/query/operands/0/classOut").asInt());
+ assertEquals("korap:token", res.at("/query/operands/0/operands/0/@type").asText());
+ assertEquals("kommt", res.at("/query/operands/0/operands/0/wrap/key").asText());
query = "#END(der /w3:5 Mann)";
qs.setQuery(query, "cosmas2");
@@ -958,15 +934,14 @@
assertEquals("korap:group", res.at("/query/operands/0/operands/0/operands/0/@type").asText());
assertEquals("operation:class", res.at("/query/operands/0/operands/0/operands/0/operation").asText());
assertEquals(2, res.at("/query/operands/0/operands/0/operands/0/classOut").asInt());
- assertEquals(3, res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
assertEquals("gehen", res.at("/query/operands/0/operands/0/operands/0/operands/0/wrap/key").asText());
- assertEquals("operation:focus", res.at("/query/operands/0/operands/0/operands/1/operands/0/operation").asText());
- assertEquals(4, res.at("/query/operands/0/operands/0/operands/1/operands/0/classRef/0").asInt());
- assertEquals("operation:sequence", res.at("/query/operands/0/operands/0/operands/1/operands/0/operands/0/operation").asText());
- assertEquals(4, res.at("/query/operands/0/operands/0/operands/1/operands/0/operands/0/operands/0/classOut").asInt());
- assertEquals("voran", res.at("/query/operands/0/operands/0/operands/1/operands/0/operands/0/operands/0/operands/0/wrap/key").asText());
- assertEquals(4, res.at("/query/operands/0/operands/0/operands/1/operands/0/operands/0/operands/1/classOut").asInt());
- assertEquals("Beispiel", res.at("/query/operands/0/operands/0/operands/1/operands/0/operands/0/operands/1/operands/0/wrap/key").asText());
+ assertEquals(3, res.at("/query/operands/0/operands/0/operands/1/classOut").asInt());
+// assertEquals("classRefOp:merge", res.at("/query/operands/0/operands/0/operands/1/classRefOp").asText());
+ assertEquals("operation:sequence", res.at("/query/operands/0/operands/0/operands/1/operands/0/operation").asText());
+ assertEquals(4, res.at("/query/operands/0/operands/0/operands/1/operands/0/operands/0/classOut").asInt());
+ assertEquals("voran", res.at("/query/operands/0/operands/0/operands/1/operands/0/operands/0/operands/0/wrap/key").asText());
+ assertEquals(4, res.at("/query/operands/0/operands/0/operands/1/operands/0/operands/1/classOut").asInt());
+ assertEquals("Beispiel", res.at("/query/operands/0/operands/0/operands/1/operands/0/operands/1/operands/0/wrap/key").asText());
}