blob: b084bb40a7df2654b51cc4a41d0f53df6f1237b1 [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
14 private boolean equalsContent(String str, Object map) {
15 str = str.replaceAll(" ", "");
16 String mapStr = map.toString().replaceAll(" ", "");
17 return str.equals(mapStr);
18 }
19
20 private boolean equalsQueryContent(String res, String query) throws QueryException {
21 res = res.replaceAll(" ", "");
Joachim Bingel2daf9862014-02-12 10:18:54 +000022 ct = new CosmasTree(query);
23 String queryMap = ct.getRequestMap().get("query").toString().replaceAll(" ", "");
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000024 return res.equals(queryMap);
25 }
26
Joachim Bingel81812632014-02-18 08:55:22 +000027 @Test
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000028 public void testContext() throws QueryException {
Joachim Bingel81812632014-02-18 08:55:22 +000029 String contextString = "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld";
Joachim Bingel2daf9862014-02-12 10:18:54 +000030 ct = new CosmasTree("Test");
31 assertEquals(contextString.replaceAll(" ", ""), ct.getRequestMap().get("@context").toString().replaceAll(" ", ""));
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000032 }
33
34
35 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +000036 public void testSingleToken() throws QueryException {
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000037 query="der";
38 String single1 =
Joachim Bingelee3b21d2014-02-12 12:34:59 +000039 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}";
Joachim Bingel2daf9862014-02-12 10:18:54 +000040 ct = new CosmasTree(query);
41 map = ct.getRequestMap().get("query").toString();
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000042 assertEquals(single1.replaceAll(" ", ""), map.replaceAll(" ", ""));
43
44 query="Mann";
45 String single2 =
Joachim Bingelee3b21d2014-02-12 12:34:59 +000046 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}";
Joachim Bingel2daf9862014-02-12 10:18:54 +000047 ct = new CosmasTree(query);
48 map = ct.getRequestMap().get("query").toString();
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000049 assertEquals(single2.replaceAll(" ", ""), map.replaceAll(" ", ""));
50
51 query="&Mann";
52 String single3 =
Joachim Bingelee3b21d2014-02-12 12:34:59 +000053 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=match:eq}}";
Joachim Bingel2daf9862014-02-12 10:18:54 +000054 ct = new CosmasTree(query);
55 map = ct.getRequestMap().get("query").toString();
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000056 assertEquals(single3.replaceAll(" ", ""), map.replaceAll(" ", ""));
57 }
58
Joachim Bingelba9a0ab2014-01-29 10:12:25 +000059 @Test
Joachim Bingel8c640e42014-02-07 16:20:47 +000060 public void testCaseSensitivityFlag() throws QueryException {
Joachim Bingel0207d5e2014-02-12 14:18:41 +000061 query="$deutscher";
62 String cs1 =
63 "{@type=korap:token, wrap={@type=korap:term, caseInsensitive=true, key=deutscher, layer=orth, match=match:eq}}";
64 ct = new CosmasTree(query);
65 map = ct.getRequestMap().get("query").toString();
66 assertEquals(cs1.replaceAll(" ", ""), map.replaceAll(" ", ""));
67
68 query="$deutscher Bundestag";
69 String cs2 =
70 "{@type=korap:group, operation=operation:sequence, operands=[" +
71 "{@type=korap:token, wrap={@type=korap:term, caseInsensitive=true, key=deutscher, layer=orth, match=match:eq}}," +
72 "{@type=korap:token, wrap={@type=korap:term, key=Bundestag, layer=orth, match=match:eq}}" +
73 "]}";
74 ct = new CosmasTree(query);
75 map = ct.getRequestMap().get("query").toString();
76 assertEquals(cs2.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingel8c640e42014-02-07 16:20:47 +000077 }
78
79 @Test
Joachim Bingelffd65e32014-01-22 14:22:57 +000080 public void testMORPH() throws QueryException {
81 query="#MORPH(V)";
82 String morph1 =
Joachim Bingel0207d5e2014-02-12 14:18:41 +000083 "{@type=korap:token, wrap={@type=korap:term, key=V, layer=pos, match=match:eq}}";
Joachim Bingel2daf9862014-02-12 10:18:54 +000084 ct = new CosmasTree(query);
85 map = ct.getRequestMap().get("query").toString();
Joachim Bingelffd65e32014-01-22 14:22:57 +000086 assertEquals(morph1.replaceAll(" ", ""), map.replaceAll(" ", ""));
87 }
88
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000089 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +000090 public void testSequence() throws QueryException {
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000091 query="der Mann";
92 String seq1 =
Joachim Bingel2daf9862014-02-12 10:18:54 +000093 "{@type=korap:group, operation=operation:sequence, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +000094 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
95 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000096 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +000097 ct = new CosmasTree(query);
98 map = ct.getRequestMap().get("query").toString();
Joachim Bingelb5f7bf02014-01-07 16:36:54 +000099 assertEquals(seq1.replaceAll(" ", ""), map.replaceAll(" ", ""));
100
Joachim Bingeld5161a12014-01-08 11:15:49 +0000101 query="der Mann schläft";
102 String seq2 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000103 "{@type=korap:group, operation=operation:sequence, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000104 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
105 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}," +
106 "{@type=korap:token, wrap={@type=korap:term, key=schläft, 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(seq2.replaceAll(" ", ""), map.replaceAll(" ", ""));
111
112 query="der Mann schläft lang";
113 String seq3 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000114 "{@type=korap:group, operation=operation:sequence, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000115 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
116 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}," +
117 "{@type=korap:token, wrap={@type=korap:term, key=schläft, layer=orth, match=match:eq}}," +
118 "{@type=korap:token, wrap={@type=korap:term, key=lang, layer=orth, match=match:eq}}" +
Joachim Bingeld5161a12014-01-08 11:15:49 +0000119 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000120 ct = new CosmasTree(query);
121 map = ct.getRequestMap().get("query").toString();
Joachim Bingeld5161a12014-01-08 11:15:49 +0000122 assertEquals(seq3.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000123 }
124
125 @Test
126 public void testOPOR() throws QueryException {
127 query="Sonne oder Mond";
128 String disj1 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000129 "{@type=korap:group, operation=operation:or, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000130 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
131 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000132 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000133 ct = new CosmasTree(query);
134 map = ct.getRequestMap().get("query").toString();
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000135 assertEquals(disj1.replaceAll(" ", ""), map.replaceAll(" ", ""));
136
Joachim Bingeld5161a12014-01-08 11:15:49 +0000137 query="(Sonne scheint) oder Mond";
138 String disj2 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000139 "{@type=korap:group, operation=operation:or, operands=[" +
140 "{@type=korap:group, operation=operation:sequence, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000141 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
142 "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}" +
Joachim Bingeld5161a12014-01-08 11:15:49 +0000143 "]}," +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000144 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
Joachim Bingeld5161a12014-01-08 11:15:49 +0000145 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000146 ct = new CosmasTree(query);
147 map = ct.getRequestMap().get("query").toString();
Joachim Bingeld5161a12014-01-08 11:15:49 +0000148 assertEquals(disj2.replaceAll(" ", ""), map.replaceAll(" ", ""));
149
150 query="(Sonne scheint) oder (Mond scheint)";
151 String disj3 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000152 "{@type=korap:group, operation=operation:or, operands=[" +
153 "{@type=korap:group, operation=operation:sequence, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000154 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
155 "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}" +
Joachim Bingeld5161a12014-01-08 11:15:49 +0000156 "]}," +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000157 "{@type=korap:group, operation=operation:sequence, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000158 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}," +
159 "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}" +
Joachim Bingeld5161a12014-01-08 11:15:49 +0000160 "]}" +
161 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000162 ct = new CosmasTree(query);
163 map = ct.getRequestMap().get("query").toString();
Joachim Bingeld5161a12014-01-08 11:15:49 +0000164 assertEquals(disj3.replaceAll(" ", ""), map.replaceAll(" ", ""));
165
166 }
167
168 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000169 public void testOPORAND() throws QueryException {
Joachim Bingeld5161a12014-01-08 11:15:49 +0000170 query="(Sonne oder Mond) und scheint";
171 String orand1 =
Joachim Bingelb7a59792014-02-14 13:52:29 +0000172 "{@type=korap:group, operation=operation:sequence, distances=[" +
173 "{@type=korap:distance, key=t, min=0, max=0}" +
174 "], operands=[" +
175 "{@type=korap:group, operation=operation:or, operands=[" +
176 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
177 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
178 "]}," +
179 "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}" +
Joachim Bingeld5161a12014-01-08 11:15:49 +0000180 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000181 ct = new CosmasTree(query);
182 map = ct.getRequestMap().get("query").toString();
Joachim Bingeld5161a12014-01-08 11:15:49 +0000183 assertEquals(orand1.replaceAll(" ", ""), map.replaceAll(" ", ""));
184
185 query="scheint und (Sonne oder Mond)";
186 String orand2 =
Joachim Bingelb7a59792014-02-14 13:52:29 +0000187 "{@type=korap:group, operation=operation:sequence, distances=[" +
188 "{@type=korap:distance, key=t, min=0, max=0}" +
189 "], operands=[" +
190 "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=match:eq}}," +
191 "{@type=korap:group, operation=operation:or, operands=[" +
192 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
193 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
Joachim Bingeld5161a12014-01-08 11:15:49 +0000194 "]}" +
195 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000196 ct = new CosmasTree(query);
197 map = ct.getRequestMap().get("query").toString();
Joachim Bingeld5161a12014-01-08 11:15:49 +0000198 assertEquals(orand2.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000199 }
200
201 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000202 public void testOPPROX() throws QueryException {
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000203 query="Sonne /+w1:4 Mond";
204 String prox1 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000205 "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000206 "distances=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000207 "{@type=korap:distance, key=w, min=1, max=4}" +
Joachim Bingel89cceac2014-01-08 15:51:08 +0000208 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000209 "operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000210 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
211 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
Joachim Bingel89cceac2014-01-08 15:51:08 +0000212 "]" +
213 "}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000214 ct = new CosmasTree(query);
215 map = ct.getRequestMap().get("query").toString();
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000216 assertEquals(prox1.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingel89cceac2014-01-08 15:51:08 +0000217
218 query="Sonne /+w1:4,s0,p1:3 Mond";
219 String prox2 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000220 "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000221 "distances=[" +
Joachim Bingelcd7b7252014-02-13 08:49:14 +0000222 "{@type=korap:distance, key=w, min=1, max=4}," +
223 "{@type=korap:distance, key=s, min=0, max=0}," +
224 "{@type=korap:distance, key=p, min=1, max=3}" +
Joachim Bingel89cceac2014-01-08 15:51:08 +0000225 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000226 "operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000227 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
228 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
Joachim Bingel89cceac2014-01-08 15:51:08 +0000229 "]" +
230 "}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000231 ct = new CosmasTree(query);
232 map = ct.getRequestMap().get("query").toString();
Joachim Bingel89cceac2014-01-08 15:51:08 +0000233 assertEquals(prox2.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingel87480d02014-01-17 14:07:46 +0000234
235 query="Sonne %+w1:4,s0,p1:3 Mond";
236 String prox3 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000237 "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000238 "distances=[" +
Joachim Bingelcd7b7252014-02-13 08:49:14 +0000239 "{@type=korap:distance, key=w, min=1, max=4, exclude=true}," +
240 "{@type=korap:distance, key=s, min=0, max=0, exclude=true}," +
241 "{@type=korap:distance, key=p, min=1, max=3, exclude=true}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000242 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000243 "operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000244 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
245 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000246 "]" +
247 "}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000248 ct = new CosmasTree(query);
249 map = ct.getRequestMap().get("query").toString();
Joachim Bingel87480d02014-01-17 14:07:46 +0000250 assertEquals(prox3.replaceAll(" ", ""), map.replaceAll(" ", ""));
251
252 query="Sonne /+w4 Mond";
253 String prox4 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000254 "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000255 "distances=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000256 "{@type=korap:distance, key=w, min=0, max=4}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000257 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000258 "operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000259 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
260 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000261 "]" +
262 "}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000263 ct = new CosmasTree(query);
264 map = ct.getRequestMap().get("query").toString();
Joachim Bingel87480d02014-01-17 14:07:46 +0000265 assertEquals(prox4.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000266
267 query="Sonne /-w4 Mond";
268 String prox5 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000269 "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000270 "distances=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000271 "{@type=korap:distance, key=w, min=0, max=4}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000272 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000273 "operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000274 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}," +
275 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000276 "]" +
277 "}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000278 ct = new CosmasTree(query);
279 map = ct.getRequestMap().get("query").toString();
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000280 assertEquals(prox5.replaceAll(" ", ""), map.replaceAll(" ", ""));
281 }
282
283 @Test
Joachim Bingelba9a0ab2014-01-29 10:12:25 +0000284 public void testOPPROXNested() throws QueryException {
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000285 query="Sonne /-w4 Mond /+w2 Sterne";
286 String prox6 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000287 "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000288 "distances=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000289 "{@type=korap:distance, key=w, min=0, max=4}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000290 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000291 "operands=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000292 "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000293 "distances=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000294 "{@type=korap:distance, key=w, min=0, max=2}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000295 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000296 "operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000297 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}," +
298 "{@type=korap:token, wrap={@type=korap:term, key=Sterne, layer=orth, match=match:eq}}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000299 "]}," +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000300 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000301 "]" +
302 "}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000303 ct = new CosmasTree(query);
304 map = ct.getRequestMap().get("query").toString();
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000305 assertEquals(prox6.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000306 }
307
308 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000309 public void testOPIN() throws QueryException {
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000310 query="wegen #IN <s>";
Joachim Bingel3a9f7932014-01-07 17:11:31 +0000311 String opin1 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000312 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
313 "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
314 "{@type=korap:span, key=s}," +
315 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000316 "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
Joachim Bingeleecc7652014-01-11 17:21:07 +0000317 "]}" +
318 "]}" +
Joachim Bingeld5161a12014-01-08 11:15:49 +0000319 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000320 ct = new CosmasTree(query);
321 map = ct.getRequestMap().get("query").toString();
Joachim Bingeld5161a12014-01-08 11:15:49 +0000322 assertEquals(opin1.replaceAll(" ", ""), map.replaceAll(" ", ""));
323
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000324 query="wegen #IN(L) <s>";
325 String opin2 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000326 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
327 "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
328 "{@type=korap:span, key=s}," +
329 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000330 "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000331 "]}" +
332 "]}" +
333 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000334 ct = new CosmasTree(query);
335 map = ct.getRequestMap().get("query").toString();
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000336 assertEquals(opin2.replaceAll(" ", ""), map.replaceAll(" ", ""));
337
Joachim Bingel87480d02014-01-17 14:07:46 +0000338 query="wegen #IN(%, L) <s>";
339 String opin3 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000340 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
341 "{@type=korap:group, operation=operation:position, frame=frame:startswith, exclude=true, operands=[" +
342 "{@type=korap:span, key=s}," +
343 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000344 "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000345 "]}" +
346 "]}" +
347 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000348 ct = new CosmasTree(query);
349 map = ct.getRequestMap().get("query").toString();
Joachim Bingel87480d02014-01-17 14:07:46 +0000350 assertEquals(opin3.replaceAll(" ", ""), map.replaceAll(" ", ""));
351
352 query="wegen #IN('FE,ALL,%,MIN') <s>";
353 String opin4 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000354 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
355 "{@type=korap:group, operation=operation:position, frame=frame:matches, range=all, exclude=true, grouping=false, operands=[" +
356 "{@type=korap:span, key=s}," +
357 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000358 "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000359 "]}" +
360 "]}" +
361 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000362 ct = new CosmasTree(query);
363 map = ct.getRequestMap().get("query").toString();
Joachim Bingel87480d02014-01-17 14:07:46 +0000364 assertEquals(opin4.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingeld5161a12014-01-08 11:15:49 +0000365 }
366
367 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000368 public void testOPOV() throws QueryException {
Joachim Bingeld5161a12014-01-08 11:15:49 +0000369 query="wegen #OV <s>";
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000370 String opov1 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000371 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
372 "{@type=korap:group, operation=operation:position, frame=frame:overlaps, operands=[" +
373 "{@type=korap:span, key=s}," +
374 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000375 "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000376 "]}" +
377 "]}" +
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000378 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000379 ct = new CosmasTree(query);
380 map = ct.getRequestMap().get("query").toString();
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000381 assertEquals(opov1.replaceAll(" ", ""), map.replaceAll(" ", ""));
382
383 query="wegen #OV(L) <s>";
384 String opov2 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000385 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
386 "{@type=korap:group, operation=operation:position, frame=frame:overlaps-left, operands=[" +
387 "{@type=korap:span, key=s}," +
388 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000389 "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=match:eq}}" +
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000390 "]}" +
391 "]}" +
392 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000393 ct = new CosmasTree(query);
394 map = ct.getRequestMap().get("query").toString();
Joachim Bingelcc1dc242014-01-15 09:32:38 +0000395 assertEquals(opov2.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000396 }
397
398 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000399 public void testOPNOT() throws QueryException {
Joachim Bingel3a9f7932014-01-07 17:11:31 +0000400 query="Sonne nicht Mond";
401 String opnot1 =
Joachim Bingelb7a59792014-02-14 13:52:29 +0000402 "{@type=korap:group, operation=operation:sequence, distances=[" +
403 "{@type=korap:distance, key=t, min=0, max=0, exclude=true}" +
404 "], operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000405 "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}," +
406 "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
Joachim Bingel3a9f7932014-01-07 17:11:31 +0000407 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000408 ct = new CosmasTree(query);
409 map = ct.getRequestMap().get("query").toString();
Joachim Bingel3a9f7932014-01-07 17:11:31 +0000410 assertEquals(opnot1.replaceAll(" ", ""), map.replaceAll(" ", ""));
411 }
412
413 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000414 public void testBEG_END() throws QueryException {
Joachim Bingel3a9f7932014-01-07 17:11:31 +0000415 // BEG and END operators
416 // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/links.html
417 // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/rechts.html
418 // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/thematische-bsp/bsp-satzlaenge.html
Joachim Bingel87480d02014-01-17 14:07:46 +0000419 query="#BEG(der /w3:5 Mann)";
420 String beg1 =
Joachim Bingelcd7b7252014-02-13 08:49:14 +0000421 "{@type=korap:group, operation=operation:submatch, spanRef=[0,1], operands=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000422 "{@type=korap:group, operation=operation:sequence, inOrder=false, distances=[" +
423 "{@type=korap:distance, key=w, min=3, max=5}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000424 "]," +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000425 "operands = [" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000426 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
427 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000428 "]}" +
429 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000430 ct = new CosmasTree(query);
431 map = ct.getRequestMap().get("query").toString();
Joachim Bingel87480d02014-01-17 14:07:46 +0000432 assertEquals(beg1.replaceAll(" ", ""), map.replaceAll(" ", ""));
433
434 query="#BEG(der /w3:5 Mann) /+w10 kommt"; // nesting #BEG() in a distance group
435 String beg2 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000436 "{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
437 "{@type=korap:distance, key=w, min=0, max=10}" +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000438 "], operands=[" +
Joachim Bingelcd7b7252014-02-13 08:49:14 +0000439 "{@type=korap:group, operation=operation:submatch, spanRef=[0,1], operands=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000440 "{@type=korap:group, operation=operation:sequence, inOrder=false, distances=[" +
441 "{@type=korap:distance, key=w, min=3, max=5}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000442 "]," +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000443 "operands = [" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000444 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
445 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000446 "]}" +
447 "]}," +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000448 "{@type=korap:token, wrap={@type=korap:term, key=kommt, layer=orth, match=match:eq}}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000449 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000450 ct = new CosmasTree(query);
451 map = ct.getRequestMap().get("query").toString();
Joachim Bingel87480d02014-01-17 14:07:46 +0000452 assertEquals(beg2.replaceAll(" ", ""), map.replaceAll(" ", ""));
453
454 query="#END(der /w3:5 Mann)";
455 String end1 =
Joachim Bingelcd7b7252014-02-13 08:49:14 +0000456 "{@type=korap:group, operation=operation:submatch, spanRef=[-1,1], operands=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000457 "{@type=korap:group, operation=operation:sequence, inOrder=false, distances=[" +
458 "{@type=korap:distance, key=w, min=3, max=5}" +
Joachim Bingelba9a0ab2014-01-29 10:12:25 +0000459 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000460 "operands = [" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000461 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
462 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
Joachim Bingel87480d02014-01-17 14:07:46 +0000463 "]}" +
464 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000465 ct = new CosmasTree(query);
466 map = ct.getRequestMap().get("query").toString();
Joachim Bingel87480d02014-01-17 14:07:46 +0000467 assertEquals(end1.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000468 }
Joachim Bingeld5161a12014-01-08 11:15:49 +0000469
470
471 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000472 public void testELEM() throws QueryException {
Joachim Bingeld5161a12014-01-08 11:15:49 +0000473 // http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/elem.html
Joachim Bingeleecc7652014-01-11 17:21:07 +0000474 query="#ELEM(S)";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000475 String elem1 = "{@type=korap:span, key=s}";
476 ct = new CosmasTree(query);
477 map = ct.getRequestMap().get("query").toString();
Joachim Bingeleecc7652014-01-11 17:21:07 +0000478 assertEquals(elem1.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingeld5161a12014-01-08 11:15:49 +0000479 }
480
481 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000482 public void testOPALL() throws QueryException {
Joachim Bingel89cceac2014-01-08 15:51:08 +0000483 query="#ALL(gehen /w1:10 voran)";
Joachim Bingele98d0882014-01-21 12:58:54 +0000484 String all1 =
Joachim Bingel2daf9862014-02-12 10:18:54 +0000485 "{@type=korap:group, operation=operation:sequence, inOrder=false, " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000486 "distances=[" +
Joachim Bingel2daf9862014-02-12 10:18:54 +0000487 "{@type=korap:distance, key=w, min=1, max=10}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000488 "], " +
Joachim Bingel11d5b152014-02-11 21:33:47 +0000489 "operands=[" +
Joachim Bingelee3b21d2014-02-12 12:34:59 +0000490 "{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}," +
491 "{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000492 "]" +
493 "}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000494 ct = new CosmasTree(query);
495 map = ct.getRequestMap().get("query").toString();
Joachim Bingel89cceac2014-01-08 15:51:08 +0000496 assertEquals(all1.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingeld5161a12014-01-08 11:15:49 +0000497 }
498
Joachim Bingel36233b52014-02-13 10:48:24 +0000499 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000500 public void testOPNHIT() throws QueryException {
Joachim Bingel89cceac2014-01-08 15:51:08 +0000501 query="#NHIT(gehen /w1:10 voran)";
502 String nhit1 =
Joachim Bingel36233b52014-02-13 10:48:24 +0000503 "{@type=korap:group, operation=operation:submatch, classRef=[1,2], classRefOp=classRefOp:intersection, operands=[" +
504 "{@type=korap:group, operation=operation:sequence, inOrder=false, " +
505 "distances=[" +
506 "{@type=korap:distance, key=w, min=1, max=10}" +
507 "], " +
508 "operands=[" +
509 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
510 "{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=match:eq}}" +
511 "]}," +
512 "{@type=korap:group, operation=operation:class, class=2, operands=[" +
513 "{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=match:eq}}" +
514 "]}" +
515 "]" +
516 "}" +
517 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000518 ct = new CosmasTree(query);
519 map = ct.getRequestMap().get("query").toString();
Joachim Bingel89cceac2014-01-08 15:51:08 +0000520 assertEquals(nhit1.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingeld5161a12014-01-08 11:15:49 +0000521 }
522
523 @Test
Joachim Bingel87480d02014-01-17 14:07:46 +0000524 public void testOPBED() throws QueryException {
Joachim Bingeleecc7652014-01-11 17:21:07 +0000525 query = "#BED(der , sa)";
526 String bed1 =
Joachim Bingelcd7b7252014-02-13 08:49:14 +0000527 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands= [" +
528 "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
529 "{@type=korap:span, key=s}," +
530 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
531 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}" +
532 "]}" +
533 "]}" +
Joachim Bingeleecc7652014-01-11 17:21:07 +0000534 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000535 ct = new CosmasTree(query);
536 map = ct.getRequestMap().get("query").toString();
Joachim Bingeleecc7652014-01-11 17:21:07 +0000537 assertEquals(bed1.replaceAll(" ", ""), map.replaceAll(" ", ""));
538
539 query = "#BED(der Mann , +pe)";
540 String bed2 =
Joachim Bingel36233b52014-02-13 10:48:24 +0000541 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands= [" +
542 "{@type=korap:group, operation=operation:position, frame=frame:endswith, operands=[" +
543 "{@type=korap:span, key=p}," +
544 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
545 "{@type=korap:group, operation=operation:sequence, operands=[" +
546 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
547 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
548 "]}" +
549 "]}" +
550 "]}" +
551 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000552 ct = new CosmasTree(query);
553 map = ct.getRequestMap().get("query").toString();
Joachim Bingel36233b52014-02-13 10:48:24 +0000554 assertEquals(bed2.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000555
556 query = "#BED(der Mann , sa,-pa)";
557 String bed3 =
Joachim Bingel36233b52014-02-13 10:48:24 +0000558 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
559 "{@type=korap:group, operation=operation:sequence, distances=[" +
560 "{@type=korap:distance, key=w, min=0, max=0}" +
561 "], operands=[" +
562 "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
563 "{@type=korap:span, key=s}," +
564 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
565 "{@type=korap:group, operation=operation:sequence, operands=[" +
566 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
567 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
568 "]}" +
569 "]}" +
570 "]}," +
571 "{@type=korap:group, operation=operation:position, frame=frame:startswith, exclude=true, operands=[" +
572 "{@type=korap:span, key=p}," +
573 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
574 "{@type=korap:group, operation=operation:sequence, operands=[" +
575 "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}," +
576 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
577 "]}" +
578 "]}" +
Joachim Bingel3f0850c2014-01-17 16:50:10 +0000579 "]}" +
580 "]}" +
581 "]}";
Joachim Bingel2daf9862014-02-12 10:18:54 +0000582 ct = new CosmasTree(query);
583 map = ct.getRequestMap().get("query").toString();
Joachim Bingel36233b52014-02-13 10:48:24 +0000584 assertEquals(bed3.replaceAll(" ", ""), map.replaceAll(" ", ""));
Joachim Bingeld5161a12014-01-08 11:15:49 +0000585 }
586
Joachim Bingel81812632014-02-18 08:55:22 +0000587 @Test
588 public void testColonSeparatedConditions() throws QueryException {
589
590 query = "Der:sa";
591 String col1 =
592 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
593 "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
594 "{@type=korap:span, key=s}," +
595 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
596 "{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=match:eq}}" +
597 "]}" +
598 "]}" +
599 "]}";
600 ct = new CosmasTree(query);
601 map = ct.getRequestMap().get("query").toString();
602 assertEquals(col1.replaceAll(" ", ""), map.replaceAll(" ", ""));
603
604 query = "Mann:sa,-pa,+te)";
605 String col2 =
606 "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
607 "{@type=korap:group, operation=operation:sequence, distances=[" +
608 "{@type=korap:distance, key=w, min=0, max=0}" +
609 "], operands=[" +
610 "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
611 "{@type=korap:span, key=s}," +
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 "{@type=korap:group, operation=operation:position, frame=frame:startswith, exclude=true, operands=[" +
617 "{@type=korap:span, key=p}," +
618 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
619 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
620 "]}" +
621 "]}," +
622 "{@type=korap:group, operation=operation:position, frame=frame:endswith, operands=[" +
623 "{@type=korap:span, key=t}," +
624 "{@type=korap:group, operation=operation:class, class=1, operands=[" +
625 "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
626 "]}" +
627 "]}" +
628 "]}" +
629 "]}";
630 ct = new CosmasTree(query);
631 map = ct.getRequestMap().get("query").toString();
632 assertEquals(col2.replaceAll(" ", ""), map.replaceAll(" ", ""));
633 }
Joachim Bingelb5f7bf02014-01-07 16:36:54 +0000634}
635