Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1 | import static org.junit.Assert.*; |
| 2 | |
| 3 | import org.junit.Test; |
| 4 | |
| 5 | import de.ids_mannheim.korap.query.serialize.PoliqarpPlusTree; |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 6 | import de.ids_mannheim.korap.util.QueryException; |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 7 | |
| 8 | public class PoliqarpPlusTreeTest { |
| 9 | |
| 10 | PoliqarpPlusTree ppt; |
| 11 | String map; |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 12 | String expected; |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 13 | String metaExpected; |
| 14 | String metaMap; |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 15 | String query; |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 16 | |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 17 | private boolean equalsQueryContent(String res, String query) throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 18 | res = res.replaceAll(" ", ""); |
| 19 | ppt = new PoliqarpPlusTree(query); |
| 20 | String queryMap = ppt.getRequestMap().get("query").toString().replaceAll(" ", ""); |
| 21 | return res.equals(queryMap); |
| 22 | } |
| 23 | |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 24 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 25 | public void testContext() throws QueryException { |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 26 | String contextString = "http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 27 | ppt = new PoliqarpPlusTree("Test"); |
| 28 | assertEquals(contextString.replaceAll(" ", ""), ppt.getRequestMap().get("@context").toString().replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 32 | public void testSingleTokens() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 33 | // [base=Mann] |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 34 | String token1 = "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}"; |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 35 | assertTrue(equalsQueryContent(token1, "[base=Mann]")); |
| 36 | |
| 37 | // [orth!=Frau] |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 38 | String token2 = "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Frau, match=match:ne}}"; |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 39 | assertTrue(equalsQueryContent(token2, "[orth!=Frau]")); |
| 40 | |
| 41 | // [!p=NN] |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 42 | query = "[!p=NN]"; |
| 43 | String token3 = "{@type=korap:token, wrap={@type=korap:term, layer=p, key=NN, match=match:ne}}"; |
| 44 | ppt = new PoliqarpPlusTree(query); |
| 45 | map = ppt.getRequestMap().get("query").toString(); |
| 46 | assertEquals(token3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 47 | |
| 48 | // [!p!=NN] |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 49 | query = "[!p!=NN]"; |
| 50 | String token4 = "{@type=korap:token, wrap={@type=korap:term, layer=p, key=NN, match=match:eq}}"; |
| 51 | ppt = new PoliqarpPlusTree(query); |
| 52 | map = ppt.getRequestMap().get("query").toString(); |
| 53 | assertEquals(token4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 54 | |
Joachim Bingel | d1a3e71 | 2014-07-16 08:02:05 +0000 | [diff] [blame] | 55 | query = "[base=schland/x]"; |
Joachim Bingel | a83f8cc | 2014-08-05 14:12:59 +0000 | [diff] [blame] | 56 | String token5 = "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=.*?schland.*?, match=match:eq, type=type:regex}}"; |
Joachim Bingel | d1a3e71 | 2014-07-16 08:02:05 +0000 | [diff] [blame] | 57 | ppt = new PoliqarpPlusTree(query); |
| 58 | map = ppt.getRequestMap().get("query").toString(); |
| 59 | assertEquals(token5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 60 | } |
| 61 | |
| 62 | @Test |
| 63 | public void testValue() throws QueryException { |
Joachim Bingel | d1a3e71 | 2014-07-16 08:02:05 +0000 | [diff] [blame] | 64 | query = "[mate/m=temp:pres]"; |
| 65 | String value1 = "{@type=korap:token, wrap={@type=korap:term, foundry=mate, layer=m, key=temp, value=pres, match=match:eq}}"; |
| 66 | ppt = new PoliqarpPlusTree(query); |
| 67 | map = ppt.getRequestMap().get("query").toString(); |
| 68 | assertEquals(value1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | @Test |
Joachim Bingel | 41e112e | 2014-02-12 10:46:18 +0000 | [diff] [blame] | 72 | public void testRegex() throws QueryException { |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 73 | query = "[orth=\"M(a|ä)nn(er)?\"]"; |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 74 | String re1 = "{@type=korap:token, wrap={@type=korap:term, layer=orth, type=type:regex, key=M(a|ä)nn(er)?, match=match:eq}}"; |
Joachim Bingel | 41e112e | 2014-02-12 10:46:18 +0000 | [diff] [blame] | 75 | ppt = new PoliqarpPlusTree(query); |
| 76 | map = ppt.getRequestMap().get("query").toString(); |
| 77 | assertEquals(re1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 78 | |
| 79 | query = "[orth=\"M(a|ä)nn(er)?\"/x]"; |
| 80 | String re2 = "{@type=korap:token, wrap={@type=korap:term, layer=orth, type=type:regex, key=.*?M(a|ä)nn(er)?.*?, match=match:eq}}"; |
| 81 | ppt = new PoliqarpPlusTree(query); |
| 82 | map = ppt.getRequestMap().get("query").toString(); |
| 83 | assertEquals(re2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 84 | |
| 85 | query = "\"M(a|ä)nn(er)?\"/x"; |
| 86 | String re3 = "{@type=korap:token, wrap={@type=korap:term, type=type:regex, layer=orth, key=.*?M(a|ä)nn(er)?.*?, match=match:eq}}"; |
| 87 | ppt = new PoliqarpPlusTree(query); |
| 88 | map = ppt.getRequestMap().get("query").toString(); |
| 89 | assertEquals(re3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d1a3e71 | 2014-07-16 08:02:05 +0000 | [diff] [blame] | 90 | |
| 91 | query = "schland/x"; |
Joachim Bingel | a83f8cc | 2014-08-05 14:12:59 +0000 | [diff] [blame] | 92 | String re4 = "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=.*?schland.*?, match=match:eq, type=type:regex}}"; |
Joachim Bingel | d1a3e71 | 2014-07-16 08:02:05 +0000 | [diff] [blame] | 93 | ppt = new PoliqarpPlusTree(query); |
| 94 | map = ppt.getRequestMap().get("query").toString(); |
| 95 | assertEquals(re4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 96 | |
| 97 | query = "\".*?Mann.*?\""; |
| 98 | String re5 = "{@type=korap:token, wrap={@type=korap:term, type=type:regex, layer=orth, key=.*?Mann.*?, match=match:eq}}"; |
| 99 | ppt = new PoliqarpPlusTree(query); |
| 100 | map = ppt.getRequestMap().get("query").toString(); |
| 101 | assertEquals(re5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | a83f8cc | 2014-08-05 14:12:59 +0000 | [diff] [blame] | 102 | |
| 103 | query = "z.B./x"; |
| 104 | String re6 = "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=.*?z\\.B\\..*?, match=match:eq, type=type:regex}}"; |
| 105 | ppt = new PoliqarpPlusTree(query); |
| 106 | map = ppt.getRequestMap().get("query").toString(); |
| 107 | assertEquals(re6.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 41e112e | 2014-02-12 10:46:18 +0000 | [diff] [blame] | 108 | } |
| 109 | |
| 110 | @Test |
Joachim Bingel | 0207d5e | 2014-02-12 14:18:41 +0000 | [diff] [blame] | 111 | public void testCaseSensitivityFlag() throws QueryException { |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 112 | query="[orth=deutscher/i]"; |
Joachim Bingel | 0207d5e | 2014-02-12 14:18:41 +0000 | [diff] [blame] | 113 | String cs1 = |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 114 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=deutscher, match=match:eq, caseInsensitive=true}}"; |
Joachim Bingel | 0207d5e | 2014-02-12 14:18:41 +0000 | [diff] [blame] | 115 | ppt = new PoliqarpPlusTree(query); |
| 116 | map = ppt.getRequestMap().get("query").toString(); |
| 117 | assertEquals(cs1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 118 | |
| 119 | query="[orth=deutscher/i][orth=Bundestag]"; |
| 120 | String cs2 = |
| 121 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 122 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=deutscher, match=match:eq, caseInsensitive=true}}," + |
| 123 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Bundestag, match=match:eq}}" + |
Joachim Bingel | 0207d5e | 2014-02-12 14:18:41 +0000 | [diff] [blame] | 124 | "]}"; |
| 125 | ppt = new PoliqarpPlusTree(query); |
| 126 | map = ppt.getRequestMap().get("query").toString(); |
| 127 | assertEquals(cs2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | add0fb1 | 2014-06-24 08:54:14 +0000 | [diff] [blame] | 128 | |
| 129 | query="deutscher/i"; |
| 130 | String cs3 = |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 131 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=deutscher, match=match:eq, caseInsensitive=true}}"; |
Joachim Bingel | add0fb1 | 2014-06-24 08:54:14 +0000 | [diff] [blame] | 132 | ppt = new PoliqarpPlusTree(query); |
| 133 | map = ppt.getRequestMap().get("query").toString(); |
| 134 | assertEquals(cs3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 135 | |
| 136 | query="deutscher/i Bundestag"; |
| 137 | String cs4 = |
| 138 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 139 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=deutscher, match=match:eq, caseInsensitive=true}}," + |
| 140 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Bundestag, match=match:eq}}" + |
Joachim Bingel | add0fb1 | 2014-06-24 08:54:14 +0000 | [diff] [blame] | 141 | "]}"; |
| 142 | ppt = new PoliqarpPlusTree(query); |
| 143 | map = ppt.getRequestMap().get("query").toString(); |
| 144 | assertEquals(cs4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | f8dfcf8 | 2014-06-25 09:57:44 +0000 | [diff] [blame] | 145 | |
| 146 | query="deutscher Bundestag/i"; |
| 147 | String cs5 = |
| 148 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 149 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=deutscher, match=match:eq}}," + |
| 150 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Bundestag, match=match:eq, caseInsensitive=true}}" + |
Joachim Bingel | f8dfcf8 | 2014-06-25 09:57:44 +0000 | [diff] [blame] | 151 | "]}"; |
| 152 | ppt = new PoliqarpPlusTree(query); |
| 153 | map = ppt.getRequestMap().get("query").toString(); |
| 154 | assertEquals(cs5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 0207d5e | 2014-02-12 14:18:41 +0000 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | @Test |
Joachim Bingel | 3a41a44 | 2014-07-22 12:16:16 +0000 | [diff] [blame] | 158 | public void testSpans() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 159 | // <s> |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 160 | String elem1 = "{@type=korap:span, key=s}"; |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 161 | assertTrue(equalsQueryContent(elem1, "<s>")); |
| 162 | |
| 163 | // <vp> |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 164 | String elem2 = "{@type=korap:span, key=vp}"; |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 165 | assertTrue(equalsQueryContent(elem2, "<vp>")); |
Joachim Bingel | fc1fb35 | 2014-02-26 14:40:27 +0000 | [diff] [blame] | 166 | |
| 167 | // <cnx/c=vp> |
| 168 | query = "<c=vp>"; |
| 169 | String span3 = "{@type=korap:span, layer=c, key=vp}"; |
| 170 | ppt = new PoliqarpPlusTree(query); |
| 171 | map = ppt.getRequestMap().get("query").toString(); |
| 172 | assertEquals(span3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 173 | |
| 174 | // <cnx/c=vp> |
| 175 | query = "<cnx/c=vp>"; |
| 176 | String span4 = "{@type=korap:span, foundry=cnx, layer=c, key=vp}"; |
| 177 | ppt = new PoliqarpPlusTree(query); |
| 178 | map = ppt.getRequestMap().get("query").toString(); |
| 179 | assertEquals(span4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 3a41a44 | 2014-07-22 12:16:16 +0000 | [diff] [blame] | 180 | |
| 181 | // span negation |
| 182 | query = "<cnx/c!=vp>"; |
| 183 | expected = "{@type=korap:span, foundry=cnx, layer=c, key=vp, match=match:ne}"; |
| 184 | ppt = new PoliqarpPlusTree(query); |
| 185 | map = ppt.getRequestMap().get("query").toString(); |
| 186 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 187 | |
| 188 | // span negation |
| 189 | query = "<cnx/c!=vp>"; |
| 190 | expected = "{@type=korap:span, foundry=cnx, layer=c, key=vp, match=match:ne}"; |
| 191 | ppt = new PoliqarpPlusTree(query); |
| 192 | map = ppt.getRequestMap().get("query").toString(); |
| 193 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 194 | |
| 195 | query = "<cnx/c=vp class!=header>"; |
| 196 | expected = "{@type=korap:span, foundry=cnx, layer=c, key=vp, attr={@type=korap:term, key=class, value=header, match=match:ne}}"; |
| 197 | ppt = new PoliqarpPlusTree(query); |
| 198 | map = ppt.getRequestMap().get("query").toString(); |
| 199 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 200 | |
| 201 | query = "<cnx/c=vp !(class=header&id=7)>"; |
| 202 | expected = |
| 203 | "{@type=korap:span, foundry=cnx, layer=c, key=vp, attr=" + |
| 204 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
| 205 | "{@type=korap:term, key=class, value=header, match=match:ne}," + |
| 206 | "{@type=korap:term, key=id, value=7, match=match:ne}" + |
| 207 | "]}" + |
| 208 | "}"; |
| 209 | ppt = new PoliqarpPlusTree(query); |
| 210 | map = ppt.getRequestMap().get("query").toString(); |
| 211 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 212 | |
| 213 | query = "<cnx/c!=vp (class=header&id=7)>"; |
| 214 | expected = |
| 215 | "{@type=korap:span, foundry=cnx, layer=c, key=vp, match=match:ne, attr=" + |
| 216 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
| 217 | "{@type=korap:term, key=class, value=header, match=match:eq}," + |
| 218 | "{@type=korap:term, key=id, value=7, match=match:eq}" + |
| 219 | "]}" + |
| 220 | "}"; |
| 221 | ppt = new PoliqarpPlusTree(query); |
| 222 | map = ppt.getRequestMap().get("query").toString(); |
| 223 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 224 | |
| 225 | query = "<cnx/c=vp !!class=header>"; |
| 226 | expected = "{@type=korap:span, foundry=cnx, layer=c, key=vp, attr={@type=korap:term, key=class, value=header, match=match:eq}}"; |
| 227 | ppt = new PoliqarpPlusTree(query); |
| 228 | map = ppt.getRequestMap().get("query").toString(); |
| 229 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | a0ef08f | 2014-07-24 08:27:57 +0000 | [diff] [blame] | 230 | |
| 231 | query = "<cnx/c!=vp (foundry/class=header&id=7)>"; |
| 232 | expected = |
| 233 | "{@type=korap:span, foundry=cnx, layer=c, key=vp, match=match:ne, attr=" + |
| 234 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
| 235 | "{@type=korap:term, foundry=foundry, key=class, value=header, match=match:eq}," + |
| 236 | "{@type=korap:term, key=id, value=7, match=match:eq}" + |
| 237 | "]}" + |
| 238 | "}"; |
| 239 | ppt = new PoliqarpPlusTree(query); |
| 240 | map = ppt.getRequestMap().get("query").toString(); |
| 241 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 242 | } |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 243 | |
| 244 | @Test |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 245 | public void testDistances() throws QueryException { |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 246 | // [base=der][][base=Mann] |
| 247 | String et1 = |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 248 | "{@type=korap:group, operation=operation:sequence, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 249 | "operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 250 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," + |
| 251 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" + |
| 252 | "], inOrder=true, distances=[" + |
Joachim Bingel | 5a146cd | 2014-07-24 14:44:57 +0000 | [diff] [blame] | 253 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=2, max=2}, min=2, max=2}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 254 | "]}"; |
| 255 | ppt = new PoliqarpPlusTree("[base=der][][base=Mann]"); |
| 256 | map = ppt.getRequestMap().get("query").toString(); |
| 257 | assertEquals(et1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 258 | |
| 259 | // [base=der][][][base=Mann] |
| 260 | String et2 = |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 261 | "{@type=korap:group, operation=operation:sequence, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 262 | "operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 263 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," + |
| 264 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" + |
| 265 | "], inOrder=true, distances=[" + |
Joachim Bingel | 5a146cd | 2014-07-24 14:44:57 +0000 | [diff] [blame] | 266 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=3, max=3}, min=3, max=3}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 267 | "]}"; |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 268 | ppt = new PoliqarpPlusTree("[base=der][][][base=Mann]"); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 269 | map = ppt.getRequestMap().get("query").toString(); |
| 270 | assertEquals(et2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 271 | |
| 272 | // [base=der][][]?[base=Mann] |
| 273 | String et3 = |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 274 | "{@type=korap:group, operation=operation:sequence, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 275 | "operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 276 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," + |
| 277 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" + |
| 278 | "], inOrder=true, distances=[" + |
Joachim Bingel | 5a146cd | 2014-07-24 14:44:57 +0000 | [diff] [blame] | 279 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=2, max=3}, min=2, max=3}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 280 | "]}"; |
| 281 | ppt = new PoliqarpPlusTree("[base=der][][]?[base=Mann]"); |
| 282 | map = ppt.getRequestMap().get("query").toString(); |
| 283 | assertEquals(et3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 284 | |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 285 | |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 286 | |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 287 | |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 288 | // [base=der][]{2,5}[base=Mann][]?[][base=Frau] nested distances= |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 289 | String et5 = |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 290 | "{@type=korap:group, operation=operation:sequence," + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 291 | "operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 292 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," + |
| 293 | "{@type=korap:group, operation=operation:sequence, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 294 | "operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 295 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}," + |
| 296 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Frau, match=match:eq}}" + |
| 297 | "], inOrder=true, distances=[" + |
Joachim Bingel | 5a146cd | 2014-07-24 14:44:57 +0000 | [diff] [blame] | 298 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=2, max=3}, min=2, max=3}" + |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 299 | "]}" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 300 | "], inOrder=true, distances=[" + |
Joachim Bingel | 5a146cd | 2014-07-24 14:44:57 +0000 | [diff] [blame] | 301 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=3, max=6}, min=3, max=6}" + |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 302 | "]}"; |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 303 | ppt = new PoliqarpPlusTree("[base=der][]{2,5}[base=Mann][]?[][base=Frau]"); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 304 | map = ppt.getRequestMap().get("query").toString(); |
| 305 | assertEquals(et5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 306 | |
Joachim Bingel | c15720f | 2014-05-07 14:37:23 +0000 | [diff] [blame] | 307 | // [base=der][]*[base=Mann] |
| 308 | String et6 = |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 309 | "{@type=korap:group, operation=operation:sequence, " + |
Joachim Bingel | c15720f | 2014-05-07 14:37:23 +0000 | [diff] [blame] | 310 | "operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 311 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," + |
| 312 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" + |
| 313 | "], inOrder=true, distances=[" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 314 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1}, min=1}" + |
Joachim Bingel | c15720f | 2014-05-07 14:37:23 +0000 | [diff] [blame] | 315 | "]}"; |
| 316 | ppt = new PoliqarpPlusTree("[base=der][]*[base=Mann]"); |
| 317 | map = ppt.getRequestMap().get("query").toString(); |
| 318 | assertEquals(et6.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 319 | |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 320 | // [base=der][]+[base=Mann] |
Joachim Bingel | c15720f | 2014-05-07 14:37:23 +0000 | [diff] [blame] | 321 | String et7 = |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 322 | "{@type=korap:group, operation=operation:sequence, " + |
Joachim Bingel | c15720f | 2014-05-07 14:37:23 +0000 | [diff] [blame] | 323 | "operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 324 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," + |
| 325 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" + |
| 326 | "], inOrder=true, distances=[" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 327 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=2}, min=2}" + |
Joachim Bingel | c15720f | 2014-05-07 14:37:23 +0000 | [diff] [blame] | 328 | "]}"; |
| 329 | ppt = new PoliqarpPlusTree("[base=der][]+[base=Mann]"); |
| 330 | map = ppt.getRequestMap().get("query").toString(); |
| 331 | assertEquals(et7.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 332 | |
| 333 | // [base=der][]+[base=Mann] |
| 334 | String et8 = |
| 335 | "{@type=korap:group, operation=operation:sequence, " + |
| 336 | "operands=[" + |
| 337 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," + |
| 338 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" + |
| 339 | "], inOrder=true, distances=[" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 340 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=2, max=103}, min=2, max=103}" + |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 341 | "]}"; |
| 342 | ppt = new PoliqarpPlusTree("[base=der][]{1,102}[base=Mann]"); |
| 343 | map = ppt.getRequestMap().get("query").toString(); |
| 344 | assertEquals(et8.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 345 | |
| 346 | // [base=geht][base=der][]*[base=Mann] |
| 347 | String et9 = |
| 348 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 349 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=geht, match=match:eq}}," + |
| 350 | "{@type=korap:group, operation=operation:sequence, " + |
| 351 | "operands=[" + |
| 352 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," + |
| 353 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" + |
| 354 | "], inOrder=true, distances=[" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 355 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1}, min=1}" + |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 356 | "]}" + |
| 357 | "]}"; |
| 358 | ppt = new PoliqarpPlusTree("[base=geht][base=der][]*[base=Mann]"); |
| 359 | map = ppt.getRequestMap().get("query").toString(); |
| 360 | assertEquals(et9.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 361 | |
| 362 | query = "[base=geht][base=der][]*[base=Mann][base=da]"; |
| 363 | expected = |
| 364 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 365 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=geht, match=match:eq}}," + |
| 366 | "{@type=korap:group, operation=operation:sequence, " + |
| 367 | "operands=[" + |
| 368 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," + |
| 369 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 370 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}," + |
| 371 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=da, match=match:eq}}" + |
| 372 | "]}" + |
| 373 | "], inOrder=true, distances=[" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 374 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1}, min=1}" + |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 375 | "]}" + |
| 376 | "]}"; |
| 377 | ppt = new PoliqarpPlusTree(query); |
| 378 | map = ppt.getRequestMap().get("query").toString(); |
| 379 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 380 | |
| 381 | query = "[base=geht][base=der][]*contains(<s>,<np>)"; |
| 382 | expected = |
| 383 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 384 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=geht, match=match:eq}}," + |
| 385 | "{@type=korap:group, operation=operation:sequence, " + |
| 386 | "operands=[" + |
| 387 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 388 | "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" + |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 389 | "{@type=korap:span, key=s}," + |
| 390 | "{@type=korap:span, key=np}" + |
Joachim Bingel | 6b52d76 | 2014-09-30 15:29:11 +0000 | [diff] [blame] | 391 | "], frame=frame:contains}" + |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 392 | "], inOrder=true, distances=[" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 393 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1}, min=1}" + |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 394 | "]}" + |
| 395 | "]}"; |
| 396 | ppt = new PoliqarpPlusTree(query); |
| 397 | map = ppt.getRequestMap().get("query").toString(); |
| 398 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 399 | } |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 400 | |
| 401 | @Test |
Joachim Bingel | bd38636 | 2014-10-02 12:03:18 +0000 | [diff] [blame] | 402 | public void testDistancesWithClass() throws QueryException { |
| 403 | query = "[base=der]{1:[]}[base=Mann]"; |
| 404 | expected = |
| 405 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 406 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 407 | "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" + |
Joachim Bingel | bd38636 | 2014-10-02 12:03:18 +0000 | [diff] [blame] | 408 | "{@type=korap:token}" + |
| 409 | "]}," + |
| 410 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" + |
| 411 | "]}"; |
| 412 | ppt = new PoliqarpPlusTree(query); |
| 413 | map = ppt.getRequestMap().get("query").toString(); |
| 414 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 415 | |
| 416 | query = "{1:[]}[base=der][base=Mann]"; |
| 417 | expected = |
| 418 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 419 | "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" + |
Joachim Bingel | bd38636 | 2014-10-02 12:03:18 +0000 | [diff] [blame] | 420 | "{@type=korap:token}" + |
| 421 | "]}," + |
| 422 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," + |
| 423 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" + |
| 424 | "]}"; |
| 425 | ppt = new PoliqarpPlusTree(query); |
| 426 | map = ppt.getRequestMap().get("query").toString(); |
| 427 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 428 | } |
| 429 | |
| 430 | @Test |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 431 | public void testLeadingTrailingEmptyTokens() throws QueryException { |
| 432 | // startswith(<s>, [][base=Mann] |
| 433 | String et1 = |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 434 | "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" + |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 435 | "{@type=korap:span, key=s}," + |
| 436 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 437 | "{@type=korap:token}," + |
| 438 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" + |
| 439 | "]}" + |
Joachim Bingel | 6b52d76 | 2014-09-30 15:29:11 +0000 | [diff] [blame] | 440 | "], frame=frame:startswith}"; |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 441 | ppt = new PoliqarpPlusTree("startswith(<s>, [][base=Mann])"); |
| 442 | map = ppt.getRequestMap().get("query").toString(); |
| 443 | assertEquals(et1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 444 | |
| 445 | query = "[][base=Mann]"; |
| 446 | expected = |
| 447 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 448 | "{@type=korap:token}," + |
| 449 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" + |
| 450 | "]}"; |
| 451 | ppt = new PoliqarpPlusTree(query); |
| 452 | map = ppt.getRequestMap().get("query").toString(); |
| 453 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 454 | |
Joachim Bingel | f8e8b54 | 2014-10-22 14:58:27 +0000 | [diff] [blame] | 455 | query = "{[]}[base=Mann]"; |
| 456 | expected = |
| 457 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 458 | "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" + |
| 459 | "{@type=korap:token}" + |
| 460 | "]}," + |
| 461 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" + |
| 462 | "]}"; |
| 463 | ppt = new PoliqarpPlusTree(query); |
| 464 | map = ppt.getRequestMap().get("query").toString(); |
| 465 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 466 | |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 467 | query = "[][][base=Mann]"; |
| 468 | expected = |
| 469 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 470 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
| 471 | "{@type=korap:token}" + |
Joachim Bingel | 6163156 | 2014-07-24 14:26:02 +0000 | [diff] [blame] | 472 | "], boundary={@type=korap:boundary, min=2, max=2}, min=2, max=2}," + |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 473 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" + |
| 474 | "]}"; |
| 475 | ppt = new PoliqarpPlusTree(query); |
| 476 | map = ppt.getRequestMap().get("query").toString(); |
| 477 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 478 | |
| 479 | query = "[][]*[base=Mann]"; |
| 480 | expected = |
| 481 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 482 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
| 483 | "{@type=korap:token}" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 484 | "], boundary={@type=korap:boundary, min=1}, min=1}," + |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 485 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" + |
| 486 | "]}"; |
| 487 | ppt = new PoliqarpPlusTree(query); |
| 488 | map = ppt.getRequestMap().get("query").toString(); |
| 489 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 490 | |
| 491 | query = "[][]*[base=Mann][][]"; |
| 492 | expected = |
| 493 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 494 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
| 495 | "{@type=korap:token}" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 496 | "], boundary={@type=korap:boundary, min=1}, min=1}," + |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 497 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}," + |
| 498 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
| 499 | "{@type=korap:token}" + |
Joachim Bingel | 6163156 | 2014-07-24 14:26:02 +0000 | [diff] [blame] | 500 | "], boundary={@type=korap:boundary, min=2, max=2}, min=2, max=2}" + |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 501 | "]}"; |
| 502 | ppt = new PoliqarpPlusTree(query); |
| 503 | map = ppt.getRequestMap().get("query").toString(); |
| 504 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 505 | |
| 506 | query = "[][]*contains(<s>, <np>)[][]"; |
| 507 | expected = |
| 508 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 509 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
| 510 | "{@type=korap:token}" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 511 | "], boundary={@type=korap:boundary, min=1}, min=1}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 512 | "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" + |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 513 | "{@type=korap:span, key=s}," + |
| 514 | "{@type=korap:span, key=np}" + |
Joachim Bingel | 6b52d76 | 2014-09-30 15:29:11 +0000 | [diff] [blame] | 515 | "], frame=frame:contains}," + |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 516 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
| 517 | "{@type=korap:token}" + |
Joachim Bingel | 6163156 | 2014-07-24 14:26:02 +0000 | [diff] [blame] | 518 | "], boundary={@type=korap:boundary, min=2, max=2}, min=2, max=2}" + |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 519 | "]}"; |
| 520 | ppt = new PoliqarpPlusTree(query); |
| 521 | map = ppt.getRequestMap().get("query").toString(); |
| 522 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b46e108 | 2014-11-05 13:00:01 +0000 | [diff] [blame] | 523 | |
| 524 | query = "[base=Mann][]{2}"; |
| 525 | expected = |
| 526 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 527 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}," + |
| 528 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
| 529 | "{@type=korap:token}" + |
| 530 | "], boundary={@type=korap:boundary, min=2, max=2}, min=2, max=2}" + |
| 531 | "]}"; |
| 532 | ppt = new PoliqarpPlusTree(query); |
| 533 | map = ppt.getRequestMap().get("query").toString(); |
| 534 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 14239d8 | 2014-07-22 09:55:04 +0000 | [diff] [blame] | 535 | } |
| 536 | |
| 537 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 538 | public void testCoordinatedFields() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 539 | // [base=Mann&(cas=N|cas=A)] |
| 540 | String cof1 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 541 | "{@type=korap:token, wrap=" + |
Joachim Bingel | 2980bda | 2014-04-04 12:09:46 +0000 | [diff] [blame] | 542 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 543 | "{@type=korap:term, layer=lemma, key=Mann, match=match:eq}," + |
Joachim Bingel | 2980bda | 2014-04-04 12:09:46 +0000 | [diff] [blame] | 544 | "{@type=korap:termGroup, relation=relation:or, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 545 | "{@type=korap:term, layer=cas, key=N, match=match:eq}," + |
| 546 | "{@type=korap:term, layer=cas, key=A, match=match:eq}" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 547 | "]}" + |
| 548 | "]}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 549 | "}"; |
| 550 | ppt = new PoliqarpPlusTree("[base=Mann&(cas=N|cas=A)]"); |
| 551 | map = ppt.getRequestMap().get("query").toString(); |
| 552 | assertEquals(cof1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Nils Diewald | 7d486c2 | 2013-12-13 16:32:18 +0000 | [diff] [blame] | 553 | |
| 554 | |
| 555 | assertEquals( |
| 556 | new PoliqarpPlusTree(" [ base=Mann & ( cas=N | cas=A)] ").getRequestMap().get("query").toString(), |
| 557 | new PoliqarpPlusTree("[base=Mann &(cas=N|cas=A)]").getRequestMap().get("query").toString() |
| 558 | ); |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 559 | |
| 560 | // [base=Mann&cas=N&gen=m] |
| 561 | String cof2 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 562 | "{@type=korap:token, wrap=" + |
Joachim Bingel | 2980bda | 2014-04-04 12:09:46 +0000 | [diff] [blame] | 563 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 564 | "{@type=korap:term, layer=lemma, key=Mann, match=match:eq}," + |
| 565 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
| 566 | "{@type=korap:term, layer=cas, key=N, match=match:eq}," + |
| 567 | "{@type=korap:term, layer=gen, key=m, match=match:eq}" + |
| 568 | "]}" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 569 | "]}" + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 570 | "}"; |
| 571 | ppt = new PoliqarpPlusTree("[base=Mann&cas=N&gen=m]"); |
| 572 | map = ppt.getRequestMap().get("query").toString(); |
| 573 | assertEquals(cof2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 574 | } |
| 575 | |
| 576 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 577 | public void testOccurrence() throws QueryException { |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 578 | // [base=foo]* |
Joachim Bingel | 33bd45f | 2014-06-25 15:00:54 +0000 | [diff] [blame] | 579 | String occ1 = "{@type=korap:group, operation=operation:repetition, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 580 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=foo, match=match:eq}}" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 581 | "], boundary={@type=korap:boundary, min=0}, min=0}"; |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 582 | ppt = new PoliqarpPlusTree("[base=foo]*"); |
| 583 | map = ppt.getRequestMap().get("query").toString(); |
| 584 | assertEquals(occ1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 585 | |
| 586 | // [base=foo]*[base=bar] |
| 587 | String occ2 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 588 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 33bd45f | 2014-06-25 15:00:54 +0000 | [diff] [blame] | 589 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 590 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=foo, match=match:eq}}" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 591 | "], boundary={@type=korap:boundary, min=0}, min=0 }," + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 592 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=bar, match=match:eq}}" + |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 593 | "]}"; |
| 594 | ppt = new PoliqarpPlusTree("[base=foo]*[base=bar]"); |
| 595 | map = ppt.getRequestMap().get("query").toString(); |
| 596 | assertEquals(occ2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 597 | |
| 598 | // [base=bar][base=foo]* |
| 599 | String occ3 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 600 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 601 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=bar, match=match:eq}}," + |
Joachim Bingel | 33bd45f | 2014-06-25 15:00:54 +0000 | [diff] [blame] | 602 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 603 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=foo, match=match:eq}}" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 604 | "], boundary={@type=korap:boundary, min=0}, min=0 }" + |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 605 | "]}"; |
| 606 | ppt = new PoliqarpPlusTree("[base=bar][base=foo]*"); |
| 607 | map = ppt.getRequestMap().get("query").toString(); |
| 608 | assertEquals(occ3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 609 | |
| 610 | // ([base=bar][base=foo])* |
| 611 | String occ4 = |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 612 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 613 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 614 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=bar, match=match:eq}}," + |
| 615 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=foo, match=match:eq}}" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 616 | "]}" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 617 | "], boundary={@type=korap:boundary, min=0}, min=0}" ; |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 618 | ppt = new PoliqarpPlusTree("([base=bar][base=foo])*"); |
| 619 | map = ppt.getRequestMap().get("query").toString(); |
| 620 | assertEquals(occ4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 621 | |
| 622 | // <s>([base=bar][base=foo])* |
| 623 | String occ5 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 624 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 625 | "{@type=korap:span, key=s}," + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 626 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 627 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 628 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=bar, match=match:eq}}," + |
| 629 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=foo, match=match:eq}}" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 630 | "]}" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 631 | "], boundary={@type=korap:boundary, min=0}, min=0 }" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 632 | "]}" ; |
| 633 | ppt = new PoliqarpPlusTree("<s>([base=bar][base=foo])*"); |
| 634 | map = ppt.getRequestMap().get("query").toString(); |
| 635 | assertEquals(occ5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 636 | |
| 637 | // <s><np>([base=bar][base=foo])* |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 638 | String occ6 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 639 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 640 | "{@type=korap:span, key=s}," + |
| 641 | "{@type=korap:span, key=np}," + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 642 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 643 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 644 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=bar, match=match:eq}}," + |
| 645 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=foo, match=match:eq}}" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 646 | "]}" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 647 | "], boundary={@type=korap:boundary, min=0}, min=0 }" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 648 | "]}" ; |
| 649 | ppt = new PoliqarpPlusTree("<s><np>([base=bar][base=foo])*"); |
| 650 | map = ppt.getRequestMap().get("query").toString(); |
| 651 | assertEquals(occ6.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 652 | |
| 653 | // <s><np>([base=bar][base=foo])*[p=NN] |
| 654 | // comment: embedded sequence shouldn't really be here, but does not really hurt, either. (?) |
| 655 | // really hard to get this behaviour out of the PQPlus grammar... |
| 656 | String occ7 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 657 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 658 | "{@type=korap:span, key=s}," + |
| 659 | "{@type=korap:span, key=np}," + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 660 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 661 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 662 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=bar, match=match:eq}}," + |
| 663 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=foo, match=match:eq}}" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 664 | "]}" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 665 | "], boundary={@type=korap:boundary, min=0}, min=0 }," + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 666 | "{@type=korap:token, wrap={@type=korap:term, layer=p, key=NN, match=match:eq}}" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 667 | "]}" ; |
| 668 | ppt = new PoliqarpPlusTree("<s><np>([base=bar][base=foo])*[p=NN]"); |
| 669 | map = ppt.getRequestMap().get("query").toString(); |
| 670 | assertEquals(occ7.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 671 | |
| 672 | // ([base=bar][base=foo])*[p=NN] |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 673 | String occ8 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 674 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 675 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 676 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 677 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=bar, match=match:eq}}," + |
| 678 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=foo, match=match:eq}}" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 679 | "]}" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 680 | "], boundary={@type=korap:boundary, min=0}, min=0 }," + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 681 | "{@type=korap:token, wrap={@type=korap:term, layer=p, key=NN, match=match:eq}}" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 682 | "]}" ; |
| 683 | ppt = new PoliqarpPlusTree("([base=bar][base=foo])*[p=NN]"); |
| 684 | map = ppt.getRequestMap().get("query").toString(); |
| 685 | assertEquals(occ8.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 686 | |
| 687 | // [base=foo]+ |
Joachim Bingel | 33bd45f | 2014-06-25 15:00:54 +0000 | [diff] [blame] | 688 | String occ9 = "{@type=korap:group, operation=operation:repetition, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 689 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=foo, match=match:eq}}" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 690 | "], boundary={@type=korap:boundary, min=1}, min=1}"; |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 691 | ppt = new PoliqarpPlusTree("[base=foo]+"); |
| 692 | map = ppt.getRequestMap().get("query").toString(); |
| 693 | assertEquals(occ9.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 694 | |
| 695 | // [base=foo]? |
Joachim Bingel | 33bd45f | 2014-06-25 15:00:54 +0000 | [diff] [blame] | 696 | String occ10 = "{@type=korap:group, operation=operation:repetition, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 697 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=foo, match=match:eq}}" + |
Joachim Bingel | 6163156 | 2014-07-24 14:26:02 +0000 | [diff] [blame] | 698 | "], boundary={@type=korap:boundary, min=0, max=1}, min=0, max=1}"; |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 699 | ppt = new PoliqarpPlusTree("[base=foo]?"); |
| 700 | map = ppt.getRequestMap().get("query").toString(); |
| 701 | assertEquals(occ10.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 702 | |
| 703 | // [base=foo]{2,5} |
Joachim Bingel | 33bd45f | 2014-06-25 15:00:54 +0000 | [diff] [blame] | 704 | String occ11 = "{@type=korap:group, operation=operation:repetition, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 705 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=foo, match=match:eq}}" + |
Joachim Bingel | 6163156 | 2014-07-24 14:26:02 +0000 | [diff] [blame] | 706 | "], boundary={@type=korap:boundary, min=2, max=5}, min=2, max=5}"; |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 707 | ppt = new PoliqarpPlusTree("[base=foo]{2,5}"); |
| 708 | map = ppt.getRequestMap().get("query").toString(); |
| 709 | assertEquals(occ11.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 2980bda | 2014-04-04 12:09:46 +0000 | [diff] [blame] | 710 | |
| 711 | // [base=foo]{2} |
Joachim Bingel | 33bd45f | 2014-06-25 15:00:54 +0000 | [diff] [blame] | 712 | String occ12 = "{@type=korap:group, operation=operation:repetition, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 713 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=foo, match=match:eq}}" + |
Joachim Bingel | 6163156 | 2014-07-24 14:26:02 +0000 | [diff] [blame] | 714 | "], boundary={@type=korap:boundary, min=2, max=2}, min=2, max=2}"; |
Joachim Bingel | 2980bda | 2014-04-04 12:09:46 +0000 | [diff] [blame] | 715 | ppt = new PoliqarpPlusTree("[base=foo]{2}"); |
| 716 | map = ppt.getRequestMap().get("query").toString(); |
| 717 | assertEquals(occ12.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b2aa1c7 | 2014-07-01 12:48:46 +0000 | [diff] [blame] | 718 | |
| 719 | // [base=foo]{2} |
| 720 | String occ13 = "{@type=korap:group, operation=operation:repetition, operands=[" + |
| 721 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=foo, match=match:eq}}" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 722 | "], boundary={@type=korap:boundary, min=2}, min=2}"; |
Joachim Bingel | b2aa1c7 | 2014-07-01 12:48:46 +0000 | [diff] [blame] | 723 | ppt = new PoliqarpPlusTree("[base=foo]{2,}"); |
| 724 | map = ppt.getRequestMap().get("query").toString(); |
| 725 | assertEquals(occ13.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 726 | |
| 727 | // [base=foo]{2} |
| 728 | String occ14 = "{@type=korap:group, operation=operation:repetition, operands=[" + |
| 729 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=foo, match=match:eq}}" + |
Joachim Bingel | 6163156 | 2014-07-24 14:26:02 +0000 | [diff] [blame] | 730 | "], boundary={@type=korap:boundary, min=0, max=2}, min=0, max=2}"; |
Joachim Bingel | b2aa1c7 | 2014-07-01 12:48:46 +0000 | [diff] [blame] | 731 | ppt = new PoliqarpPlusTree("[base=foo]{,2}"); |
| 732 | map = ppt.getRequestMap().get("query").toString(); |
| 733 | assertEquals(occ14.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 734 | } |
| 735 | |
| 736 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 737 | public void testTokenSequence() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 738 | // [base=Mann][orth=Frau] |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 739 | String seq1 = "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 740 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}, " + |
| 741 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Frau, match=match:eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 742 | "]}"; |
| 743 | assertTrue(equalsQueryContent(seq1, "[base=Mann][orth=Frau]")); |
| 744 | |
| 745 | // [base=Mann][orth=Frau][p=NN] |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 746 | String seq2 = "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 747 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}, " + |
| 748 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Frau, match=match:eq}}, " + |
| 749 | "{@type=korap:token, wrap={@type=korap:term, layer=p, key=NN, match=match:eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 750 | "]}"; |
| 751 | assertTrue(equalsQueryContent(seq2, "[base=Mann][orth=Frau][p=NN]")); |
| 752 | } |
| 753 | |
| 754 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 755 | public void testDisjSegments() throws QueryException { |
Joachim Bingel | 94a1ccd | 2013-12-10 10:37:29 +0000 | [diff] [blame] | 756 | // ([base=der]|[base=das])[base=Schild] |
| 757 | String disj1 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 758 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 759 | "{@type=korap:group, operation=operation:or, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 760 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," + |
| 761 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=das, match=match:eq}}" + |
Joachim Bingel | 94a1ccd | 2013-12-10 10:37:29 +0000 | [diff] [blame] | 762 | "]}," + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 763 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Schild, match=match:eq}}" + |
Joachim Bingel | 94a1ccd | 2013-12-10 10:37:29 +0000 | [diff] [blame] | 764 | "]}"; |
| 765 | ppt = new PoliqarpPlusTree("([base=der]|[base=das])[base=Schild]"); |
| 766 | map = ppt.getRequestMap().get("query").toString(); |
| 767 | assertEquals(disj1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 768 | |
| 769 | // [base=Schild]([base=der]|[base=das]) |
| 770 | String disj2 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 771 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 772 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Schild, match=match:eq}}," + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 773 | "{@type=korap:group, operation=operation:or, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 774 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," + |
| 775 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=das, match=match:eq}}" + |
Joachim Bingel | 94a1ccd | 2013-12-10 10:37:29 +0000 | [diff] [blame] | 776 | "]}" + |
| 777 | "]}"; |
| 778 | ppt = new PoliqarpPlusTree("[base=Schild]([base=der]|[base=das])"); |
| 779 | map = ppt.getRequestMap().get("query").toString(); |
| 780 | assertEquals(disj2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 76b498d | 2014-06-06 12:06:46 +0000 | [diff] [blame] | 781 | |
| 782 | // "([orth=der][base=katze])|([orth=eine][base=baum])" |
| 783 | String disj3 = |
| 784 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 785 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 786 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=der, match=match:eq}}," + |
| 787 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=katze, match=match:eq}}" + |
Joachim Bingel | 76b498d | 2014-06-06 12:06:46 +0000 | [diff] [blame] | 788 | "]}," + |
| 789 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 790 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=eine, match=match:eq}}," + |
| 791 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=baum, match=match:eq}}" + |
Joachim Bingel | 76b498d | 2014-06-06 12:06:46 +0000 | [diff] [blame] | 792 | "]}" + |
| 793 | "]}"; |
| 794 | ppt = new PoliqarpPlusTree("([orth=der][base=katze])|([orth=eine][base=baum])"); |
| 795 | map = ppt.getRequestMap().get("query").toString(); |
| 796 | assertEquals(disj3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 797 | |
| 798 | // "[orth=der][base=katze]|[orth=eine][base=baum]" |
| 799 | String disj4 = |
| 800 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 801 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 802 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=der, match=match:eq}}," + |
| 803 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=katze, match=match:eq}}" + |
Joachim Bingel | 76b498d | 2014-06-06 12:06:46 +0000 | [diff] [blame] | 804 | "]}," + |
| 805 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 806 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=eine, match=match:eq}}," + |
| 807 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=baum, match=match:eq}}" + |
Joachim Bingel | 76b498d | 2014-06-06 12:06:46 +0000 | [diff] [blame] | 808 | "]}" + |
| 809 | "]}"; |
| 810 | ppt = new PoliqarpPlusTree("[orth=der][base=katze]|[orth=eine][base=baum]"); |
| 811 | map = ppt.getRequestMap().get("query").toString(); |
| 812 | assertEquals(disj4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 813 | |
| 814 | PoliqarpPlusTree ppt1 = new PoliqarpPlusTree("[orth=der][base=katze]|[orth=eine][base=baum]"); |
| 815 | PoliqarpPlusTree ppt2 = new PoliqarpPlusTree("([orth=der][base=katze])|([orth=eine][base=baum])"); |
| 816 | assertEquals(ppt1.getRequestMap().toString(), ppt2.getRequestMap().toString()); |
| 817 | |
| 818 | // "[orth=der][base=katze]|[orth=der][base=hund]|[orth=der][base=baum]" |
| 819 | String disj5 = |
| 820 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 821 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 822 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=der, match=match:eq}}," + |
| 823 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=katze, match=match:eq}}" + |
Joachim Bingel | 76b498d | 2014-06-06 12:06:46 +0000 | [diff] [blame] | 824 | "]}," + |
| 825 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 826 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=der, match=match:eq}}," + |
| 827 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=hund, match=match:eq}}" + |
Joachim Bingel | 76b498d | 2014-06-06 12:06:46 +0000 | [diff] [blame] | 828 | "]}," + |
| 829 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 830 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=der, match=match:eq}}," + |
| 831 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=baum, match=match:eq}}" + |
Joachim Bingel | 76b498d | 2014-06-06 12:06:46 +0000 | [diff] [blame] | 832 | "]}" + |
| 833 | "]}"; |
| 834 | ppt = new PoliqarpPlusTree("[orth=der][base=katze]|[orth=der][base=hund]|[orth=der][base=baum]"); |
| 835 | map = ppt.getRequestMap().get("query").toString(); |
| 836 | assertEquals(disj5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 837 | |
| 838 | // [orth=der]([base=katze]|[base=hund]|[base=baum]) |
| 839 | String disj6 = |
| 840 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 841 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=der, match=match:eq}}," + |
Joachim Bingel | 76b498d | 2014-06-06 12:06:46 +0000 | [diff] [blame] | 842 | "{@type=korap:group, operation=operation:or, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 843 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=katze, match=match:eq}}," + |
| 844 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=hund, match=match:eq}}," + |
| 845 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=baum, match=match:eq}}" + |
Joachim Bingel | 76b498d | 2014-06-06 12:06:46 +0000 | [diff] [blame] | 846 | "]}" + |
| 847 | "]}"; |
| 848 | ppt = new PoliqarpPlusTree("[orth=der]([base=katze]|[base=hund]|[base=baum])"); |
| 849 | map = ppt.getRequestMap().get("query").toString(); |
| 850 | assertEquals(disj6.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 94a1ccd | 2013-12-10 10:37:29 +0000 | [diff] [blame] | 851 | } |
| 852 | |
| 853 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 854 | public void testTokenElemSequence() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 855 | // [base=Mann]<vp> |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 856 | String seq1 = "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 857 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}, " + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 858 | "{@type=korap:span, key=vp}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 859 | "]}"; |
| 860 | assertTrue(equalsQueryContent(seq1, "[base=Mann]<vp>")); |
| 861 | |
| 862 | // <vp>[base=Mann] |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 863 | String seq2 = "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 864 | "{@type=korap:span, key=vp}, "+ |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 865 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}} " + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 866 | "]}"; |
| 867 | assertTrue(equalsQueryContent(seq2, "<vp>[base=Mann]")); |
| 868 | |
| 869 | // <vp>[base=Mann]<pp> |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 870 | String seq3 = "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 871 | "{@type=korap:span, key=vp}, "+ |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 872 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}, " + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 873 | "{@type=korap:span, key=pp} "+ |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 874 | "]}"; |
| 875 | assertTrue(equalsQueryContent(seq3, "<vp>[base=Mann]<pp>")); |
| 876 | } |
| 877 | |
| 878 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 879 | public void testElemSequence() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 880 | // <np><vp> |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 881 | String seq1 = "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 882 | "{@type=korap:span, key=np}," + |
| 883 | "{@type=korap:span, key=vp}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 884 | "]}"; |
| 885 | assertTrue(equalsQueryContent(seq1, "<np><vp>")); |
| 886 | |
| 887 | // <np><vp><pp> |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 888 | String seq2 = "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 889 | "{@type=korap:span, key=np}," + |
| 890 | "{@type=korap:span, key=vp}," + |
| 891 | "{@type=korap:span, key=pp}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 892 | "]}"; |
| 893 | assertTrue(equalsQueryContent(seq2, "<np><vp><pp>")); |
| 894 | } |
| 895 | |
| 896 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 897 | public void testClasses() throws QueryException { |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 898 | String query; |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 899 | // {[base=Mann]} |
Joachim Bingel | 4c0c201 | 2014-10-22 09:35:22 +0000 | [diff] [blame] | 900 | String cls1 = "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 901 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 902 | "]}"; |
Joachim Bingel | 8c640e4 | 2014-02-07 16:20:47 +0000 | [diff] [blame] | 903 | ppt = new PoliqarpPlusTree("{[base=Mann]}"); |
| 904 | map = ppt.getRequestMap().get("query").toString(); |
| 905 | assertEquals(cls1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 906 | |
| 907 | // {[base=Mann][orth=Frau]} |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 908 | query = "{[base=Mann][orth=Frau]}"; |
Joachim Bingel | 4c0c201 | 2014-10-22 09:35:22 +0000 | [diff] [blame] | 909 | String cls2 = "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 910 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 911 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}," + |
| 912 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Frau, match=match:eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 913 | "]}" + |
| 914 | "]}"; |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 915 | ppt = new PoliqarpPlusTree(query); |
| 916 | map = ppt.getRequestMap().get("query").toString(); |
| 917 | assertEquals(cls2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 918 | |
| 919 | // [p=NN]{[base=Mann][orth=Frau]} |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 920 | String cls3 = "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 921 | "{@type=korap:token, wrap={@type=korap:term, layer=p, key=NN, match=match:eq}}," + |
Joachim Bingel | 4c0c201 | 2014-10-22 09:35:22 +0000 | [diff] [blame] | 922 | "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 923 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 924 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}," + |
| 925 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Frau, match=match:eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 926 | "]}" + |
| 927 | "]}" + |
| 928 | "]}"; |
Joachim Bingel | 33bd45f | 2014-06-25 15:00:54 +0000 | [diff] [blame] | 929 | ppt = new PoliqarpPlusTree("[p=NN]{[base=Mann][orth=Frau]}"); |
| 930 | map = ppt.getRequestMap().get("query").toString(); |
| 931 | assertEquals(cls3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 932 | |
| 933 | // {[base=Mann][orth=Frau]}[p=NN] |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 934 | String cls4 = "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 4c0c201 | 2014-10-22 09:35:22 +0000 | [diff] [blame] | 935 | "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 936 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 937 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}," + |
| 938 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Frau, match=match:eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 939 | "]}" + |
| 940 | "]}," + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 941 | "{@type=korap:token, wrap={@type=korap:term, layer=p, key=NN, match=match:eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 942 | "]}"; |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 943 | ppt = new PoliqarpPlusTree("{[base=Mann][orth=Frau]}[p=NN]"); |
| 944 | map = ppt.getRequestMap().get("query").toString(); |
| 945 | assertEquals(cls4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 946 | |
| 947 | // {2:{1:[tt/p=ADJA]}[mate/p=NN]}" |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 948 | String cls5 = "{@type=korap:group, operation=operation:class, class=2, classOut=2, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 949 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 950 | "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 951 | "{@type=korap:token, wrap={@type=korap:term, foundry=tt, layer=p, key=ADJA, match=match:eq}}" + |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 952 | "]}," + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 953 | "{@type=korap:token, wrap={@type=korap:term, foundry=mate, layer=p, key=NN, match=match:eq}}" + |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 954 | "]}" + |
| 955 | "]}"; |
| 956 | ppt = new PoliqarpPlusTree("{2: {1:[tt/p=ADJA]}[mate/p=NN]}"); |
| 957 | map = ppt.getRequestMap().get("query").toString(); |
| 958 | assertEquals(cls5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 959 | } |
| 960 | |
| 961 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 962 | public void testPositions() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 963 | // contains(<s>,<np>) |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 964 | String pos1 = "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 965 | "{@type=korap:span, key=s}," + |
| 966 | "{@type=korap:span, key=np}" + |
Joachim Bingel | 6b52d76 | 2014-09-30 15:29:11 +0000 | [diff] [blame] | 967 | "], frame=frame:contains}"; |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 968 | assertTrue(equalsQueryContent(pos1, "contains(<s>,<np>)")); |
| 969 | |
| 970 | // contains(<s>,[base=Mann]) |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 971 | String pos2 = "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 972 | "{@type=korap:span, key=s}," + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 973 | "{@type=korap:token, wrap= {@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" + |
Joachim Bingel | 6b52d76 | 2014-09-30 15:29:11 +0000 | [diff] [blame] | 974 | "], frame=frame:contains}"; |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 975 | assertTrue(equalsQueryContent(pos2, "contains(<s>,[base=Mann])")); |
| 976 | |
| 977 | // contains(<s>,[orth=der][orth=Mann]) |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 978 | String pos3 = "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 979 | "{@type=korap:span, key=s}," + |
| 980 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 981 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=der, match=match:eq}}," + |
| 982 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mann, match=match:eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 983 | "]}" + |
Joachim Bingel | 6b52d76 | 2014-09-30 15:29:11 +0000 | [diff] [blame] | 984 | "], frame=frame:contains}"; |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 985 | ppt = new PoliqarpPlusTree("contains(<s>,[orth=der][orth=Mann])"); |
| 986 | map = ppt.getRequestMap().get("query").toString(); |
| 987 | assertEquals(pos3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 988 | |
| 989 | // [base=Auto]contains(<s>,[base=Mann]) |
| 990 | String pos4 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 991 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 992 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Auto, match=match:eq}}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 993 | "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 994 | "{@type=korap:span, key=s}," + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 995 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" + |
Joachim Bingel | 6b52d76 | 2014-09-30 15:29:11 +0000 | [diff] [blame] | 996 | "], frame=frame:contains}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 997 | "]}"; |
| 998 | ppt = new PoliqarpPlusTree("[base=Auto]contains(<s>,[base=Mann])"); |
| 999 | map = ppt.getRequestMap().get("query").toString(); |
| 1000 | assertEquals(pos4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | ef7059b | 2014-04-22 13:44:19 +0000 | [diff] [blame] | 1001 | |
| 1002 | // contains(<s>,[pos=N]*) |
| 1003 | String pos5 = |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1004 | "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" + |
Joachim Bingel | ef7059b | 2014-04-22 13:44:19 +0000 | [diff] [blame] | 1005 | "{@type=korap:span, key=s}," + |
Joachim Bingel | 33bd45f | 2014-06-25 15:00:54 +0000 | [diff] [blame] | 1006 | "{@type=korap:group, operation=operation:repetition, " + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1007 | "operands=[{@type=korap:token, wrap={@type=korap:term, layer=pos, key=N, match=match:eq}}" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 1008 | "], boundary={@type=korap:boundary, min=0}, min=0" + |
Joachim Bingel | ef7059b | 2014-04-22 13:44:19 +0000 | [diff] [blame] | 1009 | "}" + |
Joachim Bingel | 6b52d76 | 2014-09-30 15:29:11 +0000 | [diff] [blame] | 1010 | "], frame=frame:contains}"; |
Joachim Bingel | ef7059b | 2014-04-22 13:44:19 +0000 | [diff] [blame] | 1011 | ppt = new PoliqarpPlusTree("contains(<s>,[pos=N]*)"); |
| 1012 | map = ppt.getRequestMap().get("query").toString(); |
| 1013 | assertEquals(pos5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1014 | |
| 1015 | // [base=Auto]contains(<s>,[pos=N]*) |
| 1016 | String pos6 = |
| 1017 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1018 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Auto, match=match:eq}}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1019 | "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" + |
Joachim Bingel | ef7059b | 2014-04-22 13:44:19 +0000 | [diff] [blame] | 1020 | "{@type=korap:span, key=s}," + |
Joachim Bingel | 33bd45f | 2014-06-25 15:00:54 +0000 | [diff] [blame] | 1021 | "{@type=korap:group, operation=operation:repetition, " + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1022 | "operands=[{@type=korap:token, wrap={@type=korap:term, layer=pos, key=N, match=match:eq}}" + |
Joachim Bingel | 687e4d4 | 2014-07-30 09:34:18 +0000 | [diff] [blame] | 1023 | "], boundary={@type=korap:boundary, min=0}, min=0" + |
Joachim Bingel | ef7059b | 2014-04-22 13:44:19 +0000 | [diff] [blame] | 1024 | "}" + |
Joachim Bingel | 6b52d76 | 2014-09-30 15:29:11 +0000 | [diff] [blame] | 1025 | "], frame=frame:contains}" + |
Joachim Bingel | ef7059b | 2014-04-22 13:44:19 +0000 | [diff] [blame] | 1026 | "]}"; |
| 1027 | ppt = new PoliqarpPlusTree("[base=Auto]contains(<s>,[pos=N]*)"); |
| 1028 | map = ppt.getRequestMap().get("query").toString(); |
| 1029 | assertEquals(pos6.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1030 | } |
| 1031 | |
| 1032 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 1033 | public void testNestedPositions() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1034 | // contains(<s>,startswith(<np>,[orth=Der])) |
| 1035 | String npos1 = |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1036 | "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1037 | "{@type=korap:span, key=s}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1038 | "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1039 | "{@type=korap:span, key=np}," + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1040 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Der, match=match:eq}}" + |
Joachim Bingel | 6b52d76 | 2014-09-30 15:29:11 +0000 | [diff] [blame] | 1041 | "], frame=frame:startswith}" + |
| 1042 | "], frame=frame:contains}"; |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 1043 | ppt = new PoliqarpPlusTree("contains(<s>, startswith(<np>,[orth=Der]))"); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1044 | map = ppt.getRequestMap().get("query").toString(); |
| 1045 | assertEquals(npos1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1046 | } |
| 1047 | |
| 1048 | @Test |
Joachim Bingel | 23c31ad | 2014-08-11 09:44:46 +0000 | [diff] [blame] | 1049 | public void testFocusSplit() throws QueryException { |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1050 | // focus([orth=Der]{[orth=Mann]}) |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1051 | String shr1 = |
Joachim Bingel | 4c0c201 | 2014-10-22 09:35:22 +0000 | [diff] [blame] | 1052 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1053 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1054 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Der, match=match:eq}}," + |
Joachim Bingel | 4c0c201 | 2014-10-22 09:35:22 +0000 | [diff] [blame] | 1055 | "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1056 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mann, match=match:eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1057 | "]}" + |
| 1058 | "]}" + |
| 1059 | "]}"; |
Joachim Bingel | f8dfcf8 | 2014-06-25 09:57:44 +0000 | [diff] [blame] | 1060 | ppt = new PoliqarpPlusTree("focus([orth=Der]{[orth=Mann]})"); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1061 | map = ppt.getRequestMap().get("query").toString(); |
| 1062 | assertEquals(shr1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1063 | |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1064 | // focus([orth=Der]{[orth=Mann][orth=geht]}) |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1065 | String shr2 = |
Joachim Bingel | 4c0c201 | 2014-10-22 09:35:22 +0000 | [diff] [blame] | 1066 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1067 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1068 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Der, match=match:eq}}," + |
Joachim Bingel | 4c0c201 | 2014-10-22 09:35:22 +0000 | [diff] [blame] | 1069 | "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1070 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1071 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mann, match=match:eq}}," + |
| 1072 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=geht, match=match:eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1073 | "]}" + |
| 1074 | "]}" + |
| 1075 | "]}" + |
| 1076 | "]}"; |
Joachim Bingel | f8dfcf8 | 2014-06-25 09:57:44 +0000 | [diff] [blame] | 1077 | ppt = new PoliqarpPlusTree("focus([orth=Der]{[orth=Mann][orth=geht]})"); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1078 | map = ppt.getRequestMap().get("query").toString(); |
| 1079 | assertEquals(shr2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1080 | |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1081 | // focus(1:[orth=Der]{1:[orth=Mann][orth=geht]}) |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1082 | String shr3 = |
Joachim Bingel | d1a3e71 | 2014-07-16 08:02:05 +0000 | [diff] [blame] | 1083 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1084 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1085 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Der, match=match:eq}}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1086 | "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1087 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1088 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mann, match=match:eq}}," + |
| 1089 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=geht, match=match:eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1090 | "]}" + |
| 1091 | "]}" + |
| 1092 | "]}" + |
| 1093 | "]}"; |
Joachim Bingel | f8dfcf8 | 2014-06-25 09:57:44 +0000 | [diff] [blame] | 1094 | ppt = new PoliqarpPlusTree("focus(1:[orth=Der]{1:[orth=Mann][orth=geht]})"); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1095 | map = ppt.getRequestMap().get("query").toString(); |
| 1096 | assertEquals(shr3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1097 | |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1098 | // focus(1:startswith(<s>,{1:<np>})) |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1099 | String shr4 = |
Joachim Bingel | d1a3e71 | 2014-07-16 08:02:05 +0000 | [diff] [blame] | 1100 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1101 | "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1102 | "{@type=korap:span, key=s}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1103 | "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1104 | "{@type=korap:span, key=np}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1105 | "]}" + |
Joachim Bingel | 6b52d76 | 2014-09-30 15:29:11 +0000 | [diff] [blame] | 1106 | "], frame=frame:startswith}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1107 | "]}"; |
Joachim Bingel | f8dfcf8 | 2014-06-25 09:57:44 +0000 | [diff] [blame] | 1108 | ppt = new PoliqarpPlusTree("focus(1:startswith(<s>,{1:<np>}))"); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1109 | map = ppt.getRequestMap().get("query").toString(); |
| 1110 | assertEquals(shr4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 1111 | |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1112 | // focus(3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}})) |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 1113 | String shr5 = |
Joachim Bingel | d1a3e71 | 2014-07-16 08:02:05 +0000 | [diff] [blame] | 1114 | "{@type=korap:reference, operation=operation:focus, classRef=[3], operands=[" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1115 | "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1116 | "{@type=korap:span, key=s}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1117 | "{@type=korap:group, operation=operation:class, class=3, classOut=3, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1118 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1119 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1120 | "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1121 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1122 | "{@type=korap:token, wrap={@type=korap:term, foundry=mate, layer=p, key=ADJA, match=match:eq}}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1123 | "{@type=korap:group, operation=operation:class, class=2, classOut=2, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1124 | "{@type=korap:token, wrap={@type=korap:term, foundry=tt, layer=p, key=NN, match=match:eq}}" + |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 1125 | "]}" + |
| 1126 | "]}" + |
| 1127 | "]}" + |
| 1128 | "]}" + |
| 1129 | "]}" + |
Joachim Bingel | 6b52d76 | 2014-09-30 15:29:11 +0000 | [diff] [blame] | 1130 | "], frame=frame:startswith}" + |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 1131 | "]}"; |
Joachim Bingel | f8dfcf8 | 2014-06-25 09:57:44 +0000 | [diff] [blame] | 1132 | ppt = new PoliqarpPlusTree("focus(3:startswith(<s>,{3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}})) "); |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 1133 | map = ppt.getRequestMap().get("query").toString(); |
| 1134 | assertEquals(shr5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 1135 | |
| 1136 | // split(3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}})) |
| 1137 | String shr6 = |
Joachim Bingel | d1a3e71 | 2014-07-16 08:02:05 +0000 | [diff] [blame] | 1138 | "{@type=korap:reference, operation=operation:split, classRef=[3], operands=[" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1139 | "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1140 | "{@type=korap:span, key=s}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1141 | "{@type=korap:group, operation=operation:class, class=3, classOut=3, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1142 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1143 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1144 | "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1145 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1146 | "{@type=korap:token, wrap={@type=korap:term, foundry=mate, layer=p, key=ADJA, match=match:eq}}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1147 | "{@type=korap:group, operation=operation:class, class=2, classOut=2, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1148 | "{@type=korap:token, wrap={@type=korap:term, foundry=tt, layer=p, key=NN, match=match:eq}}" + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 1149 | "]}" + |
| 1150 | "]}" + |
| 1151 | "]}" + |
| 1152 | "]}" + |
| 1153 | "]}" + |
Joachim Bingel | 6b52d76 | 2014-09-30 15:29:11 +0000 | [diff] [blame] | 1154 | "], frame=frame:startswith}" + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 1155 | "]}"; |
| 1156 | ppt = new PoliqarpPlusTree("split(3:startswith(<s>,{3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}})) "); |
| 1157 | map = ppt.getRequestMap().get("query").toString(); |
| 1158 | assertEquals(shr6.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 8c640e4 | 2014-02-07 16:20:47 +0000 | [diff] [blame] | 1159 | |
| 1160 | // split(2|3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}})) |
| 1161 | String shr7 = |
Joachim Bingel | d1a3e71 | 2014-07-16 08:02:05 +0000 | [diff] [blame] | 1162 | "{@type=korap:reference, operation=operation:split, classRef=[2, 3], classRefOp=classRefOp:intersection, operands=[" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1163 | "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1164 | "{@type=korap:span, key=s}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1165 | "{@type=korap:group, operation=operation:class, class=3, classOut=3, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1166 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1167 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1168 | "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1169 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1170 | "{@type=korap:token, wrap={@type=korap:term, foundry=mate, layer=p, key=ADJA, match=match:eq}}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1171 | "{@type=korap:group, operation=operation:class, class=2, classOut=2, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1172 | "{@type=korap:token, wrap={@type=korap:term, foundry=tt, layer=p, key=NN, match=match:eq}}" + |
Joachim Bingel | 8c640e4 | 2014-02-07 16:20:47 +0000 | [diff] [blame] | 1173 | "]}" + |
| 1174 | "]}" + |
| 1175 | "]}" + |
| 1176 | "]}" + |
| 1177 | "]}" + |
Joachim Bingel | 6b52d76 | 2014-09-30 15:29:11 +0000 | [diff] [blame] | 1178 | "], frame=frame:startswith}" + |
Joachim Bingel | 8c640e4 | 2014-02-07 16:20:47 +0000 | [diff] [blame] | 1179 | "]}"; |
| 1180 | ppt = new PoliqarpPlusTree("split(2|3:startswith(<s>,{3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}})) "); |
| 1181 | map = ppt.getRequestMap().get("query").toString(); |
| 1182 | assertEquals(shr7.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 5146ebe | 2014-06-12 08:49:21 +0000 | [diff] [blame] | 1183 | |
| 1184 | |
| 1185 | String shr8 = |
Joachim Bingel | d1a3e71 | 2014-07-16 08:02:05 +0000 | [diff] [blame] | 1186 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | add0fb1 | 2014-06-24 08:54:14 +0000 | [diff] [blame] | 1187 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 4c0c201 | 2014-10-22 09:35:22 +0000 | [diff] [blame] | 1188 | "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1189 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=der, match=match:eq}}" + |
Joachim Bingel | add0fb1 | 2014-06-24 08:54:14 +0000 | [diff] [blame] | 1190 | "]}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1191 | "{@type=korap:group, operation=operation:class, class=1, classOut=1, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1192 | "{@type=korap:token, wrap={@type=korap:term, layer=pos, key=ADJA, match=match:eq}}" + |
Joachim Bingel | 5146ebe | 2014-06-12 08:49:21 +0000 | [diff] [blame] | 1193 | "]}" + |
Joachim Bingel | add0fb1 | 2014-06-24 08:54:14 +0000 | [diff] [blame] | 1194 | "]}" + |
| 1195 | "]}"; |
Joachim Bingel | f8dfcf8 | 2014-06-25 09:57:44 +0000 | [diff] [blame] | 1196 | ppt = new PoliqarpPlusTree("focus(1:{[base=der]}{1:[pos=ADJA]})"); |
Joachim Bingel | add0fb1 | 2014-06-24 08:54:14 +0000 | [diff] [blame] | 1197 | map = ppt.getRequestMap().get("query").toString(); |
| 1198 | assertEquals(shr8.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 5146ebe | 2014-06-12 08:49:21 +0000 | [diff] [blame] | 1199 | |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1200 | } |
| 1201 | |
Joachim Bingel | 23c31ad | 2014-08-11 09:44:46 +0000 | [diff] [blame] | 1202 | @Test |
| 1203 | public void testSubspan() throws QueryException { |
Joachim Bingel | 9bbd4fc | 2014-08-11 14:56:48 +0000 | [diff] [blame] | 1204 | query = "submatch(1,:<s>)"; |
Joachim Bingel | 23c31ad | 2014-08-11 09:44:46 +0000 | [diff] [blame] | 1205 | expected = |
| 1206 | "{@type=korap:reference, operation=operation:focus, operands=[" + |
| 1207 | "{@type=korap:span, key=s}" + |
| 1208 | "], spanRef=[1]" + |
| 1209 | "}"; |
| 1210 | ppt = new PoliqarpPlusTree(query); |
| 1211 | map = ppt.getRequestMap().get("query").toString(); |
| 1212 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1213 | |
Joachim Bingel | 9bbd4fc | 2014-08-11 14:56:48 +0000 | [diff] [blame] | 1214 | query = "submatch(1,4:<s>)"; |
Joachim Bingel | 23c31ad | 2014-08-11 09:44:46 +0000 | [diff] [blame] | 1215 | expected = |
| 1216 | "{@type=korap:reference, operation=operation:focus, operands=[" + |
| 1217 | "{@type=korap:span, key=s}" + |
| 1218 | "], spanRef=[1,4]" + |
| 1219 | "}"; |
| 1220 | ppt = new PoliqarpPlusTree(query); |
| 1221 | map = ppt.getRequestMap().get("query").toString(); |
| 1222 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1223 | |
Joachim Bingel | 9bbd4fc | 2014-08-11 14:56:48 +0000 | [diff] [blame] | 1224 | query = "submatch(1,4:contains(<s>,[base=Haus]))"; |
Joachim Bingel | 23c31ad | 2014-08-11 09:44:46 +0000 | [diff] [blame] | 1225 | expected = |
| 1226 | "{@type=korap:reference, operation=operation:focus, operands=[" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1227 | "{@type=korap:group, operation=operation:position, frames=[frames:contains], operands=[" + |
Joachim Bingel | 23c31ad | 2014-08-11 09:44:46 +0000 | [diff] [blame] | 1228 | "{@type=korap:span, key=s}," + |
| 1229 | "{@type=korap:token, wrap= {@type=korap:term, layer=lemma, key=Haus, match=match:eq}}" + |
Joachim Bingel | 6b52d76 | 2014-09-30 15:29:11 +0000 | [diff] [blame] | 1230 | "], frame=frame:contains}" + |
Joachim Bingel | 23c31ad | 2014-08-11 09:44:46 +0000 | [diff] [blame] | 1231 | "], spanRef=[1,4]" + |
| 1232 | "}"; |
| 1233 | ppt = new PoliqarpPlusTree(query); |
| 1234 | map = ppt.getRequestMap().get("query").toString(); |
| 1235 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1236 | } |
| 1237 | |
| 1238 | @Test |
| 1239 | public void testRelations() throws QueryException { |
| 1240 | query = "relatesTo(<s>,<np>)"; |
| 1241 | expected = |
| 1242 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 1243 | "{@type=korap:span, key=s}," + |
| 1244 | "{@type=korap:span, key=np}" + |
| 1245 | "], relation={@type=korap:relation}" + |
| 1246 | "}"; |
| 1247 | ppt = new PoliqarpPlusTree(query); |
| 1248 | map = ppt.getRequestMap().get("query").toString(); |
| 1249 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1250 | |
| 1251 | query = "relatesTo([base=Baum],<np>)"; |
| 1252 | expected = |
| 1253 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 1254 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Baum, match=match:eq}}," + |
| 1255 | "{@type=korap:span, key=np}" + |
| 1256 | "], relation={@type=korap:relation}" + |
| 1257 | "}"; |
| 1258 | ppt = new PoliqarpPlusTree(query); |
| 1259 | map = ppt.getRequestMap().get("query").toString(); |
| 1260 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1261 | |
| 1262 | query = "dominates(<np>,[base=Baum])"; |
| 1263 | expected = |
| 1264 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 1265 | "{@type=korap:span, key=np}," + |
| 1266 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Baum, match=match:eq}}" + |
| 1267 | "], relation={@type=korap:relation, layer=c}" + |
| 1268 | "}"; |
| 1269 | ppt = new PoliqarpPlusTree(query); |
| 1270 | map = ppt.getRequestMap().get("query").toString(); |
| 1271 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1272 | |
| 1273 | query = "dominates(cnx/c:<np>,[base=Baum])"; |
| 1274 | expected = |
| 1275 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 1276 | "{@type=korap:span, key=np}," + |
| 1277 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Baum, match=match:eq}}" + |
| 1278 | "], relation={@type=korap:relation, layer=c, foundry=cnx}" + |
| 1279 | "}"; |
| 1280 | ppt = new PoliqarpPlusTree(query); |
| 1281 | map = ppt.getRequestMap().get("query").toString(); |
| 1282 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1283 | |
| 1284 | query = "dominates(cnx/c*:<np>,[base=Baum])"; |
| 1285 | expected = |
| 1286 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 1287 | "{@type=korap:span, key=np}," + |
| 1288 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Baum, match=match:eq}}" + |
| 1289 | "], relation={@type=korap:relation, layer=c, foundry=cnx, boundary={@type=korap:boundary, min=0}}" + |
| 1290 | "}"; |
| 1291 | ppt = new PoliqarpPlusTree(query); |
| 1292 | map = ppt.getRequestMap().get("query").toString(); |
| 1293 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1294 | |
| 1295 | query = "dominates(cnx/c{1,5}:<np>,[base=Baum])"; |
| 1296 | expected = |
| 1297 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 1298 | "{@type=korap:span, key=np}," + |
| 1299 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Baum, match=match:eq}}" + |
| 1300 | "], relation={@type=korap:relation, layer=c, foundry=cnx, boundary={@type=korap:boundary, min=1, max=5}}" + |
| 1301 | "}"; |
| 1302 | ppt = new PoliqarpPlusTree(query); |
| 1303 | map = ppt.getRequestMap().get("query").toString(); |
| 1304 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1305 | |
| 1306 | query = "relatesTo(mate/d=HEAD:<np>,[base=Baum])"; |
| 1307 | expected = |
| 1308 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 1309 | "{@type=korap:span, key=np}," + |
| 1310 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Baum, match=match:eq}}" + |
| 1311 | "], relation={@type=korap:relation, foundry=mate, layer=d, key=HEAD}" + |
| 1312 | "}"; |
| 1313 | ppt = new PoliqarpPlusTree(query); |
| 1314 | map = ppt.getRequestMap().get("query").toString(); |
| 1315 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1316 | |
| 1317 | } |
| 1318 | |
| 1319 | |
Joachim Bingel | 0388270 | 2013-12-31 19:53:05 +0000 | [diff] [blame] | 1320 | |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1321 | @Test |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 1322 | public void testFoundries() throws QueryException { |
| 1323 | // [tt/base=Mann] |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1324 | String layer1 = "{@type=korap:token, wrap={@type=korap:term, foundry=tt, layer=lemma, key=Mann, match=match:eq}}"; |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 1325 | ppt = new PoliqarpPlusTree("[tt/base=Mann]"); |
| 1326 | map = ppt.getRequestMap().get("query").toString(); |
| 1327 | assertEquals(layer1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1328 | |
| 1329 | } |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 1330 | |
| 1331 | @Test |
Joachim Bingel | 8c640e4 | 2014-02-07 16:20:47 +0000 | [diff] [blame] | 1332 | public void testAlign() throws QueryException { |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 1333 | // [orth=der]^[orth=Mann] |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1334 | query = "[orth=der]^[orth=Mann]"; |
| 1335 | expected = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1336 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1337 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=der, match=match:eq}}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1338 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1339 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mann, match=match:eq}}" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1340 | "]}" + |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 1341 | "]}"; |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1342 | metaExpected = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1343 | "{alignment=129}"; |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1344 | ppt = new PoliqarpPlusTree(query); |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 1345 | map = ppt.getRequestMap().get("query").toString(); |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1346 | metaMap = ppt.getRequestMap().get("meta").toString(); |
| 1347 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1348 | assertEquals(metaExpected.replaceAll(" ", ""), metaMap.replaceAll(" ", "")); |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 1349 | |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 1350 | // [orth=der]^[orth=große][orth=Mann] |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1351 | query = "[orth=der]^[orth=große][orth=Mann]"; |
| 1352 | String expected = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1353 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1354 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=der, match=match:eq}}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1355 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1356 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1357 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=große, match=match:eq}}," + |
| 1358 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mann, match=match:eq}}" + |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 1359 | "]}" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1360 | "]}" + |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 1361 | "]}"; |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1362 | metaExpected = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1363 | "{alignment=129}"; |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 1364 | ppt = new PoliqarpPlusTree(query); |
| 1365 | map = ppt.getRequestMap().get("query").toString(); |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1366 | metaMap = ppt.getRequestMap().get("meta").toString(); |
| 1367 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1368 | assertEquals(metaExpected.replaceAll(" ", ""), metaMap.replaceAll(" ", "")); |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 1369 | |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1370 | query = "([base=a]^[base=b])|[base=c]"; |
| 1371 | expected = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1372 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 1373 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1374 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=a, match=match:eq}}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1375 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1376 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=b, match=match:eq}}" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1377 | "]}" + |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 1378 | "]}," + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1379 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=c, match=match:eq}}" + |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 1380 | "]}"; |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1381 | metaExpected = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1382 | "{alignment=129}"; |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1383 | ppt = new PoliqarpPlusTree(query); |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 1384 | map = ppt.getRequestMap().get("query").toString(); |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1385 | metaMap = ppt.getRequestMap().get("meta").toString(); |
| 1386 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1387 | assertEquals(metaExpected.replaceAll(" ", ""), metaMap.replaceAll(" ", "")); |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 1388 | |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1389 | query = "([base=a]^[base=b][base=c])|[base=d]"; |
| 1390 | expected = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1391 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 1392 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1393 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=a, match=match:eq}}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1394 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1395 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1396 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=b, match=match:eq}}," + |
| 1397 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=c, match=match:eq}}" + |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 1398 | "]}" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1399 | "]}" + |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 1400 | "]}," + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1401 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=d, match=match:eq}}" + |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 1402 | "]}"; |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1403 | metaExpected = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1404 | "{alignment=129}"; |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1405 | ppt = new PoliqarpPlusTree(query); |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 1406 | map = ppt.getRequestMap().get("query").toString(); |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1407 | metaMap = ppt.getRequestMap().get("meta").toString(); |
| 1408 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1409 | assertEquals(metaExpected.replaceAll(" ", ""), metaMap.replaceAll(" ", "")); |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 1410 | |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1411 | query = "([base=a]^[base=b]^[base=c])|[base=d]"; |
| 1412 | expected = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1413 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 1414 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1415 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=a, match=match:eq}}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1416 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1417 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1418 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=b, match=match:eq}}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1419 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1420 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=c, match=match:eq}}" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1421 | "]}" + |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 1422 | "]}" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1423 | "]}" + |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 1424 | "]}," + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1425 | "{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=d, match=match:eq}}" + |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 1426 | "]}"; |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1427 | metaExpected = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1428 | "{alignment=[129,130]}"; |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1429 | ppt = new PoliqarpPlusTree(query); |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 1430 | map = ppt.getRequestMap().get("query").toString(); |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1431 | metaMap = ppt.getRequestMap().get("meta").toString(); |
| 1432 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1433 | assertEquals(metaExpected.replaceAll(" ", ""), metaMap.replaceAll(" ", "")); |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 1434 | |
| 1435 | |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 1436 | } |
| 1437 | |
| 1438 | @Test |
Joachim Bingel | 8c640e4 | 2014-02-07 16:20:47 +0000 | [diff] [blame] | 1439 | public void testSimpleQueries() throws QueryException { |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 1440 | // Baum |
| 1441 | String simple1 = |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1442 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Baum, match=match:eq}}"; |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 1443 | ppt = new PoliqarpPlusTree("Baum"); |
| 1444 | map = ppt.getRequestMap().get("query").toString(); |
| 1445 | assertEquals(simple1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1446 | |
| 1447 | // Baum/i |
| 1448 | String simple1b = |
| 1449 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Baum, match=match:eq, caseInsensitive=true}}"; |
| 1450 | ppt = new PoliqarpPlusTree("Baum/i"); |
| 1451 | map = ppt.getRequestMap().get("query").toString(); |
| 1452 | assertEquals(simple1b.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 1453 | |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 1454 | // Der Baum |
| 1455 | String simple2 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1456 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1457 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Der, match=match:eq}}, " + |
| 1458 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Baum, match=match:eq}}" + |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 1459 | "]}"; |
| 1460 | ppt = new PoliqarpPlusTree("Der Baum"); |
| 1461 | map = ppt.getRequestMap().get("query").toString(); |
| 1462 | assertEquals(simple2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1463 | |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1464 | // Der Baum/i |
| 1465 | String simple2b = |
| 1466 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 1467 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Der, match=match:eq}}, " + |
| 1468 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Baum, match=match:eq, caseInsensitive=true}}" + |
| 1469 | "]}"; |
| 1470 | ppt = new PoliqarpPlusTree("Der Baum/i"); |
| 1471 | map = ppt.getRequestMap().get("query").toString(); |
| 1472 | assertEquals(simple2b.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1473 | |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 1474 | // Der große Baum |
| 1475 | String simple3 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1476 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1477 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Der, match=match:eq}}, " + |
| 1478 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=große, match=match:eq}}, " + |
| 1479 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Baum, match=match:eq}}" + |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 1480 | "]}"; |
| 1481 | ppt = new PoliqarpPlusTree("Der große Baum"); |
| 1482 | map = ppt.getRequestMap().get("query").toString(); |
| 1483 | assertEquals(simple3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1484 | |
| 1485 | // Baum | Stein |
| 1486 | String simple4 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1487 | "{@type=korap:group, operation=operation:or, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1488 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Baum, match=match:eq}}, " + |
| 1489 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Stein, match=match:eq}}" + |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 1490 | "]}"; |
| 1491 | ppt = new PoliqarpPlusTree("Baum | Stein"); |
| 1492 | map = ppt.getRequestMap().get("query").toString(); |
| 1493 | assertEquals(simple4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 1494 | |
| 1495 | // Baum | Stein Haus |
| 1496 | String query = "(Baum | Stein) Haus"; |
| 1497 | String simple5 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1498 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 1499 | "{@type=korap:group, operation=operation:or, operands=[" + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1500 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Baum, match=match:eq}}, " + |
| 1501 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Stein, match=match:eq}}" + |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 1502 | "]}," + |
Joachim Bingel | 0900a89 | 2014-06-30 16:26:21 +0000 | [diff] [blame] | 1503 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Haus, match=match:eq}} " + |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 1504 | "]}"; |
| 1505 | ppt = new PoliqarpPlusTree(query); |
| 1506 | map = ppt.getRequestMap().get("query").toString(); |
| 1507 | assertEquals(simple5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 1508 | } |
Joachim Bingel | b68361c | 2014-10-22 14:15:09 +0000 | [diff] [blame] | 1509 | |
| 1510 | @Test |
| 1511 | public void testUnnecessaryParantheses() throws QueryException { |
| 1512 | String query1, query2; |
| 1513 | PoliqarpPlusTree tree1, tree2; |
| 1514 | |
| 1515 | query1 = "Test"; |
| 1516 | query2 = "(Test)"; |
| 1517 | tree1 = new PoliqarpPlusTree(query1); |
| 1518 | tree2 = new PoliqarpPlusTree(query2); |
| 1519 | assertEquals(tree1.getRequestMap(), tree2.getRequestMap()); |
| 1520 | |
| 1521 | query1 = "pass|fail"; |
| 1522 | query2 = "(pass|fail)"; |
| 1523 | tree1 = new PoliqarpPlusTree(query1); |
| 1524 | tree2 = new PoliqarpPlusTree(query2); |
| 1525 | assertEquals(tree1.getRequestMap(), tree2.getRequestMap()); |
| 1526 | |
| 1527 | query1 = "pass|fail"; |
| 1528 | query2 = "pass|(fail)"; |
| 1529 | tree1 = new PoliqarpPlusTree(query1); |
| 1530 | tree2 = new PoliqarpPlusTree(query2); |
| 1531 | assertEquals(tree1.getRequestMap(), tree2.getRequestMap()); |
| 1532 | |
| 1533 | query1 = "pass|fail"; |
| 1534 | query2 = "(pass|(fail))"; |
| 1535 | tree1 = new PoliqarpPlusTree(query1); |
| 1536 | tree2 = new PoliqarpPlusTree(query2); |
| 1537 | assertEquals(tree1.getRequestMap(), tree2.getRequestMap()); |
| 1538 | |
| 1539 | query1 = "contains(<s>,Mann)"; |
| 1540 | query2 = "contains((<s>),Mann)"; |
| 1541 | tree1 = new PoliqarpPlusTree(query1); |
| 1542 | tree2 = new PoliqarpPlusTree(query2); |
| 1543 | assertEquals(tree1.getRequestMap(), tree2.getRequestMap()); |
| 1544 | } |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 1545 | } |
| 1546 | |