Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 1 | import static org.junit.Assert.*; |
| 2 | |
| 3 | import org.junit.Test; |
| 4 | |
| 5 | import de.ids_mannheim.korap.query.serialize.CosmasTree; |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 6 | import de.ids_mannheim.korap.util.QueryException; |
| 7 | |
| 8 | public class CosmasTreeTest { |
| 9 | |
| 10 | CosmasTree ppt; |
| 11 | String map; |
| 12 | String query; |
| 13 | |
| 14 | private boolean equalsContent(String str, Object map) { |
| 15 | str = str.replaceAll(" ", ""); |
| 16 | String mapStr = map.toString().replaceAll(" ", ""); |
| 17 | return str.equals(mapStr); |
| 18 | } |
| 19 | |
| 20 | private boolean equalsQueryContent(String res, String query) throws QueryException { |
| 21 | res = res.replaceAll(" ", ""); |
| 22 | ppt = new CosmasTree(query); |
| 23 | String queryMap = ppt.getRequestMap().get("query").toString().replaceAll(" ", ""); |
| 24 | return res.equals(queryMap); |
| 25 | } |
| 26 | |
| 27 | @Test |
| 28 | public void testContext() throws QueryException { |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 29 | String contextString = "{korap=http://korap.ids-mannheim.de/ns/query, @language=de, @operands={@id=korap:operands, @container=@list}, @relation={@id=korap:relation, @type=korap:relation#types}, class={@id=korap:class, @type=xsd:integer}, query=korap:query, filter=korap:filter, meta=korap:meta}"; |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 30 | ppt = new CosmasTree("Test"); |
| 31 | assertTrue(equalsContent(contextString, ppt.getRequestMap().get("@context"))); |
| 32 | } |
| 33 | |
| 34 | |
| 35 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 36 | public void testSingleToken() throws QueryException { |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 37 | query="der"; |
| 38 | String single1 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 39 | "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}"; |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 40 | ppt = new CosmasTree(query); |
| 41 | map = ppt.getRequestMap().get("query").toString(); |
| 42 | assertEquals(single1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 43 | |
| 44 | query="Mann"; |
| 45 | String single2 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 46 | "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}"; |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 47 | ppt = new CosmasTree(query); |
| 48 | map = ppt.getRequestMap().get("query").toString(); |
| 49 | assertEquals(single2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 50 | |
| 51 | query="&Mann"; |
| 52 | String single3 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 53 | "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=lemma, @relation==}}"; |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 54 | ppt = new CosmasTree(query); |
| 55 | map = ppt.getRequestMap().get("query").toString(); |
| 56 | assertEquals(single3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 57 | } |
| 58 | |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 59 | @Test |
Joachim Bingel | 8c640e4 | 2014-02-07 16:20:47 +0000 | [diff] [blame] | 60 | public void testCaseSensitivityFlag() throws QueryException { |
| 61 | //TODO ignorieroperator $ http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/ignorierung.html |
| 62 | } |
| 63 | |
| 64 | @Test |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 65 | public void testMORPH() throws QueryException { |
| 66 | query="#MORPH(V)"; |
| 67 | String morph1 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 68 | "{@type=korap:token, @value={@type=korap:term, @value=V, @relation==}}"; |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 69 | ppt = new CosmasTree(query); |
| 70 | map = ppt.getRequestMap().get("query").toString(); |
| 71 | assertEquals(morph1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 72 | } |
| 73 | |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 74 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 75 | public void testSequence() throws QueryException { |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 76 | query="der Mann"; |
| 77 | String seq1 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 78 | "{@type=korap:sequence, @operands=[" + |
| 79 | "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," + |
| 80 | "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}" + |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 81 | "]}"; |
| 82 | ppt = new CosmasTree(query); |
| 83 | map = ppt.getRequestMap().get("query").toString(); |
| 84 | assertEquals(seq1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 85 | |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 86 | query="der Mann schläft"; |
| 87 | String seq2 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 88 | "{@type=korap:sequence, @operands=[" + |
| 89 | "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," + |
| 90 | "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}," + |
| 91 | "{@type=korap:token, @value={@type=korap:term, @value=schläft, @attr=orth, @relation==}}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 92 | "]}"; |
| 93 | ppt = new CosmasTree(query); |
| 94 | map = ppt.getRequestMap().get("query").toString(); |
| 95 | assertEquals(seq2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 96 | |
| 97 | query="der Mann schläft lang"; |
| 98 | String seq3 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 99 | "{@type=korap:sequence, @operands=[" + |
| 100 | "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," + |
| 101 | "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}," + |
| 102 | "{@type=korap:token, @value={@type=korap:term, @value=schläft, @attr=orth, @relation==}}," + |
| 103 | "{@type=korap:token, @value={@type=korap:term, @value=lang, @attr=orth, @relation==}}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 104 | "]}"; |
| 105 | ppt = new CosmasTree(query); |
| 106 | map = ppt.getRequestMap().get("query").toString(); |
| 107 | assertEquals(seq3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 108 | } |
| 109 | |
| 110 | @Test |
| 111 | public void testOPOR() throws QueryException { |
| 112 | query="Sonne oder Mond"; |
| 113 | String disj1 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 114 | "{@type=korap:group, @relation=or, @operands=[" + |
| 115 | "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," + |
| 116 | "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" + |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 117 | "]}"; |
| 118 | ppt = new CosmasTree(query); |
| 119 | map = ppt.getRequestMap().get("query").toString(); |
| 120 | assertEquals(disj1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 121 | |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 122 | query="(Sonne scheint) oder Mond"; |
| 123 | String disj2 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 124 | "{@type=korap:group, @relation=or, @operands=[" + |
| 125 | "{@type=korap:sequence, @operands=[" + |
| 126 | "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," + |
| 127 | "{@type=korap:token, @value={@type=korap:term, @value=scheint, @attr=orth, @relation==}}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 128 | "]}," + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 129 | "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 130 | "]}"; |
| 131 | ppt = new CosmasTree(query); |
| 132 | map = ppt.getRequestMap().get("query").toString(); |
| 133 | assertEquals(disj2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 134 | |
| 135 | query="(Sonne scheint) oder (Mond scheint)"; |
| 136 | String disj3 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 137 | "{@type=korap:group, @relation=or, @operands=[" + |
| 138 | "{@type=korap:sequence, @operands=[" + |
| 139 | "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," + |
| 140 | "{@type=korap:token, @value={@type=korap:term, @value=scheint, @attr=orth, @relation==}}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 141 | "]}," + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 142 | "{@type=korap:sequence, @operands=[" + |
| 143 | "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}," + |
| 144 | "{@type=korap:token, @value={@type=korap:term, @value=scheint, @attr=orth, @relation==}}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 145 | "]}" + |
| 146 | "]}"; |
| 147 | ppt = new CosmasTree(query); |
| 148 | map = ppt.getRequestMap().get("query").toString(); |
| 149 | assertEquals(disj3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 150 | |
| 151 | } |
| 152 | |
| 153 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 154 | public void testOPORAND() throws QueryException { |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 155 | query="(Sonne oder Mond) und scheint"; |
| 156 | String orand1 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 157 | "{@type=korap:group, @relation=and, @operands=[" + |
| 158 | "{@type=korap:group, @relation=or, @operands=[" + |
| 159 | "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," + |
| 160 | "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 161 | "]}," + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 162 | "{@type=korap:token, @value={@type=korap:term, @value=scheint, @attr=orth, @relation==}}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 163 | "]}"; |
| 164 | ppt = new CosmasTree(query); |
| 165 | map = ppt.getRequestMap().get("query").toString(); |
| 166 | assertEquals(orand1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 167 | |
| 168 | query="scheint und (Sonne oder Mond)"; |
| 169 | String orand2 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 170 | "{@type=korap:group, @relation=and, @operands=[" + |
| 171 | "{@type=korap:token, @value={@type=korap:term, @value=scheint, @attr=orth, @relation==}}," + |
| 172 | "{@type=korap:group, @relation=or, @operands=[" + |
| 173 | "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," + |
| 174 | "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 175 | "]}" + |
| 176 | "]}"; |
| 177 | ppt = new CosmasTree(query); |
| 178 | map = ppt.getRequestMap().get("query").toString(); |
| 179 | assertEquals(orand2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 180 | } |
| 181 | |
| 182 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 183 | public void testOPPROX() throws QueryException { |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 184 | query="Sonne /+w1:4 Mond"; |
| 185 | String prox1 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 186 | "{@type=korap:sequence, @inOrder=true, " + |
| 187 | "@constraints=[" + |
| 188 | "{@type=korap:distance, @measure=w, @min=1, @max=4}" + |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 189 | "], " + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 190 | "@operands=[" + |
| 191 | "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," + |
| 192 | "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" + |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 193 | "]" + |
| 194 | "}"; |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 195 | ppt = new CosmasTree(query); |
| 196 | map = ppt.getRequestMap().get("query").toString(); |
| 197 | assertEquals(prox1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 198 | |
| 199 | query="Sonne /+w1:4,s0,p1:3 Mond"; |
| 200 | String prox2 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 201 | "{@type=korap:sequence, @inOrder=true, " + |
| 202 | "@constraints=[" + |
| 203 | "{@type=korap:group, @relation=and, @operands=[" + |
| 204 | "{@type=korap:distance, @measure=w, @min=1, @max=4}," + |
| 205 | "{@type=korap:distance, @measure=s, @min=0, @max=0}," + |
| 206 | "{@type=korap:distance, @measure=p, @min=1, @max=3}" + |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 207 | "]}" + |
| 208 | "], " + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 209 | "@operands=[" + |
| 210 | "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," + |
| 211 | "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" + |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 212 | "]" + |
| 213 | "}"; |
| 214 | ppt = new CosmasTree(query); |
| 215 | map = ppt.getRequestMap().get("query").toString(); |
| 216 | assertEquals(prox2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 217 | |
| 218 | query="Sonne %+w1:4,s0,p1:3 Mond"; |
| 219 | String prox3 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 220 | "{@type=korap:sequence, @inOrder=true, " + |
| 221 | "@constraints=[" + |
| 222 | "{@type=korap:group, @relation=and, @operands=[" + |
| 223 | "{@type=korap:distance, @measure=w, @min=1, @max=4, @exclude=true}," + |
| 224 | "{@type=korap:distance, @measure=s, @min=0, @max=0, @exclude=true}," + |
| 225 | "{@type=korap:distance, @measure=p, @min=1, @max=3, @exclude=true}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 226 | "]}" + |
| 227 | "], " + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 228 | "@operands=[" + |
| 229 | "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," + |
| 230 | "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 231 | "]" + |
| 232 | "}"; |
| 233 | ppt = new CosmasTree(query); |
| 234 | map = ppt.getRequestMap().get("query").toString(); |
| 235 | assertEquals(prox3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 236 | |
| 237 | query="Sonne /+w4 Mond"; |
| 238 | String prox4 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 239 | "{@type=korap:sequence, @inOrder=true, " + |
| 240 | "@constraints=[" + |
| 241 | "{@type=korap:distance, @measure=w, @min=0, @max=4}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 242 | "], " + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 243 | "@operands=[" + |
| 244 | "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," + |
| 245 | "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 246 | "]" + |
| 247 | "}"; |
| 248 | ppt = new CosmasTree(query); |
| 249 | map = ppt.getRequestMap().get("query").toString(); |
| 250 | assertEquals(prox4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 251 | |
| 252 | query="Sonne /-w4 Mond"; |
| 253 | String prox5 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 254 | "{@type=korap:sequence, @inOrder=true, " + |
| 255 | "@constraints=[" + |
| 256 | "{@type=korap:distance, @measure=w, @min=0, @max=4}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 257 | "], " + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 258 | "@operands=[" + |
| 259 | "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}," + |
| 260 | "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 261 | "]" + |
| 262 | "}"; |
| 263 | ppt = new CosmasTree(query); |
| 264 | map = ppt.getRequestMap().get("query").toString(); |
| 265 | assertEquals(prox5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 266 | } |
| 267 | |
| 268 | @Test |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 269 | public void testOPPROXNested() throws QueryException { |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 270 | query="Sonne /-w4 Mond /+w2 Sterne"; |
| 271 | String prox6 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 272 | "{@type=korap:sequence, @inOrder=true, " + |
| 273 | "@constraints=[" + |
| 274 | "{@type=korap:distance, @measure=w, @min=0, @max=4}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 275 | "], " + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 276 | "@operands=[" + |
| 277 | "{@type=korap:sequence, @inOrder=true, " + |
| 278 | "@constraints=[" + |
| 279 | "{@type=korap:distance, @measure=w, @min=0, @max=2}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 280 | "], " + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 281 | "@operands=[" + |
| 282 | "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}," + |
| 283 | "{@type=korap:token, @value={@type=korap:term, @value=Sterne, @attr=orth, @relation==}}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 284 | "]}," + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 285 | "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 286 | "]" + |
| 287 | "}"; |
| 288 | ppt = new CosmasTree(query); |
| 289 | map = ppt.getRequestMap().get("query").toString(); |
| 290 | assertEquals(prox6.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 291 | } |
| 292 | |
| 293 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 294 | public void testOPIN() throws QueryException { |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 295 | query="wegen #IN <s>"; |
Joachim Bingel | 3a9f793 | 2014-01-07 17:11:31 +0000 | [diff] [blame] | 296 | String opin1 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 297 | "{@type=korap:group, @relation=submatch, @classRef=1, @operands=[" + |
| 298 | "{@type=korap:group, @relation=position, @position=contains, @operands=[" + |
| 299 | "{@type=korap:span, @value=s}," + |
| 300 | "{@type=korap:group, class=1, @operands=[" + |
| 301 | "{@type=korap:token, @value={@type=korap:term, @value=wegen, @attr=orth, @relation==}}" + |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 302 | "]}" + |
| 303 | "]}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 304 | "]}"; |
| 305 | ppt = new CosmasTree(query); |
| 306 | map = ppt.getRequestMap().get("query").toString(); |
| 307 | assertEquals(opin1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 308 | |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 309 | query="wegen #IN(L) <s>"; |
| 310 | String opin2 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 311 | "{@type=korap:group, @relation=submatch, @classRef=1, @operands=[" + |
| 312 | "{@type=korap:group, @relation=position, @position=startswith, @operands=[" + |
| 313 | "{@type=korap:span, @value=s}," + |
| 314 | "{@type=korap:group, class=1, @operands=[" + |
| 315 | "{@type=korap:token, @value={@type=korap:term, @value=wegen, @attr=orth, @relation==}}" + |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 316 | "]}" + |
| 317 | "]}" + |
| 318 | "]}"; |
| 319 | ppt = new CosmasTree(query); |
| 320 | map = ppt.getRequestMap().get("query").toString(); |
| 321 | assertEquals(opin2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 322 | |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 323 | query="wegen #IN(%, L) <s>"; |
| 324 | String opin3 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 325 | "{@type=korap:group, @relation=submatch, @classRef=1, @operands=[" + |
| 326 | "{@type=korap:group, @relation=position, @position=startswith, @exclude=true, @operands=[" + |
| 327 | "{@type=korap:span, @value=s}," + |
| 328 | "{@type=korap:group, class=1, @operands=[" + |
| 329 | "{@type=korap:token, @value={@type=korap:term, @value=wegen, @attr=orth, @relation==}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 330 | "]}" + |
| 331 | "]}" + |
| 332 | "]}"; |
| 333 | ppt = new CosmasTree(query); |
| 334 | map = ppt.getRequestMap().get("query").toString(); |
| 335 | assertEquals(opin3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 336 | |
| 337 | query="wegen #IN('FE,ALL,%,MIN') <s>"; |
| 338 | String opin4 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 339 | "{@type=korap:group, @relation=submatch, @classRef=1, @operands=[" + |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 340 | "{@type=korap:group, @relation=position, @position=matches, range=all, @exclude=true, grouping=false, @operands=[" + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 341 | "{@type=korap:span, @value=s}," + |
| 342 | "{@type=korap:group, class=1, @operands=[" + |
| 343 | "{@type=korap:token, @value={@type=korap:term, @value=wegen, @attr=orth, @relation==}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 344 | "]}" + |
| 345 | "]}" + |
| 346 | "]}"; |
| 347 | ppt = new CosmasTree(query); |
| 348 | map = ppt.getRequestMap().get("query").toString(); |
| 349 | assertEquals(opin4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 350 | } |
| 351 | |
| 352 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 353 | public void testOPOV() throws QueryException { |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 354 | query="wegen #OV <s>"; |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 355 | String opov1 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 356 | "{@type=korap:group, @relation=submatch, @classRef=1, @operands=[" + |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 357 | "{@type=korap:group, @relation=position, @position=overlaps, @operands=[" + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 358 | "{@type=korap:span, @value=s}," + |
| 359 | "{@type=korap:group, class=1, @operands=[" + |
| 360 | "{@type=korap:token, @value={@type=korap:term, @value=wegen, @attr=orth, @relation==}}" + |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 361 | "]}" + |
| 362 | "]}" + |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 363 | "]}"; |
| 364 | ppt = new CosmasTree(query); |
| 365 | map = ppt.getRequestMap().get("query").toString(); |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 366 | assertEquals(opov1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 367 | |
| 368 | query="wegen #OV(L) <s>"; |
| 369 | String opov2 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 370 | "{@type=korap:group, @relation=submatch, @classRef=1, @operands=[" + |
Joachim Bingel | 84e33df | 2014-01-31 14:02:46 +0000 | [diff] [blame] | 371 | "{@type=korap:group, @relation=position, @position=overlaps-left, @operands=[" + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 372 | "{@type=korap:span, @value=s}," + |
| 373 | "{@type=korap:group, class=1, @operands=[" + |
| 374 | "{@type=korap:token, @value={@type=korap:term, @value=wegen, @attr=orth, @relation==}}" + |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 375 | "]}" + |
| 376 | "]}" + |
| 377 | "]}"; |
| 378 | ppt = new CosmasTree(query); |
| 379 | map = ppt.getRequestMap().get("query").toString(); |
| 380 | assertEquals(opov2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 381 | } |
| 382 | |
| 383 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 384 | public void testOPNOT() throws QueryException { |
Joachim Bingel | 3a9f793 | 2014-01-07 17:11:31 +0000 | [diff] [blame] | 385 | query="Sonne nicht Mond"; |
| 386 | String opnot1 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 387 | "{@type=korap:group, @relation=not, @operands=[" + |
| 388 | "{@type=korap:token, @value={@type=korap:term, @value=Sonne, @attr=orth, @relation==}}," + |
| 389 | "{@type=korap:token, @value={@type=korap:term, @value=Mond, @attr=orth, @relation==}}" + |
Joachim Bingel | 3a9f793 | 2014-01-07 17:11:31 +0000 | [diff] [blame] | 390 | "]}"; |
| 391 | ppt = new CosmasTree(query); |
| 392 | map = ppt.getRequestMap().get("query").toString(); |
| 393 | assertEquals(opnot1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 394 | } |
| 395 | |
| 396 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 397 | public void testBEG_END() throws QueryException { |
Joachim Bingel | 3a9f793 | 2014-01-07 17:11:31 +0000 | [diff] [blame] | 398 | // BEG and END operators |
| 399 | // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/links.html |
| 400 | // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/rechts.html |
| 401 | // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/thematische-bsp/bsp-satzlaenge.html |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 402 | query="#BEG(der /w3:5 Mann)"; |
| 403 | String beg1 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 404 | "{@type=korap:group, @relation=submatch, @spanRef=[0,1], @operands=[" + |
| 405 | "{@type=korap:sequence, @inOrder=false, @constraints=[" + |
| 406 | "{@type=korap:distance, @measure=w, @min=3, @max=5}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 407 | "]," + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 408 | "@operands = [" + |
| 409 | "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," + |
| 410 | "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 411 | "]}" + |
| 412 | "]}"; |
| 413 | ppt = new CosmasTree(query); |
| 414 | map = ppt.getRequestMap().get("query").toString(); |
| 415 | assertEquals(beg1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 416 | |
| 417 | query="#BEG(der /w3:5 Mann) /+w10 kommt"; // nesting #BEG() in a distance group |
| 418 | String beg2 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 419 | "{@type=korap:sequence, @inOrder=true, @constraints=[" + |
| 420 | "{@type=korap:distance, @measure=w, @min=0, @max=10}" + |
| 421 | "], @operands=[" + |
| 422 | "{@type=korap:group, @relation=submatch, @spanRef=[0,1], @operands=[" + |
| 423 | "{@type=korap:sequence, @inOrder=false, @constraints=[" + |
| 424 | "{@type=korap:distance, @measure=w, @min=3, @max=5}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 425 | "]," + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 426 | "@operands = [" + |
| 427 | "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," + |
| 428 | "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 429 | "]}" + |
| 430 | "]}," + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 431 | "{@type=korap:token, @value={@type=korap:term, @value=kommt, @attr=orth, @relation==}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 432 | "]}"; |
| 433 | ppt = new CosmasTree(query); |
| 434 | map = ppt.getRequestMap().get("query").toString(); |
| 435 | assertEquals(beg2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 436 | |
| 437 | query="#END(der /w3:5 Mann)"; |
| 438 | String end1 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 439 | "{@type=korap:group, @relation=submatch, @spanRef=[-1,1], @operands=[" + |
| 440 | "{@type=korap:sequence, @inOrder=false, @constraints=[" + |
| 441 | "{@type=korap:distance, @measure=w, @min=3, @max=5}" + |
| 442 | "], " + |
| 443 | "@operands = [" + |
| 444 | "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," + |
| 445 | "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 446 | "]}" + |
| 447 | "]}"; |
| 448 | ppt = new CosmasTree(query); |
| 449 | map = ppt.getRequestMap().get("query").toString(); |
| 450 | assertEquals(end1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 451 | } |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 452 | |
| 453 | |
| 454 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 455 | public void testELEM() throws QueryException { |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 456 | // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/elem.html |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 457 | query="#ELEM(S)"; |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 458 | String elem1 = "{@type=korap:span, @value=s}"; |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 459 | ppt = new CosmasTree(query); |
| 460 | map = ppt.getRequestMap().get("query").toString(); |
| 461 | assertEquals(elem1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 462 | } |
| 463 | |
| 464 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 465 | public void testOPALL() throws QueryException { |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 466 | query="#ALL(gehen /w1:10 voran)"; |
Joachim Bingel | e98d088 | 2014-01-21 12:58:54 +0000 | [diff] [blame] | 467 | String all1 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 468 | "{@type=korap:sequence, @inOrder=false, " + |
| 469 | "@constraints=[" + |
| 470 | "{@type=korap:distance, @measure=w, @min=1, @max=10}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 471 | "], " + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 472 | "@operands=[" + |
| 473 | "{@type=korap:token, @value={@type=korap:term, @value=gehen, @attr=orth, @relation==}}," + |
| 474 | "{@type=korap:token, @value={@type=korap:term, @value=voran, @attr=orth, @relation==}}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 475 | "]" + |
| 476 | "}"; |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 477 | ppt = new CosmasTree(query); |
| 478 | map = ppt.getRequestMap().get("query").toString(); |
| 479 | assertEquals(all1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 480 | } |
| 481 | |
Joachim Bingel | 8c640e4 | 2014-02-07 16:20:47 +0000 | [diff] [blame] | 482 | // @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 483 | public void testOPNHIT() throws QueryException { |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 484 | query="#NHIT(gehen /w1:10 voran)"; |
| 485 | String nhit1 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 486 | "{@type=korap:sequence, @inOrder=false, " + |
| 487 | "@constraints=[" + |
| 488 | "{@type=korap:distance, @measure=w, @min=1, @max=10}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 489 | "], " + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 490 | "@operands=[" + |
| 491 | "{@type=korap:token, @value={@type=korap:term, @value=gehen, @attr=orth, @relation==}}," + |
| 492 | "{@type=korap:token, @value={@type=korap:term, @value=voran, @attr=orth, @relation==}}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 493 | "]" + |
| 494 | "}"; |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 495 | ppt = new CosmasTree(query); |
| 496 | map = ppt.getRequestMap().get("query").toString(); |
| 497 | assertEquals(nhit1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 498 | } |
| 499 | |
| 500 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 501 | public void testOPBED() throws QueryException { |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 502 | query = "#BED(der , sa)"; |
| 503 | String bed1 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 504 | "{@type=korap:group, @relation=position, @position=startswith, @operands=[" + |
| 505 | "{@type=korap:span, @value=s}," + |
| 506 | "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}" + |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 507 | "]}"; |
| 508 | ppt = new CosmasTree(query); |
| 509 | map = ppt.getRequestMap().get("query").toString(); |
| 510 | assertEquals(bed1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 511 | |
| 512 | query = "#BED(der Mann , +pe)"; |
| 513 | String bed2 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 514 | "{@type=korap:group, @relation=position, @position=endswith, @operands=[" + |
| 515 | "{@type=korap:span, @value=p}," + |
| 516 | "{@type=korap:sequence, @operands=[" + |
| 517 | "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," + |
| 518 | "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 519 | "]}" + |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 520 | "]}"; |
| 521 | ppt = new CosmasTree(query); |
| 522 | map = ppt.getRequestMap().get("query").toString(); |
| 523 | assertEquals(bed2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 524 | |
| 525 | query = "#BED(der Mann , sa,-pa)"; |
| 526 | String bed3 = |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 527 | "{@type=korap:group, @relation=and, @operands=[" + |
| 528 | "{@type=korap:group, @relation=position, @position=startswith, @operands=[" + |
| 529 | "{@type=korap:span, @value=s}," + |
| 530 | "{@type=korap:sequence, @operands=[" + |
| 531 | "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," + |
| 532 | "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 533 | "]}" + |
| 534 | "]}," + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 535 | "{@type=korap:group, @relation=position, @position=startswith, @exclude=true, @operands=[" + |
| 536 | "{@type=korap:span, @value=p}," + |
| 537 | "{@type=korap:sequence, @operands=[" + |
| 538 | "{@type=korap:token, @value={@type=korap:term, @value=der, @attr=orth, @relation==}}," + |
| 539 | "{@type=korap:token, @value={@type=korap:term, @value=Mann, @attr=orth, @relation==}}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 540 | "]}" + |
| 541 | "]}" + |
| 542 | "]}"; |
| 543 | ppt = new CosmasTree(query); |
| 544 | map = ppt.getRequestMap().get("query").toString(); |
| 545 | assertEquals(bed3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 546 | } |
| 547 | |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 548 | } |
| 549 | |