blob: 10b6ed80185d46fd7e28f63c86d8179e52d21692 [file] [log] [blame]
Joachim Bingelb5f7bf02014-01-07 16:36:54 +00001import static org.junit.Assert.*;
2
3import org.junit.Test;
4
5import de.ids_mannheim.korap.query.serialize.CosmasTree;
Joachim Bingelb5f7bf02014-01-07 16:36:54 +00006import de.ids_mannheim.korap.util.QueryException;
7
8public class CosmasTreeTest {
9
Joachim Bingel2daf9862014-02-12 10:18:54 +000010 CosmasTree ct;
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000011 String map;
12 String query;
13
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000014
Joachim Bingel81812632014-02-18 08:55:22 +000015 @Test
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000016 public void testContext() throws QueryException {
Joachim Bingel81812632014-02-18 08:55:22 +000017 String contextString = "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld";
Joachim Bingel2daf9862014-02-12 10:18:54 +000018 ct = new CosmasTree("Test");
19 assertEquals(contextString.replaceAll(" ", ""), ct.getRequestMap().get("@context").toString().replaceAll(" ", ""));
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000020 }
21
22
23 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +000024 public void testSingleToken() throws QueryException {
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000025 query="der";
26 String single1 =
Joachim Bingelee3b21d2014-02-12 12:34:59 +000027 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}";
Joachim Bingel2daf9862014-02-12 10:18:54 +000028 ct = new CosmasTree(query);
29 map = ct.getRequestMap().get("query").toString();
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000030 assertEquals(single1.replaceAll(" ", ""), map.replaceAll(" ", ""));
31
32 query="Mann";
33 String single2 =
Joachim Bingelee3b21d2014-02-12 12:34:59 +000034 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}";
Joachim Bingel2daf9862014-02-12 10:18:54 +000035 ct = new CosmasTree(query);
36 map = ct.getRequestMap().get("query").toString();
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000037 assertEquals(single2.replaceAll(" ", ""), map.replaceAll(" ", ""));
38
39 query="&Mann";
40 String single3 =
Joachim Bingelee3b21d2014-02-12 12:34:59 +000041 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=match:eq}}";
Joachim Bingel2daf9862014-02-12 10:18:54 +000042 ct = new CosmasTree(query);
43 map = ct.getRequestMap().get("query").toString();
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000044 assertEquals(single3.replaceAll(" ", ""), map.replaceAll(" ", ""));
45 }
46
Joachim Bingelba9a0ab2014-01-29 10:12:25 +000047 @Test
Joachim Bingel8c640e42014-02-07 16:20:47 +000048 public void testCaseSensitivityFlag() throws QueryException {
Joachim Bingel0207d5e2014-02-12 14:18:41 +000049 query="$deutscher";
50 String cs1 =
51 "{@type=korap:token, wrap={@type=korap:term, caseInsensitive=true, key=deutscher, layer=orth, match=match:eq}}";
52 ct = new CosmasTree(query);
53 map = ct.getRequestMap().get("query").toString();
54 assertEquals(cs1.replaceAll(" ", ""), map.replaceAll(" ", ""));
55
56 query="$deutscher Bundestag";
57 String cs2 =
58 "{@type=korap:group, operation=operation:sequence, operands=[" +
59 "{@type=korap:token, wrap={@type=korap:term, caseInsensitive=true, key=deutscher, layer=orth, match=match:eq}}," +
60 "{@type=korap:token, wrap={@type=korap:term, key=Bundestag, layer=orth, match=match:eq}}" +
61 "]}";
62 ct = new CosmasTree(query);
63 map = ct.getRequestMap().get("query").toString();
64 assertEquals(cs2.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingel8c640e42014-02-07 16:20:47 +000065 }
66
67 @Test
Joachim Bingelffd65e32014-01-22 14:22:57 +000068 public void testMORPH() throws QueryException {
69 query="#MORPH(V)";
70 String morph1 =
Joachim Bingel0207d5e2014-02-12 14:18:41 +000071 "{@type=korap:token, wrap={@type=korap:term, key=V, layer=pos, match=match:eq}}";
Joachim Bingel2daf9862014-02-12 10:18:54 +000072 ct = new CosmasTree(query);
73 map = ct.getRequestMap().get("query").toString();
Joachim Bingelffd65e32014-01-22 14:22:57 +000074 assertEquals(morph1.replaceAll(" ", ""), map.replaceAll(" ", ""));
75 }
76
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000077 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +000078 public void testSequence() throws QueryException {
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000079 query="der Mann";
80 String seq1 =
Joachim Bingel2daf9862014-02-12 10:18:54 +000081 "{@type=korap:group, operation=operation:sequence, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +000082 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
83 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000084 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +000085 ct = new CosmasTree(query);
86 map = ct.getRequestMap().get("query").toString();
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000087 assertEquals(seq1.replaceAll(" ", ""), map.replaceAll(" ", ""));
88
Joachim Bingeld5161a12014-01-08 11:15:49 +000089 query="der Mann schläft";
90 String seq2 =
Joachim Bingel2daf9862014-02-12 10:18:54 +000091 "{@type=korap:group, operation=operation:sequence, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +000092 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
93 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}," +
94 "{@type=korap:token, wrap={@type=korap:term, key=schläft, layer=orth, match=match:eq}}" +
Joachim Bingeld5161a12014-01-08 11:15:49 +000095 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +000096 ct = new CosmasTree(query);
97 map = ct.getRequestMap().get("query").toString();
Joachim Bingeld5161a12014-01-08 11:15:49 +000098 assertEquals(seq2.replaceAll(" ", ""), map.replaceAll(" ", ""));
99
100 query="der Mann schläft lang";
101 String seq3 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000102 "{@type=korap:group, operation=operation:sequence, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000103 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
104 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}," +
105 "{@type=korap:token, wrap={@type=korap:term, key=schläft, layer=orth, match=match:eq}}," +
106 "{@type=korap:token, wrap={@type=korap:term, key=lang, layer=orth, match=match:eq}}" +
Joachim Bingeld5161a12014-01-08 11:15:49 +0000107 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000108 ct = new CosmasTree(query);
109 map = ct.getRequestMap().get("query").toString();
Joachim Bingeld5161a12014-01-08 11:15:49 +0000110 assertEquals(seq3.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000111 }
112
113 @Test
114 public void testOPOR() throws QueryException {
115 query="Sonne oder Mond";
116 String disj1 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000117 "{@type=korap:group, operation=operation:or, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000118 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
119 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000120 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000121 ct = new CosmasTree(query);
122 map = ct.getRequestMap().get("query").toString();
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000123 assertEquals(disj1.replaceAll(" ", ""), map.replaceAll(" ", ""));
124
Joachim Bingeld5161a12014-01-08 11:15:49 +0000125 query="(Sonne scheint) oder Mond";
126 String disj2 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000127 "{@type=korap:group, operation=operation:or, operands=[" +
128 "{@type=korap:group, operation=operation:sequence, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000129 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
130 "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}" +
Joachim Bingeld5161a12014-01-08 11:15:49 +0000131 "]}," +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000132 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
Joachim Bingeld5161a12014-01-08 11:15:49 +0000133 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000134 ct = new CosmasTree(query);
135 map = ct.getRequestMap().get("query").toString();
Joachim Bingeld5161a12014-01-08 11:15:49 +0000136 assertEquals(disj2.replaceAll(" ", ""), map.replaceAll(" ", ""));
137
138 query="(Sonne scheint) oder (Mond scheint)";
139 String disj3 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000140 "{@type=korap:group, operation=operation:or, operands=[" +
141 "{@type=korap:group, operation=operation:sequence, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000142 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
143 "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}" +
Joachim Bingeld5161a12014-01-08 11:15:49 +0000144 "]}," +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000145 "{@type=korap:group, operation=operation:sequence, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000146 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}," +
147 "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}" +
Joachim Bingeld5161a12014-01-08 11:15:49 +0000148 "]}" +
149 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000150 ct = new CosmasTree(query);
151 map = ct.getRequestMap().get("query").toString();
Joachim Bingeld5161a12014-01-08 11:15:49 +0000152 assertEquals(disj3.replaceAll(" ", ""), map.replaceAll(" ", ""));
153
154 }
155
156 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000157 public void testOPORAND() throws QueryException {
Joachim Bingeld5161a12014-01-08 11:15:49 +0000158 query="(Sonne oder Mond) und scheint";
159 String orand1 =
Joachim Bingelb7a59792014-02-14 13:52:29 +0000160 "{@type=korap:group, operation=operation:sequence, distances=[" +
161 "{@type=korap:distance, key=t, min=0, max=0}" +
162 "], operands=[" +
163 "{@type=korap:group, operation=operation:or, operands=[" +
164 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
165 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
166 "]}," +
167 "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}" +
Joachim Bingeld5161a12014-01-08 11:15:49 +0000168 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000169 ct = new CosmasTree(query);
170 map = ct.getRequestMap().get("query").toString();
Joachim Bingeld5161a12014-01-08 11:15:49 +0000171 assertEquals(orand1.replaceAll(" ", ""), map.replaceAll(" ", ""));
172
173 query="scheint und (Sonne oder Mond)";
174 String orand2 =
Joachim Bingelb7a59792014-02-14 13:52:29 +0000175 "{@type=korap:group, operation=operation:sequence, distances=[" +
176 "{@type=korap:distance, key=t, min=0, max=0}" +
177 "], operands=[" +
178 "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}," +
179 "{@type=korap:group, operation=operation:or, operands=[" +
180 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
181 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
Joachim Bingeld5161a12014-01-08 11:15:49 +0000182 "]}" +
183 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000184 ct = new CosmasTree(query);
185 map = ct.getRequestMap().get("query").toString();
Joachim Bingeld5161a12014-01-08 11:15:49 +0000186 assertEquals(orand2.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000187 }
188
189 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000190 public void testOPPROX() throws QueryException {
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000191 query="Sonne /+w1:4 Mond";
192 String prox1 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000193 "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000194 "distances=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000195 "{@type=korap:distance, key=w, min=1, max=4}" +
Joachim Bingel89cceac2014-01-08 15:51:08 +0000196 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000197 "operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000198 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
199 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
Joachim Bingel89cceac2014-01-08 15:51:08 +0000200 "]" +
201 "}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000202 ct = new CosmasTree(query);
203 map = ct.getRequestMap().get("query").toString();
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000204 assertEquals(prox1.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingel89cceac2014-01-08 15:51:08 +0000205
206 query="Sonne /+w1:4,s0,p1:3 Mond";
207 String prox2 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000208 "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000209 "distances=[" +
Joachim Bingelcd7b7252014-02-13 08:49:14 +0000210 "{@type=korap:distance, key=w, min=1, max=4}," +
211 "{@type=korap:distance, key=s, min=0, max=0}," +
212 "{@type=korap:distance, key=p, min=1, max=3}" +
Joachim Bingel89cceac2014-01-08 15:51:08 +0000213 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000214 "operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000215 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
216 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
Joachim Bingel89cceac2014-01-08 15:51:08 +0000217 "]" +
218 "}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000219 ct = new CosmasTree(query);
220 map = ct.getRequestMap().get("query").toString();
Joachim Bingel89cceac2014-01-08 15:51:08 +0000221 assertEquals(prox2.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingel87480d02014-01-17 14:07:46 +0000222
223 query="Sonne %+w1:4,s0,p1:3 Mond";
224 String prox3 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000225 "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000226 "distances=[" +
Joachim Bingelcd7b7252014-02-13 08:49:14 +0000227 "{@type=korap:distance, key=w, min=1, max=4, exclude=true}," +
228 "{@type=korap:distance, key=s, min=0, max=0, exclude=true}," +
229 "{@type=korap:distance, key=p, min=1, max=3, exclude=true}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000230 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000231 "operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000232 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
233 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000234 "]" +
235 "}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000236 ct = new CosmasTree(query);
237 map = ct.getRequestMap().get("query").toString();
Joachim Bingel87480d02014-01-17 14:07:46 +0000238 assertEquals(prox3.replaceAll(" ", ""), map.replaceAll(" ", ""));
239
240 query="Sonne /+w4 Mond";
241 String prox4 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000242 "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000243 "distances=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000244 "{@type=korap:distance, key=w, min=0, max=4}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000245 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000246 "operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000247 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
248 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000249 "]" +
250 "}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000251 ct = new CosmasTree(query);
252 map = ct.getRequestMap().get("query").toString();
Joachim Bingel87480d02014-01-17 14:07:46 +0000253 assertEquals(prox4.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000254
255 query="Sonne /-w4 Mond";
256 String prox5 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000257 "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000258 "distances=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000259 "{@type=korap:distance, key=w, min=0, max=4}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000260 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000261 "operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000262 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}," +
263 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000264 "]" +
265 "}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000266 ct = new CosmasTree(query);
267 map = ct.getRequestMap().get("query").toString();
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000268 assertEquals(prox5.replaceAll(" ", ""), map.replaceAll(" ", ""));
269 }
270
271 @Test
Joachim Bingelba9a0ab2014-01-29 10:12:25 +0000272 public void testOPPROXNested() throws QueryException {
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000273 query="Sonne /-w4 Mond /+w2 Sterne";
274 String prox6 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000275 "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000276 "distances=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000277 "{@type=korap:distance, key=w, min=0, max=4}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000278 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000279 "operands=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000280 "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000281 "distances=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000282 "{@type=korap:distance, key=w, min=0, max=2}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000283 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000284 "operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000285 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}," +
286 "{@type=korap:token, wrap={@type=korap:term, key=Sterne, layer=orth, match=match:eq}}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000287 "]}," +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000288 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000289 "]" +
290 "}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000291 ct = new CosmasTree(query);
292 map = ct.getRequestMap().get("query").toString();
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000293 assertEquals(prox6.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000294 }
295
296 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000297 public void testOPIN() throws QueryException {
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000298 query="wegen #IN <s>";
Joachim Bingel3a9f7932014-01-07 17:11:31 +0000299 String opin1 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000300 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
301 "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
302 "{@type=korap:span, key=s}," +
303 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000304 "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
Joachim Bingeleecc7652014-01-11 17:21:07 +0000305 "]}" +
306 "]}" +
Joachim Bingeld5161a12014-01-08 11:15:49 +0000307 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000308 ct = new CosmasTree(query);
309 map = ct.getRequestMap().get("query").toString();
Joachim Bingeld5161a12014-01-08 11:15:49 +0000310 assertEquals(opin1.replaceAll(" ", ""), map.replaceAll(" ", ""));
311
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000312 query="wegen #IN(L) <s>";
313 String opin2 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000314 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
315 "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
316 "{@type=korap:span, key=s}," +
317 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000318 "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000319 "]}" +
320 "]}" +
321 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000322 ct = new CosmasTree(query);
323 map = ct.getRequestMap().get("query").toString();
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000324 assertEquals(opin2.replaceAll(" ", ""), map.replaceAll(" ", ""));
325
Joachim Bingel87480d02014-01-17 14:07:46 +0000326 query="wegen #IN(%, L) <s>";
327 String opin3 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000328 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
329 "{@type=korap:group, operation=operation:position, frame=frame:startswith, exclude=true, operands=[" +
330 "{@type=korap:span, key=s}," +
331 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000332 "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000333 "]}" +
334 "]}" +
335 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000336 ct = new CosmasTree(query);
337 map = ct.getRequestMap().get("query").toString();
Joachim Bingel87480d02014-01-17 14:07:46 +0000338 assertEquals(opin3.replaceAll(" ", ""), map.replaceAll(" ", ""));
339
340 query="wegen #IN('FE,ALL,%,MIN') <s>";
341 String opin4 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000342 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
343 "{@type=korap:group, operation=operation:position, frame=frame:matches, range=all, exclude=true, grouping=false, operands=[" +
344 "{@type=korap:span, key=s}," +
345 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000346 "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000347 "]}" +
348 "]}" +
349 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000350 ct = new CosmasTree(query);
351 map = ct.getRequestMap().get("query").toString();
Joachim Bingel87480d02014-01-17 14:07:46 +0000352 assertEquals(opin4.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingeld5161a12014-01-08 11:15:49 +0000353 }
354
355 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000356 public void testOPOV() throws QueryException {
Joachim Bingeld5161a12014-01-08 11:15:49 +0000357 query="wegen #OV <s>";
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000358 String opov1 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000359 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
360 "{@type=korap:group, operation=operation:position, frame=frame:overlaps, operands=[" +
361 "{@type=korap:span, key=s}," +
362 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000363 "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000364 "]}" +
365 "]}" +
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000366 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000367 ct = new CosmasTree(query);
368 map = ct.getRequestMap().get("query").toString();
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000369 assertEquals(opov1.replaceAll(" ", ""), map.replaceAll(" ", ""));
370
371 query="wegen #OV(L) <s>";
372 String opov2 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000373 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
374 "{@type=korap:group, operation=operation:position, frame=frame:overlaps-left, operands=[" +
375 "{@type=korap:span, key=s}," +
376 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000377 "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000378 "]}" +
379 "]}" +
380 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000381 ct = new CosmasTree(query);
382 map = ct.getRequestMap().get("query").toString();
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000383 assertEquals(opov2.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000384 }
385
386 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000387 public void testOPNOT() throws QueryException {
Joachim Bingel3a9f7932014-01-07 17:11:31 +0000388 query="Sonne nicht Mond";
389 String opnot1 =
Joachim Bingelb7a59792014-02-14 13:52:29 +0000390 "{@type=korap:group, operation=operation:sequence, distances=[" +
391 "{@type=korap:distance, key=t, min=0, max=0, exclude=true}" +
392 "], operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000393 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
394 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
Joachim Bingel3a9f7932014-01-07 17:11:31 +0000395 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000396 ct = new CosmasTree(query);
397 map = ct.getRequestMap().get("query").toString();
Joachim Bingel3a9f7932014-01-07 17:11:31 +0000398 assertEquals(opnot1.replaceAll(" ", ""), map.replaceAll(" ", ""));
399 }
400
401 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000402 public void testBEG_END() throws QueryException {
Joachim Bingel3a9f7932014-01-07 17:11:31 +0000403 // BEG and END operators
404 // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/links.html
405 // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/rechts.html
406 // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/thematische-bsp/bsp-satzlaenge.html
Joachim Bingel87480d02014-01-17 14:07:46 +0000407 query="#BEG(der /w3:5 Mann)";
408 String beg1 =
Joachim Bingelcd7b7252014-02-13 08:49:14 +0000409 "{@type=korap:group, operation=operation:submatch, spanRef=[0,1], operands=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000410 "{@type=korap:group, operation=operation:sequence, inOrder=false, distances=[" +
411 "{@type=korap:distance, key=w, min=3, max=5}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000412 "]," +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000413 "operands = [" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000414 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
415 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000416 "]}" +
417 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000418 ct = new CosmasTree(query);
419 map = ct.getRequestMap().get("query").toString();
Joachim Bingel87480d02014-01-17 14:07:46 +0000420 assertEquals(beg1.replaceAll(" ", ""), map.replaceAll(" ", ""));
421
422 query="#BEG(der /w3:5 Mann) /+w10 kommt"; // nesting #BEG() in a distance group
423 String beg2 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000424 "{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
425 "{@type=korap:distance, key=w, min=0, max=10}" +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000426 "], operands=[" +
Joachim Bingelcd7b7252014-02-13 08:49:14 +0000427 "{@type=korap:group, operation=operation:submatch, spanRef=[0,1], operands=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000428 "{@type=korap:group, operation=operation:sequence, inOrder=false, distances=[" +
429 "{@type=korap:distance, key=w, min=3, max=5}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000430 "]," +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000431 "operands = [" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000432 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
433 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000434 "]}" +
435 "]}," +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000436 "{@type=korap:token, wrap={@type=korap:term, key=kommt, layer=orth, match=match:eq}}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000437 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000438 ct = new CosmasTree(query);
439 map = ct.getRequestMap().get("query").toString();
Joachim Bingel87480d02014-01-17 14:07:46 +0000440 assertEquals(beg2.replaceAll(" ", ""), map.replaceAll(" ", ""));
441
442 query="#END(der /w3:5 Mann)";
443 String end1 =
Joachim Bingelcd7b7252014-02-13 08:49:14 +0000444 "{@type=korap:group, operation=operation:submatch, spanRef=[-1,1], operands=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000445 "{@type=korap:group, operation=operation:sequence, inOrder=false, distances=[" +
446 "{@type=korap:distance, key=w, min=3, max=5}" +
Joachim Bingelba9a0ab2014-01-29 10:12:25 +0000447 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000448 "operands = [" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000449 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
450 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000451 "]}" +
452 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000453 ct = new CosmasTree(query);
454 map = ct.getRequestMap().get("query").toString();
Joachim Bingel87480d02014-01-17 14:07:46 +0000455 assertEquals(end1.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000456 }
Joachim Bingeld5161a12014-01-08 11:15:49 +0000457
458
459 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000460 public void testELEM() throws QueryException {
Joachim Bingeld5161a12014-01-08 11:15:49 +0000461 // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/elem.html
Joachim Bingeleecc7652014-01-11 17:21:07 +0000462 query="#ELEM(S)";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000463 String elem1 = "{@type=korap:span, key=s}";
464 ct = new CosmasTree(query);
465 map = ct.getRequestMap().get("query").toString();
Joachim Bingeleecc7652014-01-11 17:21:07 +0000466 assertEquals(elem1.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingeld5161a12014-01-08 11:15:49 +0000467 }
468
469 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000470 public void testOPALL() throws QueryException {
Joachim Bingel89cceac2014-01-08 15:51:08 +0000471 query="#ALL(gehen /w1:10 voran)";
Joachim Bingele98d0882014-01-21 12:58:54 +0000472 String all1 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000473 "{@type=korap:group, operation=operation:sequence, inOrder=false, " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000474 "distances=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000475 "{@type=korap:distance, key=w, min=1, max=10}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000476 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000477 "operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000478 "{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}," +
479 "{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000480 "]" +
481 "}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000482 ct = new CosmasTree(query);
483 map = ct.getRequestMap().get("query").toString();
Joachim Bingel89cceac2014-01-08 15:51:08 +0000484 assertEquals(all1.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingeld5161a12014-01-08 11:15:49 +0000485 }
486
Joachim Bingel36233b52014-02-13 10:48:24 +0000487 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000488 public void testOPNHIT() throws QueryException {
Joachim Bingel89cceac2014-01-08 15:51:08 +0000489 query="#NHIT(gehen /w1:10 voran)";
490 String nhit1 =
Joachim Bingel36233b52014-02-13 10:48:24 +0000491 "{@type=korap:group, operation=operation:submatch, classRef=[1,2], classRefOp=classRefOp:intersection, operands=[" +
492 "{@type=korap:group, operation=operation:sequence, inOrder=false, " +
493 "distances=[" +
494 "{@type=korap:distance, key=w, min=1, max=10}" +
495 "], " +
496 "operands=[" +
497 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
498 "{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}" +
499 "]}," +
500 "{@type=korap:group, operation=operation:class, class=2, operands=[" +
501 "{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}" +
502 "]}" +
503 "]" +
504 "}" +
505 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000506 ct = new CosmasTree(query);
507 map = ct.getRequestMap().get("query").toString();
Joachim Bingel89cceac2014-01-08 15:51:08 +0000508 assertEquals(nhit1.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingeld5161a12014-01-08 11:15:49 +0000509 }
510
511 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000512 public void testOPBED() throws QueryException {
Joachim Bingeleecc7652014-01-11 17:21:07 +0000513 query = "#BED(der , sa)";
514 String bed1 =
Joachim Bingelcd7b7252014-02-13 08:49:14 +0000515 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands= [" +
516 "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
517 "{@type=korap:span, key=s}," +
518 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
519 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}" +
520 "]}" +
521 "]}" +
Joachim Bingeleecc7652014-01-11 17:21:07 +0000522 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000523 ct = new CosmasTree(query);
524 map = ct.getRequestMap().get("query").toString();
Joachim Bingeleecc7652014-01-11 17:21:07 +0000525 assertEquals(bed1.replaceAll(" ", ""), map.replaceAll(" ", ""));
526
527 query = "#BED(der Mann , +pe)";
528 String bed2 =
Joachim Bingel36233b52014-02-13 10:48:24 +0000529 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands= [" +
530 "{@type=korap:group, operation=operation:position, frame=frame:endswith, operands=[" +
531 "{@type=korap:span, key=p}," +
532 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
533 "{@type=korap:group, operation=operation:sequence, operands=[" +
534 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
535 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
536 "]}" +
537 "]}" +
538 "]}" +
539 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000540 ct = new CosmasTree(query);
541 map = ct.getRequestMap().get("query").toString();
Joachim Bingel36233b52014-02-13 10:48:24 +0000542 assertEquals(bed2.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000543
544 query = "#BED(der Mann , sa,-pa)";
545 String bed3 =
Joachim Bingel36233b52014-02-13 10:48:24 +0000546 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
547 "{@type=korap:group, operation=operation:sequence, distances=[" +
548 "{@type=korap:distance, key=w, min=0, max=0}" +
549 "], operands=[" +
550 "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
551 "{@type=korap:span, key=s}," +
552 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
553 "{@type=korap:group, operation=operation:sequence, operands=[" +
554 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
555 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
556 "]}" +
557 "]}" +
558 "]}," +
559 "{@type=korap:group, operation=operation:position, frame=frame:startswith, exclude=true, operands=[" +
560 "{@type=korap:span, key=p}," +
561 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
562 "{@type=korap:group, operation=operation:sequence, operands=[" +
563 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
564 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
565 "]}" +
566 "]}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000567 "]}" +
568 "]}" +
569 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000570 ct = new CosmasTree(query);
571 map = ct.getRequestMap().get("query").toString();
Joachim Bingel36233b52014-02-13 10:48:24 +0000572 assertEquals(bed3.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingeld5161a12014-01-08 11:15:49 +0000573 }
574
Joachim Bingel81812632014-02-18 08:55:22 +0000575 @Test
576 public void testColonSeparatedConditions() throws QueryException {
577
578 query = "Der:sa";
579 String col1 =
580 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
581 "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
582 "{@type=korap:span, key=s}," +
583 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
584 "{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=match:eq}}" +
585 "]}" +
586 "]}" +
587 "]}";
588 ct = new CosmasTree(query);
589 map = ct.getRequestMap().get("query").toString();
590 assertEquals(col1.replaceAll(" ", ""), map.replaceAll(" ", ""));
591
592 query = "Mann:sa,-pa,+te)";
593 String col2 =
594 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
595 "{@type=korap:group, operation=operation:sequence, distances=[" +
596 "{@type=korap:distance, key=w, min=0, max=0}" +
597 "], operands=[" +
598 "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
599 "{@type=korap:span, key=s}," +
600 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
601 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
602 "]}" +
603 "]}," +
604 "{@type=korap:group, operation=operation:position, frame=frame:startswith, exclude=true, operands=[" +
605 "{@type=korap:span, key=p}," +
606 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
607 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
608 "]}" +
609 "]}," +
610 "{@type=korap:group, operation=operation:position, frame=frame:endswith, operands=[" +
611 "{@type=korap:span, key=t}," +
612 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
613 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
614 "]}" +
615 "]}" +
616 "]}" +
617 "]}";
618 ct = new CosmasTree(query);
619 map = ct.getRequestMap().get("query").toString();
620 assertEquals(col2.replaceAll(" ", ""), map.replaceAll(" ", ""));
621 }
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000622}
623