Mirror collection
Change-Id: Ib597547f09eaa1191b2c43f0d818d0f3002114c7
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 c0e1cf5..df00673 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
@@ -245,6 +245,7 @@
assertEquals(sqwi.toQuery().toString(), "tokens:base/p:foo");
};
+
@Test
public void queryJSONBspClass () throws QueryException {
SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
@@ -450,46 +451,40 @@
"spanOverlap(<tokens:s />, spanNext(tokens:tt/p:CARD, SpanMultiTermQueryWrapper(tokens:/tt/p:N.*/)))");
};
+
@Test
public void queryJSONflags1 () throws QueryException {
// buchstabe/i
SpanQueryWrapper sqwi = jsonQuery(getClass().getResource(
"/queries/flags/caseInsensitive.jsonld").getFile());
- assertEquals(
- sqwi.toQuery().toString(),
- "tokens:i:buchstabe");
+ assertEquals(sqwi.toQuery().toString(), "tokens:i:buchstabe");
};
+
@Test
public void queryJSONflags2 () throws QueryException {
// buchstabe/i
try {
- String json = getString(
- getClass().getResource(
- "/queries/flags/unknown1.jsonld"
- ).getFile()
- );
+ String json = getString(getClass().getResource(
+ "/queries/flags/unknown1.jsonld").getFile());
KrillQuery kq = new KrillQuery("tokens");
- assertEquals(kq.fromJson(json).toQuery().toString(),"tokens:s:buchstabe");
- assertEquals(kq.getWarning(0).getCode(), 748);
-
- json = getString(
- getClass().getResource(
- "/queries/flags/unknown2.jsonld"
- ).getFile()
- );
- kq = new KrillQuery("tokens");
- assertEquals(kq.fromJson(json).toQuery().toString(),"tokens:i:buchstabe");
+ assertEquals(kq.fromJson(json).toQuery().toString(),
+ "tokens:s:buchstabe");
assertEquals(kq.getWarning(0).getCode(), 748);
- json = getString(
- getClass().getResource(
- "/queries/flags/unknown3.jsonld"
- ).getFile()
- );
+ json = getString(getClass().getResource(
+ "/queries/flags/unknown2.jsonld").getFile());
kq = new KrillQuery("tokens");
- assertEquals(kq.fromJson(json).toQuery().toString(),"tokens:i:buchstabe");
+ assertEquals(kq.fromJson(json).toQuery().toString(),
+ "tokens:i:buchstabe");
+ assertEquals(kq.getWarning(0).getCode(), 748);
+
+ json = getString(getClass().getResource(
+ "/queries/flags/unknown3.jsonld").getFile());
+ kq = new KrillQuery("tokens");
+ assertEquals(kq.fromJson(json).toQuery().toString(),
+ "tokens:i:buchstabe");
assertEquals(kq.getWarning(0).getCode(), 748);
}
@@ -498,6 +493,7 @@
};
};
+
public static String getString (String path) {
StringBuilder contentBuilder = new StringBuilder();
try {
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanReferenceQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanReferenceQueryJSON.java
index 57c29bc..a401916 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanReferenceQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanReferenceQueryJSON.java
@@ -14,7 +14,7 @@
public class TestSpanReferenceQueryJSON {
@Test
- public void testFirstOperandRef() throws IOException, QueryException {
+ public void testFirstOperandRef () throws IOException, QueryException {
String filepath = getClass().getResource(
"/queries/reference/first-operand-reference.jsonld").getFile();
@@ -30,8 +30,9 @@
sq.toString());
}
+
@Test
- public void testSecondOperandRef() throws QueryException {
+ public void testSecondOperandRef () throws QueryException {
String filepath = getClass().getResource(
"/queries/reference/second-operand-reference.jsonld").getFile();
@@ -47,8 +48,9 @@
+ "{3: tokens:p:P}), 3)", sq.toString());
}
+
@Test
- public void testMultipleReferences() throws QueryException {
+ public void testMultipleReferences () throws QueryException {
String filepath = getClass().getResource(
"/queries/reference/multiple-references.jsonld").getFile();
SpanQueryWrapper sqwi = getJSONQuery(filepath);
@@ -60,55 +62,38 @@
"spanReference(focus(#[1,2]spanSegment(focus(#2: spanSegment(spanRelation(tokens:>:mate/d:HEAD), "
+ "focus(2: spanReference(spanNext(focus(1: spanNext(focus(2: spanNext({1: <tokens:c:VP />}, "
+ "{2: <tokens:c:NP />})), {3: <tokens:c:PP />})), {3: <tokens:c:PP />}), 3)))), "
- + "{1: <tokens:c:VP />})), 1)",
- sq.toString());
+ + "{1: <tokens:c:VP />})), 1)", sq.toString());
}
+
@Test
- public void testDistanceReferences() throws QueryException {
+ public void testDistanceReferences () throws QueryException {
String filepath = getClass().getResource(
- "/queries/reference/bug-multiple-distance-simple.jsonld"
- ).getFile();
+ "/queries/reference/bug-multiple-distance-simple.jsonld")
+ .getFile();
SpanQueryWrapper sqwi = getJSONQuery(filepath);
SpanQuery sq = sqwi.toQuery();
- assertEquals("spanDistance(<tokens:c:vb />, <tokens:c:prp />, [(w[1:1], notOrdered, notExcluded)])", sq.toString());
+ assertEquals(
+ "spanDistance(<tokens:c:vb />, <tokens:c:prp />, [(w[1:1], notOrdered, notExcluded)])",
+ sq.toString());
// "/queries/reference/distance-reference.jsonld").getFile();
filepath = getClass().getResource(
- "/queries/reference/bug-multiple-distance.jsonld"
- ).getFile();
+ "/queries/reference/bug-multiple-distance.jsonld").getFile();
sqwi = getJSONQuery(filepath);
sq = sqwi.toQuery();
// 'cat="VP" & cat="NP" & cat="PP" & #1 . #2 & #2 . #3 & #1 .
// #3 & #2 ->dep #1'
- assertEquals(
- "spanReference("+
- "focus("+
- "#[1,2]spanSegment("+
- "focus("+
- "#2: spanSegment("+
- "spanRelation(tokens:>:stanford/d:tag), " +
- "focus("+
- "2: spanDistance("+
- "focus("+
- "1: spanDistance("+
- "<tokens:c:vb />, "+
- "{1: <tokens:c:prp />}, " +
- "[(w[1:1], notOrdered, notExcluded)]"+
- ")"+
- "), "+
- "{2: <tokens:c:nn />}, "+
- "[(w[0:2], ordered, notExcluded)]"+
- ")"+
- ")"+
- ")"+
- "), " +
- "{1: <tokens:c:prp />}"+
- ")"+
- "), 1"+
- ")",
- sq.toString());
+ assertEquals("spanReference(" + "focus(" + "#[1,2]spanSegment("
+ + "focus(" + "#2: spanSegment("
+ + "spanRelation(tokens:>:stanford/d:tag), " + "focus("
+ + "2: spanDistance(" + "focus(" + "1: spanDistance("
+ + "<tokens:c:vb />, " + "{1: <tokens:c:prp />}, "
+ + "[(w[1:1], notOrdered, notExcluded)]" + ")" + "), "
+ + "{2: <tokens:c:nn />}, " + "[(w[0:2], ordered, notExcluded)]"
+ + ")" + ")" + ")" + "), " + "{1: <tokens:c:prp />}" + ")"
+ + "), 1" + ")", sq.toString());
}
}
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanRelationQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanRelationQueryJSON.java
index fccd34a..b051509 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanRelationQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanRelationQueryJSON.java
@@ -89,6 +89,7 @@
sq.toString());
}
+
@Test
public void testFocusSource () throws QueryException {
//
@@ -101,8 +102,9 @@
sq.toString());
}
+
@Test
- public void testFocusTarget() throws QueryException {
+ public void testFocusTarget () throws QueryException {
String filepath = getClass().getResource(
"/queries/relation/focus-target.json").getFile();
SpanQueryWrapper sqwi = getJSONQuery(filepath);
@@ -113,8 +115,9 @@
sq.toString());
}
+
@Test
- public void testFocusEmptyTarget() throws QueryException {
+ public void testFocusEmptyTarget () throws QueryException {
String filepath = getClass().getResource(
"/queries/relation/focus-empty-target.json").getFile();
SpanQueryWrapper sqwi = getJSONQuery(filepath);
@@ -124,8 +127,9 @@
sq.toString());
}
+
@Test
- public void testFocusEmptyBoth() throws QueryException {
+ public void testFocusEmptyBoth () throws QueryException {
String filepath = getClass().getResource(
"/queries/relation/focus-empty-both.json").getFile();
SpanQueryWrapper sqwi = getJSONQuery(filepath);