adapted Cosmas and PQ to current JSON-LD specifications
diff --git a/src/test/java/CosmasTreeTest.java b/src/test/java/CosmasTreeTest.java
index 0d7db7a..efe86f6 100644
--- a/src/test/java/CosmasTreeTest.java
+++ b/src/test/java/CosmasTreeTest.java
@@ -26,7 +26,7 @@
@Test
public void testContext() throws QueryException {
- String contextString = "{korap=http://korap.ids-mannheim.de/ns/query, @language=de, operands={@id=korap:operands, @container=@list}, relation={@id=korap:relation, @type=korap:relation#types}, class={@id=korap:class, @type=xsd:integer}, query=korap:query, filter=korap:filter, meta=korap:meta}";
+ String contextString = "{korap=http://korap.ids-mannheim.de/ns/query, @language=de, @operands={@id=korap:operands, @container=@list}, @relation={@id=korap:relation, @type=korap:relation#types}, class={@id=korap:class, @type=xsd:integer}, query=korap:query, filter=korap:filter, meta=korap:meta}";
ppt = new CosmasTree("Test");
assertTrue(equalsContent(contextString, ppt.getRequestMap().get("@context")));
}
@@ -36,31 +36,31 @@
public void testSingleToken() throws QueryException {
query="der";
String single1 =
- "{@type=korap:token, @value={@type=korap:term, @value=orth:der, relation==}}";
+ "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}";
ppt = new CosmasTree(query);
map = ppt.getRequestMap().get("query").toString();
assertEquals(single1.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="Mann";
String single2 =
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mann, relation==}}";
+ "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}";
ppt = new CosmasTree(query);
map = ppt.getRequestMap().get("query").toString();
assertEquals(single2.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="&Mann";
String single3 =
- "{@type=korap:token, @value={@type=korap:term, @value=base:Mann, relation==}}";
+ "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=lemma, @relation==}}";
ppt = new CosmasTree(query);
map = ppt.getRequestMap().get("query").toString();
assertEquals(single3.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
-// @Test
+ @Test
public void testMORPH() throws QueryException {
query="#MORPH(V)";
String morph1 =
- "{@type=korap:token, @value={@type=korap:term, @value=pos:v, relation==}}";
+ "{@type=korap:token, @value={@type=korap:term, @value=V, @relation==}}";
ppt = new CosmasTree(query);
map = ppt.getRequestMap().get("query").toString();
assertEquals(morph1.replaceAll(" ", ""), map.replaceAll(" ", ""));
@@ -70,9 +70,9 @@
public void testSequence() throws QueryException {
query="der Mann";
String seq1 =
- "{@type=korap:sequence, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:der, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mann, relation==}}" +
+ "{@type=korap:sequence, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}" +
"]}";
ppt = new CosmasTree(query);
map = ppt.getRequestMap().get("query").toString();
@@ -80,10 +80,10 @@
query="der Mann schläft";
String seq2 =
- "{@type=korap:sequence, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:der, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mann, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:schläft, relation==}}" +
+ "{@type=korap:sequence, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=schläft, @attr=orth, @relation==}}" +
"]}";
ppt = new CosmasTree(query);
map = ppt.getRequestMap().get("query").toString();
@@ -91,11 +91,11 @@
query="der Mann schläft lang";
String seq3 =
- "{@type=korap:sequence, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:der, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mann, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:schläft, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:lang, relation==}}" +
+ "{@type=korap:sequence, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=schläft, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=lang, @attr=orth, @relation==}}" +
"]}";
ppt = new CosmasTree(query);
map = ppt.getRequestMap().get("query").toString();
@@ -106,9 +106,9 @@
public void testOPOR() throws QueryException {
query="Sonne oder Mond";
String disj1 =
- "{@type=korap:group, relation=or, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Sonne, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mond, relation==}}" +
+ "{@type=korap:group, @relation=or, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" +
"]}";
ppt = new CosmasTree(query);
map = ppt.getRequestMap().get("query").toString();
@@ -116,12 +116,12 @@
query="(Sonne scheint) oder Mond";
String disj2 =
- "{@type=korap:group, relation=or, operands=[" +
- "{@type=korap:sequence, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Sonne, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:scheint, relation==}}" +
+ "{@type=korap:group, @relation=or, @operands=[" +
+ "{@type=korap:sequence, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=scheint, @attr=orth, @relation==}}" +
"]}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mond, relation==}}" +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" +
"]}";
ppt = new CosmasTree(query);
map = ppt.getRequestMap().get("query").toString();
@@ -129,14 +129,14 @@
query="(Sonne scheint) oder (Mond scheint)";
String disj3 =
- "{@type=korap:group, relation=or, operands=[" +
- "{@type=korap:sequence, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Sonne, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:scheint, relation==}}" +
+ "{@type=korap:group, @relation=or, @operands=[" +
+ "{@type=korap:sequence, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=scheint, @attr=orth, @relation==}}" +
"]}," +
- "{@type=korap:sequence, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mond, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:scheint, relation==}}" +
+ "{@type=korap:sequence, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=scheint, @attr=orth, @relation==}}" +
"]}" +
"]}";
ppt = new CosmasTree(query);
@@ -149,12 +149,12 @@
public void testOPORAND() throws QueryException {
query="(Sonne oder Mond) und scheint";
String orand1 =
- "{@type=korap:group, relation=and, operands=[" +
- "{@type=korap:group, relation=or, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Sonne, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mond, relation==}}" +
+ "{@type=korap:group, @relation=and, @operands=[" +
+ "{@type=korap:group, @relation=or, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" +
"]}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:scheint, relation==}}" +
+ "{@type=korap:token, @value={@type=korap:term, @value=scheint, @attr=orth, @relation==}}" +
"]}";
ppt = new CosmasTree(query);
map = ppt.getRequestMap().get("query").toString();
@@ -162,11 +162,11 @@
query="scheint und (Sonne oder Mond)";
String orand2 =
- "{@type=korap:group, relation=and, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:scheint, relation==}}," +
- "{@type=korap:group, relation=or, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Sonne, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mond, relation==}}" +
+ "{@type=korap:group, @relation=and, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=scheint, @attr=orth, @relation==}}," +
+ "{@type=korap:group, @relation=or, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" +
"]}" +
"]}";
ppt = new CosmasTree(query);
@@ -178,13 +178,13 @@
public void testOPPROX() throws QueryException {
query="Sonne /+w1:4 Mond";
String prox1 =
- "{@type=korap:group, relation=distance, match=operands, @subtype=incl, " +
- "constraint=[" +
- "{@type=korap:distance, measure=w, direction=plus, min=1, max=4}" +
+ "{@type=korap:sequence, @inOrder=true, " +
+ "@constraints=[" +
+ "{@type=korap:distance, @measure=w, @min=1, @max=4}" +
"], " +
- "operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Sonne, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mond, relation==}}" +
+ "@operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" +
"]" +
"}";
ppt = new CosmasTree(query);
@@ -193,17 +193,17 @@
query="Sonne /+w1:4,s0,p1:3 Mond";
String prox2 =
- "{@type=korap:group, relation=distance, match=operands, @subtype=incl, " +
- "constraint=[" +
- "{@type=korap:group, relation=and, operands=[" +
- "{@type=korap:distance, measure=w, direction=plus, min=1, max=4}," +
- "{@type=korap:distance, measure=s, direction=both, min=0, max=0}," +
- "{@type=korap:distance, measure=p, direction=both, min=1, max=3}" +
+ "{@type=korap:sequence, @inOrder=true, " +
+ "@constraints=[" +
+ "{@type=korap:group, @relation=and, @operands=[" +
+ "{@type=korap:distance, @measure=w, @min=1, @max=4}," +
+ "{@type=korap:distance, @measure=s, @min=0, @max=0}," +
+ "{@type=korap:distance, @measure=p, @min=1, @max=3}" +
"]}" +
"], " +
- "operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Sonne, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mond, relation==}}" +
+ "@operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" +
"]" +
"}";
ppt = new CosmasTree(query);
@@ -212,17 +212,17 @@
query="Sonne %+w1:4,s0,p1:3 Mond";
String prox3 =
- "{@type=korap:group, relation=distance, match=operands, @subtype=excl, " +
- "constraint=[" +
- "{@type=korap:group, relation=and, operands=[" +
- "{@type=korap:distance, measure=w, direction=plus, min=1, max=4}," +
- "{@type=korap:distance, measure=s, direction=both, min=0, max=0}," +
- "{@type=korap:distance, measure=p, direction=both, min=1, max=3}" +
+ "{@type=korap:sequence, @inOrder=true, " +
+ "@constraints=[" +
+ "{@type=korap:group, @relation=and, @operands=[" +
+ "{@type=korap:distance, @measure=w, @min=1, @max=4, @exclude=true}," +
+ "{@type=korap:distance, @measure=s, @min=0, @max=0, @exclude=true}," +
+ "{@type=korap:distance, @measure=p, @min=1, @max=3, @exclude=true}" +
"]}" +
"], " +
- "operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Sonne, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mond, relation==}}" +
+ "@operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" +
"]" +
"}";
ppt = new CosmasTree(query);
@@ -231,13 +231,13 @@
query="Sonne /+w4 Mond";
String prox4 =
- "{@type=korap:group, relation=distance, match=operands, @subtype=incl, " +
- "constraint=[" +
- "{@type=korap:distance, measure=w, direction=plus, min=0, max=4}" +
+ "{@type=korap:sequence, @inOrder=true, " +
+ "@constraints=[" +
+ "{@type=korap:distance, @measure=w, @min=0, @max=4}" +
"], " +
- "operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Sonne, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mond, relation==}}" +
+ "@operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" +
"]" +
"}";
ppt = new CosmasTree(query);
@@ -246,13 +246,13 @@
query="Sonne /-w4 Mond";
String prox5 =
- "{@type=korap:group, relation=distance, match=operands, @subtype=incl, " +
- "constraint=[" +
- "{@type=korap:distance, measure=w, direction=plus, min=0, max=4}" +
+ "{@type=korap:sequence, @inOrder=true, " +
+ "@constraints=[" +
+ "{@type=korap:distance, @measure=w, @min=0, @max=4}" +
"], " +
- "operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mond, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Sonne, relation==}}" +
+ "@operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}" +
"]" +
"}";
ppt = new CosmasTree(query);
@@ -261,23 +261,23 @@
}
@Test
- public void testNestedOPPROX() throws QueryException {
+ public void testOPPROXNested() throws QueryException {
query="Sonne /-w4 Mond /+w2 Sterne";
String prox6 =
- "{@type=korap:group, relation=distance, match=operands, @subtype=incl, " +
- "constraint=[" +
- "{@type=korap:distance, measure=w, direction=plus, min=0, max=4}" +
+ "{@type=korap:sequence, @inOrder=true, " +
+ "@constraints=[" +
+ "{@type=korap:distance, @measure=w, @min=0, @max=4}" +
"], " +
- "operands=[" +
- "{@type=korap:group, relation=distance, match=operands, @subtype=incl, " +
- "constraint=[" +
- "{@type=korap:distance, measure=w, direction=plus, min=0, max=2}" +
+ "@operands=[" +
+ "{@type=korap:sequence, @inOrder=true, " +
+ "@constraints=[" +
+ "{@type=korap:distance, @measure=w, @min=0, @max=2}" +
"], " +
- "operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mond, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Sterne, relation==}}" +
+ "@operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Sterne, @attr=orth, @relation==}}" +
"]}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Sonne, relation==}}" +
+ "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}" +
"]" +
"}";
ppt = new CosmasTree(query);
@@ -289,11 +289,11 @@
public void testOPIN() throws QueryException {
query="wegen #IN <s>";
String opin1 =
- "{@type=korap:group, relation=shrink, shrink=1, operands=[" +
- "{@type=korap:group, relation=position, position=contains, operands=[" +
- "{@type=korap:element, @value=s}," +
- "{@type=korap:group, class=1, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:wegen, relation==}}" +
+ "{@type=korap:group, @relation=submatch, @classRef=1, @operands=[" +
+ "{@type=korap:group, @relation=position, @position=contains, @operands=[" +
+ "{@type=korap:span, @value=s}," +
+ "{@type=korap:group, class=1, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=wegen, @attr=orth, @relation==}}" +
"]}" +
"]}" +
"]}";
@@ -303,11 +303,11 @@
query="wegen #IN(L) <s>";
String opin2 =
- "{@type=korap:group, relation=shrink, shrink=1, operands=[" +
- "{@type=korap:group, relation=position, position=startswith, operands=[" +
- "{@type=korap:element, @value=s}," +
- "{@type=korap:group, class=1, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:wegen, relation==}}" +
+ "{@type=korap:group, @relation=submatch, @classRef=1, @operands=[" +
+ "{@type=korap:group, @relation=position, @position=startswith, @operands=[" +
+ "{@type=korap:span, @value=s}," +
+ "{@type=korap:group, class=1, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=wegen, @attr=orth, @relation==}}" +
"]}" +
"]}" +
"]}";
@@ -317,11 +317,11 @@
query="wegen #IN(%, L) <s>";
String opin3 =
- "{@type=korap:group, relation=shrink, shrink=1, operands=[" +
- "{@type=korap:group, relation=position, position=startswith, @subtype=excl, operands=[" +
- "{@type=korap:element, @value=s}," +
- "{@type=korap:group, class=1, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:wegen, relation==}}" +
+ "{@type=korap:group, @relation=submatch, @classRef=1, @operands=[" +
+ "{@type=korap:group, @relation=position, @position=startswith, @exclude=true, @operands=[" +
+ "{@type=korap:span, @value=s}," +
+ "{@type=korap:group, class=1, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=wegen, @attr=orth, @relation==}}" +
"]}" +
"]}" +
"]}";
@@ -331,11 +331,11 @@
query="wegen #IN('FE,ALL,%,MIN') <s>";
String opin4 =
- "{@type=korap:group, relation=shrink, shrink=1, operands=[" +
- "{@type=korap:group, relation=position, position=ident, range=all, @subtype=excl, grouping=false, operands=[" +
- "{@type=korap:element, @value=s}," +
- "{@type=korap:group, class=1, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:wegen, relation==}}" +
+ "{@type=korap:group, @relation=submatch, @classRef=1, @operands=[" +
+ "{@type=korap:group, @relation=position, @position=ident, range=all, @exclude=true, grouping=false, @operands=[" +
+ "{@type=korap:span, @value=s}," +
+ "{@type=korap:group, class=1, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=wegen, @attr=orth, @relation==}}" +
"]}" +
"]}" +
"]}";
@@ -348,11 +348,11 @@
public void testOPOV() throws QueryException {
query="wegen #OV <s>";
String opov1 =
- "{@type=korap:group, relation=shrink, shrink=1, operands=[" +
- "{@type=korap:group, relation=overlap, position=any, operands=[" +
- "{@type=korap:element, @value=s}," +
- "{@type=korap:group, class=1, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:wegen, relation==}}" +
+ "{@type=korap:group, @relation=submatch, @classRef=1, @operands=[" +
+ "{@type=korap:group, @relation=overlaps, @position=any, @operands=[" +
+ "{@type=korap:span, @value=s}," +
+ "{@type=korap:group, class=1, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=wegen, @attr=orth, @relation==}}" +
"]}" +
"]}" +
"]}";
@@ -362,11 +362,11 @@
query="wegen #OV(L) <s>";
String opov2 =
- "{@type=korap:group, relation=shrink, shrink=1, operands=[" +
- "{@type=korap:group, relation=overlap, position=startswith, operands=[" +
- "{@type=korap:element, @value=s}," +
- "{@type=korap:group, class=1, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:wegen, relation==}}" +
+ "{@type=korap:group, @relation=submatch, @classRef=1, @operands=[" +
+ "{@type=korap:group, @relation=overlaps, @position=startswith, @operands=[" +
+ "{@type=korap:span, @value=s}," +
+ "{@type=korap:group, class=1, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=wegen, @attr=orth, @relation==}}" +
"]}" +
"]}" +
"]}";
@@ -379,9 +379,9 @@
public void testOPNOT() throws QueryException {
query="Sonne nicht Mond";
String opnot1 =
- "{@type=korap:group, relation=not, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Sonne, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mond, relation==}}" +
+ "{@type=korap:group, @relation=not, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" +
"]}";
ppt = new CosmasTree(query);
map = ppt.getRequestMap().get("query").toString();
@@ -396,13 +396,13 @@
// http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/thematische-bsp/bsp-satzlaenge.html
query="#BEG(der /w3:5 Mann)";
String beg1 =
- "{@type=korap:group, relation=shrink, shrink=first, operands=[" +
- "{@type=korap:group, relation=distance, match=operands, @subtype=incl, constraint=[" +
- "{@type=korap:distance, measure=w, direction=both, min=3, max=5}" +
+ "{@type=korap:group, @relation=submatch, @spanRef=[0,1], @operands=[" +
+ "{@type=korap:sequence, @inOrder=false, @constraints=[" +
+ "{@type=korap:distance, @measure=w, @min=3, @max=5}" +
"]," +
- "operands = [" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:der, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mann, relation==}}" +
+ "@operands = [" +
+ "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}" +
"]}" +
"]}";
ppt = new CosmasTree(query);
@@ -411,19 +411,19 @@
query="#BEG(der /w3:5 Mann) /+w10 kommt"; // nesting #BEG() in a distance group
String beg2 =
- "{@type=korap:group, relation=distance, match=operands, @subtype=incl, constraint=[" +
- "{@type=korap:distance, measure=w, direction=plus, min=0, max=10}" +
- "], operands=[" +
- "{@type=korap:group, relation=shrink, shrink=first, operands=[" +
- "{@type=korap:group, relation=distance, match=operands, @subtype=incl, constraint=[" +
- "{@type=korap:distance, measure=w, direction=both, min=3, max=5}" +
+ "{@type=korap:sequence, @inOrder=true, @constraints=[" +
+ "{@type=korap:distance, @measure=w, @min=0, @max=10}" +
+ "], @operands=[" +
+ "{@type=korap:group, @relation=submatch, @spanRef=[0,1], @operands=[" +
+ "{@type=korap:sequence, @inOrder=false, @constraints=[" +
+ "{@type=korap:distance, @measure=w, @min=3, @max=5}" +
"]," +
- "operands = [" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:der, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mann, relation==}}" +
+ "@operands = [" +
+ "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}" +
"]}" +
"]}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:kommt, relation==}}" +
+ "{@type=korap:token, @value={@type=korap:term, @value=kommt, @attr=orth, @relation==}}" +
"]}";
ppt = new CosmasTree(query);
map = ppt.getRequestMap().get("query").toString();
@@ -431,13 +431,13 @@
query="#END(der /w3:5 Mann)";
String end1 =
- "{@type=korap:group, relation=shrink, shrink=last, operands=[" +
- "{@type=korap:group, relation=distance, match=operands, @subtype=incl, constraint=[" +
- "{@type=korap:distance, measure=w, direction=both, min=3, max=5}" +
- "]," +
- "operands = [" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:der, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mann, relation==}}" +
+ "{@type=korap:group, @relation=submatch, @spanRef=[-1,1], @operands=[" +
+ "{@type=korap:sequence, @inOrder=false, @constraints=[" +
+ "{@type=korap:distance, @measure=w, @min=3, @max=5}" +
+ "], " +
+ "@operands = [" +
+ "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}" +
"]}" +
"]}";
ppt = new CosmasTree(query);
@@ -450,7 +450,7 @@
public void testELEM() throws QueryException {
// http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/elem.html
query="#ELEM(S)";
- String elem1 = "{@type=korap:element, @value=s}";
+ String elem1 = "{@type=korap:span, @value=s}";
ppt = new CosmasTree(query);
map = ppt.getRequestMap().get("query").toString();
assertEquals(elem1.replaceAll(" ", ""), map.replaceAll(" ", ""));
@@ -460,13 +460,13 @@
public void testOPALL() throws QueryException {
query="#ALL(gehen /w1:10 voran)";
String all1 =
- "{@type=korap:group, relation=distance, match=all, @subtype=incl, " +
- "constraint=[" +
- "{@type=korap:distance, measure=w, direction=both, min=1, max=10}" +
+ "{@type=korap:sequence, @inOrder=false, " +
+ "@constraints=[" +
+ "{@type=korap:distance, @measure=w, @min=1, @max=10}" +
"], " +
- "operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:gehen, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:voran, relation==}}" +
+ "@operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=gehen, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=voran, @attr=orth, @relation==}}" +
"]" +
"}";
ppt = new CosmasTree(query);
@@ -478,13 +478,13 @@
public void testOPNHIT() throws QueryException {
query="#NHIT(gehen /w1:10 voran)";
String nhit1 =
- "{@type=korap:group, relation=distance, match=between, @subtype=incl, " +
- "constraint=[" +
- "{@type=korap:distance, measure=w, direction=both, min=1, max=10}" +
+ "{@type=korap:sequence, @inOrder=false, " +
+ "@constraints=[" +
+ "{@type=korap:distance, @measure=w, @min=1, @max=10}" +
"], " +
- "operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:gehen, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:voran, relation==}}" +
+ "@operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=gehen, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=voran, @attr=orth, @relation==}}" +
"]" +
"}";
ppt = new CosmasTree(query);
@@ -496,9 +496,9 @@
public void testOPBED() throws QueryException {
query = "#BED(der , sa)";
String bed1 =
- "{@type=korap:group, relation=position, position=startswith, operands=[" +
- "{@type=korap:element, @value=s}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:der, relation==}}" +
+ "{@type=korap:group, @relation=position, @position=startswith, @operands=[" +
+ "{@type=korap:span, @value=s}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}" +
"]}";
ppt = new CosmasTree(query);
map = ppt.getRequestMap().get("query").toString();
@@ -506,11 +506,11 @@
query = "#BED(der Mann , +pe)";
String bed2 =
- "{@type=korap:group, relation=position, position=endswith, operands=[" +
- "{@type=korap:element, @value=p}," +
- "{@type=korap:sequence, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:der, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mann, relation==}}" +
+ "{@type=korap:group, @relation=position, @position=endswith, @operands=[" +
+ "{@type=korap:span, @value=p}," +
+ "{@type=korap:sequence, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}" +
"]}" +
"]}";
ppt = new CosmasTree(query);
@@ -519,19 +519,19 @@
query = "#BED(der Mann , sa,-pa)";
String bed3 =
- "{@type=korap:group, relation=and, operands=[" +
- "{@type=korap:group, relation=position, position=startswith, operands=[" +
- "{@type=korap:element, @value=s}," +
- "{@type=korap:sequence, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:der, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mann, relation==}}" +
+ "{@type=korap:group, @relation=and, @operands=[" +
+ "{@type=korap:group, @relation=position, @position=startswith, @operands=[" +
+ "{@type=korap:span, @value=s}," +
+ "{@type=korap:sequence, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}" +
"]}" +
"]}," +
- "{@type=korap:group, relation=position, position=startswith, @subtype=excl, operands=[" +
- "{@type=korap:element, @value=p}," +
- "{@type=korap:sequence, operands=[" +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:der, relation==}}," +
- "{@type=korap:token, @value={@type=korap:term, @value=orth:Mann, relation==}}" +
+ "{@type=korap:group, @relation=position, @position=startswith, @exclude=true, @operands=[" +
+ "{@type=korap:span, @value=p}," +
+ "{@type=korap:sequence, @operands=[" +
+ "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," +
+ "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}" +
"]}" +
"]}" +
"]}";