Reenabled previously enabled tests
Change-Id: I911a7d77f5295417c2a9c4ad6e774755b7774451
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 2a263a6..a1edeef 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
@@ -719,21 +719,29 @@
// Create the initial query
SpanQuery query = null;
int i = 0;
+
+ // Get the first valid segment
while (query == null && i < this.segments.size()) {
query = this.segments.get(i).retrieveNode(this.retrieveNode)
- .toFragmentQuery();
+ .toFragmentQuery();
i++;
};
+ // No valid segment found
if (query == null)
return (SpanQuery) null;
-
+
// NextQueries
if (!this.hasConstraints() && this.isInOrder()) {
+
+ // TODO: Optimize:
+ // Join identicals to repetition, so spanNext(a,a) -> a{2}
+
for (; i < this.segments.size(); i++) {
+ // Get the first query for next sequence
SpanQuery second = this.segments.get(i)
- .retrieveNode(this.retrieveNode).toFragmentQuery();
+ .retrieveNode(this.retrieveNode).toFragmentQuery();
if (second == null)
continue;
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQuery.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQuery.java
index 912642a..b55b360 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQuery.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQuery.java
@@ -65,7 +65,7 @@
};
- @Ignore
+ @Test
public void spanSequenceQueryWrapper () throws QueryException {
SpanSequenceQueryWrapper ssqw, ssqw2;
@@ -150,14 +150,13 @@
+ "(x[2:3], ordered, notExcluded)])",
ssqw.toQuery().toString());
-
// Support empty class ins sequence
ssqw = new SpanSequenceQueryWrapper("field", "Der");
srqw = new SpanRepetitionQueryWrapper();
scqw = new SpanClassQueryWrapper(srqw, (short) 3);
ssqw.append(scqw);
- assertEquals("spanExpansion(field:Der, []{1, 1}, right, class:3)",
- ssqw.toQuery().toString());
+ assertEquals("focus(254: spanContain(<field:base/s:t />, {254: spanExpansion(field:Der, []{1, 1}, right, class:3)}))",
+ ssqw.toQuery().toString());
// Support empty class ins sequence
ssqw = new SpanSequenceQueryWrapper("field");
@@ -170,14 +169,5 @@
catch (Exception e) {
fail(e.getMessage() + " (Known issue)");
};
- // assertEquals("", scqw.toQuery().toString());
-
- /*
- sssq = new SpanSequenceQueryWrapper("field");
- sssc = new SpanClassQueryWrapper(sssq, (short) 2);
- SpanSequenceQueryWrapper sssq2 = new SpanSequenceQueryWrapper("field");
- sssq2.append("hui").append(sssc);
- assertEquals("", sssq2.toQuery().toString());
- */
};
};