wrap term in PQ+ relation
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessor.java
index b325a3f..00da8d2 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessor.java
@@ -407,9 +407,12 @@
KoralObjectGenerator.makeGroup("relation");
LinkedHashMap<String, Object> relation =
KoralObjectGenerator.makeRelation();
+ LinkedHashMap<String, Object> term =
+ KoralObjectGenerator.makeTerm();
relationGroup.put("relation", relation);
+ relation.put("wrap", term);
if (node.getChild(0).getText().equals("dominates")) {
- relation.put("layer", "c");
+ term.put("layer", "c");
}
ParseTree relSpec = getFirstChildWithCat(node, "relSpec");
ParseTree repetition = getFirstChildWithCat(node, "repetition");
@@ -418,11 +421,11 @@
ParseTree layer = getFirstChildWithCat(relSpec, "layer");
ParseTree key = getFirstChildWithCat(relSpec, "key");
if (foundry != null)
- relation.put("foundry", foundry.getText());
+ term.put("foundry", foundry.getText());
if (layer != null)
- relation.put("layer", layer.getText());
+ term.put("layer", layer.getText());
if (key != null)
- relation.put("key", key.getText());
+ term.put("key", key.getText());
}
if (repetition != null) {
Integer[] minmax = parseRepetition(repetition);
diff --git a/src/test/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessorTest.java b/src/test/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessorTest.java
index 2466f5b..44519ec 100644
--- a/src/test/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessorTest.java
+++ b/src/test/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessorTest.java
@@ -1028,12 +1028,13 @@
}
@Test
public void testRelations() throws JsonProcessingException, IOException {
- query = "relatesTo(<s>,<np>)";
+ query = "dominates(<s>,<np>)";
qs.setQuery(query, "poliqarpplus");
res = mapper.readTree(qs.toJSON());
assertEquals("korap:group", res.at("/query/@type").asText());
assertEquals("operation:relation", res.at("/query/operation").asText());
assertEquals("korap:relation", res.at("/query/relation/@type").asText());
+ assertEquals("c", res.at("/query/relation/wrap/layer").asText());
assertEquals("s", res.at("/query/operands/0/key").asText());
assertEquals("np", res.at("/query/operands/1/key").asText());
@@ -1058,9 +1059,9 @@
assertEquals("lemma", res.at("/query/operands/1/wrap/layer").asText());
assertEquals("Baum", res.at("/query/operands/1/wrap/key").asText());
assertEquals("korap:relation", res.at("/query/relation/@type").asText());
- assertEquals("mate", res.at("/query/relation/foundry").asText());
- assertEquals("d", res.at("/query/relation/layer").asText());
- assertEquals("HEAD", res.at("/query/relation/key").asText());
+ assertEquals("mate", res.at("/query/relation/wrap/foundry").asText());
+ assertEquals("d", res.at("/query/relation/wrap/layer").asText());
+ assertEquals("HEAD", res.at("/query/relation/wrap/key").asText());
query = "dominates(Baum,<np>)";
qs.setQuery(query, "poliqarpplus");
@@ -1068,19 +1069,19 @@
assertEquals("orth", res.at("/query/operands/0/wrap/layer").asText());
assertEquals("Baum", res.at("/query/operands/0/wrap/key").asText());
assertEquals("korap:relation", res.at("/query/relation/@type").asText());
- assertEquals("c", res.at("/query/relation/layer").asText());
+ assertEquals("c", res.at("/query/relation/wrap/layer").asText());
query = "dominates(cnx/c:<vp>,<np>)";
qs.setQuery(query, "poliqarpplus");
res = mapper.readTree(qs.toJSON());
- assertEquals("cnx", res.at("/query/relation/foundry").asText());
- assertEquals("c", res.at("/query/relation/layer").asText());
+ assertEquals("cnx", res.at("/query/relation/wrap/foundry").asText());
+ assertEquals("c", res.at("/query/relation/wrap/layer").asText());
query = "dominates(cnx/c*:<vp>,<np>)";
qs.setQuery(query, "poliqarpplus");
res = mapper.readTree(qs.toJSON());
- assertEquals("cnx", res.at("/query/relation/foundry").asText());
- assertEquals("c", res.at("/query/relation/layer").asText());
+ assertEquals("cnx", res.at("/query/relation/wrap/foundry").asText());
+ assertEquals("c", res.at("/query/relation/wrap/layer").asText());
assertEquals(0, res.at("/query/relation/boundary/min").asInt());
assertEquals(true, res.at("/query/relation/boundary/max").isMissingNode());