Code autoformat
Change-Id: I437d1e8d6d45f7d9241cb52f36951bbb5dbd752d
diff --git a/src/main/java/de/ids_mannheim/korap/KrillIndex.java b/src/main/java/de/ids_mannheim/korap/KrillIndex.java
index 6f8682c..44528f0 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillIndex.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillIndex.java
@@ -1365,11 +1365,12 @@
if (DEBUG) {
if (match.getDocID() != null)
- log.trace("With DocID: I've got 1 match of {} in {}",
- count, match.getDocID());
+ log.trace(
+ "With DocID: I've got 1 match of {} in {}",
+ count, match.getDocID());
else
log.trace("With UID: I've got 1 match of {} in {}",
- count, match.getUID());
+ count, match.getUID());
};
atomicMatches.add(match);
diff --git a/src/main/java/de/ids_mannheim/korap/index/Indexer.java b/src/main/java/de/ids_mannheim/korap/index/Indexer.java
index 591e511..1735517 100644
--- a/src/main/java/de/ids_mannheim/korap/index/Indexer.java
+++ b/src/main/java/de/ids_mannheim/korap/index/Indexer.java
@@ -16,7 +16,8 @@
* this tool may be more suitable for your needs
* (especially as it is way faster).
*
- * Usage: java -jar Krill-Indexer.jar [--config propfile] [directories]*
+ * Usage: java -jar Krill-Indexer.jar [--config propfile]
+ * [directories]*
*/
public class Indexer {
KrillIndex index;
@@ -118,19 +119,19 @@
if (argv.length == 0) {
String jar = new File(Indexer.class.getProtectionDomain()
- .getCodeSource().getLocation().getPath()).getName();
-
- System.out.println("Add documents from a directory to the Krill index.");
+ .getCodeSource().getLocation().getPath()).getName();
+
+ System.out
+ .println("Add documents from a directory to the Krill index.");
System.out.println("Usage: java -jar " + jar
- + " [--config propfile] [directories]*");
+ + " [--config propfile] [directories]*");
System.out.println();
System.err.println(" --config|-c Configuration file");
- System.err.println(" (defaults to " +
- de.ids_mannheim.korap.util.KrillProperties.file +
- ")");
+ System.err.println(" (defaults to "
+ + de.ids_mannheim.korap.util.KrillProperties.file + ")");
System.err.println(" --indexDir|-d Index directory");
- System.err.println(" (defaults to krill.indexDir"+
- " in configuration)");
+ System.err.println(" (defaults to krill.indexDir"
+ + " in configuration)");
System.err.println();
return;
};
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanRelationMatchQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanRelationMatchQuery.java
index 131c4ec..151abf4 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanRelationMatchQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanRelationMatchQuery.java
@@ -49,7 +49,7 @@
operandQuery, true), relation.getTempTargetNum());
sq.setSorted(false);
sq.setMatchTemporaryClass(true);
-
+
sq2 = new SpanFocusQuery(new SpanSegmentQuery(operand2Query, sq,
true), relation.getTempClassNumbers());
}
@@ -58,11 +58,11 @@
sq = new SpanFocusQuery(new SpanSegmentQuery(relationQuery,
operandQuery, true), relation.getTempSourceNum());
sq.setMatchTemporaryClass(true);
-
- sq2 = new SpanFocusQuery(new SpanSegmentQuery(sq,
- operand2Query, true), relation.getTempClassNumbers());
+
+ sq2 = new SpanFocusQuery(new SpanSegmentQuery(sq, operand2Query,
+ true), relation.getTempClassNumbers());
}
-
+
sq2.setMatchTemporaryClass(true);
sq2.setRemoveTemporaryClasses(true);
sq2.setSorted(false);
@@ -91,7 +91,8 @@
this.operandQuery = operand;
}
- public void checkVariables(SpanRelationQuery relation, SpanQuery operand,
+
+ public void checkVariables (SpanRelationQuery relation, SpanQuery operand,
SpanQuery target) {
checkVariables(relation, operand);
if (target == null) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanRelationQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanRelationQuery.java
index 61ec3db..a2f565c 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanRelationQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanRelationQuery.java
@@ -23,7 +23,8 @@
* prefix "<" or
* ">". The direction of the angle bracket represents the direction of
* the
- * corresponding relation. By default, the relation is set ">". <br/><br/>
+ * corresponding relation. By default, the relation is set ">".
+ * <br/><br/>
*
* This class provides two types of query:
* <ol>
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanWithAttributeQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanWithAttributeQuery.java
index edd22b4..fae7aa0 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanWithAttributeQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanWithAttributeQuery.java
@@ -32,11 +32,13 @@
* <br/>
*
* <pre>
- * SpanAttributeQuery saq = new SpanAttributeQuery(new SpanTermQuery(new Term(
- * "tokens", "@:class=header")), true);
+ * SpanAttributeQuery saq = new SpanAttributeQuery(new
+ * SpanTermQuery(new Term(
+ * "tokens", "@:class=header")), true);
* <br/>
- * SpanWithAttributeQuery sq = new SpanWithAttributeQuery(new SpanElementQuery(
- * "tokens", "div"), saq, true);
+ * SpanWithAttributeQuery sq = new SpanWithAttributeQuery(new
+ * SpanElementQuery(
+ * "tokens", "div"), saq, true);
* </pre>
*
*
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/FocusSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/FocusSpans.java
index 244c79d..3fe6dbb 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/FocusSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/FocusSpans.java
@@ -171,12 +171,13 @@
// throw new
// IllegalArgumentException("Classnumber is not found.");
// }
- if (spanId > 0) hasSpanId = true;
- }
+ if (spanId > 0)
+ hasSpanId = true;
+ }
else if (cs.getSpanId() > 0) {
setSpanId(cs.getSpanId());
hasSpanId = true;
- }
+ }
}
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java
index 42d391b..59d678e 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java
@@ -372,27 +372,33 @@
this.rightEnd = rightEnd;
}
- public byte getTempSourceNum() {
+
+ public byte getTempSourceNum () {
return tempSourceNum;
}
- public void setTempSourceNum(byte tempSourceNum) {
+
+ public void setTempSourceNum (byte tempSourceNum) {
this.tempSourceNum = tempSourceNum;
}
- public byte getTempTargetNum() {
+
+ public byte getTempTargetNum () {
return tempTargetNum;
}
- public void setTempTargetNum(byte tempTargetNum) {
+
+ public void setTempTargetNum (byte tempTargetNum) {
this.tempTargetNum = tempTargetNum;
}
- public int getDirection() {
+
+ public int getDirection () {
return direction;
}
- public void setDirection(int direction) {
+
+ public void setDirection (int direction) {
this.direction = direction;
}
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/RepetitionSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/RepetitionSpans.java
index 5b5c33a..843ccd8 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/RepetitionSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/RepetitionSpans.java
@@ -38,6 +38,7 @@
private List<CandidateSpan> matchList;
private List<CandidateSpan> candidates;
+
/**
* Constructs RepetitionSpans from the given
* {@link SpanRepetitionQuery}.
@@ -139,11 +140,9 @@
if (DEBUG) {
log.debug("Check adjacency at {}-{}|{}-{} in {}",
- prevSpan.getStart(),
- prevSpan.getEnd(),
- firstSpans.start(),
- firstSpans.end(),
- startSpan.getDoc());
+ prevSpan.getStart(), prevSpan.getEnd(),
+ firstSpans.start(), firstSpans.end(),
+ startSpan.getDoc());
};
if (firstSpans.start() > prevSpan.getEnd()) {
@@ -161,6 +160,7 @@
return adjacentSpans;
}
+
/**
* Generates all possible repetition match spans from the given
* list of
@@ -175,17 +175,17 @@
int endIndex;
while ((endIndex = j + i - 1) < adjacentSpans.size()) {
startSpan = adjacentSpans.get(j);
-
+
if (i == 1) {
try {
- matchSpan = startSpan.clone();
- matchSpan.setPayloads(computeMatchPayload(
- adjacentSpans, 0, endIndex - 1));
- matchList.add(matchSpan);
+ matchSpan = startSpan.clone();
+ matchSpan.setPayloads(computeMatchPayload(
+ adjacentSpans, 0, endIndex - 1));
+ matchList.add(matchSpan);
}
catch (CloneNotSupportedException e) {
- e.printStackTrace();
- }
+ e.printStackTrace();
+ }
}
else {
endSpan = adjacentSpans.get(endIndex);
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/WithinSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/WithinSpans.java
index 0cfb938..215dc85 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/WithinSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/WithinSpans.java
@@ -284,7 +284,7 @@
this.more = true;
this.inSameDoc = true;
this.tryMatch = true;
-
+
this.nextSpanB();
continue;
}
@@ -417,7 +417,7 @@
this.inSameDoc = false;
return false;
};
-*/
+ */
this.more = true;
this.inSameDoc = true;
@@ -442,7 +442,7 @@
this.inSameDoc = false;
return false;
};
-
+
// Clear all spanStores
if (this.wrapDoc != this.embeddedDoc) {
@@ -951,12 +951,9 @@
private byte withinCase () {
if (DEBUG) {
- log.trace(">>>>>>>>>>>>>> {}-{}|{}-{}",
- this.wrapStart,
- this.wrapSpans.end(),
- this.embeddedStart,
- this.embeddedSpans.end()
- );
+ log.trace(">>>>>>>>>>>>>> {}-{}|{}-{}", this.wrapStart,
+ this.wrapSpans.end(), this.embeddedStart,
+ this.embeddedSpans.end());
};
// case 1-5
@@ -1170,6 +1167,7 @@
public short elementRef = -1;
+
public void clear () {
this.start = -1;
this.end = -1;
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanAttributeQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanAttributeQueryWrapper.java
index 5f11c02..0d0fe23 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanAttributeQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanAttributeQueryWrapper.java
@@ -41,7 +41,8 @@
if (isNull || isEmpty)
return null;
- SpanQuery sq = subquery.retrieveNode(this.retrieveNode).toFragmentQuery();
+ SpanQuery sq = subquery.retrieveNode(this.retrieveNode)
+ .toFragmentQuery();
if (sq == null) {
isNull = true;
return null;
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanQueryWrapper.java
index 2cb72fc..0855885 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanQueryWrapper.java
@@ -66,16 +66,15 @@
// Wrap the query in a <base/s=t>, if it's extended to the right
if (this.isExtendedToTheRight()) {
- return new SpanFocusQuery(
- new SpanWithinQuery(
- "base/s:t",
- new SpanClassQuery(this.toFragmentQuery(), (byte) 254)), (byte) 254
- );
+ return new SpanFocusQuery(new SpanWithinQuery("base/s:t",
+ new SpanClassQuery(this.toFragmentQuery(), (byte) 254)),
+ (byte) 254);
};
return this.toFragmentQuery();
};
+
/**
* Boolean value indicating that the wrapped query
* is optional.
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanReferenceQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanReferenceQueryWrapper.java
index 48ba7c2..c874fef 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanReferenceQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanReferenceQueryWrapper.java
@@ -40,7 +40,8 @@
return null;
}
- SpanQuery sq = subQuery.retrieveNode(this.retrieveNode).toFragmentQuery();
+ SpanQuery sq = subQuery.retrieveNode(this.retrieveNode)
+ .toFragmentQuery();
if (sq == null)
return null;
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanRelationWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanRelationWrapper.java
index 3eea9c8..d7b0f6d 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanRelationWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanRelationWrapper.java
@@ -54,7 +54,8 @@
if (subQuery1.isEmpty) {
if (!subQuery2.isEmpty) {
// match target
- subq2 = subQuery2.retrieveNode(this.retrieveNode).toFragmentQuery();
+ subq2 = subQuery2.retrieveNode(this.retrieveNode)
+ .toFragmentQuery();
if (subQuery1.hasClass) {
rq.setSourceClass(subQuery1.getClassNumber());
}
@@ -65,7 +66,8 @@
else if (subQuery2.isEmpty) {
if (!subQuery1.isEmpty) {
// match source
- subq1 = subQuery1.retrieveNode(this.retrieveNode).toFragmentQuery();
+ subq1 = subQuery1.retrieveNode(this.retrieveNode)
+ .toFragmentQuery();
if (subQuery2.hasClass) {
rq.setTargetClass(subQuery2.getClassNumber());
}
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanRepetitionQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanRepetitionQueryWrapper.java
index dbbdd67..65c4da6 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanRepetitionQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanRepetitionQueryWrapper.java
@@ -97,7 +97,8 @@
// The query is not a repetition query at all, but may be optional
if (this.min == 1 && this.max == 1)
- return this.subquery.retrieveNode(this.retrieveNode).toFragmentQuery();
+ return this.subquery.retrieveNode(this.retrieveNode)
+ .toFragmentQuery();
// That's a fine repetition query
return new SpanRepetitionQuery(this.subquery.retrieveNode(
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSequenceQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSequenceQueryWrapper.java
index eadba22..72fadb2 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSequenceQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSequenceQueryWrapper.java
@@ -134,7 +134,8 @@
if (DEBUG) {
if (!sswq.isEmpty()) {
try {
- log.trace("New span sequence {}", sswq.toFragmentQuery().toString());
+ log.trace("New span sequence {}", sswq.toFragmentQuery()
+ .toString());
}
catch (QueryException qe) {
log.trace("Unable to serialize query {}", qe.getMessage());
@@ -546,8 +547,8 @@
// Todo: This should possibly be evaluated to a query later on!
try {
this.constraints.add(new DistanceConstraint((SpanElementQuery) unit
- .retrieveNode(this.retrieveNode).toFragmentQuery(), min, max,
- isInOrder, exclusion));
+ .retrieveNode(this.retrieveNode).toFragmentQuery(), min,
+ max, isInOrder, exclusion));
}
catch (QueryException qe) {
this.constraintException = qe;
@@ -637,6 +638,7 @@
return super.isNegative();
};
+
public boolean isExtendedToTheRight () {
if (!this.isSolved)
_solveProblematicSequence();
@@ -943,11 +945,13 @@
problem.getClassNumber());
query = new SpanExpansionQuery(anchor.retrieveNode(
- this.retrieveNode).toFragmentQuery(), problem.isOptional() ? 0 : problem.getMin(),
+ this.retrieveNode).toFragmentQuery(),
+ problem.isOptional() ? 0 : problem.getMin(),
problem.getMax(), direction,
problem.hasClass() ? problem.getClassNumber() : (byte) 0,
true);
- SpanQueryWrapper sqw = new SpanSimpleQueryWrapper(query).isExtended(true);
+ SpanQueryWrapper sqw = new SpanSimpleQueryWrapper(query)
+ .isExtended(true);
// Set right extension
if (direction >= 0)
@@ -972,7 +976,8 @@
problem.hasClass() ? problem.getClassNumber() : (byte) 0,
true);
- SpanQueryWrapper sqw = new SpanSimpleQueryWrapper(query).isExtended(true);
+ SpanQueryWrapper sqw = new SpanSimpleQueryWrapper(query)
+ .isExtended(true);
// Set right extension
if (direction >= 0)
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSubspanQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSubspanQueryWrapper.java
index 8c809c5..d311a27 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSubspanQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSubspanQueryWrapper.java
@@ -110,7 +110,8 @@
return null;
}
- SpanQuery sq = subquery.retrieveNode(this.retrieveNode).toFragmentQuery();
+ SpanQuery sq = subquery.retrieveNode(this.retrieveNode)
+ .toFragmentQuery();
if (sq == null)
return null;
if (sq instanceof SpanTermQuery) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanWithinQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanWithinQueryWrapper.java
index 89d1fc5..dc1f449 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanWithinQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanWithinQueryWrapper.java
@@ -88,6 +88,7 @@
this.isNull = false;
};
+
@Override
public SpanQuery toFragmentQuery () throws QueryException {
if (this.isNull)
@@ -96,8 +97,8 @@
// TODO: if (wrap.isNegative())
return new SpanWithinQuery(this.element.retrieveNode(this.retrieveNode)
- .toFragmentQuery(),
- this.wrap.retrieveNode(this.retrieveNode).toFragmentQuery(), this.flag);
+ .toFragmentQuery(), this.wrap.retrieveNode(this.retrieveNode)
+ .toFragmentQuery(), this.flag);
};
diff --git a/src/main/java/de/ids_mannheim/korap/response/Match.java b/src/main/java/de/ids_mannheim/korap/response/Match.java
index 4bb289a..47806af 100644
--- a/src/main/java/de/ids_mannheim/korap/response/Match.java
+++ b/src/main/java/de/ids_mannheim/korap/response/Match.java
@@ -244,22 +244,25 @@
if (DEBUG)
log.trace(
"Have a highlight of class {} in {}-{} inside of {}-{}",
- unsignedByte(number), start, end, this.getStartPos(),
- this.getEndPos());
+ unsignedByte(number), start, end,
+ this.getStartPos(), this.getEndPos());
// Ignore classes out of match range and set by the system
// TODO: This may be decidable by PTI!
- if (unsignedByte(number) <= 128 && start >= this.getStartPos()
+ if (unsignedByte(number) <= 128
+ && start >= this.getStartPos()
&& end <= this.getEndPos()) {
if (DEBUG) {
- log.trace("Add highlight of class {}!", unsignedByte(number));
+ log.trace("Add highlight of class {}!",
+ unsignedByte(number));
};
this.addHighlight(start, end - 1, number);
}
else if (DEBUG) {
- log.trace("Don't add highlight of class {}!", unsignedByte(number));
+ log.trace("Don't add highlight of class {}!",
+ unsignedByte(number));
};
}
diff --git a/src/main/java/de/ids_mannheim/korap/util/KrillByte.java b/src/main/java/de/ids_mannheim/korap/util/KrillByte.java
index 0666cc7..378fbb1 100644
--- a/src/main/java/de/ids_mannheim/korap/util/KrillByte.java
+++ b/src/main/java/de/ids_mannheim/korap/util/KrillByte.java
@@ -69,7 +69,7 @@
*
* @param data
* The byte.
- */
+ */
public static int unsignedByte (byte data) {
return (int) data & 0xFF;
};
diff --git a/src/main/java/de/ids_mannheim/korap/util/KrillProperties.java b/src/main/java/de/ids_mannheim/korap/util/KrillProperties.java
index 82ed821..fc066f1 100644
--- a/src/main/java/de/ids_mannheim/korap/util/KrillProperties.java
+++ b/src/main/java/de/ids_mannheim/korap/util/KrillProperties.java
@@ -9,7 +9,7 @@
// Todo: Properties may be loaded twice - althogh Java may cache automatically
public class KrillProperties {
- public static String file = "krill.properties";
+ public static String file = "krill.properties";
private static String info = "krill.info";
private static Properties prop;
@@ -41,12 +41,12 @@
catch (IOException t) {
try {
iFile = KrillProperties.class.getClassLoader()
- .getResourceAsStream(propFile);
+ .getResourceAsStream(propFile);
if (iFile == null) {
log.warn(
- "Cannot find {}. Please create it using \"{}.info\" as template.",
- propFile, propFile);
+ "Cannot find {}. Please create it using \"{}.info\" as template.",
+ propFile, propFile);
return null;
};
@@ -67,7 +67,7 @@
public static Properties loadInfo () {
try {
InputStream iFile = KrillProperties.class.getClassLoader()
- .getResourceAsStream(info);
+ .getResourceAsStream(info);
if (iFile == null) {
log.error("Cannot find {}.", info);
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java
index d8f79a7..9aaefc6 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java
@@ -146,7 +146,7 @@
+ "<:child-of$<b>34<i>4<i>38<i>7<i>2<s>2<s>1<s>0|"
+ "<:child-of$<b>35<i>4<i>38<i>10<i>38<i>7<i>2<i>7<s>2<s>4<s>0|"
+ ">:dep$<b>32<i>0<s>1<s>1<s>0|"
- + ">:dep$<b>32<i>3<s>1<s>1<s>0]"
+ + ">:dep$<b>32<i>3<s>1<s>1<s>0]"
+ "[(2-3)s:die|_2$<i>10<i>13|pos:ART$<s>1|tt:DET$<s>2|"
+ "<>:np$<b>64<i>10<i>20<i>4<b>0<s>3|<>:np$<b>64<i>10<i>38<i>7<b>0<s>4|"
@@ -326,7 +326,7 @@
// for (Match m : kr.getMatches()) {
// System.out.println(m.getStartPos() + " " + m.getEndPos());
// }
-
+
SpanAttributeQuery saq = new SpanAttributeQuery(new SpanTermQuery(
new Term("base", "@:func=sbj")), true);
// kr = ki.search(saq, (short) 20);
@@ -587,8 +587,9 @@
assertEquals(7, kr.getMatch(6).getEndPos());
}
+
@Test
- public void testCase9b() throws IOException {
+ public void testCase9b () throws IOException {
ki.addDoc(createFieldDoc2());
ki.commit();
@@ -622,8 +623,9 @@
// }
}
+
@Test
- public void testCase9c() throws IOException {
+ public void testCase9c () throws IOException {
ki.addDoc(createFieldDoc2());
ki.commit();
@@ -714,12 +716,13 @@
// }
}
+
/**
* Relation whose nodes have a specific attribute.
*
* */
@Test
- public void testCase10a() throws IOException {
+ public void testCase10a () throws IOException {
ki.addDoc(createFieldDoc2());
ki.commit();
@@ -738,29 +741,28 @@
// Matching relation source node with an attribute
SpanFocusQuery sfq1 = new SpanFocusQuery(srq, (byte) 1);
SpanWithAttributeQuery swaq = new SpanWithAttributeQuery(sfq1, aq, true);
-
+
kr = ki.search(swaq, (short) 10);
assertEquals((long) 2, kr.getTotalResults());
assertEquals(2, kr.getMatch(0).getStartPos());
assertEquals(4, kr.getMatch(0).getEndPos());
assertEquals(5, kr.getMatch(1).getStartPos());
assertEquals(7, kr.getMatch(1).getEndPos());
-
- // Returning relations whose source has a specific attribute
- SpanFocusQuery fqr = new SpanFocusQuery(swaq,
- srq.getTempClassNumbers());
- fqr.setMatchTemporaryClass(true);
- fqr.setRemoveTemporaryClasses(true);
- assertEquals("focus(#[1,2]spanRelationWithAttribute(focus(1: "
+
+ // Returning relations whose source has a specific attribute
+ SpanFocusQuery fqr = new SpanFocusQuery(swaq, srq.getTempClassNumbers());
+ fqr.setMatchTemporaryClass(true);
+ fqr.setRemoveTemporaryClasses(true);
+ assertEquals("focus(#[1,2]spanRelationWithAttribute(focus(1: "
+ "{1: source:{2: target:spanRelation(base:>:child-of)}}), "
+ "spanAttribute(base:@:case=accusative)))", fqr.toString());
-
- kr = ki.search(fqr, (short) 10);
- assertEquals((long) 2, kr.getTotalResults());
- assertEquals(2, kr.getMatch(0).getStartPos());
- assertEquals(7, kr.getMatch(0).getEndPos());
- assertEquals(4, kr.getMatch(1).getStartPos());
- assertEquals(7, kr.getMatch(1).getEndPos());
+
+ kr = ki.search(fqr, (short) 10);
+ assertEquals((long) 2, kr.getTotalResults());
+ assertEquals(2, kr.getMatch(0).getStartPos());
+ assertEquals(7, kr.getMatch(0).getEndPos());
+ assertEquals(4, kr.getMatch(1).getStartPos());
+ assertEquals(7, kr.getMatch(1).getEndPos());
// Matching relation target nodes with an attribute
SpanFocusQuery sfq2 = new SpanFocusQuery(srq, (byte) 2);
@@ -792,12 +794,13 @@
assertEquals(7, kr.getMatch(1).getEndPos());
}
+
/**
* Relation whose nodes have a specific attribute. Alternative
* query (actually used in serialization)
* */
@Test
- public void testCase10b() throws IOException {
+ public void testCase10b () throws IOException {
ki.addDoc(createFieldDoc2());
ki.commit();
@@ -861,11 +864,12 @@
assertEquals(7, kr.getMatch(1).getEndPos());
}
+
/**
* Matching both relation nodes whose a specific attribute
* */
@Test
- public void testCase11() throws IOException {
+ public void testCase11 () throws IOException {
ki.addDoc(createFieldDoc2());
ki.commit();
@@ -885,7 +889,7 @@
srq.setTargetClass((byte) 2);
kr = ki.search(srq, (short) 20);
assertEquals((long) 13, kr.getTotalResults());
-
+
SpanWithAttributeQuery swaq1 = new SpanWithAttributeQuery(aq, true);
SpanWithAttributeQuery swaq2 = new SpanWithAttributeQuery(aq2, true);
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestSegmentIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestSegmentIndex.java
index 74d611e..b0c1305 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestSegmentIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestSegmentIndex.java
@@ -175,6 +175,7 @@
assertEquals("EndPos (0)", 2, kr.getMatch(1).endPos);
}
+
private FieldDocument createFieldDoc0 () {
fd = new FieldDocument();
fd.addString("ID", "doc-0");
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java
index f60d1be..5c2bc24 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java
@@ -31,12 +31,14 @@
Result kr;
KrillIndex ki;
+
public TestSpanExpansionIndex () throws IOException {
ki = new KrillIndex();
ki.addDoc(getClass().getResourceAsStream("/wiki/00001.json.gz"), true);
ki.commit();
}
+
/**
* Left and right expansions
* */
@@ -316,7 +318,7 @@
/**
* Query rewrite bug
- *
+ *
* Warning: This is not armoured by <base/s=t>!
*
* @throws IOException
@@ -332,10 +334,8 @@
ki.commit();
// See /queries/bugs/repetition_group_rewrite
- RegexpQuery requery = new RegexpQuery(
- new Term("base", "s:[ac]"),
- RegExp.ALL
- );
+ RegexpQuery requery = new RegexpQuery(new Term("base", "s:[ac]"),
+ RegExp.ALL);
SpanMultiTermQueryWrapper<RegexpQuery> query = new SpanMultiTermQueryWrapper<RegexpQuery>(
requery);
SpanExpansionQuery seq = new SpanExpansionQuery(query, 1, 1, 1, true);
@@ -361,7 +361,7 @@
assertEquals(6, kr.getMatch(3).getEndPos());
assertEquals(9, kr.getMatch(4).getStartPos());
assertEquals(10, kr.getMatch(4).getEndPos());
-
+
kr = ki.search(seq, (short) 20);
assertEquals(5, kr.getTotalResults());
assertEquals(0, kr.getMatch(0).getStartPos());
@@ -394,7 +394,6 @@
-
/**
* Query rewrite bug
*
@@ -408,23 +407,24 @@
ki.commit();
String json = readFile(getClass().getResource(
- "/queries/bugs/expansion_bug_3.jsonld").getFile()
- );
+ "/queries/bugs/expansion_bug_3.jsonld").getFile());
KrillQuery kq = new KrillQuery("base");
SpanQuery sq = kq.fromJson(json).toQuery();
- assertEquals(sq.toString(),"focus(254: spanContain(<base:base/s:t />, {254: spanExpansion(base:s:c, []{0, 4}, right)}))");
+ assertEquals(
+ sq.toString(),
+ "focus(254: spanContain(<base:base/s:t />, {254: spanExpansion(base:s:c, []{0, 4}, right)}))");
kr = ki.search(sq, (short) 10);
- assertEquals("[c]ab",kr.getMatch(0).getSnippetBrackets());
- assertEquals("[ca]b",kr.getMatch(1).getSnippetBrackets());
- assertEquals("[cab]",kr.getMatch(2).getSnippetBrackets());
- assertEquals("[c]e",kr.getMatch(3).getSnippetBrackets());
+ assertEquals("[c]ab", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("[ca]b", kr.getMatch(1).getSnippetBrackets());
+ assertEquals("[cab]", kr.getMatch(2).getSnippetBrackets());
+ assertEquals("[c]e", kr.getMatch(3).getSnippetBrackets());
- assertEquals("[ce]",kr.getMatch(4).getSnippetBrackets());
+ assertEquals("[ce]", kr.getMatch(4).getSnippetBrackets());
assertEquals(5, kr.getTotalResults());
sq = kq.builder().tag("base/s:t").toQuery();
- assertEquals(sq.toString(),"<base:base/s:t />");
+ assertEquals(sq.toString(), "<base:base/s:t />");
kr = ki.search(sq, (short) 5);
assertEquals("[cab]", kr.getMatch(0).getSnippetBrackets());
assertEquals("[ce]", kr.getMatch(1).getSnippetBrackets());
@@ -433,21 +433,16 @@
-
private FieldDocument createFieldDoc0 () {
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-0");
fd.addTV("base", "ceccecdeec",
- "[(0-1)s:c|_0$<i>0<i>1|<>:base/s:t$<b>64<i>0<i>10<i>10<b>0]"
- + "[(1-2)s:e|_1$<i>1<i>2]"
- + "[(2-3)s:c|_2$<i>2<i>3]"
- + "[(3-4)s:c|s:d|_3$<i>3<i>4]"
- + "[(4-5)s:e|_4$<i>4<i>5]"
- + "[(5-6)s:c|_5$<i>5<i>6]"
- + "[(6-7)s:d|_6$<i>6<i>7]"
- + "[(7-8)s:e|_7$<i>7<i>8]"
- + "[(8-9)s:e|_8$<i>8<i>9]"
- + "[(9-10)s:c|_9$<i>9<i>10]");
+ "[(0-1)s:c|_0$<i>0<i>1|<>:base/s:t$<b>64<i>0<i>10<i>10<b>0]"
+ + "[(1-2)s:e|_1$<i>1<i>2]" + "[(2-3)s:c|_2$<i>2<i>3]"
+ + "[(3-4)s:c|s:d|_3$<i>3<i>4]"
+ + "[(4-5)s:e|_4$<i>4<i>5]" + "[(5-6)s:c|_5$<i>5<i>6]"
+ + "[(6-7)s:d|_6$<i>6<i>7]" + "[(7-8)s:e|_7$<i>7<i>8]"
+ + "[(8-9)s:e|_8$<i>8<i>9]" + "[(9-10)s:c|_9$<i>9<i>10]");
return fd;
}
@@ -456,12 +451,10 @@
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-1");
fd.addTV("base", "bbccdd",
- "[(0-1)s:b|_0$<i>0<i>1|<>:base/s:t$<b>64<i>0<i>6<i>6<b>0]]"
- + "[(1-2)s:b|_1$<i>1<i>2]"
- + "[(2-3)s:c|_2$<i>2<i>3]"
- + "[(3-4)s:c|_3$<i>3<i>4]"
- + "[(4-5)s:d|_4$<i>4<i>5]"
- + "[(5-6)s:d|_5$<i>5<i>6]");
+ "[(0-1)s:b|_0$<i>0<i>1|<>:base/s:t$<b>64<i>0<i>6<i>6<b>0]]"
+ + "[(1-2)s:b|_1$<i>1<i>2]" + "[(2-3)s:c|_2$<i>2<i>3]"
+ + "[(3-4)s:c|_3$<i>3<i>4]" + "[(4-5)s:d|_4$<i>4<i>5]"
+ + "[(5-6)s:d|_5$<i>5<i>6]");
return fd;
}
@@ -470,12 +463,10 @@
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-2");
fd.addTV("base", "beccea",
- "[(0-1)s:b|_0$<i>0<i>1|<>:base/s:t$<b>64<i>0<i>6<i>6<b>0]]"
- + "[(1-2)s:e|_1$<i>1<i>2]"
- + "[(2-3)s:c|_2$<i>2<i>3]"
- + "[(3-4)s:c|_3$<i>3<i>4]"
- + "[(4-5)s:e|_4$<i>4<i>5]"
- + "[(5-6)s:a|_5$<i>5<i>6]");
+ "[(0-1)s:b|_0$<i>0<i>1|<>:base/s:t$<b>64<i>0<i>6<i>6<b>0]]"
+ + "[(1-2)s:e|_1$<i>1<i>2]" + "[(2-3)s:c|_2$<i>2<i>3]"
+ + "[(3-4)s:c|_3$<i>3<i>4]" + "[(4-5)s:e|_4$<i>4<i>5]"
+ + "[(5-6)s:a|_5$<i>5<i>6]");
return fd;
}
@@ -484,9 +475,8 @@
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-3");
fd.addTV("base", "cab",
- "[(0-1)s:c|_0$<i>0<i>1|<>:base/s:t$<b>64<i>0<i>3<i>3<b>0]]"
- + "[(1-2)s:a|_1$<i>1<i>2]"
- + "[(2-3)s:b|_2$<i>2<i>3]");
+ "[(0-1)s:c|_0$<i>0<i>1|<>:base/s:t$<b>64<i>0<i>3<i>3<b>0]]"
+ + "[(1-2)s:a|_1$<i>1<i>2]" + "[(2-3)s:b|_2$<i>2<i>3]");
return fd;
}
@@ -495,8 +485,8 @@
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-3");
fd.addTV("base", "ce",
- "[(0-1)s:c|_0$<i>0<i>1|<>:base/s:t$<b>64<i>0<i>2<i>2<b>0]]"
- + "[(1-2)s:e|_1$<i>1<i>2]");
+ "[(0-1)s:c|_0$<i>0<i>1|<>:base/s:t$<b>64<i>0<i>2<i>2<b>0]]"
+ + "[(1-2)s:e|_1$<i>1<i>2]");
return fd;
}
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
index b47d9fa..b85206e 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
@@ -392,6 +392,7 @@
};
+
@Test
public void indexExample2e () throws IOException {
KrillIndex ki = new KrillIndex();
@@ -432,29 +433,29 @@
assertEquals("StartPos (0)", 0, kr.getMatch(0).startPos);
assertEquals("EndPos (0)", 4, kr.getMatch(0).endPos);
- assertEquals("Snippet (0)", "[h h i j ]h i j h i j ...",
- kr.getMatch(0).getSnippetBrackets());
+ assertEquals("Snippet (0)", "[h h i j ]h i j h i j ...", kr
+ .getMatch(0).getSnippetBrackets());
assertEquals("StartPos (1)", 0, kr.getMatch(1).startPos);
assertEquals("EndPos (1)", 4, kr.getMatch(1).endPos);
- assertEquals("Snippet (1)", "[h h i j ]h i j h i j ...",
- kr.getMatch(1).getSnippetBrackets());
+ assertEquals("Snippet (1)", "[h h i j ]h i j h i j ...", kr
+ .getMatch(1).getSnippetBrackets());
assertEquals("StartPos (2)", 0, kr.getMatch(2).startPos);
assertEquals("EndPos (2)", 8, kr.getMatch(2).endPos);
assertEquals("Snippet (2)", "[h h i j h i j h ]i j ",
- kr.getMatch(2).getSnippetBrackets());
+ kr.getMatch(2).getSnippetBrackets());
assertEquals("StartPos (3)", 0, kr.getMatch(3).startPos);
assertEquals("EndPos (3)", 8, kr.getMatch(3).endPos);
assertEquals("Snippet (3)", "[h h i j h i j h ]i j ",
- kr.getMatch(3).getSnippetBrackets());
+ kr.getMatch(3).getSnippetBrackets());
assertEquals("StartPos (4)", 0, kr.getMatch(4).startPos);
assertEquals("EndPos (4)", 8, kr.getMatch(4).endPos);
assertEquals("Snippet (4)", "[h h i j h i j h ]i j ",
- kr.getMatch(4).getSnippetBrackets());
+ kr.getMatch(4).getSnippetBrackets());
assertEquals("StartPos (5)", 0, kr.getMatch(5).startPos);
assertEquals("EndPos (5)", 8, kr.getMatch(5).endPos);
assertEquals("Snippet (5)", "[h h i j h i j h ]i j ",
- kr.getMatch(5).getSnippetBrackets());
+ kr.getMatch(5).getSnippetBrackets());
assertEquals("StartPos (6)", 0, kr.getMatch(6).startPos);
@@ -900,14 +901,12 @@
// Case 1, 6, 7, 13
// xy<a><a>x</a>b<a>c</a></a>x
FieldDocument fd = new FieldDocument();
- fd.addTV("base", "x y x b c x ",
- "[(0-3)s:x|_0$<i>0<i>3]"
- + "[(3-6)s:y|_1$<i>3<i>6]"
- + "[(6-9)s:x|_2$<i>6<i>9|<>:a$<b>64<i>6<i>9<i>3<b>0|"
- + "<>:a$<b>64<i>6<i>15<i>5<b>0]" +
- "[(9-12)s:b|_3$<i>9<i>12]"
- + "[(12-15)s:c|_4$<i>12<i>15|<>:a$<b>64<i>12<i>15<i>5<b>0]"
- + "[(15-18)s:x|_5$<i>15<i>18]");
+ fd.addTV("base", "x y x b c x ", "[(0-3)s:x|_0$<i>0<i>3]"
+ + "[(3-6)s:y|_1$<i>3<i>6]"
+ + "[(6-9)s:x|_2$<i>6<i>9|<>:a$<b>64<i>6<i>9<i>3<b>0|"
+ + "<>:a$<b>64<i>6<i>15<i>5<b>0]" + "[(9-12)s:b|_3$<i>9<i>12]"
+ + "[(12-15)s:c|_4$<i>12<i>15|<>:a$<b>64<i>12<i>15<i>5<b>0]"
+ + "[(15-18)s:x|_5$<i>15<i>18]");
ki.addDoc(fd);
// Save documents
@@ -923,8 +922,10 @@
assertEquals("totalResults", kr.getTotalResults(), 2);
- assertEquals("x y [x ]b c x ", kr.getMatch(0).getSnippetBrackets());
- assertEquals("x y [x b c ]x ", kr.getMatch(1).getSnippetBrackets());
+ assertEquals("x y [x ]b c x ", kr.getMatch(0)
+ .getSnippetBrackets());
+ assertEquals("x y [x b c ]x ", kr.getMatch(1)
+ .getSnippetBrackets());
assertEquals("StartPos (0)", 2, kr.getMatch(0).startPos);
assertEquals("EndPos (0)", 3, kr.getMatch(0).endPos);
@@ -1105,7 +1106,8 @@
@Test
- public void queryJSONcomplexSpanOrTerm () throws QueryException, IOException {
+ public void queryJSONcomplexSpanOrTerm () throws QueryException,
+ IOException {
/*
at org.apache.lucene.search.spans.SpanOrQuery$1.doc(SpanOrQuery.java:234)
at de.ids_mannheim.korap.query.spans.WithinSpans.toSameDoc(WithinSpans.java:423)
@@ -1114,22 +1116,22 @@
at de.ids_mannheim.korap.Krill.apply(Krill.java:304)
*/
- String jsonPath = getClass().getResource("/queries/bugs/span_or_bug.jsonld")
- .getFile();
+ String jsonPath = getClass().getResource(
+ "/queries/bugs/span_or_bug.jsonld").getFile();
String jsonPQuery = readFile(jsonPath);
SpanQueryWrapper sqwi = new KrillQuery("tokens").fromJson(jsonPQuery);
SpanWithinQuery sq = (SpanWithinQuery) sqwi.toQuery();
- assertEquals("spanStartsWith(<tokens:base/s:s />, " +
- "spanOr([tokens:s:Er, tokens:s:Sie]))", sq.toString());
+ assertEquals("spanStartsWith(<tokens:base/s:s />, "
+ + "spanOr([tokens:s:Er, tokens:s:Sie]))", sq.toString());
KrillIndex ki = new KrillIndex();
ki.addDoc(getClass().getResourceAsStream("/wiki/DDD-08370.json.gz"),
- true);
+ true);
ki.addDoc(getClass().getResourceAsStream("/wiki/SSS-09803.json.gz"),
- true);
+ true);
ki.commit();
Result kr = ki.search(sq, (short) 1);
assertEquals(1, kr.getTotalResults());
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestKrillQuery.java b/src/test/java/de/ids_mannheim/korap/query/TestKrillQuery.java
index 4c1776b..7111b38 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestKrillQuery.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestKrillQuery.java
@@ -308,8 +308,11 @@
@Test
public void KorapSequenceWithEmptyRepetitionQuery () throws QueryException {
QueryBuilder kq = new QueryBuilder("field");
- SpanQuery sq = kq.seq(kq.seg("try")).append(kq.repeat(kq.empty(),0,100)).toQuery();
- assertEquals("focus(254: spanContain(<field:base/s:t />, {254: spanExpansion(field:try, []{0, 100}, right)}))",sq.toString());
+ SpanQuery sq = kq.seq(kq.seg("try"))
+ .append(kq.repeat(kq.empty(), 0, 100)).toQuery();
+ assertEquals(
+ "focus(254: spanContain(<field:base/s:t />, {254: spanExpansion(field:try, []{0, 100}, right)}))",
+ sq.toString());
};
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 4230d0d..cf8f67d 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
@@ -545,7 +545,8 @@
"/queries/bugs/expansion_bug_3.jsonld").getFile());
KrillQuery kq = new KrillQuery("tokens");
- assertEquals(kq.fromJson(json).toQuery().toString(),
+ assertEquals(
+ kq.fromJson(json).toQuery().toString(),
"focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:c, []{0, 4}, right)}))");
}
catch (QueryException e) {
@@ -558,12 +559,12 @@
public void queryJSONcomplexSpanOrTerm () throws QueryException {
// startsWith(<base/s=s>, { lassen | laufen })
try {
- String json = getString(getClass().getResource("/queries/bugs/span_or_bug.jsonld").getFile());
+ String json = getString(getClass().getResource(
+ "/queries/bugs/span_or_bug.jsonld").getFile());
KrillQuery kq = new KrillQuery("tokens");
- assertEquals(
- kq.fromJson(json).toQuery().toString(),
- "spanStartsWith(<tokens:base/s:s />, spanOr([tokens:s:Er, tokens:s:Sie]))");
+ assertEquals(kq.fromJson(json).toQuery().toString(),
+ "spanStartsWith(<tokens:base/s:s />, spanOr([tokens:s:Er, tokens:s:Sie]))");
}
catch (QueryException e) {
fail(e.getMessage());
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 7e1a4ab..caaef7b 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanRelationQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanRelationQueryJSON.java
@@ -12,7 +12,8 @@
public class TestSpanRelationQueryJSON {
@Test
- public void testMatchAnyRelationSourceWithAttribute() throws QueryException {
+ public void testMatchAnyRelationSourceWithAttribute ()
+ throws QueryException {
String filepath = getClass().getResource(
"/queries/relation/any-source-with-attribute.json").getFile();
SpanQueryWrapper sqwi = getJSONQuery(filepath);
@@ -25,8 +26,10 @@
sq.toString());
}
+
@Test
- public void testMatchAnyRelationTargetWithAttribute() throws QueryException {
+ public void testMatchAnyRelationTargetWithAttribute ()
+ throws QueryException {
String filepath = getClass().getResource(
"/queries/relation/any-target-with-attribute.json").getFile();
SpanQueryWrapper sqwi = getJSONQuery(filepath);
@@ -36,16 +39,16 @@
// +
// "<tokens:c:vp />)), spanWithAttribute(spanAttribute(tokens:type:case:accusative))))",
//
- "focus(#[1,2]spanSegment(spanWithAttribute(spanAttribute(tokens:type:case:accusative)), " +
- "focus(#2: spanSegment(spanRelation(tokens:>:mate/d:HEAD), "
- + "<tokens:c:vp />))))",
- sq.toString());
+ "focus(#[1,2]spanSegment(spanWithAttribute(spanAttribute(tokens:type:case:accusative)), "
+ + "focus(#2: spanSegment(spanRelation(tokens:>:mate/d:HEAD), "
+ + "<tokens:c:vp />))))", sq.toString());
// System.out.println(sq.toString());
}
+
@Test
- public void testMatchSpecificRelationSourceWithAttribute()
+ public void testMatchSpecificRelationSourceWithAttribute ()
throws QueryException {
String filepath = getClass().getResource(
"/queries/relation/specific-source-with-attribute.json")
@@ -60,8 +63,9 @@
sq.toString());
}
+
@Test
- public void testMatchBothRelationNodeWithAttribute() throws QueryException {
+ public void testMatchBothRelationNodeWithAttribute () throws QueryException {
String filepath = getClass().getResource(
"/queries/relation/both-operands-with-attribute.json")
.getFile();
@@ -76,6 +80,7 @@
sq.toString());
}
+
@Test
public void testMatchRelationSource () throws QueryException {
//
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 6b3285c..a38aec2 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
@@ -37,7 +37,8 @@
@Test
public void queryJSONseqEmptyEnd () throws QueryException {
SpanQueryWrapper sqwi = jsonQueryFile("empty-last.jsonld");
- assertEquals(sqwi.toQuery().toString(),
+ assertEquals(
+ sqwi.toQuery().toString(),
"focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{1, 1}, right)}))");
};
@@ -46,7 +47,8 @@
public void queryJSONseqEmptyEndClass () throws QueryException {
SpanQueryWrapper sqwi = jsonQueryFile("empty-last-class.jsonld");
// der{3:[]}
- assertEquals(sqwi.toQuery().toString(),
+ assertEquals(
+ sqwi.toQuery().toString(),
"focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{1, 1}, right, class:3)}))");
};
@@ -55,7 +57,8 @@
public void queryJSONseqEmptyEndRepetition () throws QueryException {
SpanQueryWrapper sqwi = jsonQueryFile("empty-last-repetition.jsonld");
// der[]{3,5}
- assertEquals(sqwi.toQuery().toString(),
+ assertEquals(
+ sqwi.toQuery().toString(),
"focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{3, 5}, right)}))");
};
@@ -127,7 +130,8 @@
public void queryJSONseqEmptySurround () throws QueryException {
SpanQueryWrapper sqwi = jsonQueryFile("empty-surround.jsonld");
// [][tt/p=NN][]
- assertEquals(sqwi.toQuery().toString(),
+ assertEquals(
+ sqwi.toQuery().toString(),
"focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(spanExpansion(tokens:tt/p:NN, []{1, 1}, left), []{1, 1}, right)}))");
};
@@ -156,7 +160,8 @@
public void queryJSONseqEmptySurroundRepetition () throws QueryException {
SpanQueryWrapper sqwi = jsonQueryFile("empty-surround-repetition.jsonld");
// [][tt/p=NN][]{2,7}
- assertEquals(sqwi.toQuery().toString(),
+ assertEquals(
+ sqwi.toQuery().toString(),
"focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(spanExpansion(tokens:tt/p:NN, []{1, 1}, left), []{2, 7}, right)}))");
};
@@ -165,7 +170,8 @@
public void queryJSONseqEmptySurroundRepetition2 () throws QueryException {
SpanQueryWrapper sqwi = jsonQueryFile("empty-surround-repetition-2.jsonld");
// []{3,5}[tt/p=NN][]{2,7}
- assertEquals(sqwi.toQuery().toString(),
+ assertEquals(
+ sqwi.toQuery().toString(),
"focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(spanExpansion(tokens:tt/p:NN, []{3, 5}, left), []{2, 7}, right)}))");
};
@@ -204,7 +210,8 @@
public void queryJSONseqNegativeEnd () throws QueryException {
SpanQueryWrapper sqwi = jsonQueryFile("negative-last.jsonld");
// [tt/p=NN][tt/p!=NN]
- assertEquals(sqwi.toQuery().toString(),
+ assertEquals(
+ sqwi.toQuery().toString(),
"focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:tt/p:NN, !tokens:tt/p:NN{1, 1}, right)}))");
};
@@ -240,7 +247,8 @@
SpanQueryWrapper sqwi = jsonQueryFile("negative-last-class.jsonld");
// [tt/p=NN]{2:[tt/p!=NN]}
SpanQuery sq = sqwi.toQuery();
- assertEquals(sq.toString(),
+ assertEquals(
+ sq.toString(),
"focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:tt/p:NN, !tokens:tt/p:NN{1, 1}, right, class:2)}))");
};
@@ -249,7 +257,8 @@
public void queryJSONseqNegativeEndRepetitionClass () throws QueryException {
SpanQueryWrapper sqwi = jsonQueryFile("negative-last-class-repetition.jsonld");
// [tt/p=NN]{2:[tt/p!=NN]{4,5}}
- assertEquals(sqwi.toQuery().toString(),
+ assertEquals(
+ sqwi.toQuery().toString(),
"focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:tt/p:NN, !tokens:tt/p:NN{4, 5}, right, class:2)}))");
};
@@ -259,7 +268,8 @@
throws QueryException {
SpanQueryWrapper sqwi = jsonQueryFile("negative-last-class-repetition-2.jsonld");
// [tt/p=NN]{2:[tt/p!=NN]}{4,5}
- assertEquals(sqwi.toQuery().toString(),
+ assertEquals(
+ sqwi.toQuery().toString(),
"focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:tt/p:NN, !tokens:tt/p:NN{4, 5}, right, class:2)}))");
};
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanSubspanQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanSubspanQueryJSON.java
index d0db622..2713702 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSubspanQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSubspanQueryJSON.java
@@ -154,7 +154,8 @@
"/queries/submatch/embedded-valid-empty.jsonld").getFile();
SpanQueryWrapper sqwi = getJSONQuery(filepath);
SpanQuery sq = sqwi.toQuery();
- assertEquals("focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:die, []{2, 5}, right)}))",
+ assertEquals(
+ "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:die, []{2, 5}, right)}))",
sq.toString());
}
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanWithinQuery.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanWithinQuery.java
index 574b19a..114ea99 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanWithinQuery.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanWithinQuery.java
@@ -33,17 +33,15 @@
};
+
@Test
public void spanSegmentStartsWithQuery () throws QueryException {
SpanSequenceQueryWrapper ssquery = new SpanSequenceQueryWrapper(
"field", "a", "b", "c");
- SpanWithinQuery ssequery = new SpanWithinQuery(
- new SpanElementQuery("field", "s"),
- ssquery.toQuery(),
- SpanWithinQuery.STARTSWITH,
- true
- );
+ SpanWithinQuery ssequery = new SpanWithinQuery(new SpanElementQuery(
+ "field", "s"), ssquery.toQuery(), SpanWithinQuery.STARTSWITH,
+ true);
assertEquals(
"spanStartsWith(<field:s />, spanNext(spanNext(field:a, field:b), field:c))",