Deserialization of new json-ld format
diff --git a/src/main/java/de/ids_mannheim/korap/KorapQuery.java b/src/main/java/de/ids_mannheim/korap/KorapQuery.java
index c011d6e..9d0a3a0 100644
--- a/src/main/java/de/ids_mannheim/korap/KorapQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/KorapQuery.java
@@ -35,7 +35,8 @@
private String field;
private ObjectMapper json;
- private String defaultFoundry = "mate/";
+ // The default foundry for lemmata and pos
+ // private String defaultFoundry = "mate";
// Logger
private final static Logger log = LoggerFactory.getLogger(KorapQuery.class);
@@ -68,7 +69,7 @@
// TODO: Exception messages are horrible!
// TODO: Use the shortcuts implemented in this class instead of the wrapper constructors
// TODO: Check for isArray()
- // TODO: Check for the number of operands before getting them
+ // TODO: Rename this span context!
public SpanQueryWrapperInterface fromJSON (JsonNode json) throws QueryException {
if (!json.has("@type")) {
@@ -82,134 +83,178 @@
case "korap:group":
SpanClassQueryWrapper classWrapper;
- if (!json.has("relation")) {
- if (json.has("class")) {
- return new SpanClassQueryWrapper(
- this.fromJSON(json.get("operands").get(0)),
- json.get("class").asInt(0)
- );
- }
- throw new QueryException("Group needs a relation or a class");
- };
+ if (!json.has("operation"))
+ throw new QueryException("Group expects operation");
- String relation = json.get("relation").asText();
+ String operation = json.get("operation").asText();
- if (!json.has("operands"))
- throw new QueryException("Operation needs operands");
+ // Get all operands
+ JsonNode operands = json.get("operands");
- // Alternation
- switch (relation) {
+ if (!json.has("operands") || !operands.isArray())
+ throw new QueryException("Operation needs operand list");
- case "or":
+ switch (operation) {
+
+ case "operation:or":
SpanAlterQueryWrapper ssaq = new SpanAlterQueryWrapper(this.field);
- for (JsonNode operand : json.get("operands")) {
+ for (JsonNode operand : operands) {
ssaq.or(this.fromJSON(operand));
};
- if (json.has("class")) {
- return new SpanClassQueryWrapper(ssaq, json.get("class").asInt(0));
- };
return ssaq;
- case "position":
- if (!json.has("position"))
- throw new QueryException("Operation needs position specification");
+ case "operation:position":
+ if (!json.has("frame"))
+ throw new QueryException("Operation needs frame specification");
- String position = json.get("position").asText();
+ if (operands.size() != 2)
+ throw new QueryException("Operation needs exactly two operands");
+
+ // TODO: Check for operands
+
+ String frame = json.has("frame") ? json.get("frame").asText() : "contains";
short flag = 0;
- switch (position) {
- case "startswith":
+ switch (frame) {
+ case "frame:contains":
+ break;
+ case "frame:within":
+ break;
+ case "frame:startswith":
flag = (short) 1;
break;
- case "endswith":
+ case "frame:endswith":
flag = (short) 2;
break;
- case "match":
+ case "frame:matches":
flag = (short) 3;
break;
+ case "frame:overlaps":
+ throw new QueryException("Frame overlap not yet supported");
+ default:
+ throw new QueryException("Frame type unknown");
};
+ // Check for exclusion modificator
+ Boolean exclude;
+ if (json.has("exclude") && json.get("exclude").asBoolean())
+ throw new QueryException("Exclusion is currently not supported in position operations");
+
+
return new SpanWithinQueryWrapper(
- this.fromJSON(json.get("operands").get(0)),
- this.fromJSON(json.get("operands").get(1)),
+ this.fromJSON(operands.get(0)),
+ this.fromJSON(operands.get(1)),
flag
- );
+ );
- case "shrink":
+ case "operation:submatch":
int number = 0;
- // temporary
- if (json.has("shrink"))
- number = json.get("shrink").asInt();
- return new SpanMatchModifyQueryWrapper(this.fromJSON(json.get("operands").get(0)), number);
+ if (operands.size() != 1)
+ throw new QueryException("Operation needs exactly two operands");
+
+ if (json.has("classRef")) {
+ if (json.has("classRefOp"))
+ throw new QueryException("Class reference operators not supported yet");
+
+ number = json.get("classRef").get(0).asInt();
+ }
+ else if (json.has("spanRef")) {
+ throw new QueryException("Span references not supported yet");
+ };
+
+ return new SpanMatchModifyQueryWrapper(
+ this.fromJSON(operands.get(0)), number
+ );
+
+ case "operation:sequence":
+ if (operands.size() < 2)
+ throw new QueryException(
+ "SpanSequenceQuery needs at least two operands"
+ );
+
+ if (json.has("distances"))
+ throw new QueryException("Distances are not supported yet");
+
+ if (json.has("inOrder"))
+ throw new QueryException("inOrder attribute is not supported yet");
+
+ SpanSequenceQueryWrapper sseqqw = new SpanSequenceQueryWrapper(this.field);
+ for (JsonNode operand : operands) {
+ sseqqw.append(this.fromJSON(operand));
+ };
+ return sseqqw;
+
+ case "operation:class":
+ if (json.has("class")) {
+ if (operands.size() != 1)
+ throw new QueryException(
+ "Class group expects exactly one operand in list"
+ );
+ return new SpanClassQueryWrapper(this.fromJSON(operands.get(0)), json.get("class").asInt(0));
+ };
+
+ throw new QueryException("Class group expects class attribute");
+
+ case "operation:repetition":
+ throw new QueryException("Repetition group not yet supported");
+
+ /*
+ if (json.has("min") || json.has("max"))
+ throw new QueryException("Quantifier for repetition group not yet supported");
+ */
};
- throw new QueryException("Unknown group relation");
+
+ throw new QueryException("Unknown group operation");
case "korap:token":
- return this._segFromJSON(json.get("@value"));
+ if (!json.has("wrap"))
+ throw new QueryException("Tokens need a wrap attribute");
- case "korap:sequence":
- if (!json.has("operands"))
- throw new QueryException("SpanSequenceQuery needs operands");
+ return this._segFromJSON(json.get("wrap"));
- JsonNode operands = json.get("operands");
- if (!operands.isArray() || operands.size() < 2)
- throw new QueryException("SpanSequenceQuery needs operands");
-
- SpanSequenceQueryWrapper sseqqw = new SpanSequenceQueryWrapper(this.field);
- for (JsonNode operand : json.get("operands")) {
- sseqqw.append(this.fromJSON(operand));
- };
- return sseqqw;
+ case "korap:span":
+ if (!json.has("key"))
+ throw new QueryException("A span need at least a key definition");
- case "korap:element":
- String value = json.get("@value").asText().replace('=',':');
- return this.tag(value);
+ return this._termFromJSON(json);
};
throw new QueryException("Unknown serialized query type: " + type);
};
+
private SpanQueryWrapperInterface _segFromJSON (JsonNode json) throws QueryException {
String type = json.get("@type").asText();
switch (type) {
case "korap:term":
- switch (json.get("relation").asText()) {
- case "=":
- String value = json.get("@value").asText();
+ String match = "match:eq";
+ if (json.has("match"))
+ match = json.get("match").asText();
- value = value.replaceFirst("base:", defaultFoundry +"l:").replaceFirst("orth:", "s:");
-
- if (json.has("@subtype") && json.get("@subtype").asText().equals("korap:regex")) {
- if (value.charAt(0) == '\'' || value.charAt(0) == '"') {
- value = "s:" + value;
- };
- value = value.replace("'", "").replace("\"", "");
-
- // Temporary
- value = value.replace("_", "/");
-
- return this.seg(this.re(value));
- };
-
- if (!value.matches("[^:]+?:.+"))
- value = "s:" + value;
-
- // Temporary
- value = value.replace("_", "/");
-
- return this.seg(value);
-
- case "!=":
- throw new QueryException("Term relation != not yet supported");
+ switch (match) {
+ case "match:ne":
+ return this.seg().without((SpanSegmentQueryWrapper) this._termFromJSON(json));
+ case "match:eq":
+ return this._termFromJSON(json);
};
- throw new QueryException("Unknown term relation");
- case "korap:group":
- SpanSegmentQueryWrapper ssegqw = new SpanSegmentQueryWrapper(this.field);
+ throw new QueryException("Match relation unknown");
+
+ case "korap:termGroup":
+
+ if (!json.has("operands"))
+ throw new QueryException("TermGroup expects operands");
+
+ SpanSegmentQueryWrapper ssegqw = this.seg();
+
+ if (!json.has("relation"))
+ throw new QueryException("termGroup expects a relation");
+
switch (json.get("relation").asText()) {
- case "and":
+ case "relation:and":
+
for (JsonNode operand : json.get("operands")) {
SpanQueryWrapperInterface part = this._segFromJSON(operand);
if (part instanceof SpanAlterQueryWrapper) {
@@ -226,19 +271,89 @@
};
};
return ssegqw;
- case "or":
+
+ case "relation:or":
SpanAlterQueryWrapper ssaq = new SpanAlterQueryWrapper(this.field);
for (JsonNode operand : json.get("operands")) {
ssaq.or(this._segFromJSON(operand));
};
return ssaq;
};
+ };
+ throw new QueryException("Unknown token type");
};
- throw new QueryException("Unknown token type");
-};
+ private SpanQueryWrapperInterface _termFromJSON (JsonNode json) throws QueryException {
+ if (!json.has("key") || json.get("key").asText().length() < 1)
+ throw new QueryException("Terms and spans have to provide key attributes");
+
+ Boolean isTerm = json.get("@type").asText().equals("korap:term") ? true : false;
+ Boolean isCaseInsensitive = false;
+
+ if (json.has("caseInsensitive") && json.get("caseInsensitive").asBoolean())
+ isCaseInsensitive = true;
+
+ StringBuffer value = new StringBuffer();
+
+ // expect orth? expect lemma?
+ // s:den | i:den | cnx/l:die | mate/m:mood:ind | cnx/syn:@PREMOD |
+ // mate/m:number:sg | opennlp/p:ART
+
+ if (json.has("foundry") && json.get("foundry").asText().length() > 0)
+ value.append(json.get("foundry").asText()).append('/');
+
+ // value.append(defaultFoundry).append('/');
+
+ if (json.has("layer") && json.get("layer").asText().length() > 0) {
+ String layer = json.get("layer").asText();
+ switch (layer) {
+ case "lemma":
+ layer = "l";
+ break;
+ case "pos":
+ layer = "p";
+ break;
+ case "orth":
+ layer = "s";
+ break;
+ };
+
+ if (isCaseInsensitive && isTerm && layer.equals("s"))
+ layer = "i";
+
+ value.append(layer).append(':');
+ };
+
+ if (json.has("key") && json.get("key").asText().length() > 0) {
+ String key = json.get("key").asText();
+ value.append(isCaseInsensitive ? key.toLowerCase() : key);
+ };
+
+ // Regular expression or wildcard
+ if (isTerm && json.has("type")) {
+ switch (json.get("type").asText()) {
+ case "type:regex":
+ return this.seg(this.re(value.toString(), isCaseInsensitive));
+ case "type:wildcard":
+ return this.seq(this.wc(value.toString(), isCaseInsensitive));
+ };
+ };
+
+ if (json.has("value") && json.get("value").asText().length() > 0)
+ value.append(':').append(json.get("value").asText());
+
+ if (isTerm)
+ return this.seg(value.toString());
+
+ if (json.has("attr"))
+ throw new QueryException("Attributes not yet supported in spans");
+
+ return this.tag(value.toString());
+ };
+
+
// SpanRegexQueryWrapper
/**
* Create a query object based on a regular expression.
diff --git a/src/main/java/de/ids_mannheim/korap/KorapSearch.java b/src/main/java/de/ids_mannheim/korap/KorapSearch.java
index 4f55dd0..ae3f70f 100644
--- a/src/main/java/de/ids_mannheim/korap/KorapSearch.java
+++ b/src/main/java/de/ids_mannheim/korap/KorapSearch.java
@@ -167,6 +167,10 @@
// Empty constructor
public KorapSearch () { };
+ public String getError () {
+ return this.error;
+ };
+
public SpanQuery getQuery () {
return this.query;
};
@@ -267,7 +271,10 @@
public KorapResult run (KorapIndex ki) {
if (this.query == null) {
KorapResult kr = new KorapResult();
- kr.setError(this.getClass() + " expects a query");
+ if (this.error != null)
+ kr.setError(this.error);
+ else
+ kr.setError(this.getClass() + " expects a query");
return kr;
};
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanAlterQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanAlterQueryWrapper.java
index ec2d254..bc706f2 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanAlterQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanAlterQueryWrapper.java
@@ -16,6 +16,7 @@
private SpanQuery query;
private List<SpanQuery> alternatives;
+
public SpanAlterQueryWrapper (String field) {
this.field = field;
this.alternatives = new ArrayList<>();
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSegmentQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSegmentQueryWrapper.java
index c6ba009..e59316a 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSegmentQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSegmentQueryWrapper.java
@@ -9,6 +9,7 @@
import org.apache.lucene.search.spans.SpanNotQuery;
import org.apache.lucene.search.spans.SpanOrQuery;
import de.ids_mannheim.korap.query.wrap.SpanRegexQueryWrapper;
+import de.ids_mannheim.korap.query.wrap.SpanWildcardQueryWrapper;
import de.ids_mannheim.korap.query.SpanSegmentQuery;
/**
@@ -83,11 +84,17 @@
return this;
};
+ public SpanSegmentQueryWrapper with (SpanWildcardQueryWrapper wc) {
+ this.inclusive.add((SpanQuery) wc.toQuery());
+ return this;
+ };
+
public SpanSegmentQueryWrapper with (SpanAlterQueryWrapper alter) {
this.inclusive.add((SpanQuery) alter.toQuery());
return this;
};
+ // Identical to without
public SpanSegmentQueryWrapper with (SpanSegmentQueryWrapper seg) {
for (SpanQuery sq : seg.inclusive) {
this.inclusive.add(sq);
@@ -108,11 +115,21 @@
return this;
};
+ public SpanSegmentQueryWrapper without (SpanWildcardQueryWrapper wc) {
+ this.exclusive.add((SpanQuery) wc.toQuery());
+ return this;
+ };
+
public SpanSegmentQueryWrapper without (SpanAlterQueryWrapper alter) {
this.exclusive.add((SpanQuery) alter.toQuery());
return this;
};
+ // Identical to with
+ public SpanSegmentQueryWrapper without (SpanSegmentQueryWrapper seg) {
+ return this.with(seg);
+ };
+
public SpanQuery toQuery () {
if (this.inclusive.size() + this.exclusive.size() == 0) {
return null;
@@ -127,6 +144,7 @@
else if (this.inclusive.size() == 0 && this.exclusive.size() >= 1) {
// Not supported anymore
+ // TODO: Raise error
return (SpanQuery) new SpanNotQuery(
new SpanTermQuery(new Term(this.field, "T")),
this._listToOrQuery(this.exclusive)
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java
index 354797b..a6b7f70 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java
@@ -20,7 +20,7 @@
@Ignore
public void queryJSONBsp1 () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp1.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp1.jsonld").getFile());
// ([base=foo]|[base=bar])[base=foobar]
assertEquals(sqwi.toQuery().toString(), "");
@@ -29,7 +29,7 @@
@Test
public void queryJSONBsp1b () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp1b.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp1b.jsonld").getFile());
// [base=foo]|([base=foo][base=bar]) meta author=Goethe&year=1815
assertEquals(sqwi.toQuery().toString(), "spanOr([tokens:"+defaultFoundry+"l:foo, spanNext(tokens:"+defaultFoundry+"l:foo, tokens:"+defaultFoundry+"l:bar)])");
@@ -38,7 +38,7 @@
@Test
public void queryJSONBsp2 () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp2.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp2.jsonld").getFile());
// ([base=foo]|[base=bar])[base=foobar]
assertEquals(sqwi.toQuery().toString(), "spanNext(spanOr([tokens:"+defaultFoundry+"l:foo, tokens:"+defaultFoundry+"l:bar]), tokens:"+defaultFoundry+"l:foobar)");
@@ -46,7 +46,7 @@
@Test
public void queryJSONBsp3 () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp3.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp3.jsonld").getFile());
// shrink({[base=Mann]})
assertEquals(sqwi.toQuery().toString(), "shrink(0: {0: tokens:"+defaultFoundry+"l:Mann})");
@@ -54,7 +54,7 @@
@Test
public void queryJSONBsp4 () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp4.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp4.jsonld").getFile());
// shrink({[base=foo]}[orth=bar])
assertEquals(sqwi.toQuery().toString(), "shrink(0: spanNext({0: tokens:"+defaultFoundry+"l:foo}, tokens:s:bar))");
@@ -62,7 +62,7 @@
@Test
public void queryJSONBsp5 () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp5.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp5.jsonld").getFile());
// shrink(1:[base=Der]{1:[base=Mann]})
assertEquals(sqwi.toQuery().toString(), "shrink(1: spanNext(tokens:"+defaultFoundry+"l:Der, {1: tokens:"+defaultFoundry+"l:Mann}))");
@@ -70,7 +70,7 @@
@Test
public void queryJSONBsp6 () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp6.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp6.jsonld").getFile());
// [base=katze]
assertEquals(sqwi.toQuery().toString(), "tokens:"+defaultFoundry+"l:Katze");
@@ -78,7 +78,7 @@
@Ignore
public void queryJSONBsp7 () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp7.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp7.jsonld").getFile());
// [!base=Katze]
assertEquals(sqwi.toQuery().toString(), "");
@@ -94,7 +94,7 @@
@Test
public void queryJSONBsp9 () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp9.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp9.jsonld").getFile());
// [base=Katze&orth=Katzen]
assertEquals(sqwi.toQuery().toString(), "spanSegment(tokens:"+defaultFoundry+"l:Katze, tokens:s:Katzen)");
@@ -102,7 +102,7 @@
@Test
public void queryJSONBsp10 () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp10.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp10.jsonld").getFile());
// [base=Katze][orth=und][orth=Hunde]
assertEquals(sqwi.toQuery().toString(), "spanNext(spanNext(tokens:"+defaultFoundry+"l:Katze, tokens:s:und), tokens:s:Hunde)");
@@ -110,7 +110,7 @@
@Ignore
public void queryJSONBsp11 () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp11.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp11.jsonld").getFile());
// [!(base=Katze&orth=Katzen)]
assertEquals(sqwi.toQuery().toString(), "");
@@ -118,7 +118,7 @@
@Test
public void queryJSONBsp12 () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp12.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp12.jsonld").getFile());
// contains(<np>,[base=Mann])
assertEquals(sqwi.toQuery().toString(), "spanWithin(<tokens:np />, tokens:"+defaultFoundry+"l:Mann)");
@@ -126,7 +126,7 @@
@Ignore
public void queryJSONBsp13 () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp13.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp13.jsonld").getFile());
// startswith(<np>,[!pos=Det])
assertEquals(sqwi.toQuery().toString(), "");
@@ -134,15 +134,15 @@
@Test
public void queryJSONBsp13b () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp13b.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp13b.jsonld").getFile());
- // startswith(<np>,[!pos=Det])
- assertEquals(sqwi.toQuery().toString(), "spanWithin(<tokens:np />, tokens:pos:Det, 1)");
+ // startswith(<np>,[pos=Det])
+ assertEquals(sqwi.toQuery().toString(), "spanWithin(<tokens:np />, tokens:mate/p:Det, 1)");
};
@Test
public void queryJSONBsp14 () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp14.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp14.jsonld").getFile());
// 'vers{2,3}uch'
assertEquals(sqwi.toQuery().toString(), "SpanMultiTermQueryWrapper(tokens:/s:vers{2,3}uch/)");
@@ -150,7 +150,7 @@
@Test
public void queryJSONBsp15 () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp15.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp15.jsonld").getFile());
// [orth='vers.*ch']
assertEquals(sqwi.toQuery().toString(), "SpanMultiTermQueryWrapper(tokens:/s:vers.*ch/)");
@@ -158,7 +158,7 @@
@Test
public void queryJSONBsp16 () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp16.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp16.jsonld").getFile());
// [(base=bar|base=foo)&orth=foobar]
assertEquals(sqwi.toQuery().toString(), "spanSegment(spanOr([tokens:"+defaultFoundry+"l:bar, tokens:"+defaultFoundry+"l:foo]), tokens:s:foobar)");
@@ -166,7 +166,7 @@
@Test
public void queryJSONBsp17 () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp17.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp17.jsonld").getFile());
// within(<np>,[base=Mann])
assertEquals(sqwi.toQuery().toString(), "spanWithin(<tokens:np />, tokens:"+defaultFoundry+"l:Mann)");
@@ -174,14 +174,14 @@
@Test
public void queryJSONDemo () throws QueryException {
- SpanQueryWrapperInterface sqwi = new KorapQuery("tokens").fromJSON("{ \"query\" : { \"@type\" : \"korap:token\", \"@value\" : { \"@type\" : \"korap:term\", \"@value\" : \"base_p:foo\", \"relation\" : \"=\" }}}");
+ SpanQueryWrapperInterface sqwi = new KorapQuery("tokens").fromJSON("{ \"query\" : { \"@type\" : \"korap:token\", \"wrap\" : { \"@type\" : \"korap:term\", \"foundry\" : \"base\", \"layer\" : \"p\", \"key\" : \"foo\", \"match\" : \"match:eq\" }}}");
assertEquals(sqwi.toQuery().toString(), "tokens:base/p:foo");
};
@Test
public void queryJSONBspClass () {
- SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp-class.json").getFile());
+ SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp-class.jsonld").getFile());
// within(<np>,[base=Mann])
assertEquals(sqwi.toQuery().toString(), "{0: spanNext(tokens:tt/p:ADJA, tokens:mate/p:NN)}");
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestKorapSearch.java b/src/test/java/de/ids_mannheim/korap/search/TestKorapSearch.java
index 2b48eb0..9b5be8b 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestKorapSearch.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestKorapSearch.java
@@ -106,12 +106,11 @@
};
ki.commit();
- String json = getString(getClass().getResource("/queries/metaquery3.json").getFile());
+ String json = getString(getClass().getResource("/queries/metaquery3.jsonld").getFile());
- KorapResult kr = new KorapSearch(json).run(ki);
+ KorapSearch ks = new KorapSearch(json);
- //System.out.println(kr.getQuery().toString());
-
+ KorapResult kr = ks.run(ki);
assertEquals(66, kr.getTotalResults());
assertEquals(5, kr.getItemsPerPage());
assertEquals(5, kr.getStartIndex());
@@ -131,18 +130,19 @@
};
ki.commit();
- String json = getString(getClass().getResource("/queries/metaquery4.json").getFile());
+ String json = getString(getClass().getResource("/queries/metaquery4.jsonld").getFile());
KorapSearch ks = new KorapSearch(json);
KorapResult kr = ks.run(ki);
+
assertEquals(2, kr.getTotalResults());
- json = getString(getClass().getResource("/queries/metaquery5.json").getFile());
+ json = getString(getClass().getResource("/queries/metaquery5.jsonld").getFile());
ks = new KorapSearch(json);
kr = ks.run(ki);
assertEquals(2, kr.getTotalResults());
- json = getString(getClass().getResource("/queries/metaquery6.json").getFile());
+ json = getString(getClass().getResource("/queries/metaquery6.jsonld").getFile());
ks = new KorapSearch(json);
kr = ks.run(ki);
assertEquals(1, kr.getTotalResults());
@@ -183,7 +183,7 @@
};
ki.commit();
- String json = getString(getClass().getResource("/queries/bsp-fail1.json").getFile());
+ String json = getString(getClass().getResource("/queries/bsp-fail1.jsonld").getFile());
KorapResult kr = new KorapSearch(json).run(ki);
assertEquals(0, kr.getStartIndex());
@@ -204,7 +204,7 @@
};
ki.commit();
- String json = getString(getClass().getResource("/queries/bsp-fail2.json").getFile());
+ String json = getString(getClass().getResource("/queries/bsp-fail2.jsonld").getFile());
KorapResult kr = new KorapSearch(json).run(ki);
assertEquals(50, kr.getItemsPerPage());
@@ -226,7 +226,7 @@
};
ki.commit();
- String json = getString(getClass().getResource("/queries/bsp-context.json").getFile());
+ String json = getString(getClass().getResource("/queries/bsp-context.jsonld").getFile());
KorapSearch ks = new KorapSearch(json);
KorapResult kr = ks.run(ki);
@@ -241,7 +241,7 @@
assertEquals(5, kr.getItemsPerPage());
- json = getString(getClass().getResource("/queries/bsp-context-2.json").getFile());
+ json = getString(getClass().getResource("/queries/bsp-context-2.jsonld").getFile());
kr = new KorapSearch(json).run(ki);
assertEquals(-1, kr.getTotalResults());
@@ -261,7 +261,7 @@
};
ki.commit();
- String json = getString(getClass().getResource("/queries/bsp-paging.json").getFile());
+ String json = getString(getClass().getResource("/queries/bsp-paging.jsonld").getFile());
KorapSearch ks = new KorapSearch(json);
KorapResult kr = ks.run(ki);
@@ -269,7 +269,7 @@
assertEquals(5, kr.getStartIndex());
assertEquals(5, kr.getItemsPerPage());
- json = getString(getClass().getResource("/queries/bsp-cutoff.json").getFile());
+ json = getString(getClass().getResource("/queries/bsp-cutoff.jsonld").getFile());
ks = ks = new KorapSearch(json);
kr = ks.run(ki);
diff --git a/src/test/resources/queries/bsp-class.jsonld b/src/test/resources/queries/bsp-class.jsonld
new file mode 100644
index 0000000..f036535
--- /dev/null
+++ b/src/test/resources/queries/bsp-class.jsonld
@@ -0,0 +1,36 @@
+{
+ "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query":{
+ "@type":"korap:group",
+ "operation" : "operation:class",
+ "class":0,
+ "operands":[
+ {
+ "@type":"korap:group",
+ "operation" : "operation:sequence",
+ "operands":[
+ {
+ "@type":"korap:token",
+ "wrap":{
+ "@type":"korap:term",
+ "foundry":"tt",
+ "layer" : "pos",
+ "key" : "ADJA",
+ "match":"match:eq"
+ }
+ },
+ {
+ "@type":"korap:token",
+ "wrap":{
+ "@type":"korap:term",
+ "foundry":"mate",
+ "layer" : "p",
+ "key" : "NN",
+ "match":"match:eq"
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "meta":[{"@type":"korap:meta-filter","@value":{"@type":"korap:term","@field":"korap:field#corpusID","@value":"WPD"}}],"startPage":1,"count":50,"context":{"left":["token",6],"right":["token",6]}}
diff --git a/src/test/resources/queries/bsp-context-2.jsonld b/src/test/resources/queries/bsp-context-2.jsonld
new file mode 100644
index 0000000..576d2f6
--- /dev/null
+++ b/src/test/resources/queries/bsp-context-2.jsonld
@@ -0,0 +1,24 @@
+{"@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query":{
+ "@type":"korap:token",
+ "wrap":{
+ "@type":"korap:term",
+ "foundry" : "mate",
+ "layer":"l",
+ "key":"wert",
+ "match":"match:eq"
+ }
+ },
+ "meta":[
+ {
+ "@type":"korap:meta-filter",
+ "@value":{
+ "@type":"korap:term",
+ "@field":"korap:field#corpusID",
+ "@value":"WPD"
+ }
+ }
+ ],
+ "startPage":1,
+ "count":25,
+ "context":{"left":["char",210],"right":["char",210]},"cutOff":true}
diff --git a/src/test/resources/queries/bsp-context.jsonld b/src/test/resources/queries/bsp-context.jsonld
new file mode 100644
index 0000000..327b8be
--- /dev/null
+++ b/src/test/resources/queries/bsp-context.jsonld
@@ -0,0 +1,17 @@
+{
+ "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query": {
+ "@type": "korap:token",
+ "wrap": {
+ "@type": "korap:term",
+ "foundry": "mate",
+ "layer" : "l",
+ "key" : "alphabet",
+ "match": "match:eq"
+ }
+ },
+ "context":{
+ "left":["char",90],
+ "right":["char",90]
+ }
+}
diff --git a/src/test/resources/queries/bsp-cutoff.jsonld b/src/test/resources/queries/bsp-cutoff.jsonld
new file mode 100644
index 0000000..fea64b8
--- /dev/null
+++ b/src/test/resources/queries/bsp-cutoff.jsonld
@@ -0,0 +1,20 @@
+{
+ "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query": {
+ "@type": "korap:token",
+ "wrap": {
+ "@type": "korap:term",
+ "foundry": "mate",
+ "layer": "lemma",
+ "key" : "alphabet",
+ "match": "match:eq"
+ }
+ },
+ "startPage":2,
+ "count": 2,
+ "cutOff": true,
+ "context":{
+ "left":["char",90],
+ "right":["char",90]
+ }
+}
diff --git a/src/test/resources/queries/bsp-fail1.json b/src/test/resources/queries/bsp-fail1.json
index 16c16a0..a3e9bb3 100644
--- a/src/test/resources/queries/bsp-fail1.json
+++ b/src/test/resources/queries/bsp-fail1.json
@@ -1,25 +1,9 @@
{
- "@context": {
- "@language": "de",
- "class": {
- "@id": "korap:class",
- "@type": "xsd:integer"
- },
- "filter": "korap:filter",
- "korap": "http://korap.ids-mannheim.de/ns/query",
- "meta": "korap:meta",
- "operands": {
- "@container": "@list",
- "@id": "korap:operands"
- },
- "query": "korap:query",
- "relation": {
- "@id": "korap:relation",
- "@type": "korap:relation#types"
- }
- },
+ "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
"query": {
"@type": "korap:group",
+ "frame": "frame:contains",
+ "operation": "operation:position"
"operands": [
{
"@type": "korap:element",
@@ -34,8 +18,6 @@
}
}
],
- "position": "within",
- "relation": "position"
},
"startIndex": -2
}
diff --git a/src/test/resources/queries/bsp-fail1.jsonld b/src/test/resources/queries/bsp-fail1.jsonld
new file mode 100644
index 0000000..d39a792
--- /dev/null
+++ b/src/test/resources/queries/bsp-fail1.jsonld
@@ -0,0 +1,25 @@
+{
+ "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query": {
+ "@type": "korap:group",
+ "frame": "frame:contains",
+ "operation": "operation:position"
+ "operands": [
+ {
+ "@type": "korap:span",
+ "key": "np"
+ },
+ {
+ "@type": "korap:token",
+ "wrap": {
+ "@type": "korap:term",
+ "foundry" : "mate",
+ "layer": "l",
+ "key" : "Mann",
+ "match": "match:eq"
+ }
+ }
+ ],
+ },
+ "startIndex": -2
+}
diff --git a/src/test/resources/queries/bsp-fail2.jsonld b/src/test/resources/queries/bsp-fail2.jsonld
new file mode 100644
index 0000000..417083e
--- /dev/null
+++ b/src/test/resources/queries/bsp-fail2.jsonld
@@ -0,0 +1,28 @@
+{
+ "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query": {
+ "@type": "korap:group",
+ "operation": "operation:position",
+ "frame": "frame:contains",
+ "operands": [
+ {
+ "@type": "korap:span",
+ "foundry" : "cnx",
+ "layer" : "c",
+ "key": "np"
+ },
+ {
+ "@type": "korap:token",
+ "wrap": {
+ "@type": "korap:term",
+ "foundry" : "mate",
+ "layer": "l",
+ "key" : "Mann",
+ "match": "match:eq"
+ }
+ }
+ ]
+ },
+ "count": 100,
+ "startPage": 1000
+}
diff --git a/src/test/resources/queries/bsp-paging.jsonld b/src/test/resources/queries/bsp-paging.jsonld
new file mode 100644
index 0000000..b410ea2
--- /dev/null
+++ b/src/test/resources/queries/bsp-paging.jsonld
@@ -0,0 +1,19 @@
+{
+ "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query": {
+ "@type": "korap:token",
+ "wrap": {
+ "@type": "korap:term",
+ "foundry": "mate",
+ "layer" : "lemma",
+ "key":"alphabet",
+ "match": "match:eq"
+ }
+ },
+ "startPage":2,
+ "count": 5,
+ "context":{
+ "left":["char",90],
+ "right":["char",90]
+ }
+}
diff --git a/src/test/resources/queries/bsp1.jsonld b/src/test/resources/queries/bsp1.jsonld
index 100d9fa..36fb042 100644
--- a/src/test/resources/queries/bsp1.jsonld
+++ b/src/test/resources/queries/bsp1.jsonld
@@ -114,7 +114,7 @@
},
{
"@type": "korap:group",
- "quantifier": "*",
+ "min" : 0,
"operation": "operation:repetition",
"operands": [
{
@@ -132,7 +132,7 @@
{
"@type": "korap:token",
"wrap": {
- "@type": "korap:term",
+ "@type": "korap:term",
"layer": "base",
"key" : "bar"
}
diff --git a/src/test/resources/queries/bsp10.jsonld b/src/test/resources/queries/bsp10.jsonld
index 19ad4a2..643edc3 100644
--- a/src/test/resources/queries/bsp10.jsonld
+++ b/src/test/resources/queries/bsp10.jsonld
@@ -108,7 +108,8 @@
"@type": "korap:token",
"wrap": {
"@type": "korap:term",
- "layer": "base",
+ "foundry" : "mate",
+ "layer": "lemma",
"key" : "Katze"
}
},
diff --git a/src/test/resources/queries/bsp12.jsonld b/src/test/resources/queries/bsp12.jsonld
index b909da1..4db4b95 100644
--- a/src/test/resources/queries/bsp12.jsonld
+++ b/src/test/resources/queries/bsp12.jsonld
@@ -113,7 +113,8 @@
"@type": "korap:token",
"wrap" : {
"@type": "korap:term",
- "layer": "base",
+ "foundry": "mate",
+ "layer": "lemma",
"key" : "Mann"
}
}
diff --git a/src/test/resources/queries/bsp13b.jsonld b/src/test/resources/queries/bsp13b.jsonld
index f67adef..6a4b19e 100644
--- a/src/test/resources/queries/bsp13b.jsonld
+++ b/src/test/resources/queries/bsp13b.jsonld
@@ -113,9 +113,10 @@
"@type": "korap:token",
"wrap": {
"@type": "korap:term",
+ "foundry" : "mate",
"layer": "pos",
"key" : "Det",
- "match" : "match:ne"
+ "match" : "match:eq"
}
}
]
diff --git a/src/test/resources/queries/bsp14.jsonld b/src/test/resources/queries/bsp14.jsonld
index ad6e7e3..f9c98e0 100644
--- a/src/test/resources/queries/bsp14.jsonld
+++ b/src/test/resources/queries/bsp14.jsonld
@@ -104,7 +104,8 @@
"@type": "korap:token",
"wrap": {
"@type" : "korap:term",
- "type": "type:regex",
+ "type": "type:regex",
+ "layer": "orth",
"key": "vers{2,3}uch"
}
}
diff --git a/src/test/resources/queries/bsp16.jsonld b/src/test/resources/queries/bsp16.jsonld
index 778a01b..72586cb 100644
--- a/src/test/resources/queries/bsp16.jsonld
+++ b/src/test/resources/queries/bsp16.jsonld
@@ -112,12 +112,14 @@
"operands": [
{
"@type": "korap:term",
- "layer": "base",
+ "foundry": "mate",
+ "layer": "lemma",
"key" : "bar"
},
{
"@type": "korap:term",
- "layer": "base",
+ "foundry": "mate",
+ "layer": "lemma",
"key" : "foo"
}
]
diff --git a/src/test/resources/queries/bsp17.jsonld b/src/test/resources/queries/bsp17.jsonld
index 5fe54e0..2df7268 100644
--- a/src/test/resources/queries/bsp17.jsonld
+++ b/src/test/resources/queries/bsp17.jsonld
@@ -113,7 +113,8 @@
"@type": "korap:token",
"wrap": {
"@type": "korap:term",
- "layer": "base",
+ "foundry" : "mate",
+ "layer": "lemma",
"key" : "Mann"
}
}
diff --git a/src/test/resources/queries/bsp1b.jsonld b/src/test/resources/queries/bsp1b.jsonld
new file mode 100644
index 0000000..2a2631c
--- /dev/null
+++ b/src/test/resources/queries/bsp1b.jsonld
@@ -0,0 +1,64 @@
+{
+ "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query":{
+ "@type":"korap:group",
+ "operation":"operation:or",
+ "operands":[
+ {
+ "@type":"korap:token",
+ "wrap":{
+ "@type":"korap:term",
+ "foundry":"mate",
+ "layer" : "lemma",
+ "key" :"foo",
+ "match":"match:eq"
+ }
+ },
+ {
+ "@type":"korap:group",
+ "operation":"operation:sequence",
+ "operands":[
+ {
+ "@type":"korap:token",
+ "wrap":{
+ "@type":"korap:term",
+ "foundry" : "mate",
+ "layer":"lemma",
+ "key":"foo",
+ "match":"match:eq"
+ }
+ },
+ {
+ "@type":"korap:token",
+ "wrap":{
+ "@type":"korap:term",
+ "foundry": "mate",
+ "layer":"lemma",
+ "key" : "bar",
+ "match":"match:eq"
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "meta":{
+ "@type":"korap:meta",
+ "@value":{
+ "@type":"korap:group",
+ "operands":[
+ {
+ "@type":"korap:term",
+ "@value":"author:Goethe",
+ "relation":"="
+ },
+ {
+ "@type":"korap:term",
+ "@value":"year:1815",
+ "relation":"="
+ }
+ ],
+ "relation":"and"
+ }
+ }
+}
diff --git a/src/test/resources/queries/bsp2.jsonld b/src/test/resources/queries/bsp2.jsonld
index aa8673e..08ac500 100644
--- a/src/test/resources/queries/bsp2.jsonld
+++ b/src/test/resources/queries/bsp2.jsonld
@@ -112,7 +112,8 @@
"@type": "korap:token",
"wrap": {
"@type": "korap:term",
- "layer": "base",
+ "foundry": "mate",
+ "layer": "lemma",
"key" : "foo"
}
},
@@ -120,7 +121,8 @@
"@type": "korap:token",
"wrap": {
"@type": "korap:term",
- "layer": "base",
+ "foundry": "mate",
+ "layer": "lemma",
"key" : "bar"
}
}
@@ -130,7 +132,8 @@
"@type": "korap:token",
"wrap": {
"@type": "korap:term",
- "layer": "base",
+ "foundry": "mate",
+ "layer": "lemma",
"key" : "foobar"
}
}
diff --git a/src/test/resources/queries/bsp3.jsonld b/src/test/resources/queries/bsp3.jsonld
index 642d91f..1a40038 100644
--- a/src/test/resources/queries/bsp3.jsonld
+++ b/src/test/resources/queries/bsp3.jsonld
@@ -114,7 +114,8 @@
"@type": "korap:token",
"wrap": {
"@type": "korap:term",
- "layer": "base",
+ "foundry" : "mate",
+ "layer": "lemma",
"key" : "Mann"
}
}
diff --git a/src/test/resources/queries/bsp4.json b/src/test/resources/queries/bsp4.json
index c7ddb5b..138bdd4 100644
--- a/src/test/resources/queries/bsp4.json
+++ b/src/test/resources/queries/bsp4.json
@@ -26,7 +26,7 @@
"operands": [
{
"@type": "korap:group",
- "class": "0",
+ "class": 0,
"operands": [
{
"@type": "korap:token",
diff --git a/src/test/resources/queries/bsp4.jsonld b/src/test/resources/queries/bsp4.jsonld
index b64ef29..c5cc7db 100644
--- a/src/test/resources/queries/bsp4.jsonld
+++ b/src/test/resources/queries/bsp4.jsonld
@@ -111,13 +111,15 @@
"operands": [
{
"@type": "korap:group",
+ "operation":"operation:class",
"class": 0,
"operands": [
{
"@type": "korap:token",
"wrap": {
"@type": "korap:term",
- "layer": "base",
+ "foundry" : "mate",
+ "layer": "lemma",
"key" : "foo"
}
}
diff --git a/src/test/resources/queries/bsp5.jsonld b/src/test/resources/queries/bsp5.jsonld
index 1a12d6d..bebc438 100644
--- a/src/test/resources/queries/bsp5.jsonld
+++ b/src/test/resources/queries/bsp5.jsonld
@@ -106,25 +106,29 @@
"classRef": [1],
"operands": [
{
- "@type": "korap:sequence",
+ "@type": "korap:group",
+ "operation" : "operation:sequence",
"operands": [
{
"@type": "korap:token",
"wrap": {
"@type": "korap:term",
- "layer": "base",
+ "foundry" : "mate",
+ "layer": "lemma",
"key" : "Der"
}
},
{
"@type": "korap:group",
+ "operation" : "operation:class",
"class": 1,
"operands": [
{
"@type": "korap:token",
"wrap": {
"@type": "korap:term",
- "layer": "base",
+ "foundry": "mate",
+ "layer": "lemma",
"key" : "Mann"
}
}
diff --git a/src/test/resources/queries/bsp6.jsonld b/src/test/resources/queries/bsp6.jsonld
index fc9fe84..64e8d17 100644
--- a/src/test/resources/queries/bsp6.jsonld
+++ b/src/test/resources/queries/bsp6.jsonld
@@ -104,7 +104,8 @@
"@type": "korap:token",
"wrap": {
"@type": "korap:term",
- "layer": "base",
+ "foundry" : "mate",
+ "layer": "lemma",
"key" : "Katze"
}
}
diff --git a/src/test/resources/queries/bsp7.jsonld b/src/test/resources/queries/bsp7.jsonld
index 074d2d3..46ab329 100644
--- a/src/test/resources/queries/bsp7.jsonld
+++ b/src/test/resources/queries/bsp7.jsonld
@@ -104,7 +104,8 @@
"@type": "korap:token",
"wrap" : {
"@type": "korap:term",
- "layer": "base",
+ "foundry": "mate",
+ "layer": "lemma",
"key": "Katze",
"match": "match:ne"
}
diff --git a/src/test/resources/queries/bsp9.jsonld b/src/test/resources/queries/bsp9.jsonld
index 41e9cfb..52f10b9 100644
--- a/src/test/resources/queries/bsp9.jsonld
+++ b/src/test/resources/queries/bsp9.jsonld
@@ -108,7 +108,8 @@
"operands": [
{
"@type": "korap:term",
- "layer": "base",
+ "foundry": "mate",
+ "layer": "lemma",
"key" : "Katze"
},
{
diff --git a/src/test/resources/queries/metaquery3.jsonld b/src/test/resources/queries/metaquery3.jsonld
new file mode 100644
index 0000000..0f7f3dd
--- /dev/null
+++ b/src/test/resources/queries/metaquery3.jsonld
@@ -0,0 +1,51 @@
+{
+ "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "startPage" : 2,
+ "count" : 5,
+ "context" : {
+ "left" : [ "token", 3 ],
+ "right" : [ "char", 6 ]
+ },
+ "query":{
+ "@type":"korap:group",
+ "operation":"operation:or",
+ "operands":[
+ {
+ "@type":"korap:token",
+ "wrap":{
+ "@type":"korap:term",
+ "foundry" : "mate",
+ "layer":"l",
+ "key":"Vokal",
+ "match":"match:eq"
+ }
+ },
+ {
+ "@type":"korap:group",
+ "operation" : "operation:sequence",
+ "operands":[
+ {
+ "@type":"korap:token",
+ "wrap":{
+ "@type":"korap:term",
+ "foundry" : "mate",
+ "layer":"l",
+ "key" : "der",
+ "match":"match:eq"
+ }
+ },
+ {
+ "@type":"korap:token",
+ "wrap":{
+ "@type":"korap:term",
+ "foundry":"mate",
+ "layer" : "p",
+ "key" : "ADJA",
+ "match":"match:eq"
+ }
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/src/test/resources/queries/metaquery4.jsonld b/src/test/resources/queries/metaquery4.jsonld
new file mode 100644
index 0000000..7da685d
--- /dev/null
+++ b/src/test/resources/queries/metaquery4.jsonld
@@ -0,0 +1,40 @@
+{
+ "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "startPage" : 1,
+ "count" : 5,
+ "context" : {
+ "left" : [ "token", 3 ],
+ "right" : [ "char", 6 ]
+ },
+ "query":{
+ "@type":"korap:token",
+ "wrap":{
+ "@type":"korap:term",
+ "foundry":"mate",
+ "layer":"l",
+ "key":"lediglich",
+ "match":"match:eq"
+ }
+ },
+ "meta": [
+ {
+ "@type": "korap:meta-filter",
+ "@id": "korap-filter#id-1223232",
+ "@value": {
+ "@type": "korap:group",
+ "relation": "between",
+ "@field": "korap:field#pubDate",
+ "operands": [
+ {
+ "@type": "korap:date",
+ "@value": "2000-01-01"
+ },
+ {
+ "@type": "korap:date",
+ "@value": "2013-12-31"
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/src/test/resources/queries/metaquery5.jsonld b/src/test/resources/queries/metaquery5.jsonld
new file mode 100644
index 0000000..497494e
--- /dev/null
+++ b/src/test/resources/queries/metaquery5.jsonld
@@ -0,0 +1,46 @@
+{
+ "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "startPage" : 1,
+ "count" : 5,
+ "context" : {
+ "left" : [ "token", 3 ],
+ "right" : [ "char", 6 ]
+ },
+ "query":{
+ "@type":"korap:token",
+ "wrap":{
+ "@type":"korap:term",
+ "foundry": "mate",
+ "layer":"l",
+ "key":"lediglich",
+ "match":"match:eq"
+ }
+ },
+ "meta": [
+ {
+ "@type": "korap:meta-filter",
+ "@id": "korap-filter#id-1223232",
+ "@value": {
+ "@type": "korap:group",
+ "relation": "and",
+ "operands": [
+ {
+ "@type": "korap:group",
+ "relation": "between",
+ "@field": "korap:field#pubDate",
+ "operands": [
+ {
+ "@type": "korap:date",
+ "@value": "2000-01-01"
+ },
+ {
+ "@type": "korap:date",
+ "@value": "2013-12-31"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/src/test/resources/queries/metaquery6.jsonld b/src/test/resources/queries/metaquery6.jsonld
new file mode 100644
index 0000000..5acb266
--- /dev/null
+++ b/src/test/resources/queries/metaquery6.jsonld
@@ -0,0 +1,45 @@
+{
+ "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "startPage" : 1,
+ "count" : 5,
+ "context" : {
+ "left" : [ "token", 3 ],
+ "right" : [ "char", 6 ]
+ },
+ "query":{
+ "@type":"korap:token",
+ "wrap":{
+ "@type":"korap:term",
+ "foundry":"mate",
+ "layer":"l",
+ "key":"lediglich"
+ }
+ },
+ "meta": [
+ {
+ "@type": "korap:meta-filter",
+ "@id": "korap-filter#id-1223232",
+ "@value": {
+ "@type": "korap:group",
+ "relation": "and",
+ "operands": [
+ {
+ "@type": "korap:group",
+ "relation": "between",
+ "@field": "korap:field#pubDate",
+ "operands": [
+ {
+ "@type": "korap:date",
+ "@value": "2005-01-01"
+ },
+ {
+ "@type": "korap:date",
+ "@value": "2013-12-31"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+}