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; |
| 12 | |
| 13 | private boolean equalsContent(String str, Object map) { |
| 14 | str = str.replaceAll(" ", ""); |
| 15 | String mapStr = map.toString().replaceAll(" ", ""); |
| 16 | return str.equals(mapStr); |
| 17 | } |
| 18 | |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 19 | private boolean equalsQueryContent(String res, String query) throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 20 | res = res.replaceAll(" ", ""); |
| 21 | ppt = new PoliqarpPlusTree(query); |
| 22 | String queryMap = ppt.getRequestMap().get("query").toString().replaceAll(" ", ""); |
| 23 | return res.equals(queryMap); |
| 24 | } |
| 25 | |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 26 | // @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 27 | public void testContext() throws QueryException { |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 28 | String contextString = "{korap=http://korap.ids-mannheim.de/ns/query, @language=de, operands={@id=korap:operands, @container=@list}, operation={@id=korap:relation, type=korap:relation#types}, class={@id=korap:class, type=xsd:integer}, query=korap:query, filter=korap:filter, meta=korap:meta}"; |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 29 | ppt = new PoliqarpPlusTree("[base=test]"); |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 30 | // assertTrue(equalsContent(contextString, ppt.getRequestMap().get("@context"))); |
| 31 | assertEquals(contextString, ppt.getRequestMap().get("@context")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 35 | public void testSingleTokens() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 36 | // [base=Mann] |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 37 | String token1 = "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}"; |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 38 | assertTrue(equalsQueryContent(token1, "[base=Mann]")); |
| 39 | |
| 40 | // [orth!=Frau] |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 41 | String token2 = "{type=token, key={type=term, key=Frau, layer=orth, match=ne}}"; |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 42 | assertTrue(equalsQueryContent(token2, "[orth!=Frau]")); |
| 43 | |
| 44 | // [!p=NN] |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 45 | String token3 = "{type=token, key={type=term, key=NN, layer=p, match=ne}}"; |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 46 | assertTrue(equalsQueryContent(token3, "[!p=NN]")); |
| 47 | |
| 48 | // [!p!=NN] |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 49 | String token4 = "{type=token, key={type=term, key=NN, layer=p, match=eq}}"; |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 50 | assertTrue(equalsQueryContent(token4, "[!p!=NN]")); |
| 51 | } |
| 52 | |
| 53 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 54 | public void testElements() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 55 | // <s> |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 56 | String elem1 = "{type=span, key=s}"; |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 57 | assertTrue(equalsQueryContent(elem1, "<s>")); |
| 58 | |
| 59 | // <vp> |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 60 | String elem2 = "{type=span, key=vp}"; |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 61 | assertTrue(equalsQueryContent(elem2, "<vp>")); |
| 62 | } |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 63 | |
| 64 | @Test |
| 65 | public void testEmptyTokens() throws QueryException { |
| 66 | // [base=der][][base=Mann] |
| 67 | String et1 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 68 | "{type=group, operation=sequence, inOrder=true, distances=[" + |
| 69 | "{type=distance, measure=w, min=1, max=1}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 70 | "], " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 71 | "operands=[" + |
| 72 | "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," + |
| 73 | "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 74 | "]}"; |
| 75 | ppt = new PoliqarpPlusTree("[base=der][][base=Mann]"); |
| 76 | map = ppt.getRequestMap().get("query").toString(); |
| 77 | assertEquals(et1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 78 | |
| 79 | // [base=der][][][base=Mann] |
| 80 | String et2 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 81 | "{type=group, operation=sequence, inOrder=true, distances=[" + |
| 82 | "{type=distance, measure=w, min=2, max=2}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 83 | "], " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 84 | "operands=[" + |
| 85 | "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," + |
| 86 | "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 87 | "]}"; |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 88 | ppt = new PoliqarpPlusTree("[base=der][][][base=Mann]"); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 89 | map = ppt.getRequestMap().get("query").toString(); |
| 90 | assertEquals(et2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 91 | |
| 92 | // [base=der][][]?[base=Mann] |
| 93 | String et3 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 94 | "{type=group, operation=sequence, inOrder=true, distances=[" + |
| 95 | "{type=distance, measure=w, min=1, max=2}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 96 | "], " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 97 | "operands=[" + |
| 98 | "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," + |
| 99 | "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 100 | "]}"; |
| 101 | ppt = new PoliqarpPlusTree("[base=der][][]?[base=Mann]"); |
| 102 | map = ppt.getRequestMap().get("query").toString(); |
| 103 | assertEquals(et3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 104 | |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 105 | |
| 106 | // startswith(<s>, [][base=Mann] |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 107 | String et4 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 108 | "{type=group, operation=position, frame=startswith, operands=[" + |
| 109 | "{type=span, key=s}," + |
| 110 | "{type=group, operation=sequence, offset-min=1, offset-max=1, operands=[" + |
| 111 | "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 112 | "]}" + |
| 113 | "]}"; |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 114 | ppt = new PoliqarpPlusTree("startswith(<s>, [][base=Mann])"); |
| 115 | map = ppt.getRequestMap().get("query").toString(); |
| 116 | assertEquals(et4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 117 | |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 118 | // [base=der][]{2,5}[base=Mann][]?[][base=Frau] nested distances= |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 119 | String et5 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 120 | "{type=group, operation=sequence, inOrder=true, distances=[" + |
| 121 | "{type=distance, measure=w, min=2, max=5}" + |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 122 | "], " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 123 | "operands=[" + |
| 124 | "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," + |
| 125 | "{type=group, operation=sequence, inOrder=true, distances=[" + |
| 126 | "{type=distance, measure=w, min=1, max=2}" + |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 127 | "], " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 128 | "operands=[" + |
| 129 | "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}," + |
| 130 | "{type=token, key={type=term, key=Frau, layer=lemma, match=eq}}" + |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 131 | "]}" + |
| 132 | "]}"; |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 133 | ppt = new PoliqarpPlusTree("[base=der][]{2,5}[base=Mann][]?[][base=Frau]"); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 134 | map = ppt.getRequestMap().get("query").toString(); |
| 135 | assertEquals(et5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 136 | |
| 137 | } |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 138 | |
| 139 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 140 | public void testCoordinatedFields() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 141 | // [base=Mann&(cas=N|cas=A)] |
| 142 | String cof1 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 143 | "{type=token, key=" + |
| 144 | "{type=group, operands=[" + |
| 145 | "{type=term, key=Mann, layer=lemma, match=eq}," + |
| 146 | "{type=group, operands=[" + |
| 147 | "{type=term, key=N, layer=cas, match=eq}," + |
| 148 | "{type=term, key=A, layer=cas, match=eq}" + |
| 149 | "], operation=or}" + |
| 150 | "], operation=and}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 151 | "}"; |
| 152 | ppt = new PoliqarpPlusTree("[base=Mann&(cas=N|cas=A)]"); |
| 153 | map = ppt.getRequestMap().get("query").toString(); |
| 154 | assertEquals(cof1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Nils Diewald | 7d486c2 | 2013-12-13 16:32:18 +0000 | [diff] [blame] | 155 | |
| 156 | |
| 157 | assertEquals( |
| 158 | new PoliqarpPlusTree(" [ base=Mann & ( cas=N | cas=A)] ").getRequestMap().get("query").toString(), |
| 159 | new PoliqarpPlusTree("[base=Mann &(cas=N|cas=A)]").getRequestMap().get("query").toString() |
| 160 | ); |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 161 | |
| 162 | // [base=Mann&cas=N&gen=m] |
| 163 | String cof2 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 164 | "{type=token, key=" + |
| 165 | "{type=group, operands=[" + |
| 166 | "{type=term, key=Mann, layer=lemma, match=eq}," + |
| 167 | "{type=term, key=N, layer=cas, match=eq}," + |
| 168 | "{type=term, key=m, layer=gen, match=eq}" + |
| 169 | "], operation=and}" + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 170 | "}"; |
| 171 | ppt = new PoliqarpPlusTree("[base=Mann&cas=N&gen=m]"); |
| 172 | map = ppt.getRequestMap().get("query").toString(); |
| 173 | assertEquals(cof2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 177 | public void testOccurrence() throws QueryException { |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 178 | // [base=foo]* |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 179 | String occ1 = "{type=group, operands=[" + |
| 180 | "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" + |
| 181 | "], operation=repetition, @min=0, @max=100}"; |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 182 | ppt = new PoliqarpPlusTree("[base=foo]*"); |
| 183 | map = ppt.getRequestMap().get("query").toString(); |
| 184 | assertEquals(occ1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 185 | |
| 186 | // [base=foo]*[base=bar] |
| 187 | String occ2 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 188 | "{type=group, operation=sequence, operands=[" + |
| 189 | "{type=group, operands=[" + |
| 190 | "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" + |
| 191 | "], operation=repetition, @min=0, @max=100 }," + |
| 192 | "{type=token, key={type=term, key=bar, layer=lemma, match=eq}}" + |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 193 | "]}"; |
| 194 | ppt = new PoliqarpPlusTree("[base=foo]*[base=bar]"); |
| 195 | map = ppt.getRequestMap().get("query").toString(); |
| 196 | assertEquals(occ2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 197 | |
| 198 | // [base=bar][base=foo]* |
| 199 | String occ3 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 200 | "{type=group, operation=sequence, operands=[" + |
| 201 | "{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," + |
| 202 | "{type=group, operands=[" + |
| 203 | "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" + |
| 204 | "], operation=repetition, @min=0, @max=100 }" + |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 205 | "]}"; |
| 206 | ppt = new PoliqarpPlusTree("[base=bar][base=foo]*"); |
| 207 | map = ppt.getRequestMap().get("query").toString(); |
| 208 | assertEquals(occ3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 209 | |
| 210 | // ([base=bar][base=foo])* |
| 211 | String occ4 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 212 | "{type=group, operands=[" + |
| 213 | "{type=group, operation=sequence, operands=[" + |
| 214 | "{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," + |
| 215 | "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 216 | "]}" + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 217 | "], operation=repetition, @min=0, @max=100 }" ; |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 218 | ppt = new PoliqarpPlusTree("([base=bar][base=foo])*"); |
| 219 | map = ppt.getRequestMap().get("query").toString(); |
| 220 | assertEquals(occ4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 221 | |
| 222 | // <s>([base=bar][base=foo])* |
| 223 | String occ5 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 224 | "{type=group, operation=sequence, operands=[" + |
| 225 | "{type=span, key=s}," + |
| 226 | "{type=group, operands=[" + |
| 227 | "{type=group, operation=sequence, operands=[" + |
| 228 | "{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," + |
| 229 | "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 230 | "]}" + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 231 | "], operation=repetition, @min=0, @max=100 }" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 232 | "]}" ; |
| 233 | ppt = new PoliqarpPlusTree("<s>([base=bar][base=foo])*"); |
| 234 | map = ppt.getRequestMap().get("query").toString(); |
| 235 | assertEquals(occ5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 236 | |
| 237 | // <s><np>([base=bar][base=foo])* |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 238 | String occ6 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 239 | "{type=group, operation=sequence, operands=[" + |
| 240 | "{type=span, key=s}," + |
| 241 | "{type=span, key=np}," + |
| 242 | "{type=group, operands=[" + |
| 243 | "{type=group, operation=sequence, operands=[" + |
| 244 | "{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," + |
| 245 | "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 246 | "]}" + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 247 | "], operation=repetition, @min=0, @max=100 }" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 248 | "]}" ; |
| 249 | ppt = new PoliqarpPlusTree("<s><np>([base=bar][base=foo])*"); |
| 250 | map = ppt.getRequestMap().get("query").toString(); |
| 251 | assertEquals(occ6.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 252 | |
| 253 | // <s><np>([base=bar][base=foo])*[p=NN] |
| 254 | // comment: embedded sequence shouldn't really be here, but does not really hurt, either. (?) |
| 255 | // really hard to get this behaviour out of the PQPlus grammar... |
| 256 | String occ7 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 257 | "{type=group, operation=sequence, operands=[" + |
| 258 | "{type=span, key=s}," + |
| 259 | "{type=span, key=np}," + |
| 260 | "{type=group, operands=[" + |
| 261 | "{type=group, operation=sequence, operands=[" + |
| 262 | "{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," + |
| 263 | "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 264 | "]}" + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 265 | "], operation=repetition, @min=0, @max=100 }," + |
| 266 | "{type=token, key={type=term, key=NN, layer=p, match=eq}}" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 267 | "]}" ; |
| 268 | ppt = new PoliqarpPlusTree("<s><np>([base=bar][base=foo])*[p=NN]"); |
| 269 | map = ppt.getRequestMap().get("query").toString(); |
| 270 | assertEquals(occ7.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 271 | |
| 272 | // ([base=bar][base=foo])*[p=NN] |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 273 | String occ8 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 274 | "{type=group, operation=sequence, operands=[" + |
| 275 | "{type=group, operands=[" + |
| 276 | "{type=group, operation=sequence, operands=[" + |
| 277 | "{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," + |
| 278 | "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 279 | "]}" + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 280 | "], operation=repetition, @min=0, @max=100 }," + |
| 281 | "{type=token, key={type=term, key=NN, layer=p, match=eq}}" + |
Joachim Bingel | b4da702 | 2013-12-09 23:17:24 +0000 | [diff] [blame] | 282 | "]}" ; |
| 283 | ppt = new PoliqarpPlusTree("([base=bar][base=foo])*[p=NN]"); |
| 284 | map = ppt.getRequestMap().get("query").toString(); |
| 285 | assertEquals(occ8.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 286 | |
| 287 | // [base=foo]+ |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 288 | String occ9 = "{type=group, operands=[" + |
| 289 | "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" + |
| 290 | "], operation=repetition, @min=1, @max=100}"; |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 291 | ppt = new PoliqarpPlusTree("[base=foo]+"); |
| 292 | map = ppt.getRequestMap().get("query").toString(); |
| 293 | assertEquals(occ9.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 294 | |
| 295 | // [base=foo]? |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 296 | String occ10 = "{type=group, operands=[" + |
| 297 | "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" + |
| 298 | "], operation=repetition, @min=0, @max=1}"; |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 299 | ppt = new PoliqarpPlusTree("[base=foo]?"); |
| 300 | map = ppt.getRequestMap().get("query").toString(); |
| 301 | assertEquals(occ10.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 302 | |
| 303 | // [base=foo]{2,5} |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 304 | String occ11 = "{type=group, operands=[" + |
| 305 | "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" + |
| 306 | "], operation=repetition, @min=2, @max=5}"; |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 307 | ppt = new PoliqarpPlusTree("[base=foo]{2,5}"); |
| 308 | map = ppt.getRequestMap().get("query").toString(); |
| 309 | assertEquals(occ11.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 310 | } |
| 311 | |
| 312 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 313 | public void testTokenSequence() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 314 | // [base=Mann][orth=Frau] |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 315 | String seq1 = "{type=group, operation=sequence, operands=[" + |
| 316 | "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}, " + |
| 317 | "{type=token, key={type=term, key=Frau, layer=orth, match=eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 318 | "]}"; |
| 319 | assertTrue(equalsQueryContent(seq1, "[base=Mann][orth=Frau]")); |
| 320 | |
| 321 | // [base=Mann][orth=Frau][p=NN] |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 322 | String seq2 = "{type=group, operation=sequence, operands=[" + |
| 323 | "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}, " + |
| 324 | "{type=token, key={type=term, key=Frau, layer=orth, match=eq}}, " + |
| 325 | "{type=token, key={type=term, key=NN,layer=p, match=eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 326 | "]}"; |
| 327 | assertTrue(equalsQueryContent(seq2, "[base=Mann][orth=Frau][p=NN]")); |
| 328 | } |
| 329 | |
| 330 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 331 | public void testDisjSegments() throws QueryException { |
Joachim Bingel | 94a1ccd | 2013-12-10 10:37:29 +0000 | [diff] [blame] | 332 | // ([base=der]|[base=das])[base=Schild] |
| 333 | String disj1 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 334 | "{type=group, operation=sequence, operands=[" + |
| 335 | "{type=group, operation=or, operands=[" + |
| 336 | "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," + |
| 337 | "{type=token, key={type=term, key=das, layer=lemma, match=eq}}" + |
Joachim Bingel | 94a1ccd | 2013-12-10 10:37:29 +0000 | [diff] [blame] | 338 | "]}," + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 339 | "{type=token, key={type=term, key=Schild, layer=lemma, match=eq}}" + |
Joachim Bingel | 94a1ccd | 2013-12-10 10:37:29 +0000 | [diff] [blame] | 340 | "]}"; |
| 341 | ppt = new PoliqarpPlusTree("([base=der]|[base=das])[base=Schild]"); |
| 342 | map = ppt.getRequestMap().get("query").toString(); |
| 343 | assertEquals(disj1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 344 | |
| 345 | // [base=Schild]([base=der]|[base=das]) |
| 346 | String disj2 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 347 | "{type=group, operation=sequence, operands=[" + |
| 348 | "{type=token, key={type=term, key=Schild, layer=lemma, match=eq}}," + |
| 349 | "{type=group, operation=or, operands=[" + |
| 350 | "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," + |
| 351 | "{type=token, key={type=term, key=das, layer=lemma, match=eq}}" + |
Joachim Bingel | 94a1ccd | 2013-12-10 10:37:29 +0000 | [diff] [blame] | 352 | "]}" + |
| 353 | "]}"; |
| 354 | ppt = new PoliqarpPlusTree("[base=Schild]([base=der]|[base=das])"); |
| 355 | map = ppt.getRequestMap().get("query").toString(); |
| 356 | assertEquals(disj2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 357 | } |
| 358 | |
| 359 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 360 | public void testTokenElemSequence() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 361 | // [base=Mann]<vp> |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 362 | String seq1 = "{type=group, operation=sequence, operands=[" + |
| 363 | "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}, " + |
| 364 | "{type=span, key=vp}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 365 | "]}"; |
| 366 | assertTrue(equalsQueryContent(seq1, "[base=Mann]<vp>")); |
| 367 | |
| 368 | // <vp>[base=Mann] |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 369 | String seq2 = "{type=group, operation=sequence, operands=[" + |
| 370 | "{type=span, key=vp}, "+ |
| 371 | "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}} " + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 372 | "]}"; |
| 373 | assertTrue(equalsQueryContent(seq2, "<vp>[base=Mann]")); |
| 374 | |
| 375 | // <vp>[base=Mann]<pp> |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 376 | String seq3 = "{type=group, operation=sequence, operands=[" + |
| 377 | "{type=span, key=vp}, "+ |
| 378 | "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}, " + |
| 379 | "{type=span, key=pp} "+ |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 380 | "]}"; |
| 381 | assertTrue(equalsQueryContent(seq3, "<vp>[base=Mann]<pp>")); |
| 382 | } |
| 383 | |
| 384 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 385 | public void testElemSequence() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 386 | // <np><vp> |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 387 | String seq1 = "{type=group, operation=sequence, operands=[" + |
| 388 | "{type=span, key=np}," + |
| 389 | "{type=span, key=vp}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 390 | "]}"; |
| 391 | assertTrue(equalsQueryContent(seq1, "<np><vp>")); |
| 392 | |
| 393 | // <np><vp><pp> |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 394 | String seq2 = "{type=group, operation=sequence, operands=[" + |
| 395 | "{type=span, key=np}," + |
| 396 | "{type=span, key=vp}," + |
| 397 | "{type=span, key=pp}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 398 | "]}"; |
| 399 | assertTrue(equalsQueryContent(seq2, "<np><vp><pp>")); |
| 400 | } |
| 401 | |
| 402 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 403 | public void testClasses() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 404 | // {[base=Mann]} |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 405 | String cls1 = "{type=group, operation=class, class=0, operands=[" + |
| 406 | "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 407 | "]}"; |
Joachim Bingel | 8c640e4 | 2014-02-07 16:20:47 +0000 | [diff] [blame] | 408 | ppt = new PoliqarpPlusTree("{[base=Mann]}"); |
| 409 | map = ppt.getRequestMap().get("query").toString(); |
| 410 | assertEquals(cls1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 411 | |
| 412 | // {[base=Mann][orth=Frau]} |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 413 | String cls2 = "{type=group, operation=class, class=0, operands=[" + |
| 414 | "{type=group, operation=sequence, operands=[" + |
| 415 | "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}," + |
| 416 | "{type=token, key={type=term, key=Frau, layer=orth, match=eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 417 | "]}" + |
| 418 | "]}"; |
| 419 | assertTrue(equalsQueryContent(cls2, "{[base=Mann][orth=Frau]}")); |
| 420 | |
| 421 | // [p=NN]{[base=Mann][orth=Frau]} |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 422 | String cls3 = "{type=group, operation=sequence, operands=[" + |
| 423 | "{type=token, key={type=term, key=NN, layer=p, match=eq}}," + |
| 424 | "{type=group, operation=class, class=0, operands=[" + |
| 425 | "{type=group, operation=sequence, operands=[" + |
| 426 | "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}," + |
| 427 | "{type=token, key={type=term, key=Frau, layer=orth, match=eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 428 | "]}" + |
| 429 | "]}" + |
| 430 | "]}"; |
| 431 | assertTrue(equalsQueryContent(cls3, "[p=NN]{[base=Mann][orth=Frau]}")); |
| 432 | |
| 433 | // {[base=Mann][orth=Frau]}[p=NN] |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 434 | String cls4 = "{type=group, operation=sequence, operands=[" + |
| 435 | "{type=group, operation=class, class=0, operands=[" + |
| 436 | "{type=group, operation=sequence, operands=[" + |
| 437 | "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}," + |
| 438 | "{type=token, key={type=term, key=Frau, layer=orth, match=eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 439 | "]}" + |
| 440 | "]}," + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 441 | "{type=token, key={type=term, key=NN, layer=p, match=eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 442 | "]}"; |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 443 | ppt = new PoliqarpPlusTree("{[base=Mann][orth=Frau]}[p=NN]"); |
| 444 | map = ppt.getRequestMap().get("query").toString(); |
| 445 | assertEquals(cls4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 446 | |
| 447 | // {2:{1:[tt/p=ADJA]}[mate/p=NN]}" |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 448 | String cls5 = "{type=group, operation=class, class=2, operands=[" + |
| 449 | "{type=group, operation=sequence, operands=[" + |
| 450 | "{type=group, operation=class, class=1, operands=[" + |
| 451 | "{type=token, key={type=term, key=ADJA, layer=p, foundry=tt, match=eq}}" + |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 452 | "]}," + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 453 | "{type=token, key={type=term, key=NN, layer=p, foundry=mate, match=eq}}" + |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 454 | "]}" + |
| 455 | "]}"; |
| 456 | ppt = new PoliqarpPlusTree("{2: {1:[tt/p=ADJA]}[mate/p=NN]}"); |
| 457 | map = ppt.getRequestMap().get("query").toString(); |
| 458 | assertEquals(cls5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 459 | } |
| 460 | |
| 461 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 462 | public void testPositions() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 463 | // contains(<s>,<np>) |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 464 | String pos1 = "{type=group, operation=position, frame=contains, operands=[" + |
| 465 | "{type=span, key=s}," + |
| 466 | "{type=span, key=np}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 467 | "]}"; |
| 468 | assertTrue(equalsQueryContent(pos1, "contains(<s>,<np>)")); |
| 469 | |
| 470 | // contains(<s>,[base=Mann]) |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 471 | String pos2 = "{type=group, operation=position, frame=contains, operands=[" + |
| 472 | "{type=span, key=s}," + |
| 473 | "{type=token, key= {type=term, key=Mann, layer=lemma, match=eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 474 | "]}"; |
| 475 | assertTrue(equalsQueryContent(pos2, "contains(<s>,[base=Mann])")); |
| 476 | |
| 477 | // contains(<s>,[orth=der][orth=Mann]) |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 478 | String pos3 = "{type=group, operation=position, frame=contains, operands=[" + |
| 479 | "{type=span, key=s}," + |
| 480 | "{type=group, operation=sequence, operands=[" + |
| 481 | "{type=token, key={type=term, key=der, layer=orth, match=eq}}," + |
| 482 | "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 483 | "]}" + |
| 484 | "]}"; |
| 485 | ppt = new PoliqarpPlusTree("contains(<s>,[orth=der][orth=Mann])"); |
| 486 | map = ppt.getRequestMap().get("query").toString(); |
| 487 | assertEquals(pos3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 488 | |
| 489 | // [base=Auto]contains(<s>,[base=Mann]) |
| 490 | String pos4 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 491 | "{type=group, operation=sequence, operands=[" + |
| 492 | "{type=token, key={type=term, key=Auto, layer=lemma, match=eq}}," + |
| 493 | "{type=group, operation=position, frame=contains, operands=[" + |
| 494 | "{type=span, key=s}," + |
| 495 | "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 496 | "]}" + |
| 497 | "]}"; |
| 498 | ppt = new PoliqarpPlusTree("[base=Auto]contains(<s>,[base=Mann])"); |
| 499 | map = ppt.getRequestMap().get("query").toString(); |
| 500 | assertEquals(pos4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 501 | } |
| 502 | |
| 503 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 504 | public void testNestedPositions() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 505 | // contains(<s>,startswith(<np>,[orth=Der])) |
| 506 | String npos1 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 507 | "{type=group, operation=position, frame=contains, operands=[" + |
| 508 | "{type=span, key=s}," + |
| 509 | "{type=group, operation=position, frame=startswith, operands=[" + |
| 510 | "{type=span, key=np}," + |
| 511 | "{type=token, key={type=term, key=Der, layer=orth, match=eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 512 | "]}" + |
| 513 | "]}"; |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 514 | ppt = new PoliqarpPlusTree("contains(<s>, startswith(<np>,[orth=Der]))"); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 515 | map = ppt.getRequestMap().get("query").toString(); |
| 516 | assertEquals(npos1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 517 | } |
| 518 | |
| 519 | @Test |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 520 | public void testShrinkSplit() throws QueryException { |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 521 | // shrink([orth=Der]{[orth=Mann]}) |
| 522 | String shr1 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 523 | "{type=group, operation=submatch, classRef=[0], operands=[" + |
| 524 | "{type=group, operation=sequence, operands=[" + |
| 525 | "{type=token, key={type=term, key=Der, layer=orth, match=eq}}," + |
| 526 | "{type=group, operation=class, class=0, operands=[" + |
| 527 | "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 528 | "]}" + |
| 529 | "]}" + |
| 530 | "]}"; |
| 531 | ppt = new PoliqarpPlusTree("shrink([orth=Der]{[orth=Mann]})"); |
| 532 | map = ppt.getRequestMap().get("query").toString(); |
| 533 | assertEquals(shr1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 534 | |
| 535 | // shrink([orth=Der]{[orth=Mann][orth=geht]}) |
| 536 | String shr2 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 537 | "{type=group, operation=submatch, classRef=[0], operands=[" + |
| 538 | "{type=group, operation=sequence, operands=[" + |
| 539 | "{type=token, key={type=term, key=Der, layer=orth, match=eq}}," + |
| 540 | "{type=group, operation=class, class=0, operands=[" + |
| 541 | "{type=group, operation=sequence, operands=[" + |
| 542 | "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}," + |
| 543 | "{type=token, key={type=term, key=geht, layer=orth, match=eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 544 | "]}" + |
| 545 | "]}" + |
| 546 | "]}" + |
| 547 | "]}"; |
| 548 | ppt = new PoliqarpPlusTree("shrink([orth=Der]{[orth=Mann][orth=geht]})"); |
| 549 | map = ppt.getRequestMap().get("query").toString(); |
| 550 | assertEquals(shr2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 551 | |
| 552 | // shrink(1:[orth=Der]{1:[orth=Mann][orth=geht]}) |
| 553 | String shr3 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 554 | "{type=group, operation=submatch, classRef=[1], operands=[" + |
| 555 | "{type=group, operation=sequence, operands=[" + |
| 556 | "{type=token, key={type=term, key=Der, layer=orth, match=eq}}," + |
| 557 | "{type=group, operation=class, class=1, operands=[" + |
| 558 | "{type=group, operation=sequence, operands=[" + |
| 559 | "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}," + |
| 560 | "{type=token, key={type=term, key=geht, layer=orth, match=eq}}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 561 | "]}" + |
| 562 | "]}" + |
| 563 | "]}" + |
| 564 | "]}"; |
| 565 | ppt = new PoliqarpPlusTree("shrink(1:[orth=Der]{1:[orth=Mann][orth=geht]})"); |
| 566 | map = ppt.getRequestMap().get("query").toString(); |
| 567 | assertEquals(shr3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 568 | |
| 569 | // shrink(1:startswith(<s>,{1:<np>})) |
| 570 | String shr4 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 571 | "{type=group, operation=submatch, classRef=[1], operands=[" + |
| 572 | "{type=group, operation=position, frame=startswith, operands=[" + |
| 573 | "{type=span, key=s}," + |
| 574 | "{type=group, operation=class, class=1, operands=[" + |
| 575 | "{type=span, key=np}" + |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 576 | "]}" + |
| 577 | "]}" + |
| 578 | "]}"; |
Joachim Bingel | adefa62 | 2013-12-13 10:51:48 +0000 | [diff] [blame] | 579 | ppt = new PoliqarpPlusTree("shrink(1:startswith(<s>,{1:<np>}))"); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 580 | map = ppt.getRequestMap().get("query").toString(); |
| 581 | assertEquals(shr4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 582 | |
| 583 | // shrink(3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}})) |
| 584 | String shr5 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 585 | "{type=group, operation=submatch, classRef=[3], operands=[" + |
| 586 | "{type=group, operation=position, frame=startswith, operands=[" + |
| 587 | "{type=span, key=s}," + |
| 588 | "{type=group, operation=class, class=3, operands=[" + |
| 589 | "{type=group, operation=sequence, operands=[" + |
| 590 | "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," + |
| 591 | "{type=group, operation=class, class=1, operands=[" + |
| 592 | "{type=group, operation=sequence, operands=[" + |
| 593 | "{type=token, key={type=term, key=ADJA, layer=p, foundry=mate, match=eq}}," + |
| 594 | "{type=group, operation=class, class=2, operands=[" + |
| 595 | "{type=token, key={type=term, key=NN, layer=p, foundry=tt, match=eq}}" + |
Joachim Bingel | cd9ed33 | 2013-12-09 21:01:35 +0000 | [diff] [blame] | 596 | "]}" + |
| 597 | "]}" + |
| 598 | "]}" + |
| 599 | "]}" + |
| 600 | "]}" + |
| 601 | "]}" + |
| 602 | "]}"; |
Joachim Bingel | adefa62 | 2013-12-13 10:51:48 +0000 | [diff] [blame] | 603 | ppt = new PoliqarpPlusTree("shrink(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] | 604 | map = ppt.getRequestMap().get("query").toString(); |
| 605 | assertEquals(shr5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 606 | |
| 607 | // split(3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}})) |
| 608 | String shr6 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 609 | "{type=group, operation=split, classRef=[3], operands=[" + |
| 610 | "{type=group, operation=position, frame=startswith, operands=[" + |
| 611 | "{type=span, key=s}," + |
| 612 | "{type=group, operation=class, class=3, operands=[" + |
| 613 | "{type=group, operation=sequence, operands=[" + |
| 614 | "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," + |
| 615 | "{type=group, operation=class, class=1, operands=[" + |
| 616 | "{type=group, operation=sequence, operands=[" + |
| 617 | "{type=token, key={type=term, key=ADJA, layer=p, foundry=mate, match=eq}}," + |
| 618 | "{type=group, operation=class, class=2, operands=[" + |
| 619 | "{type=token, key={type=term, key=NN, layer=p, foundry=tt, match=eq}}" + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 620 | "]}" + |
| 621 | "]}" + |
| 622 | "]}" + |
| 623 | "]}" + |
| 624 | "]}" + |
| 625 | "]}" + |
| 626 | "]}"; |
| 627 | ppt = new PoliqarpPlusTree("split(3:startswith(<s>,{3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}})) "); |
| 628 | map = ppt.getRequestMap().get("query").toString(); |
| 629 | assertEquals(shr6.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 8c640e4 | 2014-02-07 16:20:47 +0000 | [diff] [blame] | 630 | |
| 631 | // split(2|3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}})) |
| 632 | String shr7 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 633 | "{type=group, operation=split, classRef=[2, 3], classRefOp=intersection, operands=[" + |
| 634 | "{type=group, operation=position, frame=startswith, operands=[" + |
| 635 | "{type=span, key=s}," + |
| 636 | "{type=group, operation=class, class=3, operands=[" + |
| 637 | "{type=group, operation=sequence, operands=[" + |
| 638 | "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," + |
| 639 | "{type=group, operation=class, class=1, operands=[" + |
| 640 | "{type=group, operation=sequence, operands=[" + |
| 641 | "{type=token, key={type=term, key=ADJA, layer=p, foundry=mate, match=eq}}," + |
| 642 | "{type=group, operation=class, class=2, operands=[" + |
| 643 | "{type=token, key={type=term, key=NN, layer=p, foundry=tt, match=eq}}" + |
Joachim Bingel | 8c640e4 | 2014-02-07 16:20:47 +0000 | [diff] [blame] | 644 | "]}" + |
| 645 | "]}" + |
| 646 | "]}" + |
| 647 | "]}" + |
| 648 | "]}" + |
| 649 | "]}" + |
| 650 | "]}"; |
| 651 | ppt = new PoliqarpPlusTree("split(2|3:startswith(<s>,{3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}})) "); |
| 652 | map = ppt.getRequestMap().get("query").toString(); |
| 653 | assertEquals(shr7.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 654 | } |
| 655 | |
Joachim Bingel | 0388270 | 2013-12-31 19:53:05 +0000 | [diff] [blame] | 656 | |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 657 | @Test |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 658 | public void testFoundries() throws QueryException { |
| 659 | // [tt/base=Mann] |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 660 | String layer1 = "{type=token, key={type=term, key=Mann, layer=base, foundry=tt, match=eq}}"; |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 661 | ppt = new PoliqarpPlusTree("[tt/base=Mann]"); |
| 662 | map = ppt.getRequestMap().get("query").toString(); |
| 663 | assertEquals(layer1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 664 | |
| 665 | } |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 666 | |
| 667 | @Test |
Joachim Bingel | 8c640e4 | 2014-02-07 16:20:47 +0000 | [diff] [blame] | 668 | public void testAlign() throws QueryException { |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 669 | // [orth=der]^[orth=Mann] |
| 670 | String align1 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 671 | "{type=group, operation=sequence, operands=[" + |
| 672 | "{type=token, key={type=term, key=der, layer=orth, match=eq}}," + |
| 673 | "{type=group, alignment=left, operands=[" + |
| 674 | "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" + |
Joachim Bingel | 0388270 | 2013-12-31 19:53:05 +0000 | [diff] [blame] | 675 | "]}" + |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 676 | "]}"; |
| 677 | ppt = new PoliqarpPlusTree("[orth=der]^[orth=Mann]"); |
| 678 | map = ppt.getRequestMap().get("query").toString(); |
| 679 | assertEquals(align1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 680 | |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 681 | // [orth=der]^[orth=große][orth=Mann] |
| 682 | String query = "[orth=der]^[orth=große][orth=Mann]"; |
| 683 | String align1b = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 684 | "{type=group, operation=sequence, operands=[" + |
| 685 | "{type=token, key={type=term, key=der, layer=orth, match=eq}}," + |
| 686 | "{type=group, alignment=left, operands=[" + |
| 687 | "{type=group, operation=sequence, operands=[" + |
| 688 | "{type=token, key={type=term, key=große, layer=orth, match=eq}}," + |
| 689 | "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" + |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 690 | "]}" + |
| 691 | "]}" + |
| 692 | "]}"; |
| 693 | ppt = new PoliqarpPlusTree(query); |
| 694 | map = ppt.getRequestMap().get("query").toString(); |
| 695 | assertEquals(align1b.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 696 | |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 697 | // "([base=a]^[base=b])|[base=c]", |
| 698 | String align2 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 699 | "{type=group, operation=or, operands=[" + |
| 700 | "{type=group, operation=sequence, operands=[" + |
| 701 | "{type=token, key={type=term, key=a, layer=lemma, match=eq}}," + |
| 702 | "{type=group, alignment=left, operands=[" + |
| 703 | "{type=token, key={type=term, key=b, layer=lemma, match=eq}}" + |
Joachim Bingel | 0388270 | 2013-12-31 19:53:05 +0000 | [diff] [blame] | 704 | "]}" + |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 705 | "]}," + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 706 | "{type=token, key={type=term, key=c, layer=lemma, match=eq}}" + |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 707 | "]}"; |
| 708 | ppt = new PoliqarpPlusTree("([base=a]^[base=b])|[base=c]"); |
| 709 | map = ppt.getRequestMap().get("query").toString(); |
| 710 | assertEquals(align2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 711 | |
| 712 | // "([base=a]^[base=b][base=c])|[base=d]", |
| 713 | String align3 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 714 | "{type=group, operation=or, operands=[" + |
| 715 | "{type=group, operation=sequence, operands=[" + |
| 716 | "{type=token, key={type=term, key=a, layer=lemma, match=eq}}," + |
| 717 | "{type=group, alignment=left, operands=[" + |
| 718 | "{type=group, operation=sequence, operands=[" + |
| 719 | "{type=token, key={type=term, key=b, layer=lemma, match=eq}}," + |
| 720 | "{type=token, key={type=term, key=c, layer=lemma, match=eq}}" + |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 721 | "]}" + |
| 722 | "]}" + |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 723 | "]}," + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 724 | "{type=token, key={type=term, key=d, layer=lemma, match=eq}}" + |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 725 | "]}"; |
| 726 | ppt = new PoliqarpPlusTree("([base=a]^[base=b][base=c])|[base=d]"); |
| 727 | map = ppt.getRequestMap().get("query").toString(); |
| 728 | assertEquals(align3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 729 | |
| 730 | // "([base=a]^[base=b]^[base=c])|[base=d]", |
| 731 | String align4 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 732 | "{type=group, operation=or, operands=[" + |
| 733 | "{type=group, operation=sequence, operands=[" + |
| 734 | "{type=token, key={type=term, key=a, layer=lemma, match=eq}}," + |
| 735 | "{type=group, alignment=left, operands=[" + |
| 736 | "{type=group, operation=sequence, operands=[" + |
| 737 | "{type=token, key={type=term, key=b, layer=lemma, match=eq}}," + |
| 738 | "{type=group, alignment=left, operands=[" + |
| 739 | "{type=token, key={type=term, key=c, layer=lemma, match=eq}}" + |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 740 | "]}" + |
| 741 | "]}" + |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 742 | "]}" + |
| 743 | "]}," + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 744 | "{type=token, key={type=term, key=d, layer=lemma, match=eq}}" + |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 745 | "]}"; |
| 746 | ppt = new PoliqarpPlusTree("([base=a]^[base=b]^[base=c])|[base=d]"); |
| 747 | map = ppt.getRequestMap().get("query").toString(); |
| 748 | assertEquals(align4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 749 | |
| 750 | |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 751 | } |
| 752 | |
| 753 | @Test |
Joachim Bingel | 8c640e4 | 2014-02-07 16:20:47 +0000 | [diff] [blame] | 754 | public void testSimpleQueries() throws QueryException { |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 755 | // Baum |
| 756 | String simple1 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 757 | "{type=token, key={type=term, key=Baum, layer=orth, match=eq}}"; |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 758 | ppt = new PoliqarpPlusTree("Baum"); |
| 759 | map = ppt.getRequestMap().get("query").toString(); |
| 760 | assertEquals(simple1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 761 | |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 762 | // Der Baum |
| 763 | String simple2 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 764 | "{type=group, operation=sequence, operands=[" + |
| 765 | "{type=token, key={type=term, key=Der, layer=orth, match=eq}}, " + |
| 766 | "{type=token, key={type=term, key=Baum, layer=orth, match=eq}}" + |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 767 | "]}"; |
| 768 | ppt = new PoliqarpPlusTree("Der Baum"); |
| 769 | map = ppt.getRequestMap().get("query").toString(); |
| 770 | assertEquals(simple2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 771 | |
| 772 | // Der große Baum |
| 773 | String simple3 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 774 | "{type=group, operation=sequence, operands=[" + |
| 775 | "{type=token, key={type=term, key=Der, layer=orth, match=eq}}, " + |
| 776 | "{type=token, key={type=term, key=große, layer=orth, match=eq}}, " + |
| 777 | "{type=token, key={type=term, key=Baum, layer=orth, match=eq}}" + |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 778 | "]}"; |
| 779 | ppt = new PoliqarpPlusTree("Der große Baum"); |
| 780 | map = ppt.getRequestMap().get("query").toString(); |
| 781 | assertEquals(simple3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 782 | |
| 783 | // Baum | Stein |
| 784 | String simple4 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 785 | "{type=group, operation=or, operands=[" + |
| 786 | "{type=token, key={type=term, key=Baum, layer=orth, match=eq}}, " + |
| 787 | "{type=token, key={type=term, key=Stein, layer=orth, match=eq}}" + |
Joachim Bingel | a67e6a3 | 2014-01-02 18:35:24 +0000 | [diff] [blame] | 788 | "]}"; |
| 789 | ppt = new PoliqarpPlusTree("Baum | Stein"); |
| 790 | map = ppt.getRequestMap().get("query").toString(); |
| 791 | assertEquals(simple4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 792 | |
| 793 | // Baum | Stein Haus |
| 794 | String query = "(Baum | Stein) Haus"; |
| 795 | String simple5 = |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 796 | "{type=group, operation=sequence, operands=[" + |
| 797 | "{type=group, operation=or, operands=[" + |
| 798 | "{type=token, key={type=term, key=Baum, layer=orth, match=eq}}, " + |
| 799 | "{type=token, key={type=term, key=Stein, layer=orth, match=eq}}" + |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 800 | "]}," + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame^] | 801 | "{type=token, key={type=term, key=Haus, layer=orth, match=eq}} " + |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 802 | "]}"; |
| 803 | ppt = new PoliqarpPlusTree(query); |
| 804 | map = ppt.getRequestMap().get("query").toString(); |
| 805 | assertEquals(simple5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 16da4e1 | 2013-12-17 09:48:12 +0000 | [diff] [blame] | 806 | } |
Joachim Bingel | 53333e6 | 2013-12-09 19:25:52 +0000 | [diff] [blame] | 807 | } |
| 808 | |