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 | |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 10 | CosmasTree ct; |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 11 | String map; |
| 12 | String query; |
| 13 | |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 14 | |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 15 | @Test |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 16 | public void testContext() throws QueryException { |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 17 | String contextString = "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 18 | ct = new CosmasTree("Test"); |
| 19 | assertEquals(contextString.replaceAll(" ", ""), ct.getRequestMap().get("@context").toString().replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | |
| 23 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 24 | public void testSingleToken() throws QueryException { |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 25 | query="der"; |
| 26 | String single1 = |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 27 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 28 | ct = new CosmasTree(query); |
| 29 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 30 | assertEquals(single1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Michael Hanl | baf1a5e | 2014-05-15 19:51:40 +0000 | [diff] [blame] | 31 | |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 32 | query="Mann"; |
| 33 | String single2 = |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 34 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 35 | ct = new CosmasTree(query); |
| 36 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 37 | assertEquals(single2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 38 | |
| 39 | query="&Mann"; |
| 40 | String single3 = |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 41 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=match:eq}}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 42 | ct = new CosmasTree(query); |
| 43 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 44 | assertEquals(single3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 45 | } |
| 46 | |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 47 | @Test |
Joachim Bingel | 8c640e4 | 2014-02-07 16:20:47 +0000 | [diff] [blame] | 48 | public void testCaseSensitivityFlag() throws QueryException { |
Joachim Bingel | 0207d5e | 2014-02-12 14:18:41 +0000 | [diff] [blame] | 49 | query="$deutscher"; |
| 50 | String cs1 = |
| 51 | "{@type=korap:token, wrap={@type=korap:term, caseInsensitive=true, key=deutscher, layer=orth, match=match:eq}}"; |
| 52 | ct = new CosmasTree(query); |
| 53 | map = ct.getRequestMap().get("query").toString(); |
| 54 | assertEquals(cs1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 55 | |
| 56 | query="$deutscher Bundestag"; |
| 57 | String cs2 = |
| 58 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 59 | "{@type=korap:token, wrap={@type=korap:term, caseInsensitive=true, key=deutscher, layer=orth, match=match:eq}}," + |
| 60 | "{@type=korap:token, wrap={@type=korap:term, key=Bundestag, layer=orth, match=match:eq}}" + |
| 61 | "]}"; |
| 62 | ct = new CosmasTree(query); |
| 63 | map = ct.getRequestMap().get("query").toString(); |
| 64 | assertEquals(cs2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 8c640e4 | 2014-02-07 16:20:47 +0000 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | @Test |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 68 | public void testMORPH() throws QueryException { |
| 69 | query="#MORPH(V)"; |
| 70 | String morph1 = |
Joachim Bingel | 0207d5e | 2014-02-12 14:18:41 +0000 | [diff] [blame] | 71 | "{@type=korap:token, wrap={@type=korap:term, key=V, layer=pos, match=match:eq}}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 72 | ct = new CosmasTree(query); |
| 73 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 74 | assertEquals(morph1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 75 | } |
| 76 | |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 77 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 78 | public void testSequence() throws QueryException { |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 79 | query="der Mann"; |
| 80 | String seq1 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 81 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 82 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 83 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 84 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 85 | ct = new CosmasTree(query); |
| 86 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 87 | assertEquals(seq1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 88 | |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 89 | query="der Mann schläft"; |
| 90 | String seq2 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 91 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 92 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 93 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}," + |
| 94 | "{@type=korap:token, wrap={@type=korap:term, key=schläft, layer=orth, match=match:eq}}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 95 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 96 | ct = new CosmasTree(query); |
| 97 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 98 | assertEquals(seq2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 99 | |
| 100 | query="der Mann schläft lang"; |
| 101 | String seq3 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 102 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 103 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 104 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}," + |
| 105 | "{@type=korap:token, wrap={@type=korap:term, key=schläft, layer=orth, match=match:eq}}," + |
| 106 | "{@type=korap:token, wrap={@type=korap:term, key=lang, layer=orth, match=match:eq}}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 107 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 108 | ct = new CosmasTree(query); |
| 109 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 110 | assertEquals(seq3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | @Test |
| 114 | public void testOPOR() throws QueryException { |
| 115 | query="Sonne oder Mond"; |
| 116 | String disj1 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 117 | "{@type=korap:group, operation=operation:or, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 118 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 119 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 120 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 121 | ct = new CosmasTree(query); |
| 122 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 123 | assertEquals(disj1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 124 | |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 125 | query="(Sonne scheint) oder Mond"; |
| 126 | String disj2 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 127 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 128 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 129 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 130 | "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 131 | "]}," + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 132 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 133 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 134 | ct = new CosmasTree(query); |
| 135 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 136 | assertEquals(disj2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 137 | |
| 138 | query="(Sonne scheint) oder (Mond scheint)"; |
| 139 | String disj3 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 140 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 141 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 142 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 143 | "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 144 | "]}," + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 145 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 146 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}," + |
| 147 | "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 148 | "]}" + |
| 149 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 150 | ct = new CosmasTree(query); |
| 151 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 152 | assertEquals(disj3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 153 | |
| 154 | } |
| 155 | |
| 156 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 157 | public void testOPORAND() throws QueryException { |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 158 | query="(Sonne oder Mond) und scheint"; |
| 159 | String orand1 = |
Joachim Bingel | b7a5979 | 2014-02-14 13:52:29 +0000 | [diff] [blame] | 160 | "{@type=korap:group, operation=operation:sequence, distances=[" + |
| 161 | "{@type=korap:distance, key=t, min=0, max=0}" + |
| 162 | "], operands=[" + |
| 163 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 164 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 165 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 166 | "]}," + |
| 167 | "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 168 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 169 | ct = new CosmasTree(query); |
| 170 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 171 | assertEquals(orand1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 172 | |
| 173 | query="scheint und (Sonne oder Mond)"; |
| 174 | String orand2 = |
Joachim Bingel | b7a5979 | 2014-02-14 13:52:29 +0000 | [diff] [blame] | 175 | "{@type=korap:group, operation=operation:sequence, distances=[" + |
| 176 | "{@type=korap:distance, key=t, min=0, max=0}" + |
| 177 | "], operands=[" + |
| 178 | "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}," + |
| 179 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 180 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 181 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 182 | "]}" + |
| 183 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 184 | ct = new CosmasTree(query); |
| 185 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 186 | assertEquals(orand2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 92f9c9c | 2014-06-25 15:01:17 +0000 | [diff] [blame] | 187 | |
| 188 | query="Regen und scheint und (Sonne oder Mond)"; |
| 189 | String orand3 = |
| 190 | "{@type=korap:group, operation=operation:sequence, distances=[" + |
| 191 | "{@type=korap:distance, key=t, min=0, max=0}" + |
| 192 | "], operands=[" + |
| 193 | "{@type=korap:token, wrap={@type=korap:term, key=Regen, layer=orth, match=match:eq}}," + |
| 194 | "{@type=korap:group, operation=operation:sequence, distances=[" + |
| 195 | "{@type=korap:distance, key=t, min=0, max=0}" + |
| 196 | "], operands=[" + |
| 197 | "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}," + |
| 198 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 199 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 200 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 201 | "]}" + |
| 202 | "]}" + |
| 203 | "]}"; |
| 204 | ct = new CosmasTree(query); |
| 205 | map = ct.getRequestMap().get("query").toString(); |
| 206 | assertEquals(orand3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 210 | public void testOPPROX() throws QueryException { |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 211 | query="Sonne /+w1:4 Mond"; |
| 212 | String prox1 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 213 | "{@type=korap:group, operation=operation:sequence, inOrder=true, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 214 | "distances=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 215 | "{@type=korap:distance, key=w, min=1, max=4}" + |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 216 | "], " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 217 | "operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 218 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 219 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 220 | "]" + |
| 221 | "}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 222 | ct = new CosmasTree(query); |
| 223 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 224 | assertEquals(prox1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 225 | |
| 226 | query="Sonne /+w1:4,s0,p1:3 Mond"; |
| 227 | String prox2 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 228 | "{@type=korap:group, operation=operation:sequence, inOrder=true, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 229 | "distances=[" + |
Joachim Bingel | cd7b725 | 2014-02-13 08:49:14 +0000 | [diff] [blame] | 230 | "{@type=korap:distance, key=w, min=1, max=4}," + |
| 231 | "{@type=korap:distance, key=s, min=0, max=0}," + |
| 232 | "{@type=korap:distance, key=p, min=1, max=3}" + |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 233 | "], " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 234 | "operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 235 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 236 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 237 | "]" + |
| 238 | "}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 239 | ct = new CosmasTree(query); |
| 240 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 241 | assertEquals(prox2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 242 | |
| 243 | query="Sonne %+w1:4,s0,p1:3 Mond"; |
| 244 | String prox3 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 245 | "{@type=korap:group, operation=operation:sequence, inOrder=true, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 246 | "distances=[" + |
Joachim Bingel | cd7b725 | 2014-02-13 08:49:14 +0000 | [diff] [blame] | 247 | "{@type=korap:distance, key=w, min=1, max=4, exclude=true}," + |
| 248 | "{@type=korap:distance, key=s, min=0, max=0, exclude=true}," + |
| 249 | "{@type=korap:distance, key=p, min=1, max=3, exclude=true}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 250 | "], " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 251 | "operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 252 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 253 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 254 | "]" + |
| 255 | "}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 256 | ct = new CosmasTree(query); |
| 257 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 258 | assertEquals(prox3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 259 | |
| 260 | query="Sonne /+w4 Mond"; |
| 261 | String prox4 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 262 | "{@type=korap:group, operation=operation:sequence, inOrder=true, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 263 | "distances=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 264 | "{@type=korap:distance, key=w, min=0, max=4}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 265 | "], " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 266 | "operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 267 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 268 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 269 | "]" + |
| 270 | "}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 271 | ct = new CosmasTree(query); |
| 272 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 273 | assertEquals(prox4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 274 | |
| 275 | query="Sonne /-w4 Mond"; |
| 276 | String prox5 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 277 | "{@type=korap:group, operation=operation:sequence, inOrder=true, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 278 | "distances=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 279 | "{@type=korap:distance, key=w, min=0, max=4}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 280 | "], " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 281 | "operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 282 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}," + |
| 283 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 284 | "]" + |
| 285 | "}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 286 | ct = new CosmasTree(query); |
| 287 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 288 | assertEquals(prox5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 289 | } |
| 290 | |
| 291 | @Test |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 292 | public void testOPPROXNested() throws QueryException { |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 293 | query="Sonne /-w4 Mond /+w2 Sterne"; |
| 294 | String prox6 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 295 | "{@type=korap:group, operation=operation:sequence, inOrder=true, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 296 | "distances=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 297 | "{@type=korap:distance, key=w, min=0, max=4}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 298 | "], " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 299 | "operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 300 | "{@type=korap:group, operation=operation:sequence, inOrder=true, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 301 | "distances=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 302 | "{@type=korap:distance, key=w, min=0, max=2}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 303 | "], " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 304 | "operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 305 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}," + |
| 306 | "{@type=korap:token, wrap={@type=korap:term, key=Sterne, layer=orth, match=match:eq}}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 307 | "]}," + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 308 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 309 | "]" + |
| 310 | "}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 311 | ct = new CosmasTree(query); |
| 312 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 313 | assertEquals(prox6.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 314 | } |
| 315 | |
| 316 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 317 | public void testOPIN() throws QueryException { |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 318 | query="wegen #IN <s>"; |
Joachim Bingel | 3a9f793 | 2014-01-07 17:11:31 +0000 | [diff] [blame] | 319 | String opin1 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame^] | 320 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 321 | "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" + |
| 322 | "{@type=korap:span, key=s}," + |
| 323 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 324 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 325 | "]}" + |
| 326 | "]}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 327 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 328 | ct = new CosmasTree(query); |
| 329 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 330 | assertEquals(opin1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 331 | |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 332 | query="wegen #IN(L) <s>"; |
| 333 | String opin2 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame^] | 334 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 335 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
| 336 | "{@type=korap:span, key=s}," + |
| 337 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 338 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 339 | "]}" + |
| 340 | "]}" + |
| 341 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 342 | ct = new CosmasTree(query); |
| 343 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 344 | assertEquals(opin2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 345 | |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 346 | query="wegen #IN(%, L) <s>"; |
| 347 | String opin3 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame^] | 348 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 349 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 350 | "{@type=korap:span, key=s}," + |
| 351 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 352 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 353 | "]}" + |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame^] | 354 | "], exclude=true}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 355 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 356 | ct = new CosmasTree(query); |
| 357 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 358 | assertEquals(opin3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 359 | |
| 360 | query="wegen #IN('FE,ALL,%,MIN') <s>"; |
| 361 | String opin4 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame^] | 362 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 363 | "{@type=korap:group, operation=operation:position, frame=frame:matches, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 364 | "{@type=korap:span, key=s}," + |
| 365 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 366 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 367 | "]}" + |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame^] | 368 | "], range=all, exclude=true, grouping=false}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 369 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 370 | ct = new CosmasTree(query); |
| 371 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 372 | assertEquals(opin4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 373 | } |
| 374 | |
| 375 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 376 | public void testOPOV() throws QueryException { |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 377 | query="wegen #OV <s>"; |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 378 | String opov1 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame^] | 379 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 380 | "{@type=korap:group, operation=operation:position, frame=frame:overlaps, operands=[" + |
| 381 | "{@type=korap:span, key=s}," + |
| 382 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 383 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 384 | "]}" + |
| 385 | "]}" + |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 386 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 387 | ct = new CosmasTree(query); |
| 388 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 389 | assertEquals(opov1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 390 | |
| 391 | query="wegen #OV(L) <s>"; |
| 392 | String opov2 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame^] | 393 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 394 | "{@type=korap:group, operation=operation:position, frame=frame:overlaps-left, operands=[" + |
| 395 | "{@type=korap:span, key=s}," + |
| 396 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 397 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 398 | "]}" + |
| 399 | "]}" + |
| 400 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 401 | ct = new CosmasTree(query); |
| 402 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 403 | assertEquals(opov2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 404 | } |
| 405 | |
| 406 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 407 | public void testOPNOT() throws QueryException { |
Joachim Bingel | 3a9f793 | 2014-01-07 17:11:31 +0000 | [diff] [blame] | 408 | query="Sonne nicht Mond"; |
| 409 | String opnot1 = |
Joachim Bingel | b7a5979 | 2014-02-14 13:52:29 +0000 | [diff] [blame] | 410 | "{@type=korap:group, operation=operation:sequence, distances=[" + |
| 411 | "{@type=korap:distance, key=t, min=0, max=0, exclude=true}" + |
| 412 | "], operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 413 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 414 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
Joachim Bingel | 3a9f793 | 2014-01-07 17:11:31 +0000 | [diff] [blame] | 415 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 416 | ct = new CosmasTree(query); |
| 417 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 3a9f793 | 2014-01-07 17:11:31 +0000 | [diff] [blame] | 418 | assertEquals(opnot1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 419 | } |
| 420 | |
| 421 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 422 | public void testBEG_END() throws QueryException { |
Joachim Bingel | 3a9f793 | 2014-01-07 17:11:31 +0000 | [diff] [blame] | 423 | // BEG and END operators |
| 424 | // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/links.html |
| 425 | // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/rechts.html |
| 426 | // 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] | 427 | query="#BEG(der /w3:5 Mann)"; |
| 428 | String beg1 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame^] | 429 | "{@type=korap:reference, operation=operation:focus, spanRef=[0,1], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 430 | "{@type=korap:group, operation=operation:sequence, inOrder=false, distances=[" + |
| 431 | "{@type=korap:distance, key=w, min=3, max=5}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 432 | "]," + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 433 | "operands = [" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 434 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 435 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 436 | "]}" + |
| 437 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 438 | ct = new CosmasTree(query); |
| 439 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 440 | assertEquals(beg1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 441 | |
| 442 | query="#BEG(der /w3:5 Mann) /+w10 kommt"; // nesting #BEG() in a distance group |
| 443 | String beg2 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 444 | "{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" + |
| 445 | "{@type=korap:distance, key=w, min=0, max=10}" + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 446 | "], operands=[" + |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame^] | 447 | "{@type=korap:reference, operation=operation:focus, spanRef=[0,1], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 448 | "{@type=korap:group, operation=operation:sequence, inOrder=false, distances=[" + |
| 449 | "{@type=korap:distance, key=w, min=3, max=5}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 450 | "]," + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 451 | "operands = [" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 452 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 453 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 454 | "]}" + |
| 455 | "]}," + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 456 | "{@type=korap:token, wrap={@type=korap:term, key=kommt, layer=orth, match=match:eq}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 457 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 458 | ct = new CosmasTree(query); |
| 459 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 460 | assertEquals(beg2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 461 | |
| 462 | query="#END(der /w3:5 Mann)"; |
| 463 | String end1 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame^] | 464 | "{@type=korap:reference, operation=operation:focus, spanRef=[-1,1], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 465 | "{@type=korap:group, operation=operation:sequence, inOrder=false, distances=[" + |
| 466 | "{@type=korap:distance, key=w, min=3, max=5}" + |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 467 | "], " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 468 | "operands = [" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 469 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 470 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 471 | "]}" + |
| 472 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 473 | ct = new CosmasTree(query); |
| 474 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 475 | assertEquals(end1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 476 | } |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 477 | |
| 478 | |
| 479 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 480 | public void testELEM() throws QueryException { |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 481 | // 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] | 482 | query="#ELEM(S)"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 483 | String elem1 = "{@type=korap:span, key=s}"; |
| 484 | ct = new CosmasTree(query); |
| 485 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 486 | assertEquals(elem1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 487 | |
| 488 | query="#ELEM(W ANA=N)"; |
| 489 | String elem2 = |
| 490 | "{@type=korap:span, key=w, attr=" + |
| 491 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
| 492 | "{@type=korap:term, layer=pos, key=N, match=match:eq}" + |
| 493 | "]}" + |
| 494 | "}"; |
| 495 | ct = new CosmasTree(query); |
| 496 | map = ct.getRequestMap().get("query").toString(); |
| 497 | assertEquals(elem2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 498 | |
| 499 | query="#ELEM(W ANA != 'N V')"; |
| 500 | String elem3 = |
| 501 | "{@type=korap:span, key=w, attr=" + |
| 502 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
Joachim Bingel | b674cca | 2014-05-09 14:00:58 +0000 | [diff] [blame] | 503 | "{@type=korap:term, layer=pos, key=N, match=match:ne}," + |
| 504 | "{@type=korap:term, layer=pos, key=V, match=match:ne}" + |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 505 | "]}" + |
| 506 | "}"; |
| 507 | ct = new CosmasTree(query); |
| 508 | map = ct.getRequestMap().get("query").toString(); |
| 509 | assertEquals(elem3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 510 | |
Joachim Bingel | b674cca | 2014-05-09 14:00:58 +0000 | [diff] [blame] | 511 | query="#ELEM(W ANA != 'N A V' Genre = Sport)"; |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 512 | String elem4 = |
| 513 | "{@type=korap:span, key=w, attr=" + |
| 514 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
| 515 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
Joachim Bingel | b674cca | 2014-05-09 14:00:58 +0000 | [diff] [blame] | 516 | "{@type=korap:term, layer=pos, key=N, match=match:ne}," + |
| 517 | "{@type=korap:term, layer=pos, key=A, match=match:ne}," + |
| 518 | "{@type=korap:term, layer=pos, key=V, match=match:ne}" + |
| 519 | "]}," + |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 520 | "{@type=korap:term, layer=Genre, key=Sport, match=match:eq}" + |
| 521 | "]}" + |
| 522 | "}"; |
| 523 | ct = new CosmasTree(query); |
| 524 | map = ct.getRequestMap().get("query").toString(); |
| 525 | assertEquals(elem4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b674cca | 2014-05-09 14:00:58 +0000 | [diff] [blame] | 526 | |
| 527 | query="#ELEM(W ANA != 'N V' Genre != 'Sport Politik')"; |
| 528 | String elem5 = |
| 529 | "{@type=korap:span, key=w, attr=" + |
| 530 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
| 531 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
| 532 | "{@type=korap:term, layer=pos, key=N, match=match:ne}," + |
| 533 | "{@type=korap:term, layer=pos, key=V, match=match:ne}" + |
| 534 | "]}," + |
| 535 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
| 536 | "{@type=korap:term, layer=Genre, key=Sport, match=match:ne}," + |
| 537 | "{@type=korap:term, layer=Genre, key=Politik, match=match:ne}" + |
| 538 | "]}" + |
| 539 | "]}" + |
| 540 | "}"; |
| 541 | ct = new CosmasTree(query); |
| 542 | map = ct.getRequestMap().get("query").toString(); |
| 543 | assertEquals(elem5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 544 | } |
| 545 | |
| 546 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 547 | public void testOPALL() throws QueryException { |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 548 | query="#ALL(gehen /w1:10 voran)"; |
Joachim Bingel | e98d088 | 2014-01-21 12:58:54 +0000 | [diff] [blame] | 549 | String all1 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 550 | "{@type=korap:group, operation=operation:sequence, inOrder=false, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 551 | "distances=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 552 | "{@type=korap:distance, key=w, min=1, max=10}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 553 | "], " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 554 | "operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 555 | "{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}," + |
| 556 | "{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 557 | "]" + |
| 558 | "}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 559 | ct = new CosmasTree(query); |
| 560 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 561 | assertEquals(all1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 562 | } |
| 563 | |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 564 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 565 | public void testOPNHIT() throws QueryException { |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 566 | query="#NHIT(gehen /w1:10 voran)"; |
| 567 | String nhit1 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame^] | 568 | "{@type=korap:reference, operation=operation:focus, classRef=[1,2], classRefOp=classRefOp:intersection, operands=[" + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 569 | "{@type=korap:group, operation=operation:sequence, inOrder=false, " + |
| 570 | "distances=[" + |
| 571 | "{@type=korap:distance, key=w, min=1, max=10}" + |
| 572 | "], " + |
| 573 | "operands=[" + |
| 574 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 575 | "{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}" + |
| 576 | "]}," + |
| 577 | "{@type=korap:group, operation=operation:class, class=2, operands=[" + |
| 578 | "{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}" + |
| 579 | "]}" + |
| 580 | "]" + |
| 581 | "}" + |
| 582 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 583 | ct = new CosmasTree(query); |
| 584 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 585 | assertEquals(nhit1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 586 | } |
| 587 | |
| 588 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 589 | public void testOPBED() throws QueryException { |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 590 | query = "#BED(der , sa)"; |
| 591 | String bed1 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame^] | 592 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands= [" + |
Joachim Bingel | cd7b725 | 2014-02-13 08:49:14 +0000 | [diff] [blame] | 593 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
| 594 | "{@type=korap:span, key=s}," + |
| 595 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 596 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}" + |
| 597 | "]}" + |
| 598 | "]}" + |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 599 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 600 | ct = new CosmasTree(query); |
| 601 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 602 | assertEquals(bed1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 603 | |
| 604 | query = "#BED(der Mann , +pe)"; |
| 605 | String bed2 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame^] | 606 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands= [" + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 607 | "{@type=korap:group, operation=operation:position, frame=frame:endswith, operands=[" + |
| 608 | "{@type=korap:span, key=p}," + |
| 609 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 610 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 611 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 612 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 613 | "]}" + |
| 614 | "]}" + |
| 615 | "]}" + |
| 616 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 617 | ct = new CosmasTree(query); |
| 618 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 619 | assertEquals(bed2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 620 | |
| 621 | query = "#BED(der Mann , sa,-pa)"; |
| 622 | String bed3 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame^] | 623 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 624 | "{@type=korap:group, operation=operation:sequence, distances=[" + |
| 625 | "{@type=korap:distance, key=w, min=0, max=0}" + |
| 626 | "], operands=[" + |
| 627 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
| 628 | "{@type=korap:span, key=s}," + |
| 629 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 630 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 631 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 632 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 633 | "]}" + |
| 634 | "]}" + |
| 635 | "]}," + |
| 636 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, exclude=true, operands=[" + |
| 637 | "{@type=korap:span, key=p}," + |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 638 | "{@type=korap:group, operation=operation:class, class=2, operands=[" + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 639 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 640 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 641 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 642 | "]}" + |
| 643 | "]}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 644 | "]}" + |
| 645 | "]}" + |
| 646 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 647 | ct = new CosmasTree(query); |
| 648 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 649 | assertEquals(bed3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 650 | } |
| 651 | |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 652 | @Test |
| 653 | public void testColonSeparatedConditions() throws QueryException { |
| 654 | |
| 655 | query = "Der:sa"; |
| 656 | String col1 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame^] | 657 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 658 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
| 659 | "{@type=korap:span, key=s}," + |
| 660 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 661 | "{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=match:eq}}" + |
| 662 | "]}" + |
| 663 | "]}" + |
| 664 | "]}"; |
| 665 | ct = new CosmasTree(query); |
| 666 | map = ct.getRequestMap().get("query").toString(); |
| 667 | assertEquals(col1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 668 | |
| 669 | query = "Mann:sa,-pa,+te)"; |
| 670 | String col2 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame^] | 671 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 672 | "{@type=korap:group, operation=operation:sequence, distances=[" + |
| 673 | "{@type=korap:distance, key=w, min=0, max=0}" + |
| 674 | "], operands=[" + |
| 675 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
| 676 | "{@type=korap:span, key=s}," + |
| 677 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 678 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 679 | "]}" + |
| 680 | "]}," + |
| 681 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, exclude=true, operands=[" + |
| 682 | "{@type=korap:span, key=p}," + |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 683 | "{@type=korap:group, operation=operation:class, class=2, operands=[" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 684 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 685 | "]}" + |
| 686 | "]}," + |
| 687 | "{@type=korap:group, operation=operation:position, frame=frame:endswith, operands=[" + |
| 688 | "{@type=korap:span, key=t}," + |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 689 | "{@type=korap:group, operation=operation:class, class=3, operands=[" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 690 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 691 | "]}" + |
| 692 | "]}" + |
| 693 | "]}" + |
| 694 | "]}"; |
| 695 | ct = new CosmasTree(query); |
| 696 | map = ct.getRequestMap().get("query").toString(); |
| 697 | assertEquals(col2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 698 | } |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 699 | } |
| 700 | |