positions using classRefCheck
cosmas MORPH
diff --git a/src/test/java/AqlTreeTest.java b/src/test/java/AqlTreeTest.java
index b3ad0fc..d10b07c 100644
--- a/src/test/java/AqlTreeTest.java
+++ b/src/test/java/AqlTreeTest.java
@@ -20,7 +20,7 @@
@Test
public void testContext() throws QueryException {
- String contextString = "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld";
+ String contextString = "http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld";
aqlt = new AqlTree("Test");
assertEquals(contextString.replaceAll(" ", ""), aqlt.getRequestMap().get("@context").toString().replaceAll(" ", ""));
}
@@ -194,7 +194,7 @@
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:relation, operands=[" +
"{@type=korap:span, layer=cat, key=CP, match=match:eq}," +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1024, classOut=1024, operands=[" +
"{@type=korap:span, layer=cat, key=VP, match=match:eq}" +
"]}" +
"], relation={@type=korap:relation, wrap={@type=korap:term, layer=c}}}" +
@@ -214,12 +214,12 @@
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:relation, operands=[" +
"{@type=korap:span, layer=cat, key=CP, match=match:eq}," +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1024, classOut=1024, operands=[" +
"{@type=korap:span, layer=cat, key=VP, match=match:eq}" +
"]}" +
"], relation={@type=korap:relation, wrap={@type=korap:term, layer=c}}}" +
"]}," +
- "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1025, classOut=1025, operands=[" +
"{@type=korap:span, layer=cat, key=NP, match=match:eq}" +
"]}" +
"], relation={@type=korap:relation, wrap={@type=korap:term, layer=c}}}" +
@@ -308,7 +308,7 @@
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Sonne, match=match:eq}}," +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1024, classOut=1024, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mond, match=match:eq}}" +
"]}" +
"], distances=[" +
@@ -330,7 +330,7 @@
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:span}," +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1024, classOut=1024, operands=[" +
"{@type=korap:span}" +
"]} "+
"], inOrder=true}" +
@@ -352,14 +352,14 @@
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Sonne, match=match:eq}}," +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1024, classOut=1024, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mond, match=match:eq}}" +
"]}" +
"], distances=[" +
"{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=0, max=2}, min=0, max=2}" +
"], inOrder=true}" +
"]}," +
- "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1025, classOut=1025, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Sterne, match=match:eq}}" +
"]}" +
"],distances=[" +
@@ -381,7 +381,7 @@
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:relation, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Sonne, match=match:eq}}," +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1024, classOut=1024, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mond, match=match:eq}}" +
"]}" +
"], relation={@type=korap:relation, wrap={@type=korap:term, layer=c}}}" +
@@ -401,7 +401,7 @@
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:relation, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Sonne, match=match:eq}}," +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1024, classOut=1024, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mond, match=match:eq}}" +
"]}" +
"], relation={@type=korap:relation, wrap={@type=korap:term, layer=c}}}" +
@@ -422,13 +422,13 @@
"{@type=korap:group, operation=operation:relation, operands=[" +
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:relation, operands=[" +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1024, classOut=1024, operands=[" +
"{@type=korap:span}" +
"]}," +
"{@type=korap:span, layer=cat, key=NP, match=match:eq}" +
"], relation={@type=korap:relation, wrap={@type=korap:term, layer=c}}}" +
"]}," +
- "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1025, classOut=1025, operands=[" +
"{@type=korap:span, layer=cat, key=VP, match=match:eq}" +
"]}" +
"], relation={@type=korap:relation, wrap={@type=korap:term, layer=c}}" +
@@ -449,10 +449,10 @@
String eq2 =
"{@type=korap:group, operation=operation:position, frames=[frame:startswith], sharedClasses=[sharedClasses:includes], operands=[" +
"{@type=korap:group, operation=operation:relation, operands=[" +
- "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=, classOut=1025, operands=[" +
"{@type=korap:span, layer=cat, key=NP, match=match:eq}" +
"]}," +
- "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=, classOut=1025, operands=[" +
"{@type=korap:span, layer=cat, key=VP, match=match:eq}" +
"]}" +
"], relation={@type=korap:relation, wrap={@type=korap:term, layer=c}}," +
@@ -530,7 +530,7 @@
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=pos, key=N, match=match:eq}}," +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1024, classOut=1024, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=pos, key=V, match=match:eq}}" +
"]}" +
"], inOrder=true}" +
@@ -548,7 +548,7 @@
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=pos, key=N, match=match:eq}}," +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1024, classOut=1024, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=pos, key=V, match=match:eq}}" +
"]}" +
"], inOrder=true}" +
@@ -564,7 +564,7 @@
"{@type=korap:group, operation=operation:relation, operands=[" +
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:relation, operands=[" +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1024, classOut=1024, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=pos, key=N, match=match:eq}}" +
"]}," +
"{@type=korap:token, wrap={@type=korap:term, layer=pos, key=V, match=match:eq}}" +
@@ -585,16 +585,16 @@
// dominance relation #1 > #2 is reduced to #1, for expressing #1 > #3
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:relation, operands=[" +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1024, classOut=1024, operands=[" +
"{@type=korap:span, layer=cat, key=NP, match=match:eq}" +
"]}," +
- "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1025, classOut=1025, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=pos, key=V, match=match:eq}}" +
"]}" +
"], relation={@type=korap:relation, wrap={@type=korap:term, layer=c}}}" +
"]}," +
// establish class 2 around P for later reference
- "{@type=korap:group, operation=operation:class, class=2, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1026, classOut=1026, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=pos, key=P, match=match:eq}}" +
"]}" +
"], relation={@type=korap:relation, wrap={@type=korap:term, layer=c}}}" +
@@ -649,7 +649,7 @@
"{@type=korap:group, operation=operation:relation, operands=[" +
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:relation, operands=[" +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1024, classOut=1024, operands=[" +
"{@type=korap:span}" +
"]}," +
"{@type=korap:span, layer=cat, key=NP, match=match:eq}" +
@@ -669,7 +669,7 @@
"{@type=korap:group, operation=operation:relation, operands=[" +
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:relation, operands=[" +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1024, classOut=1024, operands=[" +
"{@type=korap:span}" +
"]}," +
"{@type=korap:span, layer=cat, key=NP, match=match:eq}" +
@@ -695,7 +695,7 @@
"{@type=korap:group, operation=operation:relation, operands=[" +
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:relation, operands=[" +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1024, classOut=1024, operands=[" +
"{@type=korap:span}" +
"]}," +
"{@type=korap:span, layer=cat, key=NP, match=match:eq}" +
@@ -720,7 +720,7 @@
"{@type=korap:group, operation=operation:relation, operands=[" +
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:relation, operands=[" +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1024, classOut=1024, operands=[" +
"{@type=korap:span}" +
"]}," +
"{@type=korap:span, layer=cat, key=NP, match=match:eq}" +
diff --git a/src/test/java/CosmasTreeTest.java b/src/test/java/CosmasTreeTest.java
index e074ee8..2f8fe07 100644
--- a/src/test/java/CosmasTreeTest.java
+++ b/src/test/java/CosmasTreeTest.java
@@ -168,7 +168,7 @@
query="(Sonne oder Mond) und scheint";
String orand1 =
"{@type=korap:group, operation=operation:sequence, distances=[" +
- "{@type=korap:distance, key=t, min=0, max=0}" +
+ "{@type=cosmas:distance, key=t, min=0, max=0}" +
"], operands=[" +
"{@type=korap:group, operation=operation:or, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
@@ -183,7 +183,7 @@
query="scheint und (Sonne oder Mond)";
String orand2 =
"{@type=korap:group, operation=operation:sequence, distances=[" +
- "{@type=korap:distance, key=t, min=0, max=0}" +
+ "{@type=cosmas:distance, key=t, min=0, max=0}" +
"], operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}," +
"{@type=korap:group, operation=operation:or, operands=[" +
@@ -198,11 +198,11 @@
query="Regen und scheint und (Sonne oder Mond)";
String orand3 =
"{@type=korap:group, operation=operation:sequence, distances=[" +
- "{@type=korap:distance, key=t, min=0, max=0}" +
+ "{@type=cosmas:distance, key=t, min=0, max=0}" +
"], operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=Regen, layer=orth, match=match:eq}}," +
"{@type=korap:group, operation=operation:sequence, distances=[" +
- "{@type=korap:distance, key=t, min=0, max=0}" +
+ "{@type=cosmas:distance, key=t, min=0, max=0}" +
"], operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}," +
"{@type=korap:group, operation=operation:or, operands=[" +
@@ -253,8 +253,8 @@
"], inOrder=true, " +
"distances=[" +
"{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4}," +
- "{@type=korap:distance, key=s, boundary={@type=korap:boundary, min=0, max=0}, min=0, max=0}," +
- "{@type=korap:distance, key=p, boundary={@type=korap:boundary, min=1, max=3}, min=1, max=3}" +
+ "{@type=cosmas:distance, key=s, boundary={@type=korap:boundary, min=0, max=0}, min=0, max=0}," +
+ "{@type=cosmas:distance, key=p, boundary={@type=korap:boundary, min=1, max=3}, min=1, max=3}" +
"]" +
"}" +
"]}";
@@ -276,8 +276,8 @@
"], inOrder=true, " +
"distances=[" +
"{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4, exclude=true}," +
- "{@type=korap:distance, key=s, boundary={@type=korap:boundary, min=0, max=0}, min=0, max=0, exclude=true}," +
- "{@type=korap:distance, key=p, boundary={@type=korap:boundary, min=1, max=3}, min=1, max=3, exclude=true}" +
+ "{@type=cosmas:distance, key=s, boundary={@type=korap:boundary, min=0, max=0}, min=0, max=0, exclude=true}," +
+ "{@type=cosmas:distance, key=p, boundary={@type=korap:boundary, min=1, max=3}, min=1, max=3, exclude=true}" +
"]" +
"}" +
"]}";
@@ -801,7 +801,7 @@
query="Sonne nicht Mond";
String opnot1 =
"{@type=korap:group, operation=operation:sequence, distances=[" +
- "{@type=korap:distance, key=t, min=0, max=0, exclude=true}" +
+ "{@type=cosmas:distance, key=t, min=0, max=0, exclude=true}" +
"], operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
"{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
@@ -1175,23 +1175,6 @@
@Test
public void testOPNHIT() throws QueryException {
query="#NHIT(gehen /w1:10 voran)";
-// String nhit1 =
-// "{@type=korap:reference, operation=operation:focus, classRef=[1025], classRefOp=classRefOp:inversion, operands=[" +
-// "{@type=korap:group, operation=operation:sequence, " +
-// "operands=[" +
-// "{@type=korap:group, operation=operation:class, class= , classOut=1025, operands=[" +
-// "{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}" +
-// "]}," +
-// "{@type=korap:group, operation=operation:class, class= , classOut=1025, operands=[" +
-// "{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}" +
-// "]}" +
-// "], inOrder=false, " +
-// "distances=[" +
-// "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" +
-// "]" +
-// "}" +
-// "]}";
-//
String nhit1 =
"{@type=korap:reference, operation=operation:focus, classRef=[1025], operands=[" +
"{@type=korap:group, operation=operation:class, classRefOp=classRefOp:inversion, classIn=[1026,1027], classOut=1025, operands=[" +
@@ -1213,7 +1196,7 @@
ct = new CosmasTree(query);
map = ct.getRequestMap().get("query").toString();
assertEquals(nhit1.replaceAll(" ", ""), map.replaceAll(" ", ""));
-//
+
// query="#NHIT(gehen %w1:10 voran)";
// String nhit2 =
// "{@type=korap:reference, operation=operation:focus, classRef=1025, operands=[" +
diff --git a/src/test/java/PoliqarpPlusTreeTest.java b/src/test/java/PoliqarpPlusTreeTest.java
index 53145d8..3a79aaa 100644
--- a/src/test/java/PoliqarpPlusTreeTest.java
+++ b/src/test/java/PoliqarpPlusTreeTest.java
@@ -10,6 +10,8 @@
PoliqarpPlusTree ppt;
String map;
String expected;
+ String metaExpected;
+ String metaMap;
String query;
private boolean equalsQueryContent(String res, String query) throws QueryException {
@@ -21,14 +23,13 @@
@Test
public void testContext() throws QueryException {
- String contextString = "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld";
+ String contextString = "http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld";
ppt = new PoliqarpPlusTree("Test");
assertEquals(contextString.replaceAll(" ", ""), ppt.getRequestMap().get("@context").toString().replaceAll(" ", ""));
}
@Test
public void testSingleTokens() throws QueryException {
- String query;
// [base=Mann]
String token1 = "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}";
assertTrue(equalsQueryContent(token1, "[base=Mann]"));
@@ -60,8 +61,6 @@
@Test
public void testValue() throws QueryException {
- String query;
-
query = "[mate/m=temp:pres]";
String value1 = "{@type=korap:token, wrap={@type=korap:term, foundry=mate, layer=m, key=temp, value=pres, match=match:eq}}";
ppt = new PoliqarpPlusTree(query);
@@ -71,7 +70,7 @@
@Test
public void testRegex() throws QueryException {
- String query = "[orth=\"M(a|ä)nn(er)?\"]";
+ query = "[orth=\"M(a|ä)nn(er)?\"]";
String re1 = "{@type=korap:token, wrap={@type=korap:term, layer=orth, type=type:regex, key=M(a|ä)nn(er)?, match=match:eq}}";
ppt = new PoliqarpPlusTree(query);
map = ppt.getRequestMap().get("query").toString();
@@ -110,7 +109,7 @@
@Test
public void testCaseSensitivityFlag() throws QueryException {
- String query="[orth=deutscher/i]";
+ query="[orth=deutscher/i]";
String cs1 =
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=deutscher, match=match:eq, caseInsensitive=true}}";
ppt = new PoliqarpPlusTree(query);
@@ -386,7 +385,7 @@
"{@type=korap:group, operation=operation:sequence, " +
"operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," +
- "{@type=korap:group, operation=operation:position, frames=[],sharedClasses=[sharedClasses:includes], operands=[" +
+ "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" +
"{@type=korap:span, key=s}," +
"{@type=korap:span, key=np}" +
"], frame=frame:contains}" +
@@ -405,7 +404,7 @@
expected =
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," +
- "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" +
"{@type=korap:token}" +
"]}," +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" +
@@ -417,7 +416,7 @@
query = "{1:[]}[base=der][base=Mann]";
expected =
"{@type=korap:group, operation=operation:sequence, operands=[" +
- "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" +
"{@type=korap:token}" +
"]}," +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," +
@@ -432,7 +431,7 @@
public void testLeadingTrailingEmptyTokens() throws QueryException {
// startswith(<s>, [][base=Mann]
String et1 =
- "{@type=korap:group, operation=operation:position, frames=[frame:startswith],sharedClasses=[sharedClasses:includes], operands=[" +
+ "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" +
"{@type=korap:span, key=s}," +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token}," +
@@ -498,7 +497,7 @@
"{@type=korap:group, operation=operation:repetition, operands=[" +
"{@type=korap:token}" +
"], boundary={@type=korap:boundary, min=1}, min=1}," +
- "{@type=korap:group, operation=operation:position, frames=[],sharedClasses=[sharedClasses:includes], operands=[" +
+ "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" +
"{@type=korap:span, key=s}," +
"{@type=korap:span, key=np}" +
"], frame=frame:contains}," +
@@ -874,7 +873,7 @@
public void testClasses() throws QueryException {
String query;
// {[base=Mann]}
- String cls1 = "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ String cls1 = "{@type=korap:group, operation=operation:class, class=0, classOut=0, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" +
"]}";
ppt = new PoliqarpPlusTree("{[base=Mann]}");
@@ -883,7 +882,7 @@
// {[base=Mann][orth=Frau]}
query = "{[base=Mann][orth=Frau]}";
- String cls2 = "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ String cls2 = "{@type=korap:group, operation=operation:class, class=0, classOut=0, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}," +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Frau, match=match:eq}}" +
@@ -896,7 +895,7 @@
// [p=NN]{[base=Mann][orth=Frau]}
String cls3 = "{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=p, key=NN, match=match:eq}}," +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=0, classOut=0, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}," +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Frau, match=match:eq}}" +
@@ -909,7 +908,7 @@
// {[base=Mann][orth=Frau]}[p=NN]
String cls4 = "{@type=korap:group, operation=operation:sequence, operands=[" +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=0, classOut=0, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}," +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Frau, match=match:eq}}" +
@@ -922,9 +921,9 @@
assertEquals(cls4.replaceAll(" ", ""), map.replaceAll(" ", ""));
// {2:{1:[tt/p=ADJA]}[mate/p=NN]}"
- String cls5 = "{@type=korap:group, operation=operation:class, class=2, operands=[" +
+ String cls5 = "{@type=korap:group, operation=operation:class, class=2, classOut=2, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
- "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, foundry=tt, layer=p, key=ADJA, match=match:eq}}" +
"]}," +
"{@type=korap:token, wrap={@type=korap:term, foundry=mate, layer=p, key=NN, match=match:eq}}" +
@@ -938,21 +937,21 @@
@Test
public void testPositions() throws QueryException {
// contains(<s>,<np>)
- String pos1 = "{@type=korap:group, operation=operation:position, frames=[],sharedClasses=[sharedClasses:includes], operands=[" +
+ String pos1 = "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" +
"{@type=korap:span, key=s}," +
"{@type=korap:span, key=np}" +
"], frame=frame:contains}";
assertTrue(equalsQueryContent(pos1, "contains(<s>,<np>)"));
// contains(<s>,[base=Mann])
- String pos2 = "{@type=korap:group, operation=operation:position, frames=[],sharedClasses=[sharedClasses:includes], operands=[" +
+ String pos2 = "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" +
"{@type=korap:span, key=s}," +
"{@type=korap:token, wrap= {@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" +
"], frame=frame:contains}";
assertTrue(equalsQueryContent(pos2, "contains(<s>,[base=Mann])"));
// contains(<s>,[orth=der][orth=Mann])
- String pos3 = "{@type=korap:group, operation=operation:position, frames=[],sharedClasses=[sharedClasses:includes], operands=[" +
+ String pos3 = "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" +
"{@type=korap:span, key=s}," +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=der, match=match:eq}}," +
@@ -967,7 +966,7 @@
String pos4 =
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Auto, match=match:eq}}," +
- "{@type=korap:group, operation=operation:position, frames=[],sharedClasses=[sharedClasses:includes], operands=[" +
+ "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" +
"{@type=korap:span, key=s}," +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" +
"], frame=frame:contains}" +
@@ -978,7 +977,7 @@
// contains(<s>,[pos=N]*)
String pos5 =
- "{@type=korap:group, operation=operation:position, frames=[],sharedClasses=[sharedClasses:includes], operands=[" +
+ "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" +
"{@type=korap:span, key=s}," +
"{@type=korap:group, operation=operation:repetition, " +
"operands=[{@type=korap:token, wrap={@type=korap:term, layer=pos, key=N, match=match:eq}}" +
@@ -993,7 +992,7 @@
String pos6 =
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Auto, match=match:eq}}," +
- "{@type=korap:group, operation=operation:position, frames=[],sharedClasses=[sharedClasses:includes], operands=[" +
+ "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" +
"{@type=korap:span, key=s}," +
"{@type=korap:group, operation=operation:repetition, " +
"operands=[{@type=korap:token, wrap={@type=korap:term, layer=pos, key=N, match=match:eq}}" +
@@ -1010,9 +1009,9 @@
public void testNestedPositions() throws QueryException {
// contains(<s>,startswith(<np>,[orth=Der]))
String npos1 =
- "{@type=korap:group, operation=operation:position, frames=[],sharedClasses=[sharedClasses:includes], operands=[" +
+ "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" +
"{@type=korap:span, key=s}," +
- "{@type=korap:group, operation=operation:position, frames=[frame:startswith],sharedClasses=[sharedClasses:includes], operands=[" +
+ "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" +
"{@type=korap:span, key=np}," +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Der, match=match:eq}}" +
"], frame=frame:startswith}" +
@@ -1029,7 +1028,7 @@
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Der, match=match:eq}}," +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=0, classOut=0, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mann, match=match:eq}}" +
"]}" +
"]}" +
@@ -1043,7 +1042,7 @@
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Der, match=match:eq}}," +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=0, classOut=0, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mann, match=match:eq}}," +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=geht, match=match:eq}}" +
@@ -1060,7 +1059,7 @@
"{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Der, match=match:eq}}," +
- "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mann, match=match:eq}}," +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=geht, match=match:eq}}" +
@@ -1075,9 +1074,9 @@
// focus(1:startswith(<s>,{1:<np>}))
String shr4 =
"{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" +
- "{@type=korap:group, operation=operation:position, frames=[frame:startswith],sharedClasses=[sharedClasses:includes], operands=[" +
+ "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" +
"{@type=korap:span, key=s}," +
- "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" +
"{@type=korap:span, key=np}" +
"]}" +
"], frame=frame:startswith}" +
@@ -1089,15 +1088,15 @@
// focus(3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}}))
String shr5 =
"{@type=korap:reference, operation=operation:focus, classRef=[3], operands=[" +
- "{@type=korap:group, operation=operation:position, frames=[frame:startswith],sharedClasses=[sharedClasses:includes], operands=[" +
+ "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" +
"{@type=korap:span, key=s}," +
- "{@type=korap:group, operation=operation:class, class=3, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=3, classOut=3, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," +
- "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, foundry=mate, layer=p, key=ADJA, match=match:eq}}," +
- "{@type=korap:group, operation=operation:class, class=2, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=2, classOut=2, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, foundry=tt, layer=p, key=NN, match=match:eq}}" +
"]}" +
"]}" +
@@ -1113,15 +1112,15 @@
// split(3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}}))
String shr6 =
"{@type=korap:reference, operation=operation:split, classRef=[3], operands=[" +
- "{@type=korap:group, operation=operation:position, frames=[frame:startswith],sharedClasses=[sharedClasses:includes], operands=[" +
+ "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" +
"{@type=korap:span, key=s}," +
- "{@type=korap:group, operation=operation:class, class=3, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=3, classOut=3, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," +
- "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, foundry=mate, layer=p, key=ADJA, match=match:eq}}," +
- "{@type=korap:group, operation=operation:class, class=2, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=2, classOut=2, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, foundry=tt, layer=p, key=NN, match=match:eq}}" +
"]}" +
"]}" +
@@ -1137,15 +1136,15 @@
// split(2|3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}}))
String shr7 =
"{@type=korap:reference, operation=operation:split, classRef=[2, 3], classRefOp=classRefOp:intersection, operands=[" +
- "{@type=korap:group, operation=operation:position, frames=[frame:startswith],sharedClasses=[sharedClasses:includes], operands=[" +
+ "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" +
"{@type=korap:span, key=s}," +
- "{@type=korap:group, operation=operation:class, class=3, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=3, classOut=3, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," +
- "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, foundry=mate, layer=p, key=ADJA, match=match:eq}}," +
- "{@type=korap:group, operation=operation:class, class=2, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=2, classOut=2, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, foundry=tt, layer=p, key=NN, match=match:eq}}" +
"]}" +
"]}" +
@@ -1162,10 +1161,10 @@
String shr8 =
"{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
- "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=0, classOut=0, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}" +
"]}," +
- "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=pos, key=ADJA, match=match:eq}}" +
"]}" +
"]}" +
@@ -1201,7 +1200,7 @@
query = "submatch(1,4:contains(<s>,[base=Haus]))";
expected =
"{@type=korap:reference, operation=operation:focus, operands=[" +
- "{@type=korap:group, operation=operation:position, frames=[],sharedClasses=[sharedClasses:includes], operands=[" +
+ "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" +
"{@type=korap:span, key=s}," +
"{@type=korap:token, wrap= {@type=korap:term, layer=lemma, key=Haus, match=match:eq}}" +
"], frame=frame:contains}" +
@@ -1308,85 +1307,106 @@
@Test
public void testAlign() throws QueryException {
// [orth=der]^[orth=Mann]
- String align1 =
+ query = "[orth=der]^[orth=Mann]";
+ expected =
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=der, match=match:eq}}," +
- "{@type=korap:group, operation=operation:alignment, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1025, classOut=1025, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mann, match=match:eq}}" +
- "], align=align:left}" +
+ "]}" +
"]}";
- ppt = new PoliqarpPlusTree("[orth=der]^[orth=Mann]");
+ metaExpected =
+ "{alignment=1025}";
+ ppt = new PoliqarpPlusTree(query);
map = ppt.getRequestMap().get("query").toString();
- assertEquals(align1.replaceAll(" ", ""), map.replaceAll(" ", ""));
+ metaMap = ppt.getRequestMap().get("meta").toString();
+ assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", ""));
+ assertEquals(metaExpected.replaceAll(" ", ""), metaMap.replaceAll(" ", ""));
// [orth=der]^[orth=große][orth=Mann]
- String query = "[orth=der]^[orth=große][orth=Mann]";
- String align1b =
+ query = "[orth=der]^[orth=große][orth=Mann]";
+ String expected =
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=der, match=match:eq}}," +
- "{@type=korap:group, operation=operation:alignment, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1025, classOut=1025, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=große, match=match:eq}}," +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mann, match=match:eq}}" +
"]}" +
- "], align=align:left}" +
+ "]}" +
"]}";
+ metaExpected =
+ "{alignment=1025}";
ppt = new PoliqarpPlusTree(query);
map = ppt.getRequestMap().get("query").toString();
- assertEquals(align1b.replaceAll(" ", ""), map.replaceAll(" ", ""));
+ metaMap = ppt.getRequestMap().get("meta").toString();
+ assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", ""));
+ assertEquals(metaExpected.replaceAll(" ", ""), metaMap.replaceAll(" ", ""));
- // "([base=a]^[base=b])|[base=c]",
- String align2 =
+ query = "([base=a]^[base=b])|[base=c]";
+ expected =
"{@type=korap:group, operation=operation:or, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=a, match=match:eq}}," +
- "{@type=korap:group, operation=operation:alignment, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1025, classOut=1025, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=b, match=match:eq}}" +
- "], align=align:left}" +
+ "]}" +
"]}," +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=c, match=match:eq}}" +
"]}";
- ppt = new PoliqarpPlusTree("([base=a]^[base=b])|[base=c]");
+ metaExpected =
+ "{alignment=1025}";
+ ppt = new PoliqarpPlusTree(query);
map = ppt.getRequestMap().get("query").toString();
- assertEquals(align2.replaceAll(" ", ""), map.replaceAll(" ", ""));
+ metaMap = ppt.getRequestMap().get("meta").toString();
+ assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", ""));
+ assertEquals(metaExpected.replaceAll(" ", ""), metaMap.replaceAll(" ", ""));
- // "([base=a]^[base=b][base=c])|[base=d]",
- String align3 =
+ query = "([base=a]^[base=b][base=c])|[base=d]";
+ expected =
"{@type=korap:group, operation=operation:or, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=a, match=match:eq}}," +
- "{@type=korap:group, operation=operation:alignment, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1025, classOut=1025, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=b, match=match:eq}}," +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=c, match=match:eq}}" +
"]}" +
- "], align=align:left}" +
+ "]}" +
"]}," +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=d, match=match:eq}}" +
"]}";
- ppt = new PoliqarpPlusTree("([base=a]^[base=b][base=c])|[base=d]");
+ metaExpected =
+ "{alignment=1025}";
+ ppt = new PoliqarpPlusTree(query);
map = ppt.getRequestMap().get("query").toString();
- assertEquals(align3.replaceAll(" ", ""), map.replaceAll(" ", ""));
+ metaMap = ppt.getRequestMap().get("meta").toString();
+ assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", ""));
+ assertEquals(metaExpected.replaceAll(" ", ""), metaMap.replaceAll(" ", ""));
- // "([base=a]^[base=b]^[base=c])|[base=d]",
- String align4 =
+ query = "([base=a]^[base=b]^[base=c])|[base=d]";
+ expected =
"{@type=korap:group, operation=operation:or, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=a, match=match:eq}}," +
- "{@type=korap:group, operation=operation:alignment, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1025, classOut=1025, operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=b, match=match:eq}}," +
- "{@type=korap:group, operation=operation:alignment, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1026, classOut=1026, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=c, match=match:eq}}" +
- "], align=align:left}" +
+ "]}" +
"]}" +
- "], align=align:left}" +
+ "]}" +
"]}," +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=d, match=match:eq}}" +
"]}";
- ppt = new PoliqarpPlusTree("([base=a]^[base=b]^[base=c])|[base=d]");
+ metaExpected =
+ "{alignment=[1025,1026]}";
+ ppt = new PoliqarpPlusTree(query);
map = ppt.getRequestMap().get("query").toString();
- assertEquals(align4.replaceAll(" ", ""), map.replaceAll(" ", ""));
+ metaMap = ppt.getRequestMap().get("meta").toString();
+ assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", ""));
+ assertEquals(metaExpected.replaceAll(" ", ""), metaMap.replaceAll(" ", ""));
}