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 | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 17 | String contextString = "http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 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 | 9a202ab | 2014-10-07 12:35:17 +0000 | [diff] [blame] | 48 | public void testWildcardToken() throws QueryException { |
| 49 | query="*der"; |
| 50 | String wc1 = |
| 51 | "{@type=korap:token, wrap={@type=korap:term, type=type:wildcard, key=*der, layer=orth, match=match:eq}}"; |
| 52 | ct = new CosmasTree(query); |
| 53 | map = ct.getRequestMap().get("query").toString(); |
| 54 | assertEquals(wc1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 55 | } |
| 56 | |
| 57 | @Test |
Joachim Bingel | 8c640e4 | 2014-02-07 16:20:47 +0000 | [diff] [blame] | 58 | public void testCaseSensitivityFlag() throws QueryException { |
Joachim Bingel | 0207d5e | 2014-02-12 14:18:41 +0000 | [diff] [blame] | 59 | query="$deutscher"; |
| 60 | String cs1 = |
| 61 | "{@type=korap:token, wrap={@type=korap:term, caseInsensitive=true, key=deutscher, layer=orth, match=match:eq}}"; |
| 62 | ct = new CosmasTree(query); |
| 63 | map = ct.getRequestMap().get("query").toString(); |
| 64 | assertEquals(cs1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 65 | |
| 66 | query="$deutscher Bundestag"; |
| 67 | String cs2 = |
| 68 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 69 | "{@type=korap:token, wrap={@type=korap:term, caseInsensitive=true, key=deutscher, layer=orth, match=match:eq}}," + |
| 70 | "{@type=korap:token, wrap={@type=korap:term, key=Bundestag, layer=orth, match=match:eq}}" + |
| 71 | "]}"; |
| 72 | ct = new CosmasTree(query); |
| 73 | map = ct.getRequestMap().get("query").toString(); |
| 74 | assertEquals(cs2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 8c640e4 | 2014-02-07 16:20:47 +0000 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | @Test |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 78 | public void testMORPH() throws QueryException { |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 79 | query="#MORPH(pos=V)"; |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 80 | String morph1 = |
Joachim Bingel | 0207d5e | 2014-02-12 14:18:41 +0000 | [diff] [blame] | 81 | "{@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] | 82 | ct = new CosmasTree(query); |
| 83 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | ffd65e3 | 2014-01-22 14:22:57 +0000 | [diff] [blame] | 84 | assertEquals(morph1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 85 | } |
| 86 | |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 87 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 88 | public void testSequence() throws QueryException { |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 89 | query="der Mann"; |
| 90 | String seq1 = |
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}}" + |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 94 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 95 | ct = new CosmasTree(query); |
| 96 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 97 | assertEquals(seq1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 98 | |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 99 | query="der Mann schläft"; |
| 100 | String seq2 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 101 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 102 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 103 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}," + |
| 104 | "{@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] | 105 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 106 | ct = new CosmasTree(query); |
| 107 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 108 | assertEquals(seq2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 109 | |
| 110 | query="der Mann schläft lang"; |
| 111 | String seq3 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 112 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 113 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 114 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}," + |
| 115 | "{@type=korap:token, wrap={@type=korap:term, key=schläft, layer=orth, match=match:eq}}," + |
| 116 | "{@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] | 117 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 118 | ct = new CosmasTree(query); |
| 119 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 120 | assertEquals(seq3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | @Test |
| 124 | public void testOPOR() throws QueryException { |
| 125 | query="Sonne oder Mond"; |
| 126 | String disj1 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 127 | "{@type=korap:group, operation=operation:or, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 128 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 129 | "{@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] | 130 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 131 | ct = new CosmasTree(query); |
| 132 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 133 | assertEquals(disj1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 134 | |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 135 | query="(Sonne scheint) oder Mond"; |
| 136 | String disj2 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 137 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 138 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 139 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 140 | "{@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] | 141 | "]}," + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 142 | "{@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] | 143 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 144 | ct = new CosmasTree(query); |
| 145 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 146 | assertEquals(disj2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 147 | |
| 148 | query="(Sonne scheint) oder (Mond scheint)"; |
| 149 | String disj3 = |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 150 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 151 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 152 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 153 | "{@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] | 154 | "]}," + |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 155 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 156 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}," + |
| 157 | "{@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] | 158 | "]}" + |
| 159 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 160 | ct = new CosmasTree(query); |
| 161 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 162 | assertEquals(disj3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 163 | |
| 164 | } |
| 165 | |
| 166 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 167 | public void testOPORAND() throws QueryException { |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 168 | query="(Sonne oder Mond) und scheint"; |
| 169 | String orand1 = |
Joachim Bingel | b7a5979 | 2014-02-14 13:52:29 +0000 | [diff] [blame] | 170 | "{@type=korap:group, operation=operation:sequence, distances=[" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 171 | "{@type=cosmas:distance, key=t, min=0, max=0}" + |
Joachim Bingel | b7a5979 | 2014-02-14 13:52:29 +0000 | [diff] [blame] | 172 | "], operands=[" + |
| 173 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 174 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 175 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 176 | "]}," + |
| 177 | "{@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] | 178 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 179 | ct = new CosmasTree(query); |
| 180 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 181 | assertEquals(orand1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 182 | |
| 183 | query="scheint und (Sonne oder Mond)"; |
| 184 | String orand2 = |
Joachim Bingel | b7a5979 | 2014-02-14 13:52:29 +0000 | [diff] [blame] | 185 | "{@type=korap:group, operation=operation:sequence, distances=[" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 186 | "{@type=cosmas:distance, key=t, min=0, max=0}" + |
Joachim Bingel | b7a5979 | 2014-02-14 13:52:29 +0000 | [diff] [blame] | 187 | "], operands=[" + |
| 188 | "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}," + |
| 189 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 190 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 191 | "{@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] | 192 | "]}" + |
| 193 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 194 | ct = new CosmasTree(query); |
| 195 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 196 | assertEquals(orand2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 92f9c9c | 2014-06-25 15:01:17 +0000 | [diff] [blame] | 197 | |
| 198 | query="Regen und scheint und (Sonne oder Mond)"; |
| 199 | String orand3 = |
| 200 | "{@type=korap:group, operation=operation:sequence, distances=[" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 201 | "{@type=cosmas:distance, key=t, min=0, max=0}" + |
Joachim Bingel | 92f9c9c | 2014-06-25 15:01:17 +0000 | [diff] [blame] | 202 | "], operands=[" + |
| 203 | "{@type=korap:token, wrap={@type=korap:term, key=Regen, layer=orth, match=match:eq}}," + |
| 204 | "{@type=korap:group, operation=operation:sequence, distances=[" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 205 | "{@type=cosmas:distance, key=t, min=0, max=0}" + |
Joachim Bingel | 92f9c9c | 2014-06-25 15:01:17 +0000 | [diff] [blame] | 206 | "], operands=[" + |
| 207 | "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}," + |
| 208 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 209 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 210 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 211 | "]}" + |
| 212 | "]}" + |
| 213 | "]}"; |
| 214 | ct = new CosmasTree(query); |
| 215 | map = ct.getRequestMap().get("query").toString(); |
| 216 | assertEquals(orand3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 220 | public void testOPPROX() throws QueryException { |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 221 | query="Sonne /+w1:4 Mond"; |
| 222 | String prox1 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 223 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 224 | "{@type=korap:group, operation=operation:sequence, " + |
| 225 | "operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 226 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 227 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 228 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 229 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 230 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 231 | "]}" + |
| 232 | "], inOrder=true, " + |
| 233 | "distances=[" + |
| 234 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4}" + |
| 235 | "]" + |
| 236 | "}" + |
| 237 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 238 | ct = new CosmasTree(query); |
| 239 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 240 | assertEquals(prox1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 241 | |
| 242 | query="Sonne /+w1:4,s0,p1:3 Mond"; |
| 243 | String prox2 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 244 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 245 | "{@type=korap:group, operation=operation:sequence, " + |
| 246 | "operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 247 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 248 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 249 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 250 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 251 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 252 | "]}" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 253 | "], inOrder=true, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 254 | "distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame] | 255 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 256 | "{@type=cosmas:distance, key=s, boundary={@type=korap:boundary, min=0, max=0}, min=0, max=0}," + |
| 257 | "{@type=cosmas: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] | 258 | "]" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 259 | "}" + |
| 260 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 261 | ct = new CosmasTree(query); |
| 262 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 263 | assertEquals(prox2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 264 | |
| 265 | query="Sonne %+w1:4,s0,p1:3 Mond"; |
| 266 | String prox3 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 267 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 268 | "{@type=korap:group, operation=operation:sequence, " + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 269 | "operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 270 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 271 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 272 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 273 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 274 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 275 | "]}" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 276 | "], inOrder=true, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 277 | "distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame] | 278 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4, exclude=true}," + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 279 | "{@type=cosmas:distance, key=s, boundary={@type=korap:boundary, min=0, max=0}, min=0, max=0, exclude=true}," + |
| 280 | "{@type=cosmas: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] | 281 | "]" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 282 | "}" + |
| 283 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 284 | ct = new CosmasTree(query); |
| 285 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame] | 286 | // assertEquals(prox3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 287 | |
| 288 | query="Sonne /+w4 Mond"; |
| 289 | String prox4 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 290 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 291 | "{@type=korap:group, operation=operation:sequence, " + |
| 292 | "operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 293 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 294 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 295 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 296 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 297 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 298 | "]}" + |
| 299 | "], inOrder=true, " + |
| 300 | "distances=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 301 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=0, max=4}, min=0, max=4}" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 302 | "]" + |
| 303 | "}" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 304 | "]}"; |
| 305 | // "{@type=korap:group, operation=operation:or, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 306 | // "{@type=korap:group, operation=operation:position, frames=[frames:], sharedClasses=[sharedClasses:intersects], operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 307 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 308 | // "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 309 | // "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 310 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 311 | // "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 312 | // "]}" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 313 | // "], frame=frame:overlaps}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 314 | // "{@type=korap:reference, operation=operation:focus, classRef=[128], operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 315 | // "{@type=korap:group, operation=operation:sequence, " + |
| 316 | // "operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 317 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 318 | // "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 319 | // "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 320 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 321 | // "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 322 | // "]}" + |
| 323 | // "], inOrder=true, " + |
| 324 | // "distances=[" + |
| 325 | // "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4}" + |
| 326 | // "]" + |
| 327 | // "}" + |
| 328 | // "]}" + |
| 329 | // "]}"; |
| 330 | |
| 331 | |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 332 | ct = new CosmasTree(query); |
| 333 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 334 | assertEquals(prox4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 335 | |
| 336 | query="Sonne /-w4 Mond"; |
| 337 | String prox5 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 338 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 339 | "{@type=korap:group, operation=operation:sequence, " + |
| 340 | "operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 341 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 342 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 343 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 344 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 345 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 346 | "]}" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 347 | "], inOrder=true, " + |
| 348 | "distances=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 349 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=0, max=4}, min=0, max=4}" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 350 | "]" + |
| 351 | "}" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 352 | "]}"; |
| 353 | // "{@type=korap:group, operation=operation:or, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 354 | // "{@type=korap:group, operation=operation:position, frames=[frames:], sharedClasses=[sharedClasses:intersects], operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 355 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 356 | // "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 357 | // "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 358 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 359 | // "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 360 | // "]}" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 361 | // "], frame=frame:overlaps}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 362 | // "{@type=korap:reference, operation=operation:focus, classRef=[128], operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 363 | // "{@type=korap:group, operation=operation:sequence, " + |
| 364 | // "operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 365 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 366 | // "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 367 | // "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 368 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 369 | // "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 370 | // "]}" + |
| 371 | // "], inOrder=true, " + |
| 372 | // "distances=[" + |
| 373 | // "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4}" + |
| 374 | // "]" + |
| 375 | // "}" + |
| 376 | // "]}" + |
| 377 | // "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 378 | ct = new CosmasTree(query); |
| 379 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 380 | assertEquals(prox5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 381 | |
| 382 | query="Sonne /w4 Mond"; |
| 383 | String prox6 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 384 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 385 | "{@type=korap:group, operation=operation:sequence, " + |
| 386 | "operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 387 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 388 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 389 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 390 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 391 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 392 | "]}" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 393 | "], inOrder=false, " + |
| 394 | "distances=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 395 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=0, max=4}, min=0, max=4}" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 396 | "]" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 397 | "}" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 398 | "]}"; |
| 399 | // "{@type=korap:group, operation=operation:or, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 400 | // "{@type=korap:group, operation=operation:position, frames=[frames:], sharedClasses=[sharedClasses:intersects], operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 401 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 402 | // "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 403 | // "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 404 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 405 | // "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 406 | // "]}" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 407 | // "], frame=frame:overlaps}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 408 | // "{@type=korap:reference, operation=operation:focus, classRef=[128], operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 409 | // "{@type=korap:group, operation=operation:sequence, " + |
| 410 | // "operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 411 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 412 | // "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 413 | // "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 414 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 415 | // "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 416 | // "]}" + |
| 417 | // "], inOrder=false, " + |
| 418 | // "distances=[" + |
| 419 | // "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4}" + |
| 420 | // "]" + |
| 421 | // "}" + |
| 422 | // "]}" + |
| 423 | // "]}"; |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 424 | ct = new CosmasTree(query); |
| 425 | map = ct.getRequestMap().get("query").toString(); |
| 426 | assertEquals(prox6.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 427 | } |
| 428 | |
| 429 | @Test |
Joachim Bingel | ba9a0ab | 2014-01-29 10:12:25 +0000 | [diff] [blame] | 430 | public void testOPPROXNested() throws QueryException { |
Joachim Bingel | 0973797 | 2014-09-22 09:43:06 +0000 | [diff] [blame] | 431 | query="Sonne /+w1:4 Mond /-w1:7 Sterne"; |
| 432 | expected = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 433 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
Joachim Bingel | 0973797 | 2014-09-22 09:43:06 +0000 | [diff] [blame] | 434 | "{@type=korap:group, operation=operation:sequence, " + |
| 435 | "operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 436 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 0973797 | 2014-09-22 09:43:06 +0000 | [diff] [blame] | 437 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 438 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 439 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
| 440 | "{@type=korap:reference, operation=operation:focus, classRef=[130], operands=[" + |
Joachim Bingel | 0973797 | 2014-09-22 09:43:06 +0000 | [diff] [blame] | 441 | "{@type=korap:group, operation=operation:sequence, " + |
| 442 | "operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 443 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 444 | "{@type=korap:token, wrap={@type=korap:term, key=Sterne, layer=orth, match=match:eq}}" + |
Joachim Bingel | 0973797 | 2014-09-22 09:43:06 +0000 | [diff] [blame] | 445 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 446 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 447 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
Joachim Bingel | 0973797 | 2014-09-22 09:43:06 +0000 | [diff] [blame] | 448 | "]}" + |
| 449 | "], inOrder=true, " + |
| 450 | "distances=[" + |
| 451 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=7}, min=1, max=7}" + |
| 452 | "]" + |
| 453 | "}" + |
| 454 | "]}" + |
| 455 | "]}" + |
| 456 | "], inOrder=true, " + |
| 457 | "distances=[" + |
| 458 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4}" + |
| 459 | "]" + |
| 460 | "}" + |
| 461 | "]}" + |
| 462 | "" ; |
| 463 | ct = new CosmasTree(query); |
| 464 | map = ct.getRequestMap().get("query").toString(); |
| 465 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 466 | |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 467 | query="Sonne /-w4 Mond /+w2 Sterne"; |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 468 | |
Joachim Bingel | ceb7906 | 2014-09-22 11:50:37 +0000 | [diff] [blame] | 469 | // String mondsterne = |
| 470 | // "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}," + |
| 471 | // "{@type=korap:token, wrap={@type=korap:term, key=Sterne, layer=orth, match=match:eq}}" ; |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 472 | |
| 473 | String mondsterneClasses = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 474 | "{@type=korap:group, operation=operation:class, class=128 , classOut=128, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 475 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 476 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 477 | "{@type=korap:group, operation=operation:class, class=128 , classOut=128, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 478 | "{@type=korap:token, wrap={@type=korap:term, key=Sterne, layer=orth, match=match:eq}}" + |
| 479 | "]}"; |
Joachim Bingel | ceb7906 | 2014-09-22 11:50:37 +0000 | [diff] [blame] | 480 | // String mondsterneSeq = |
| 481 | // "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 482 | // mondsterne + |
| 483 | // "], inOrder=true, distances=[" + |
| 484 | // "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=2}, min=1, max=2}" + |
| 485 | // "]}" ; |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 486 | String mondsterneClassesSeq = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 487 | "{@type=korap:reference, operation=operation:focus, classRef=[128], operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 488 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 489 | mondsterneClasses + |
| 490 | "], inOrder=true, distances=[" + |
| 491 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=2}, min=1, max=2}" + |
| 492 | "]}" + |
| 493 | "]}" ; |
Joachim Bingel | ceb7906 | 2014-09-22 11:50:37 +0000 | [diff] [blame] | 494 | // String mondsterneOv = |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 495 | // "{@type=korap:group, operation=operation:position, frames=[frames:], sharedClasses=[sharedClasses:intersects], operands=[" + |
Joachim Bingel | ceb7906 | 2014-09-22 11:50:37 +0000 | [diff] [blame] | 496 | // mondsterne + |
| 497 | // "]}"; |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 498 | String mondsterneClassesOv = |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 499 | "{@type=korap:group, operation=operation:position, frames=[frames:], sharedClasses=[sharedClasses:intersects], operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 500 | mondsterneClasses + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 501 | "], frame=frame:overlaps}"; |
Joachim Bingel | ceb7906 | 2014-09-22 11:50:37 +0000 | [diff] [blame] | 502 | // String mondsterneAll = |
| 503 | // "{@type=korap:group, operation=operation:or, operands=[" + |
| 504 | // mondsterneOv + "," + mondsterneClassesSeq + |
| 505 | // "]}"; |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 506 | String mondsterneAllClasses = |
| 507 | "{@type=korap:group, operation=operation:or, operands=[" + |
| 508 | mondsterneClassesOv + "," + mondsterneClassesSeq + |
| 509 | "]}"; |
| 510 | |
| 511 | |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 512 | String prox6 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 513 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 514 | "{@type=korap:group, operation=operation:sequence, " + |
| 515 | "operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 516 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
| 517 | "{@type=korap:reference, operation=operation:focus, classRef=[130], operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 518 | "{@type=korap:group, operation=operation:sequence, " + |
| 519 | "operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 520 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 521 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 522 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 523 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 524 | "{@type=korap:token, wrap={@type=korap:term, key=Sterne, layer=orth, match=match:eq}}" + |
| 525 | "]}" + |
| 526 | "], inOrder=true, " + |
| 527 | "distances=[" + |
| 528 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=0, max=2}, min=0, max=2}" + |
| 529 | "]" + |
| 530 | "}" + |
| 531 | "]}" + |
| 532 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 533 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 534 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 535 | "]}" + |
| 536 | "], inOrder=true, " + |
| 537 | "distances=[" + |
| 538 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=0, max=4}, min=0, max=4}" + |
| 539 | "]" + |
| 540 | "}" + |
| 541 | "]}" + |
| 542 | "" ; |
| 543 | // "{@type=korap:group, operation=operation:or, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 544 | // "{@type=korap:group, operation=operation:position, frames=[frames:], sharedClasses=[sharedClasses:intersects], operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 545 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 546 | // mondsterneAllClasses + |
| 547 | // "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 548 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 549 | // "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 550 | // "]}" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 551 | // "], frame=frame:overlaps}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 552 | // "{@type=korap:reference, operation=operation:focus, classRef=[128], operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 553 | // "{@type=korap:group, operation=operation:sequence, " + |
| 554 | // "operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 555 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 556 | // mondsterneAllClasses + |
| 557 | // "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 558 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 559 | // "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 560 | // "]}" + |
| 561 | // "], inOrder=true, " + |
| 562 | // "distances=[" + |
| 563 | // "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4}" + |
| 564 | // "]" + |
| 565 | // "}" + |
| 566 | // "]}" + |
| 567 | // "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 568 | ct = new CosmasTree(query); |
| 569 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 570 | assertEquals(prox6.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 571 | } |
| 572 | |
| 573 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 574 | public void testOPIN() throws QueryException { |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 575 | query="wegen #IN <s>"; |
Joachim Bingel | 3a9f793 | 2014-01-07 17:11:31 +0000 | [diff] [blame] | 576 | String opin1 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 577 | "{@type=korap:reference, operation=operation:focus, classRef=[130], operands=[" + |
| 578 | "{@type=korap:group, operation=operation:class, classRefCheck=classRefCheck:includes, classIn=[129,130], classOut=131, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 579 | "{@type=korap:group, operation=operation:position, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 580 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 581 | "{@type=korap:span, key=s}" + |
| 582 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 583 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 584 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 585 | "]}" + |
| 586 | "], frames=[], frame=frame:contains}" + |
| 587 | "]}" + |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 588 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 589 | ct = new CosmasTree(query); |
| 590 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 591 | assertEquals(opin1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 592 | |
Joachim Bingel | 0973797 | 2014-09-22 09:43:06 +0000 | [diff] [blame] | 593 | query="wegen #IN(L) <s>"; |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 594 | String opin2 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 595 | "{@type=korap:reference, operation=operation:focus, classRef=[130], operands=[" + |
| 596 | "{@type=korap:group, operation=operation:class, classRefCheck=classRefCheck:includes, classIn=[129,130], classOut=131, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 597 | "{@type=korap:group, operation=operation:position, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 598 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 599 | "{@type=korap:span, key=s}" + |
| 600 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 601 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 602 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 603 | "]}" + |
| 604 | "], frames=[frames:startswith], frame=frame:startswith}" + |
| 605 | "]}" + |
| 606 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 607 | ct = new CosmasTree(query); |
| 608 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 609 | assertEquals(opin2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 610 | |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 611 | |
| 612 | query="wegen #IN(F) <s>"; |
| 613 | String opin3= |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 614 | "{@type=korap:reference, operation=operation:focus, classRef=[130], operands=[" + |
| 615 | "{@type=korap:group, operation=operation:class, classRefCheck=classRefCheck:includes, classIn=[129,130], classOut=131, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 616 | "{@type=korap:group, operation=operation:position, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 617 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 618 | "{@type=korap:span, key=s}" + |
| 619 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 620 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 621 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 622 | "]}" + |
| 623 | "], frames=[frames:matches], frame=frame:matches}" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 624 | "]}" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 625 | "]}"; |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 626 | ct = new CosmasTree(query); |
| 627 | map = ct.getRequestMap().get("query").toString(); |
| 628 | assertEquals(opin3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 629 | |
| 630 | query="wegen #IN(FI) <s>"; |
| 631 | String opin4= |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 632 | "{@type=korap:reference, operation=operation:focus, classRef=[130], operands=[" + |
| 633 | "{@type=korap:group, operation=operation:class, classRefCheck=[classRefCheck:unequals,classRefCheck:includes], classIn=[129,130], classOut=131, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 634 | "{@type=korap:group, operation=operation:position, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 635 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 636 | "{@type=korap:span, key=s}" + |
| 637 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 638 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 639 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 640 | "]}" + |
| 641 | "], frames=[frames:matches], frame=frame:matches-noident}" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 642 | "]}" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 643 | "]}"; |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 644 | ct = new CosmasTree(query); |
| 645 | map = ct.getRequestMap().get("query").toString(); |
| 646 | assertEquals(opin4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 647 | |
| 648 | query="wegen #IN(FE) <s>"; |
| 649 | String opin5= |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 650 | "{@type=korap:reference, operation=operation:focus, classRef=[130], operands=[" + |
| 651 | "{@type=korap:group, operation=operation:class, classRefCheck=classRefCheck:equals, classIn=[129,130], classOut=131, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 652 | "{@type=korap:group, operation=operation:position, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 653 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 654 | "{@type=korap:span, key=s}" + |
| 655 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 656 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 657 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 658 | "]}" + |
| 659 | "], frames=[frames:matches], frame=frame:matches}" + |
Joachim Bingel | 0973797 | 2014-09-22 09:43:06 +0000 | [diff] [blame] | 660 | "]}" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 661 | "]}"; |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 662 | ct = new CosmasTree(query); |
| 663 | map = ct.getRequestMap().get("query").toString(); |
| 664 | assertEquals(opin5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 665 | |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 666 | query="wegen #IN(%, L) <s>"; |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 667 | String opin6 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 668 | "{@type=korap:reference, operation=operation:focus, classRef=[130], operands=[" + |
| 669 | "{@type=korap:group, operation=operation:class, classRefCheck=classRefCheck:includes, classIn=[129,130], classOut=131, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 670 | "{@type=korap:group, operation=operation:position, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 671 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 672 | "{@type=korap:span, key=s}" + |
| 673 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 674 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 675 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 676 | "]}" + |
| 677 | "], frames=[frames:startswith], frame=frame:startswith, exclude=true}" + |
| 678 | "]}" + |
| 679 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 680 | ct = new CosmasTree(query); |
| 681 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 682 | assertEquals(opin6.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 683 | |
| 684 | query="wegen #IN('FE,ALL,%,MIN') <s>"; |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 685 | String opin7 = |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 686 | "{@type=korap:reference, operation=operation:focus, reset=true, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 687 | "{@type=korap:group, operation=operation:class, classRefCheck=classRefCheck:equals, classIn=[129,130], classOut=131, operands=[" + |
Joachim Bingel | 0973797 | 2014-09-22 09:43:06 +0000 | [diff] [blame] | 688 | "{@type=korap:group, operation=operation:position, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 689 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 0973797 | 2014-09-22 09:43:06 +0000 | [diff] [blame] | 690 | "{@type=korap:span, key=s}" + |
| 691 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 692 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 693 | "{@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] | 694 | "]}" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 695 | |
| 696 | "], frames=[frames:matches], frame=frame:matches, exclude=true, grouping=false}" + |
| 697 | "]}" + |
| 698 | "]}" + |
| 699 | ""; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 700 | ct = new CosmasTree(query); |
| 701 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 702 | assertEquals(opin7.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 703 | } |
| 704 | |
| 705 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 706 | public void testOPOV() throws QueryException { |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 707 | query="wegen #OV <s>"; |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 708 | String opov1 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 709 | "{@type=korap:reference, operation=operation:focus, classRef=[130], operands=[" + |
| 710 | "{@type=korap:group, operation=operation:class, classRefCheck=classRefCheck:intersects, classIn=[129,130], classOut=131, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 711 | "{@type=korap:group, operation=operation:position, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 712 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 713 | "{@type=korap:span, key=s}" + |
| 714 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 715 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 716 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 717 | "]}" + |
| 718 | "], frames=[], frame=frame:overlaps}" + |
| 719 | "]}" + |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 720 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 721 | ct = new CosmasTree(query); |
| 722 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 723 | assertEquals(opov1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 724 | |
| 725 | query="wegen #OV(L) <s>"; |
| 726 | String opov2 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 727 | "{@type=korap:reference, operation=operation:focus, classRef=[130], operands=[" + |
| 728 | "{@type=korap:group, operation=operation:class, classRefCheck=classRefCheck:intersects, classIn=[129,130], classOut=131, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 729 | "{@type=korap:group, operation=operation:position, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 730 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 731 | "{@type=korap:span, key=s}" + |
| 732 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 733 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 734 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 735 | "]}" + |
| 736 | "], frames=[frames:startswith,frames:overlapsLeft], frame=frame:overlapsLeft}" + |
| 737 | "]}" + |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 738 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 739 | ct = new CosmasTree(query); |
| 740 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | cc1dc24 | 2014-01-15 09:32:38 +0000 | [diff] [blame] | 741 | assertEquals(opov2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 742 | |
| 743 | query="wegen #OV(F) <s>"; |
| 744 | String opov3= |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 745 | |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 746 | "{@type=korap:reference, operation=operation:focus, classRef=[130], operands=[" + |
| 747 | "{@type=korap:group, operation=operation:class, classRefCheck=classRefCheck:intersects, classIn=[129,130], classOut=131, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 748 | "{@type=korap:group, operation=operation:position, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 749 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 750 | "{@type=korap:span, key=s}" + |
| 751 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 752 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 753 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 754 | "]}" + |
| 755 | "], frames=[frames:matches], frame=frame:matches}" + |
| 756 | "]}" + |
Joachim Bingel | 0973797 | 2014-09-22 09:43:06 +0000 | [diff] [blame] | 757 | "]}"; |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 758 | ct = new CosmasTree(query); |
| 759 | map = ct.getRequestMap().get("query").toString(); |
| 760 | assertEquals(opov3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 761 | |
| 762 | query="wegen #OV(FI) <s>"; |
| 763 | String opov4= |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 764 | "{@type=korap:reference, operation=operation:focus, classRef=[130], operands=[" + |
| 765 | "{@type=korap:group, operation=operation:class, classRefCheck=classRefCheck:unequals, classIn=[129,130], classOut=131, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 766 | "{@type=korap:group, operation=operation:position, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 767 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 768 | "{@type=korap:span, key=s}" + |
| 769 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 770 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 771 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 772 | "]}" + |
| 773 | "], frames=[frames:matches], frame=frame:matches-noident}" + |
| 774 | "]}" + |
Joachim Bingel | 0973797 | 2014-09-22 09:43:06 +0000 | [diff] [blame] | 775 | "]}"; |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 776 | ct = new CosmasTree(query); |
| 777 | map = ct.getRequestMap().get("query").toString(); |
| 778 | assertEquals(opov4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 779 | |
| 780 | query="wegen #OV(FE) <s>"; |
| 781 | String opov5= |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 782 | "{@type=korap:reference, operation=operation:focus, classRef=[130], operands=[" + |
| 783 | "{@type=korap:group, operation=operation:class, classRefCheck=classRefCheck:equals, classIn=[129,130], classOut=131, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 784 | "{@type=korap:group, operation=operation:position, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 785 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 786 | "{@type=korap:span, key=s}" + |
| 787 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 788 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 789 | "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" + |
| 790 | "]}" + |
| 791 | "], frames=[frames:matches], frame=frame:matches}" + |
| 792 | "]}" + |
| 793 | "]}"; |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 794 | ct = new CosmasTree(query); |
| 795 | map = ct.getRequestMap().get("query").toString(); |
| 796 | assertEquals(opov5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 797 | } |
| 798 | |
| 799 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 800 | public void testOPNOT() throws QueryException { |
Joachim Bingel | 3a9f793 | 2014-01-07 17:11:31 +0000 | [diff] [blame] | 801 | query="Sonne nicht Mond"; |
| 802 | String opnot1 = |
Joachim Bingel | b7a5979 | 2014-02-14 13:52:29 +0000 | [diff] [blame] | 803 | "{@type=korap:group, operation=operation:sequence, distances=[" + |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 804 | "{@type=cosmas:distance, key=t, min=0, max=0, exclude=true}" + |
Joachim Bingel | b7a5979 | 2014-02-14 13:52:29 +0000 | [diff] [blame] | 805 | "], operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 806 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," + |
| 807 | "{@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] | 808 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 809 | ct = new CosmasTree(query); |
| 810 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 3a9f793 | 2014-01-07 17:11:31 +0000 | [diff] [blame] | 811 | assertEquals(opnot1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 812 | } |
| 813 | |
| 814 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 815 | public void testBEG_END() throws QueryException { |
Joachim Bingel | 3a9f793 | 2014-01-07 17:11:31 +0000 | [diff] [blame] | 816 | // BEG and END operators |
| 817 | // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/links.html |
| 818 | // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/rechts.html |
| 819 | // 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] | 820 | query="#BEG(der /w3:5 Mann)"; |
| 821 | String beg1 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 822 | "{@type=korap:reference, operation=operation:focus, spanRef=[0,1], operands=[" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 823 | "{@type=korap:group, operation=operation:sequence," + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 824 | "operands = [" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 825 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 826 | "{@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] | 827 | "], inOrder=false, distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame] | 828 | "{@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] | 829 | "]}" + |
| 830 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 831 | ct = new CosmasTree(query); |
| 832 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 833 | assertEquals(beg1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 834 | |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 835 | |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 836 | // String dermannSeq = "{@type=korap:group, operation=operation:sequence," + |
| 837 | // "operands = [" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 838 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 839 | // "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}" + |
| 840 | // "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 841 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 842 | // "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 843 | // "]}" + |
| 844 | // |
| 845 | // "], inOrder=false, distances=[" + |
| 846 | // "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=3, max=5}, min=3, max=5}" + |
| 847 | // "]}"; |
| 848 | // |
| 849 | // String begDermannSeq = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 850 | //// "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 851 | // "{@type=korap:reference, operation=operation:focus, spanRef=[0,1], operands=[" + |
| 852 | // dermannSeq + |
| 853 | // "]}" + |
| 854 | //// "]}" + |
| 855 | // ""; |
| 856 | |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 857 | String kommt = "{@type=korap:token, wrap={@type=korap:term, key=kommt, layer=orth, match=match:eq}}"; |
| 858 | |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 859 | query="#BEG(der /w3:5 Mann) /+w10 kommt"; // nesting #BEG() in a distance group |
| 860 | String beg2 = |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 861 | // "{@type=korap:group, operation=operation:or, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 862 | // "{@type=korap:group, operation=operation:position, frames=[frames:], sharedClasses=[sharedClasses:intersects], operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 863 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 864 | // beg1 + |
| 865 | // "]}" + "," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 866 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 867 | // kommt + |
| 868 | // "]}" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 869 | // "], frame=frame:overlaps}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 870 | // "{@type=korap:reference, operation=operation:focus, classRef=[128], operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 871 | // "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 872 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 873 | // beg1 + |
| 874 | // "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 875 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 876 | // kommt + |
| 877 | // "]}" + |
| 878 | // "], inOrder=true, distances=[" + |
| 879 | // "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" + |
| 880 | // "]}" + |
| 881 | // "]}" + |
| 882 | // "]}"; |
| 883 | // |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 884 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 885 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 886 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 887 | beg1 + |
| 888 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 889 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 890 | kommt + |
| 891 | "]}" + |
| 892 | "], inOrder=true, distances=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 893 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=0, max=10}, min=0, max=10}" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 894 | "]}" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 895 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 896 | ct = new CosmasTree(query); |
| 897 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 898 | assertEquals(beg2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 899 | |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 900 | query="kommt /+w10 #BEG(der /w3:5 Mann)"; |
| 901 | String beg3 = |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 902 | // "{@type=korap:group, operation=operation:or, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 903 | // "{@type=korap:group, operation=operation:position, frames=[frames:], sharedClasses=[sharedClasses:intersects], operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 904 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 905 | // kommt + |
| 906 | //// "," + |
| 907 | // "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 908 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 909 | // beg1+ |
| 910 | // "]}" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 911 | // "], frame=frame:overlaps}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 912 | // "{@type=korap:reference, operation=operation:focus, classRef=[128], operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 913 | // "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 914 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 915 | // kommt + |
| 916 | // "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 917 | // "{@type=korap:group, operation=operation:class, class= , classOut=128, operands=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 918 | // beg1+ |
| 919 | // "]}" + |
| 920 | // "], inOrder=true, distances=[" + |
| 921 | // "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" + |
| 922 | // "]}" + |
| 923 | // "]}" + |
| 924 | // "]}"; |
| 925 | |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 926 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 927 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 928 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 929 | kommt + |
| 930 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 931 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 932 | beg1+ |
| 933 | "]}" + |
| 934 | "], inOrder=true, distances=[" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 935 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=0, max=10}, min=0, max=10}" + |
Joachim Bingel | fbc8879 | 2014-09-17 11:11:52 +0000 | [diff] [blame] | 936 | "]}" + |
Joachim Bingel | acb2ab3 | 2014-09-24 15:36:14 +0000 | [diff] [blame] | 937 | "]}"; |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 938 | ct = new CosmasTree(query); |
| 939 | map = ct.getRequestMap().get("query").toString(); |
| 940 | assertEquals(beg3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 941 | |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 942 | query="#END(der /w3:5 Mann)"; |
| 943 | String end1 = |
Joachim Bingel | 0de1b41 | 2014-07-02 14:51:48 +0000 | [diff] [blame] | 944 | "{@type=korap:reference, operation=operation:focus, spanRef=[-1,1], operands=[" + |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 945 | "{@type=korap:group, operation=operation:sequence, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 946 | "operands = [" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 947 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 948 | "{@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] | 949 | "], inOrder=false, distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame] | 950 | "{@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] | 951 | "]}" + |
| 952 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 953 | ct = new CosmasTree(query); |
| 954 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 955 | assertEquals(end1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 956 | } |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 957 | |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame] | 958 | /* |
| 959 | * YET UNCLEAR HOW TO SERIALIZE SPAN DISTANCES. BEING DISCUSSED. |
| 960 | * |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 961 | @Test |
| 962 | public void testSentenceDistance() throws QueryException { |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame] | 963 | query="Sonne /s0 Mond"; // contains(focus(1:contains({1:<s>},Sonne)),Mond) |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 964 | expected = |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 965 | "{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 966 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 967 | "{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 968 | "{@type=korap:group, operation=operation:class, class= , classOut=129, operands=[" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 969 | "{@type=korap:span, key=s}" + |
| 970 | "]}," + |
| 971 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 972 | "]}" + |
| 973 | "]}," + |
| 974 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 975 | "]}"; |
| 976 | ct = new CosmasTree(query); |
| 977 | map = ct.getRequestMap().get("query").toString(); |
| 978 | assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 979 | |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame] | 980 | query="Sonne /s0,w5 Mond"; |
| 981 | expected = |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 982 | "{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 983 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 984 | "{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 985 | "{@type=korap:group, operation=operation:class, class= , classOut=129, operands=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame] | 986 | "{@type=korap:span, key=s}" + |
| 987 | "]}," + |
| 988 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 989 | "]}" + |
| 990 | "]}," + |
| 991 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 992 | "]}"; |
| 993 | // ct = new CosmasTree(query); |
| 994 | // map = ct.getRequestMap().get("query").toString(); |
| 995 | // assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 996 | |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 997 | query="Sonne /s2:2 Mond"; // contains(<s>,Sonne)<s>contains(<s>,Mond) |
| 998 | expected = |
| 999 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 1000 | "{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 1001 | "{@type=korap:span, key=s}," + |
| 1002 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 1003 | "]}," + |
| 1004 | "{@type=korap:span, key=s}," + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 1005 | "{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 1006 | "{@type=korap:span, key=s}," + |
| 1007 | "{@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] | 1008 | "]}" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 1009 | "]}"; |
| 1010 | ct = new CosmasTree(query); |
| 1011 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame] | 1012 | // assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 1013 | |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame] | 1014 | query="Sonne /s2:3 Mond"; // contains(<s>,Sonne)<s>contains(<s>,Mond) |
| 1015 | expected = |
| 1016 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 1017 | "{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame] | 1018 | "{@type=korap:span, key=s}," + |
| 1019 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 1020 | "]}," + |
| 1021 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
| 1022 | "{@type=korap:span, key=s}" + |
| 1023 | "], boundary={@type=korap:boundary, min=1, max=2}, min=1, max=2}," + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 1024 | "{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame] | 1025 | "{@type=korap:span, key=s}," + |
| 1026 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 1027 | "]}" + |
| 1028 | "]}"; |
| 1029 | ct = new CosmasTree(query); |
| 1030 | map = ct.getRequestMap().get("query").toString(); |
| 1031 | // assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1032 | |
| 1033 | 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] | 1034 | expected = |
| 1035 | "{@type=korap:group, operation=operation:or, operands=[" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 1036 | "{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1037 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 1038 | "{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1039 | "{@type=korap:group, operation=operation:class, class= , classOut=129, operands=[" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 1040 | "{@type=korap:span, key=s}" + |
| 1041 | "]}," + |
| 1042 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 1043 | "]}" + |
| 1044 | "]}," + |
| 1045 | "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" + |
| 1046 | "]}," + |
| 1047 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 1048 | "{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 1049 | "{@type=korap:span, key=s}," + |
| 1050 | "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" + |
| 1051 | "]}," + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame] | 1052 | "{@type=korap:group, operation=operation:repetition, operands=[" + |
| 1053 | "{@type=korap:span, key=s}" + |
| 1054 | "], boundary={@type=korap:boundary, min=0, max=1}, min=0, max=1}," + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 1055 | "{@type=korap:group, operation=operation:position, frame=frame:frame:contains, operands=[" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 1056 | "{@type=korap:span, key=s}," + |
| 1057 | "{@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] | 1058 | "]}" + |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 1059 | "]}" + |
| 1060 | "]}"; |
| 1061 | ct = new CosmasTree(query); |
| 1062 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame] | 1063 | // assertEquals(expected.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 1064 | } |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame] | 1065 | */ |
Joachim Bingel | 37a803f | 2014-07-28 14:21:44 +0000 | [diff] [blame] | 1066 | |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 1067 | |
| 1068 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 1069 | public void testELEM() throws QueryException { |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 1070 | // 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] | 1071 | query="#ELEM(S)"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1072 | String elem1 = "{@type=korap:span, key=s}"; |
| 1073 | ct = new CosmasTree(query); |
| 1074 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 1075 | assertEquals(elem1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 1076 | |
| 1077 | query="#ELEM(W ANA=N)"; |
| 1078 | String elem2 = |
| 1079 | "{@type=korap:span, key=w, attr=" + |
| 1080 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1081 | "{@type=korap:term, layer=p, key=N, match=match:eq}" + |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 1082 | "]}" + |
| 1083 | "}"; |
| 1084 | ct = new CosmasTree(query); |
| 1085 | map = ct.getRequestMap().get("query").toString(); |
| 1086 | assertEquals(elem2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1087 | |
| 1088 | query="#ELEM(W ANA != 'N V')"; |
| 1089 | String elem3 = |
| 1090 | "{@type=korap:span, key=w, attr=" + |
| 1091 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1092 | "{@type=korap:term, layer=p, key=N, match=match:ne}," + |
| 1093 | "{@type=korap:term, layer=p, key=V, match=match:ne}" + |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 1094 | "]}" + |
| 1095 | "}"; |
| 1096 | ct = new CosmasTree(query); |
| 1097 | map = ct.getRequestMap().get("query").toString(); |
| 1098 | assertEquals(elem3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1099 | |
Joachim Bingel | b674cca | 2014-05-09 14:00:58 +0000 | [diff] [blame] | 1100 | query="#ELEM(W ANA != 'N A V' Genre = Sport)"; |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 1101 | String elem4 = |
| 1102 | "{@type=korap:span, key=w, attr=" + |
| 1103 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
| 1104 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1105 | "{@type=korap:term, layer=p, key=N, match=match:ne}," + |
| 1106 | "{@type=korap:term, layer=p, key=A, match=match:ne}," + |
| 1107 | "{@type=korap:term, layer=p, key=V, match=match:ne}" + |
Joachim Bingel | b674cca | 2014-05-09 14:00:58 +0000 | [diff] [blame] | 1108 | "]}," + |
Joachim Bingel | 402c6e1 | 2014-05-08 17:09:06 +0000 | [diff] [blame] | 1109 | "{@type=korap:term, layer=Genre, key=Sport, match=match:eq}" + |
| 1110 | "]}" + |
| 1111 | "}"; |
| 1112 | ct = new CosmasTree(query); |
| 1113 | map = ct.getRequestMap().get("query").toString(); |
| 1114 | assertEquals(elem4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | b674cca | 2014-05-09 14:00:58 +0000 | [diff] [blame] | 1115 | |
| 1116 | query="#ELEM(W ANA != 'N V' Genre != 'Sport Politik')"; |
| 1117 | String elem5 = |
| 1118 | "{@type=korap:span, key=w, attr=" + |
| 1119 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
| 1120 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1121 | "{@type=korap:term, layer=p, key=N, match=match:ne}," + |
| 1122 | "{@type=korap:term, layer=p, key=V, match=match:ne}" + |
Joachim Bingel | b674cca | 2014-05-09 14:00:58 +0000 | [diff] [blame] | 1123 | "]}," + |
| 1124 | "{@type=korap:termGroup, relation=relation:and, operands=[" + |
| 1125 | "{@type=korap:term, layer=Genre, key=Sport, match=match:ne}," + |
| 1126 | "{@type=korap:term, layer=Genre, key=Politik, match=match:ne}" + |
| 1127 | "]}" + |
| 1128 | "]}" + |
| 1129 | "}"; |
| 1130 | ct = new CosmasTree(query); |
| 1131 | map = ct.getRequestMap().get("query").toString(); |
| 1132 | assertEquals(elem5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 1133 | } |
| 1134 | |
| 1135 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 1136 | public void testOPALL() throws QueryException { |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 1137 | query="#ALL(gehen /w1:10 voran)"; |
Joachim Bingel | e98d088 | 2014-01-21 12:58:54 +0000 | [diff] [blame] | 1138 | String all1 = |
Joachim Bingel | 097c1eb | 2014-07-11 14:57:25 +0000 | [diff] [blame] | 1139 | "{@type=korap:group, operation=operation:sequence, " + |
Joachim Bingel | 11d5b15 | 2014-02-11 21:33:47 +0000 | [diff] [blame] | 1140 | "operands=[" + |
Joachim Bingel | ee3b21d | 2014-02-12 12:34:59 +0000 | [diff] [blame] | 1141 | "{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}," + |
| 1142 | "{@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] | 1143 | "], inOrder=false, " + |
| 1144 | "distances=[" + |
Joachim Bingel | 03dfd95 | 2014-07-30 08:08:53 +0000 | [diff] [blame] | 1145 | "{@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] | 1146 | "]" + |
| 1147 | "}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1148 | ct = new CosmasTree(query); |
| 1149 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 1150 | assertEquals(all1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1151 | |
| 1152 | query="#ALL(gehen /w1:10 (voran /w1:4 schnell))"; |
| 1153 | String all2 = |
| 1154 | "{@type=korap:group, operation=operation:sequence, " + |
| 1155 | "operands=[" + |
| 1156 | "{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}," + |
| 1157 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 1158 | "{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}," + |
| 1159 | "{@type=korap:token, wrap={@type=korap:term, key=schnell, layer=orth, match=match:eq}}" + |
| 1160 | "], inOrder=false, " + |
| 1161 | "distances=[" + |
| 1162 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=4}, min=1, max=4}" + |
| 1163 | "]" + |
| 1164 | "}" + |
| 1165 | "], inOrder=false, " + |
| 1166 | "distances=[" + |
| 1167 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" + |
| 1168 | "]" + |
| 1169 | "}"; |
| 1170 | ct = new CosmasTree(query); |
| 1171 | map = ct.getRequestMap().get("query").toString(); |
| 1172 | assertEquals(all2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 1173 | } |
| 1174 | |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 1175 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 1176 | public void testOPNHIT() throws QueryException { |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 1177 | query="#NHIT(gehen /w1:10 voran)"; |
| 1178 | String nhit1 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1179 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
| 1180 | "{@type=korap:group, operation=operation:class, classRefOp=classRefOp:inversion, classIn=[130,131], classOut=129, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1181 | "{@type=korap:group, operation=operation:sequence, " + |
| 1182 | "operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1183 | "{@type=korap:group, operation=operation:class, class=130 , classOut=130, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1184 | "{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}" + |
| 1185 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1186 | "{@type=korap:group, operation=operation:class, class=131 , classOut=131, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1187 | "{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}" + |
| 1188 | "]}" + |
| 1189 | "], inOrder=false, " + |
| 1190 | "distances=[" + |
| 1191 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" + |
| 1192 | "]" + |
| 1193 | "}" + |
| 1194 | "]}" + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 1195 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1196 | ct = new CosmasTree(query); |
| 1197 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 89cceac | 2014-01-08 15:51:08 +0000 | [diff] [blame] | 1198 | assertEquals(nhit1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 832800e | 2014-10-17 14:46:39 +0000 | [diff] [blame] | 1199 | |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1200 | // query="#NHIT(gehen %w1:10 voran)"; |
| 1201 | // String nhit2 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1202 | // "{@type=korap:reference, operation=operation:focus, classRef=129, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1203 | // "{@type=korap:group, operation=operation:sequence, " + |
| 1204 | // "operands=[" + |
| 1205 | // "{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1206 | // "{@type=korap:group, operation=operation:class, class= , classOut=129, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1207 | // "{@type=korap:group, operation=operation:repetition, operands=[" + |
| 1208 | // "{@type=korap:token}" + |
| 1209 | // "], boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}}" + |
| 1210 | // "]}," + |
| 1211 | // "{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}" + |
| 1212 | // "], inOrder=false, " + |
| 1213 | // "distances=[" + |
| 1214 | // "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" + |
| 1215 | // "]" + |
| 1216 | // "}" + |
| 1217 | // "]}"; |
| 1218 | // ct = new CosmasTree(query); |
| 1219 | // map = ct.getRequestMap().get("query").toString(); |
| 1220 | // assertEquals(nhit2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1221 | |
| 1222 | query="#NHIT(gehen /+w1:10 voran /w1:10 Beispiel)"; |
| 1223 | String nhit3 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1224 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
| 1225 | "{@type=korap:group, operation=operation:class, classRefOp=classRefOp:inversion, classIn=[130,131], classOut=129, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1226 | "{@type=korap:group, operation=operation:sequence, " + |
| 1227 | "operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1228 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1229 | "{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}" + |
| 1230 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1231 | "{@type=korap:group, operation=operation:class, class=131, classOut=131, operands=[" + |
| 1232 | "{@type=korap:reference, operation=operation:focus, classRef=[132], operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1233 | "{@type=korap:group, operation=operation:sequence, " + |
| 1234 | "operands=[" + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1235 | "{@type=korap:group, operation=operation:class, class=132, classOut=132, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1236 | "{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}" + |
| 1237 | "]}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1238 | "{@type=korap:group, operation=operation:class, class=132, classOut=132, operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1239 | "{@type=korap:token, wrap={@type=korap:term, key=Beispiel, layer=orth, match=match:eq}}" + |
| 1240 | "]}" + |
| 1241 | "], inOrder=false, " + |
| 1242 | "distances=[" + |
| 1243 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" + |
| 1244 | "]" + |
| 1245 | "}" + |
| 1246 | "]}" + |
| 1247 | "]}" + |
| 1248 | "], inOrder=true, " + |
| 1249 | "distances=[" + |
| 1250 | "{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1, max=10}, min=1, max=10}" + |
| 1251 | "]" + |
| 1252 | "}" + |
| 1253 | "]}" + |
| 1254 | "]}"; |
| 1255 | ct = new CosmasTree(query); |
| 1256 | map = ct.getRequestMap().get("query").toString(); |
| 1257 | assertEquals(nhit3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 1258 | } |
| 1259 | |
| 1260 | @Test |
Joachim Bingel | 87480d0 | 2014-01-17 14:07:46 +0000 | [diff] [blame] | 1261 | public void testOPBED() throws QueryException { |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 1262 | query = "#BED(der , sa)"; |
| 1263 | String bed1 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1264 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands= [" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1265 | "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" + |
Joachim Bingel | cd7b725 | 2014-02-13 08:49:14 +0000 | [diff] [blame] | 1266 | "{@type=korap:span, key=s}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1267 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | cd7b725 | 2014-02-13 08:49:14 +0000 | [diff] [blame] | 1268 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}" + |
| 1269 | "]}" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 1270 | "], frame=frame:startswith}" + |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 1271 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1272 | ct = new CosmasTree(query); |
| 1273 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | eecc765 | 2014-01-11 17:21:07 +0000 | [diff] [blame] | 1274 | assertEquals(bed1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1275 | |
| 1276 | query = "#BED(der Mann , +pe)"; |
| 1277 | String bed2 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1278 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands= [" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1279 | "{@type=korap:group, operation=operation:position, frames=[frames:endswith], operands=[" + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 1280 | "{@type=korap:span, key=p}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1281 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 1282 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 1283 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 1284 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 1285 | "]}" + |
| 1286 | "]}" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 1287 | "], frame=frame:endswith}" + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 1288 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1289 | ct = new CosmasTree(query); |
| 1290 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 1291 | assertEquals(bed2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 1292 | |
| 1293 | query = "#BED(der Mann , sa,-pa)"; |
| 1294 | String bed3 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1295 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1296 | "{@type=korap:group, operation=operation:position, frames=[frames:matches], operands=[" + |
| 1297 | "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 1298 | "{@type=korap:span, key=s}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1299 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 1300 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 1301 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 1302 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 1303 | "]}" + |
| 1304 | "]}" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 1305 | "], frame=frame:startswith}," + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1306 | "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 1307 | "{@type=korap:span, key=p}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1308 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 1309 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 1310 | "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," + |
| 1311 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 1312 | "]}" + |
| 1313 | "]}" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 1314 | "], frame=frame:startswith, exclude=true}" + |
Joachim Bingel | bd38636 | 2014-10-02 12:03:18 +0000 | [diff] [blame] | 1315 | "], frame=frame:matches}" + |
Joachim Bingel | 3f0850c | 2014-01-17 16:50:10 +0000 | [diff] [blame] | 1316 | "]}"; |
Joachim Bingel | 2daf986 | 2014-02-12 10:18:54 +0000 | [diff] [blame] | 1317 | ct = new CosmasTree(query); |
| 1318 | map = ct.getRequestMap().get("query").toString(); |
Joachim Bingel | 36233b5 | 2014-02-13 10:48:24 +0000 | [diff] [blame] | 1319 | assertEquals(bed3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d5161a1 | 2014-01-08 11:15:49 +0000 | [diff] [blame] | 1320 | } |
| 1321 | |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 1322 | @Test |
| 1323 | public void testColonSeparatedConditions() throws QueryException { |
| 1324 | |
| 1325 | query = "Der:sa"; |
| 1326 | String col1 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1327 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1328 | "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 1329 | "{@type=korap:span, key=s}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1330 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 1331 | "{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=match:eq}}" + |
| 1332 | "]}" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 1333 | "], frame=frame:startswith}" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 1334 | "]}"; |
| 1335 | ct = new CosmasTree(query); |
| 1336 | map = ct.getRequestMap().get("query").toString(); |
| 1337 | assertEquals(col1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1338 | |
| 1339 | query = "Mann:sa,-pa,+te)"; |
| 1340 | String col2 = |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1341 | "{@type=korap:reference, operation=operation:focus, classRef=[129], operands=[" + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1342 | "{@type=korap:group, operation=operation:position, frames=[frames:matches], operands=[" + |
| 1343 | "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 1344 | "{@type=korap:span, key=s}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1345 | "{@type=korap:group, operation=operation:class, class=129, classOut=129, operands=[" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 1346 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 1347 | "]}" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 1348 | "], frame=frame:startswith}," + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1349 | "{@type=korap:group, operation=operation:position, frames=[frames:startswith], operands=[" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 1350 | "{@type=korap:span, key=p}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1351 | "{@type=korap:group, operation=operation:class, class=130, classOut=130, operands=[" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 1352 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
| 1353 | "]}" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 1354 | "], frame=frame:startswith, exclude=true}," + |
Joachim Bingel | 9e6b948 | 2014-10-15 12:02:49 +0000 | [diff] [blame] | 1355 | "{@type=korap:group, operation=operation:position, frames=[frames:endswith], operands=[" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 1356 | "{@type=korap:span, key=t}," + |
Joachim Bingel | 6b491c2 | 2014-10-21 08:35:18 +0000 | [diff] [blame] | 1357 | "{@type=korap:group, operation=operation:class, class=131, classOut=131, operands=[" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 1358 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" + |
Joachim Bingel | aaabb72 | 2014-09-24 14:29:10 +0000 | [diff] [blame] | 1359 | "]}" + |
Joachim Bingel | 93e6c70 | 2014-09-30 15:19:23 +0000 | [diff] [blame] | 1360 | "], frame=frame:endswith}" + |
Joachim Bingel | bd38636 | 2014-10-02 12:03:18 +0000 | [diff] [blame] | 1361 | "], frame=frame:matches}" + |
Joachim Bingel | 8181263 | 2014-02-18 08:55:22 +0000 | [diff] [blame] | 1362 | "]}"; |
| 1363 | ct = new CosmasTree(query); |
| 1364 | map = ct.getRequestMap().get("query").toString(); |
| 1365 | assertEquals(col2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 1366 | } |
Joachim Bingel | b5f7bf0 | 2014-01-07 16:36:54 +0000 | [diff] [blame] | 1367 | } |
| 1368 | |