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; |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 13 | String expected; |
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 | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 213 | "{@type=korap:group, operation=operation:sequence, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 214 | "operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 215 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 216 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 217 | "], inOrder=true, " + |
| 218 | "distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 219 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4}" + |
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 | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 228 | "{@type=korap:group, operation=operation:sequence, " + |
| 229 | "operands=[" + |
| 230 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 231 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 232 | "], inOrder=true, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 233 | "distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 234 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4}," + |
| 235 | "{@type=korap:distance, key=s, boundary={@type=korap:boundary, min=0, max=0}, min=0, max=0}," + |
| 236 | "{@type=korap:distance, key=p, boundary={@type=korap:boundary, min=1, max=3}, min=1, max=3}" + |
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 | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 245 | "{@type=korap:group, operation=operation:sequence, " + |
| 246 | "operands=[" + |
| 247 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 248 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 249 | "], inOrder=true, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 250 | "distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 251 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4, exclude=true}," + |
| 252 | "{@type=korap:distance, key=s, boundary={@type=korap:boundary, min=0, max=0}, min=0, max=0, exclude=true}," + |
| 253 | "{@type=korap:distance, key=p, boundary={@type=korap:boundary, min=1, max=3}, min=1, max=3, exclude=true}" + |
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 | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 258 | // assertEquals(prox3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 259 | |
| 260 | query="Sonne /+w4 Mond"; |
| 261 | String prox4 = |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 262 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 263 | "{@type=korap:group, operation=operation:position, frame=frame:overlaps, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 264 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 265 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 266 | "]}," + |
| 267 | "{@type=korap:group, operation=operation:sequence, " + |
| 268 | "operands=[" + |
| 269 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 270 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 271 | "], inOrder=true, " + |
| 272 | "distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 273 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4}" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 274 | "]" + |
| 275 | "}" + |
| 276 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 277 | ct = new CosmasTree(query); |
| 278 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 279 | assertEquals(prox4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 280 | |
| 281 | query="Sonne /-w4 Mond"; |
| 282 | String prox5 = |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 283 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 284 | "{@type=korap:group, operation=operation:position, frame=frame:overlaps, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 285 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}," + |
| 286 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 287 | "]}," + |
| 288 | "{@type=korap:group, operation=operation:sequence, " + |
| 289 | "operands=[" + |
| 290 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}," + |
| 291 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 292 | "], inOrder=true, " + |
| 293 | "distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 294 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4}" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 295 | "]" + |
| 296 | "}" + |
| 297 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 298 | ct = new CosmasTree(query); |
| 299 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 300 | assertEquals(prox5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 301 | |
| 302 | query="Sonne /w4 Mond"; |
| 303 | String prox6 = |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 304 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 305 | "{@type=korap:group, operation=operation:position, frame=frame:overlaps, operands=[" + |
| 306 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 307 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 308 | "]}," + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 309 | "{@type=korap:group, operation=operation:sequence, " + |
| 310 | "operands=[" + |
| 311 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 312 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 313 | "], inOrder=false, " + |
| 314 | "distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 315 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4}" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 316 | "]" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 317 | "}" + |
| 318 | "]}"; |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 319 | ct = new CosmasTree(query); |
| 320 | map = ct.getRequestMap().get("query").toString(); |
| 321 | assertEquals(prox6.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 322 | } |
| 323 | |
| 324 | @Test |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 325 | public void testOPPROXNested() throws QueryException { |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 326 | query="Sonne /-w4 Mond /+w2 Sterne"; |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 327 | |
| 328 | String mondsterne = |
| 329 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}," + |
| 330 | "{@type=korap:token, wrap={@type=korap:term, key=Sterne, layer=orth, match=match:eq}}" ; |
| 331 | String mondsterneSeq = |
| 332 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 333 | mondsterne + |
| 334 | "], inOrder=true, distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 335 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=2}, min=1, max=2}" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 336 | "]}" ; |
| 337 | String mondsterneOv = |
| 338 | "{@type=korap:group, operation=operation:position, frame=frame:overlaps, operands=[" + |
| 339 | mondsterne + |
| 340 | "]}"; |
| 341 | String mondsterneAll = |
| 342 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 343 | mondsterneOv + "," + mondsterneSeq + |
| 344 | "]}"; |
| 345 | |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 346 | String prox6 = |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 347 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 348 | "{@type=korap:group, operation=operation:position, frame=frame:overlaps, operands=[" + |
| 349 | mondsterneAll + "," + |
| 350 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 351 | "]}," + |
| 352 | "{@type=korap:group, operation=operation:sequence, " + |
| 353 | "operands=[" + |
| 354 | mondsterneAll + "," + |
| 355 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 356 | "], inOrder=true, " + |
| 357 | "distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 358 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4}" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 359 | "]" + |
| 360 | "}" + |
| 361 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 362 | ct = new CosmasTree(query); |
| 363 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 364 | assertEquals(prox6.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 365 | } |
| 366 | |
| 367 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 368 | public void testOPIN() throws QueryException { |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 369 | query="wegen #IN <s>"; |
Joachim Bingel | 3a9f793 | 2014-01-07 17:11:31 +0000 | [diff] [blame] | 370 | String opin1 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 371 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 372 | "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" + |
| 373 | "{@type=korap:span, key=s}," + |
| 374 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 375 | "{@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] | 376 | "]}" + |
| 377 | "]}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 378 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 379 | ct = new CosmasTree(query); |
| 380 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 381 | assertEquals(opin1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 382 | |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 383 | query="wegen #IN(L) <s>"; //wrap an *excluded* matches-position around a startwith-position constraint in order to |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 384 | String opin2 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 385 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 386 | "{@type=korap:group, operation=operation:position, frame=frame:matches, operands=[" + |
| 387 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 388 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
| 389 | "{@type=korap:group, operation=operation:class, class=2, operands=[" + |
| 390 | "{@type=korap:span, key=s}" + |
| 391 | "]}," + |
| 392 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 393 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 394 | "]}" + |
| 395 | "]}" + |
| 396 | "]}," + |
| 397 | "{@type=korap:reference, operation=operation:focus, classRef=[2]}" + |
| 398 | "], exclude=true}" + |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 399 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 400 | ct = new CosmasTree(query); |
| 401 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 402 | assertEquals(opin2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 403 | |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 404 | |
| 405 | query="wegen #IN(F) <s>"; |
| 406 | String opin3= |
| 407 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 408 | "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" + |
| 409 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 410 | "{@type=korap:group, operation=operation:position, frame=frame:endswith, operands=[" + |
| 411 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 412 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
| 413 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 414 | "{@type=korap:span, key=s}" + |
| 415 | "]}," + |
| 416 | "{@type=korap:group, operation=operation:class, class=2, operands=[" + |
| 417 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 418 | "]}" + |
| 419 | "]}" + |
| 420 | "]}," + |
| 421 | "{@type=korap:reference, operation=operation:focus, classRef=[2]}" + |
| 422 | "]}" + |
| 423 | "]}," + |
| 424 | "{@type=korap:reference, operation=operation:focus, classRef=[2]}" + |
| 425 | "]}" + |
| 426 | "]}" + |
| 427 | ""; |
| 428 | ct = new CosmasTree(query); |
| 429 | map = ct.getRequestMap().get("query").toString(); |
| 430 | assertEquals(opin3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 431 | |
| 432 | query="wegen #IN(FI) <s>"; |
| 433 | String opin4= |
| 434 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 435 | "{@type=korap:group, operation=operation:position, frame=frame:matches, operands=[" + |
| 436 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 437 | "{@type=korap:group, operation=operation:position, frame=frame:endswith, operands=[" + |
| 438 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 439 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
| 440 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 441 | "{@type=korap:span, key=s}" + |
| 442 | "]}," + |
| 443 | "{@type=korap:group, operation=operation:class, class=2, operands=[" + |
| 444 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 445 | "]}" + |
| 446 | "]}" + |
| 447 | "]}," + |
| 448 | "{@type=korap:reference, operation=operation:focus, classRef=[2]}" + |
| 449 | "]}" + |
| 450 | "]}," + |
| 451 | "{@type=korap:reference, operation=operation:focus, classRef=[2]}" + |
| 452 | "], exclude=true}" + |
| 453 | "]}" + |
| 454 | ""; |
| 455 | ct = new CosmasTree(query); |
| 456 | map = ct.getRequestMap().get("query").toString(); |
| 457 | assertEquals(opin4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 458 | |
| 459 | query="wegen #IN(FE) <s>"; |
| 460 | String opin5= |
| 461 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 462 | "{@type=korap:group, operation=operation:position, frame=frame:matches, operands=[" + |
| 463 | "{@type=korap:span, key=s}," + |
| 464 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 465 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 466 | "]}" + |
| 467 | "]}" + |
| 468 | "]}" + |
| 469 | ""; |
| 470 | ct = new CosmasTree(query); |
| 471 | map = ct.getRequestMap().get("query").toString(); |
| 472 | assertEquals(opin5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 473 | |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 474 | query="wegen #IN(%, L) <s>"; |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 475 | String opin6 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 476 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 477 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 478 | "{@type=korap:span, key=s}," + |
| 479 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 480 | "{@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] | 481 | "]}" + |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 482 | "], exclude=true}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 483 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 484 | ct = new CosmasTree(query); |
| 485 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 486 | assertEquals(opin6.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 487 | |
| 488 | query="wegen #IN('FE,ALL,%,MIN') <s>"; |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 489 | String opin7 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 490 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 491 | "{@type=korap:group, operation=operation:position, frame=frame:matches, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 492 | "{@type=korap:span, key=s}," + |
| 493 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 494 | "{@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] | 495 | "]}" + |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 496 | "], range=all, exclude=true, grouping=false}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 497 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 498 | ct = new CosmasTree(query); |
| 499 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 500 | assertEquals(opin7.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 501 | } |
| 502 | |
| 503 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 504 | public void testOPOV() throws QueryException { |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 505 | query="wegen #OV <s>"; |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 506 | String opov1 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 507 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 508 | "{@type=korap:group, operation=operation:position, frame=frame:overlaps, operands=[" + |
| 509 | "{@type=korap:span, key=s}," + |
| 510 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 511 | "{@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] | 512 | "]}" + |
| 513 | "]}" + |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 514 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 515 | ct = new CosmasTree(query); |
| 516 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 517 | assertEquals(opov1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 518 | |
| 519 | query="wegen #OV(L) <s>"; |
| 520 | String opov2 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 521 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 522 | "{@type=korap:group, operation=operation:position, frame=frame:overlapsLeft, operands=[" + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 523 | "{@type=korap:span, key=s}," + |
| 524 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 525 | "{@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] | 526 | "]}" + |
| 527 | "]}" + |
| 528 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 529 | ct = new CosmasTree(query); |
| 530 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 531 | assertEquals(opov2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 532 | |
| 533 | query="wegen #OV(F) <s>"; |
| 534 | String opov3= |
| 535 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 536 | "{@type=korap:group, operation=operation:position, frame=frame:endswith, operands=[" + |
| 537 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 538 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
| 539 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 540 | "{@type=korap:span, key=s}" + |
| 541 | "]}," + |
| 542 | "{@type=korap:group, operation=operation:class, class=2, operands=[" + |
| 543 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 544 | "]}" + |
| 545 | "]}" + |
| 546 | "]}," + |
| 547 | "{@type=korap:reference, operation=operation:focus, classRef=[2]}" + |
| 548 | "]}" + |
| 549 | "]}" + |
| 550 | ""; |
| 551 | ct = new CosmasTree(query); |
| 552 | map = ct.getRequestMap().get("query").toString(); |
| 553 | assertEquals(opov3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 554 | |
| 555 | query="wegen #OV(FI) <s>"; |
| 556 | String opov4= |
| 557 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 558 | "{@type=korap:group, operation=operation:position, frame=frame:matches, operands=[" + |
| 559 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 560 | "{@type=korap:group, operation=operation:position, frame=frame:endswith, operands=[" + |
| 561 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 562 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
| 563 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 564 | "{@type=korap:span, key=s}" + |
| 565 | "]}," + |
| 566 | "{@type=korap:group, operation=operation:class, class=2, operands=[" + |
| 567 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 568 | "]}" + |
| 569 | "]}" + |
| 570 | "]}," + |
| 571 | "{@type=korap:reference, operation=operation:focus, classRef=[2]}" + |
| 572 | "]}" + |
| 573 | "]}," + |
| 574 | "{@type=korap:reference, operation=operation:focus, classRef=[2]}" + |
| 575 | "], exclude=true}" + |
| 576 | "]}" + |
| 577 | ""; |
| 578 | ct = new CosmasTree(query); |
| 579 | map = ct.getRequestMap().get("query").toString(); |
| 580 | assertEquals(opov4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 581 | |
| 582 | query="wegen #OV(FE) <s>"; |
| 583 | String opov5= |
| 584 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 585 | "{@type=korap:group, operation=operation:position, frame=frame:matches, operands=[" + |
| 586 | "{@type=korap:span, key=s}," + |
| 587 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 588 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 589 | "]}" + |
| 590 | "]}" + |
| 591 | "]}" + |
| 592 | ""; |
| 593 | ct = new CosmasTree(query); |
| 594 | map = ct.getRequestMap().get("query").toString(); |
| 595 | assertEquals(opov5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 596 | } |
| 597 | |
| 598 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 599 | public void testOPNOT() throws QueryException { |
Joachim Bingel | 3a9f793 | 2014-01-07 17:11:31 +0000 | [diff] [blame] | 600 | query="Sonne nicht Mond"; |
| 601 | String opnot1 = |
Joachim Bingel | b7a5979 | 2014-02-14 13:52:29 +0000 | [diff] [blame] | 602 | "{@type=korap:group, operation=operation:sequence, distances=[" + |
| 603 | "{@type=korap:distance, key=t, min=0, max=0, exclude=true}" + |
| 604 | "], operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 605 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 606 | "{@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] | 607 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 608 | ct = new CosmasTree(query); |
| 609 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 3a9f793 | 2014-01-07 17:11:31 +0000 | [diff] [blame] | 610 | assertEquals(opnot1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 611 | } |
| 612 | |
| 613 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 614 | public void testBEG_END() throws QueryException { |
Joachim Bingel | 3a9f793 | 2014-01-07 17:11:31 +0000 | [diff] [blame] | 615 | // BEG and END operators |
| 616 | // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/links.html |
| 617 | // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/rechts.html |
| 618 | // 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] | 619 | query="#BEG(der /w3:5 Mann)"; |
| 620 | String beg1 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 621 | "{@type=korap:reference, operation=operation:focus, spanRef=[0,1], operands=[" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 622 | "{@type=korap:group, operation=operation:sequence," + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 623 | "operands = [" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 624 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 625 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 626 | "], inOrder=false, distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 627 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=3, max=5}, min=3, max=5}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 628 | "]}" + |
| 629 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 630 | ct = new CosmasTree(query); |
| 631 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 632 | assertEquals(beg1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 633 | |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 634 | |
| 635 | String dermannSeq = "{@type=korap:group, operation=operation:sequence," + |
| 636 | "operands = [" + |
| 637 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 638 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 639 | "], inOrder=false, distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 640 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=3, max=5}, min=3, max=5}" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 641 | "]}"; |
| 642 | String begDermannSeq = "{@type=korap:reference, operation=operation:focus, spanRef=[0,1], operands=[" + |
| 643 | dermannSeq + |
| 644 | "]}"; |
| 645 | String kommt = "{@type=korap:token, wrap={@type=korap:term, key=kommt, layer=orth, match=match:eq}}"; |
| 646 | |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 647 | query="#BEG(der /w3:5 Mann) /+w10 kommt"; // nesting #BEG() in a distance group |
| 648 | String beg2 = |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 649 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 650 | "{@type=korap:group, operation=operation:position, frame=frame:overlaps, operands=[" + |
| 651 | begDermannSeq + "," + |
| 652 | kommt + |
| 653 | "]}," + |
| 654 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 655 | begDermannSeq + "," + |
| 656 | kommt + |
| 657 | "], inOrder=true, distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 658 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 659 | "]}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 660 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 661 | ct = new CosmasTree(query); |
| 662 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 663 | assertEquals(beg2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 664 | |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 665 | query="kommt /+w10 #BEG(der /w3:5 Mann)"; |
| 666 | String beg3 = |
| 667 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 668 | "{@type=korap:group, operation=operation:position, frame=frame:overlaps, operands=[" + |
| 669 | kommt + "," + |
| 670 | begDermannSeq + |
| 671 | "]}," + |
| 672 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 673 | kommt + "," + |
| 674 | begDermannSeq + |
| 675 | "], inOrder=true, distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 676 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 677 | "]}" + |
| 678 | "]}"; |
| 679 | ct = new CosmasTree(query); |
| 680 | map = ct.getRequestMap().get("query").toString(); |
| 681 | assertEquals(beg3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 682 | |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 683 | query="#END(der /w3:5 Mann)"; |
| 684 | String end1 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 685 | "{@type=korap:reference, operation=operation:focus, spanRef=[-1,1], operands=[" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 686 | "{@type=korap:group, operation=operation:sequence, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 687 | "operands = [" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 688 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 689 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 690 | "], inOrder=false, distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 691 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=3, max=5}, min=3, max=5}" + |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 692 | "]}" + |
| 693 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 694 | ct = new CosmasTree(query); |
| 695 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 696 | assertEquals(end1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 697 | } |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 698 | |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 699 | /* |
| 700 | * YET UNCLEAR HOW TO SERIALIZE SPAN DISTANCES. BEING DISCUSSED. |
| 701 | * |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 702 | @Test |
| 703 | public void testSentenceDistance() throws QueryException { |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 704 | query="Sonne /s0 Mond"; // contains(focus(1:contains({1:<s>},Sonne)),Mond) |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 705 | expected = |
| 706 | "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 707 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 708 | "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 709 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 710 | "{@type=korap:span, key=s}" + |
| 711 | "]}," + |
| 712 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 713 | "]}" + |
| 714 | "]}," + |
| 715 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 716 | "]}"; |
| 717 | ct = new CosmasTree(query); |
| 718 | map = ct.getRequestMap().get("query").toString(); |
| 719 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 720 | |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 721 | query="Sonne /s0,w5 Mond"; |
| 722 | expected = |
| 723 | "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" + |
| 724 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
| 725 | "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" + |
| 726 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 727 | "{@type=korap:span, key=s}" + |
| 728 | "]}," + |
| 729 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 730 | "]}" + |
| 731 | "]}," + |
| 732 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 733 | "]}"; |
| 734 | // ct = new CosmasTree(query); |
| 735 | // map = ct.getRequestMap().get("query").toString(); |
| 736 | // assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 737 | |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 738 | query="Sonne /s2:2 Mond"; // contains(<s>,Sonne)<s>contains(<s>,Mond) |
| 739 | expected = |
| 740 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 741 | "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" + |
| 742 | "{@type=korap:span, key=s}," + |
| 743 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 744 | "]}," + |
| 745 | "{@type=korap:span, key=s}," + |
| 746 | "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" + |
| 747 | "{@type=korap:span, key=s}," + |
| 748 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 749 | "]}" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 750 | "]}"; |
| 751 | ct = new CosmasTree(query); |
| 752 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 753 | // assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 754 | |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 755 | query="Sonne /s2:3 Mond"; // contains(<s>,Sonne)<s>contains(<s>,Mond) |
| 756 | expected = |
| 757 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 758 | "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" + |
| 759 | "{@type=korap:span, key=s}," + |
| 760 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 761 | "]}," + |
| 762 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
| 763 | "{@type=korap:span, key=s}" + |
| 764 | "], boundary={@type=korap:boundary, min=1, max=2}, min=1, max=2}," + |
| 765 | "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" + |
| 766 | "{@type=korap:span, key=s}," + |
| 767 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 768 | "]}" + |
| 769 | "]}"; |
| 770 | ct = new CosmasTree(query); |
| 771 | map = ct.getRequestMap().get("query").toString(); |
| 772 | // assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 773 | |
| 774 | query="Sonne /s2 Mond"; // contains(focus(1:contains({1:<s>},Sonne)),Mond) | contains(<s>,Sonne)<s>?contains(<s>,Mond) |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 775 | expected = |
| 776 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 777 | "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 778 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 779 | "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 780 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 781 | "{@type=korap:span, key=s}" + |
| 782 | "]}," + |
| 783 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 784 | "]}" + |
| 785 | "]}," + |
| 786 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 787 | "]}," + |
| 788 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 789 | "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" + |
| 790 | "{@type=korap:span, key=s}," + |
| 791 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 792 | "]}," + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 793 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
| 794 | "{@type=korap:span, key=s}" + |
| 795 | "], boundary={@type=korap:boundary, min=0, max=1}, min=0, max=1}," + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 796 | "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" + |
| 797 | "{@type=korap:span, key=s}," + |
| 798 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 799 | "]}" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 800 | "]}" + |
| 801 | "]}"; |
| 802 | ct = new CosmasTree(query); |
| 803 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 804 | // assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 805 | } |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 806 | */ |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 807 | |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 808 | |
| 809 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 810 | public void testELEM() throws QueryException { |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 811 | // 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] | 812 | query="#ELEM(S)"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 813 | String elem1 = "{@type=korap:span, key=s}"; |
| 814 | ct = new CosmasTree(query); |
| 815 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 816 | assertEquals(elem1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 817 | |
| 818 | query="#ELEM(W ANA=N)"; |
| 819 | String elem2 = |
| 820 | "{@type=korap:span, key=w, attr=" + |
| 821 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
| 822 | "{@type=korap:term, layer=pos, key=N, match=match:eq}" + |
| 823 | "]}" + |
| 824 | "}"; |
| 825 | ct = new CosmasTree(query); |
| 826 | map = ct.getRequestMap().get("query").toString(); |
| 827 | assertEquals(elem2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 828 | |
| 829 | query="#ELEM(W ANA != 'N V')"; |
| 830 | String elem3 = |
| 831 | "{@type=korap:span, key=w, attr=" + |
| 832 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
Joachim Bingel | b674cca | 2014-05-09 14:00:58 +0000 | [diff] [blame] | 833 | "{@type=korap:term, layer=pos, key=N, match=match:ne}," + |
| 834 | "{@type=korap:term, layer=pos, key=V, match=match:ne}" + |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 835 | "]}" + |
| 836 | "}"; |
| 837 | ct = new CosmasTree(query); |
| 838 | map = ct.getRequestMap().get("query").toString(); |
| 839 | assertEquals(elem3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 840 | |
Joachim Bingel | b674cca | 2014-05-09 14:00:58 +0000 | [diff] [blame] | 841 | query="#ELEM(W ANA != 'N A V' Genre = Sport)"; |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 842 | String elem4 = |
| 843 | "{@type=korap:span, key=w, attr=" + |
| 844 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
| 845 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
Joachim Bingel | b674cca | 2014-05-09 14:00:58 +0000 | [diff] [blame] | 846 | "{@type=korap:term, layer=pos, key=N, match=match:ne}," + |
| 847 | "{@type=korap:term, layer=pos, key=A, match=match:ne}," + |
| 848 | "{@type=korap:term, layer=pos, key=V, match=match:ne}" + |
| 849 | "]}," + |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 850 | "{@type=korap:term, layer=Genre, key=Sport, match=match:eq}" + |
| 851 | "]}" + |
| 852 | "}"; |
| 853 | ct = new CosmasTree(query); |
| 854 | map = ct.getRequestMap().get("query").toString(); |
| 855 | assertEquals(elem4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b674cca | 2014-05-09 14:00:58 +0000 | [diff] [blame] | 856 | |
| 857 | query="#ELEM(W ANA != 'N V' Genre != 'Sport Politik')"; |
| 858 | String elem5 = |
| 859 | "{@type=korap:span, key=w, attr=" + |
| 860 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
| 861 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
| 862 | "{@type=korap:term, layer=pos, key=N, match=match:ne}," + |
| 863 | "{@type=korap:term, layer=pos, key=V, match=match:ne}" + |
| 864 | "]}," + |
| 865 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
| 866 | "{@type=korap:term, layer=Genre, key=Sport, match=match:ne}," + |
| 867 | "{@type=korap:term, layer=Genre, key=Politik, match=match:ne}" + |
| 868 | "]}" + |
| 869 | "]}" + |
| 870 | "}"; |
| 871 | ct = new CosmasTree(query); |
| 872 | map = ct.getRequestMap().get("query").toString(); |
| 873 | assertEquals(elem5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 874 | } |
| 875 | |
| 876 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 877 | public void testOPALL() throws QueryException { |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 878 | query="#ALL(gehen /w1:10 voran)"; |
Joachim Bingel | e98d088 | 2014-01-21 12:58:54 +0000 | [diff] [blame] | 879 | String all1 = |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 880 | "{@type=korap:group, operation=operation:sequence, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 881 | "operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 882 | "{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}," + |
| 883 | "{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 884 | "], inOrder=false, " + |
| 885 | "distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 886 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 887 | "]" + |
| 888 | "}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 889 | ct = new CosmasTree(query); |
| 890 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 891 | assertEquals(all1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 892 | } |
| 893 | |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 894 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 895 | public void testOPNHIT() throws QueryException { |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 896 | query="#NHIT(gehen /w1:10 voran)"; |
| 897 | String nhit1 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 898 | "{@type=korap:reference, operation=operation:focus, classRef=[1,2], classRefOp=classRefOp:intersection, operands=[" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 899 | "{@type=korap:group, operation=operation:sequence, " + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 900 | "operands=[" + |
| 901 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 902 | "{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}" + |
| 903 | "]}," + |
| 904 | "{@type=korap:group, operation=operation:class, class=2, operands=[" + |
| 905 | "{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}" + |
| 906 | "]}" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 907 | "], inOrder=false, " + |
| 908 | "distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame^] | 909 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 910 | "]" + |
| 911 | "}" + |
| 912 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 913 | ct = new CosmasTree(query); |
| 914 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 915 | assertEquals(nhit1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 916 | } |
| 917 | |
| 918 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 919 | public void testOPBED() throws QueryException { |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 920 | query = "#BED(der , sa)"; |
| 921 | String bed1 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 922 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands= [" + |
Joachim Bingel | cd7b725 | 2014-02-13 08:49:14 +0000 | [diff] [blame] | 923 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
| 924 | "{@type=korap:span, key=s}," + |
| 925 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 926 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}" + |
| 927 | "]}" + |
| 928 | "]}" + |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 929 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 930 | ct = new CosmasTree(query); |
| 931 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 932 | assertEquals(bed1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 933 | |
| 934 | query = "#BED(der Mann , +pe)"; |
| 935 | String bed2 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 936 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands= [" + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 937 | "{@type=korap:group, operation=operation:position, frame=frame:endswith, operands=[" + |
| 938 | "{@type=korap:span, key=p}," + |
| 939 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 940 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 941 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 942 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 943 | "]}" + |
| 944 | "]}" + |
| 945 | "]}" + |
| 946 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 947 | ct = new CosmasTree(query); |
| 948 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 949 | assertEquals(bed2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 950 | |
| 951 | query = "#BED(der Mann , sa,-pa)"; |
| 952 | String bed3 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 953 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 954 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 955 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
| 956 | "{@type=korap:span, key=s}," + |
| 957 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 958 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 959 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 960 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 961 | "]}" + |
| 962 | "]}" + |
| 963 | "]}," + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 964 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 965 | "{@type=korap:span, key=p}," + |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 966 | "{@type=korap:group, operation=operation:class, class=2, operands=[" + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 967 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 968 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 969 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 970 | "]}" + |
| 971 | "]}" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 972 | "], exclude=true}" + |
| 973 | "], distances=[" + |
| 974 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=0, max=0}, min=0, max=0}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 975 | "]}" + |
| 976 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 977 | ct = new CosmasTree(query); |
| 978 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 979 | assertEquals(bed3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 980 | } |
| 981 | |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 982 | @Test |
| 983 | public void testColonSeparatedConditions() throws QueryException { |
| 984 | |
| 985 | query = "Der:sa"; |
| 986 | String col1 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 987 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 988 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
| 989 | "{@type=korap:span, key=s}," + |
| 990 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 991 | "{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=match:eq}}" + |
| 992 | "]}" + |
| 993 | "]}" + |
| 994 | "]}"; |
| 995 | ct = new CosmasTree(query); |
| 996 | map = ct.getRequestMap().get("query").toString(); |
| 997 | assertEquals(col1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 998 | |
| 999 | query = "Mann:sa,-pa,+te)"; |
| 1000 | String col2 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 1001 | "{@type=korap:reference, operation=operation:focus, classRef=[1], operands=[" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 1002 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 1003 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
| 1004 | "{@type=korap:span, key=s}," + |
| 1005 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 1006 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 1007 | "]}" + |
| 1008 | "]}," + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 1009 | "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 1010 | "{@type=korap:span, key=p}," + |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 1011 | "{@type=korap:group, operation=operation:class, class=2, operands=[" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 1012 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 1013 | "]}" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 1014 | "], exclude=true}," + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 1015 | "{@type=korap:group, operation=operation:position, frame=frame:endswith, operands=[" + |
| 1016 | "{@type=korap:span, key=t}," + |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 1017 | "{@type=korap:group, operation=operation:class, class=3, operands=[" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 1018 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 1019 | "]}" + |
| 1020 | "]}" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 1021 | "], distances=[" + |
| 1022 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=0, max=0}, min=0, max=0}" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 1023 | "]}" + |
| 1024 | "]}"; |
| 1025 | ct = new CosmasTree(query); |
| 1026 | map = ct.getRequestMap().get("query").toString(); |
| 1027 | assertEquals(col2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1028 | } |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 1029 | } |
| 1030 | |