Joachim Bingel | 019ba5c | 2014-04-28 14:59:04 +0000 | [diff] [blame] | 1 | import static org.junit.Assert.*; |
| 2 | |
| 3 | import org.junit.Test; |
| 4 | |
| 5 | import de.ids_mannheim.korap.query.serialize.AqlTree; |
Joachim Bingel | 019ba5c | 2014-04-28 14:59:04 +0000 | [diff] [blame] | 6 | import de.ids_mannheim.korap.util.QueryException; |
| 7 | |
| 8 | public class AqlTreeTest { |
| 9 | |
| 10 | AqlTree aqlt; |
| 11 | String map; |
| 12 | private String query; |
| 13 | |
| 14 | private boolean equalsQueryContent(String res, String query) throws QueryException { |
| 15 | res = res.replaceAll(" ", ""); |
| 16 | aqlt = new AqlTree(query); |
| 17 | String queryMap = aqlt.getRequestMap().get("query").toString().replaceAll(" ", ""); |
| 18 | return res.equals(queryMap); |
| 19 | } |
| 20 | |
| 21 | @Test |
| 22 | public void testContext() throws QueryException { |
| 23 | String contextString = "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld"; |
| 24 | aqlt = new AqlTree("Test"); |
| 25 | assertEquals(contextString.replaceAll(" ", ""), aqlt.getRequestMap().get("@context").toString().replaceAll(" ", "")); |
| 26 | } |
| 27 | |
| 28 | @Test |
| 29 | public void testSingleTokens() throws QueryException { |
| 30 | // "Mann" |
| 31 | query = "\"Mann\""; |
Joachim Bingel | eee549e | 2014-04-29 11:15:37 +0000 | [diff] [blame] | 32 | String token1 = "{@type=korap:token, wrap={@type=korap:term, key=Mann, match=match:eq}}"; |
Joachim Bingel | 019ba5c | 2014-04-28 14:59:04 +0000 | [diff] [blame] | 33 | assertTrue(equalsQueryContent(token1, query)); |
| 34 | |
| 35 | // [orth!=Frau] |
| 36 | query = "tok!=\"Frau\""; |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 37 | String token2 = "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Frau, match=match:ne}}"; |
Joachim Bingel | 019ba5c | 2014-04-28 14:59:04 +0000 | [diff] [blame] | 38 | assertTrue(equalsQueryContent(token2, query)); |
| 39 | |
| 40 | // Mann |
| 41 | query = "Mann"; |
| 42 | String token4 = "{@type=korap:span, layer=Mann}"; |
| 43 | assertTrue(equalsQueryContent(token4, query)); |
| 44 | } |
| 45 | |
| 46 | @Test |
| 47 | public void testSpans() throws QueryException { |
| 48 | query = "node"; |
| 49 | String span1 = |
| 50 | "{@type=korap:span}"; |
| 51 | aqlt = new AqlTree(query); |
| 52 | map = aqlt.getRequestMap().get("query").toString(); |
| 53 | assertEquals(span1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 54 | } |
| 55 | |
| 56 | @Test |
| 57 | public void testRegex() throws QueryException { |
| 58 | query = "/Mann/"; |
Joachim Bingel | eee549e | 2014-04-29 11:15:37 +0000 | [diff] [blame] | 59 | String regex1 = "{@type=korap:token, wrap={@type=korap:term, type=type:regex, key=Mann, match=match:eq}}"; |
Joachim Bingel | 019ba5c | 2014-04-28 14:59:04 +0000 | [diff] [blame] | 60 | aqlt = new AqlTree(query); |
| 61 | map = aqlt.getRequestMap().get("query").toString(); |
| 62 | assertEquals(regex1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 63 | } |
| 64 | |
| 65 | @Test |
| 66 | public void testLayers() throws QueryException { |
| 67 | query = "cnx/cat=\"NP\""; |
Joachim Bingel | eee549e | 2014-04-29 11:15:37 +0000 | [diff] [blame] | 68 | String layers1 = "{@type=korap:span, foundry=cnx, layer=cat, key=NP, match=match:eq}"; |
Joachim Bingel | 019ba5c | 2014-04-28 14:59:04 +0000 | [diff] [blame] | 69 | aqlt = new AqlTree(query); |
| 70 | map = aqlt.getRequestMap().get("query").toString(); |
| 71 | assertEquals(layers1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 72 | |
| 73 | query = "treetagger/pos=\"NN\""; |
Joachim Bingel | eee549e | 2014-04-29 11:15:37 +0000 | [diff] [blame] | 74 | String layers2 = "{@type=korap:token, wrap={@type=korap:term, foundry=treetagger, layer=pos, key=NN, match=match:eq}}"; |
Joachim Bingel | 019ba5c | 2014-04-28 14:59:04 +0000 | [diff] [blame] | 75 | aqlt = new AqlTree(query); |
| 76 | map = aqlt.getRequestMap().get("query").toString(); |
| 77 | assertEquals(layers2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 78 | } |
| 79 | |
| 80 | @Test |
Joachim Bingel | 7503879 | 2014-05-19 15:12:23 +0000 | [diff] [blame] | 81 | public void testDirectDeclarationRelations() throws QueryException { |
| 82 | query = "node > node"; |
| 83 | String ddr1 = |
| 84 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 85 | "{@type=korap:span}," + |
| 86 | "{@type=korap:span}" + |
| 87 | "], relation={@type=korap:treeRelation, reltype=dominance}" + |
| 88 | "}"; |
| 89 | aqlt = new AqlTree(query); |
| 90 | map = aqlt.getRequestMap().get("query").toString(); |
| 91 | assertEquals(ddr1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 92 | |
| 93 | query = "node > cnx/cat=\"NP\""; |
| 94 | String ddr2 = |
| 95 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 96 | "{@type=korap:span}," + |
| 97 | "{@type=korap:span, foundry=cnx, layer=cat, key=NP, match=match:eq}" + |
| 98 | "], relation={@type=korap:treeRelation, reltype=dominance}" + |
| 99 | "}"; |
| 100 | aqlt = new AqlTree(query); |
| 101 | map = aqlt.getRequestMap().get("query").toString(); |
| 102 | assertEquals(ddr2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 103 | |
| 104 | } |
| 105 | |
| 106 | @Test |
Joachim Bingel | fc42881 | 2014-06-18 14:50:14 +0000 | [diff] [blame] | 107 | public void testDefPredicationInversion() throws QueryException { |
| 108 | query = " #1 > #2 & cnx/cat=\"VP\" & cnx/cat=\"NP\""; |
| 109 | String dom1 = |
| 110 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 111 | "{@type=korap:span, foundry=cnx, layer=cat, key=VP, match=match:eq}," + |
| 112 | "{@type=korap:span, foundry=cnx, layer=cat, key=NP, match=match:eq}" + |
| 113 | "], relation={@type=korap:treeRelation, reltype=dominance}" + |
| 114 | "}"; |
| 115 | aqlt = new AqlTree(query); |
| 116 | map = aqlt.getRequestMap().get("query").toString(); |
| 117 | assertEquals(dom1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 118 | } |
| 119 | |
| 120 | @Test |
Joachim Bingel | 019ba5c | 2014-04-28 14:59:04 +0000 | [diff] [blame] | 121 | public void testSimpleDominance() throws QueryException { |
| 122 | query = "node & node & #2 > #1"; |
| 123 | String dom1 = |
Joachim Bingel | d4ae5fd | 2014-04-29 15:00:16 +0000 | [diff] [blame] | 124 | "{@type=korap:group, operation=operation:relation, operands=[" + |
Joachim Bingel | 019ba5c | 2014-04-28 14:59:04 +0000 | [diff] [blame] | 125 | "{@type=korap:span}," + |
| 126 | "{@type=korap:span}" + |
Joachim Bingel | d4ae5fd | 2014-04-29 15:00:16 +0000 | [diff] [blame] | 127 | "], relation={@type=korap:treeRelation, reltype=dominance}" + |
Joachim Bingel | eee549e | 2014-04-29 11:15:37 +0000 | [diff] [blame] | 128 | "}"; |
Joachim Bingel | 019ba5c | 2014-04-28 14:59:04 +0000 | [diff] [blame] | 129 | aqlt = new AqlTree(query); |
| 130 | map = aqlt.getRequestMap().get("query").toString(); |
| 131 | assertEquals(dom1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | eee549e | 2014-04-29 11:15:37 +0000 | [diff] [blame] | 132 | |
| 133 | query = "\"Mann\" & node & #2 > #1"; |
| 134 | String dom2 = |
Joachim Bingel | d4ae5fd | 2014-04-29 15:00:16 +0000 | [diff] [blame] | 135 | "{@type=korap:group, operation=operation:relation, operands=[" + |
Joachim Bingel | eee549e | 2014-04-29 11:15:37 +0000 | [diff] [blame] | 136 | "{@type=korap:span}," + |
| 137 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, match=match:eq}}" + |
Joachim Bingel | d4ae5fd | 2014-04-29 15:00:16 +0000 | [diff] [blame] | 138 | "], relation={@type=korap:treeRelation, reltype=dominance}" + |
Joachim Bingel | eee549e | 2014-04-29 11:15:37 +0000 | [diff] [blame] | 139 | "}"; |
| 140 | aqlt = new AqlTree(query); |
| 141 | map = aqlt.getRequestMap().get("query").toString(); |
| 142 | assertEquals(dom2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 143 | |
Joachim Bingel | d4ae5fd | 2014-04-29 15:00:16 +0000 | [diff] [blame] | 144 | query = "\"Mann\" & node & #2 >[cat=\"NP\"] #1"; |
Joachim Bingel | eee549e | 2014-04-29 11:15:37 +0000 | [diff] [blame] | 145 | String dom3 = |
Joachim Bingel | d4ae5fd | 2014-04-29 15:00:16 +0000 | [diff] [blame] | 146 | "{@type=korap:group, operation=operation:relation, operands=[" + |
Joachim Bingel | eee549e | 2014-04-29 11:15:37 +0000 | [diff] [blame] | 147 | "{@type=korap:span}," + |
| 148 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, match=match:eq}}" + |
Joachim Bingel | a07b8e7 | 2014-05-09 15:06:07 +0000 | [diff] [blame] | 149 | "], relation={@type=korap:treeRelation, reltype=dominance, wrap=[{@type=korap:term, layer=cat, key=NP, match=match:eq}]}" + |
Joachim Bingel | eee549e | 2014-04-29 11:15:37 +0000 | [diff] [blame] | 150 | "}"; |
| 151 | aqlt = new AqlTree(query); |
| 152 | map = aqlt.getRequestMap().get("query").toString(); |
| 153 | assertEquals(dom3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 154 | |
Joachim Bingel | d4ae5fd | 2014-04-29 15:00:16 +0000 | [diff] [blame] | 155 | query = "\"Mann\" & node & #2 >@l[cat=\"NP\"] #1"; |
Joachim Bingel | eee549e | 2014-04-29 11:15:37 +0000 | [diff] [blame] | 156 | String dom4 = |
Joachim Bingel | d4ae5fd | 2014-04-29 15:00:16 +0000 | [diff] [blame] | 157 | "{@type=korap:group, operation=operation:relation, operands=[" + |
Joachim Bingel | eee549e | 2014-04-29 11:15:37 +0000 | [diff] [blame] | 158 | "{@type=korap:span}," + |
| 159 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, match=match:eq}}" + |
Joachim Bingel | a07b8e7 | 2014-05-09 15:06:07 +0000 | [diff] [blame] | 160 | "], relation={@type=korap:treeRelation, reltype=dominance, index=0, wrap=[{@type=korap:term, layer=cat, key=NP, match=match:eq}]}" + |
Joachim Bingel | eee549e | 2014-04-29 11:15:37 +0000 | [diff] [blame] | 161 | "}"; |
| 162 | aqlt = new AqlTree(query); |
| 163 | map = aqlt.getRequestMap().get("query").toString(); |
| 164 | assertEquals(dom4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | d4ae5fd | 2014-04-29 15:00:16 +0000 | [diff] [blame] | 165 | |
| 166 | query = "\"Mann\" & node & #2 >2,4 #1"; |
| 167 | String dom5 = |
| 168 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 169 | "{@type=korap:span}," + |
| 170 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, match=match:eq}}" + |
| 171 | "], relation={@type=korap:treeRelation, reltype=dominance, " + |
Joachim Bingel | a07b8e7 | 2014-05-09 15:06:07 +0000 | [diff] [blame] | 172 | "distance={@type=korap:distance, key=r, min=2, max=4}}" + |
Joachim Bingel | d4ae5fd | 2014-04-29 15:00:16 +0000 | [diff] [blame] | 173 | "}"; |
| 174 | aqlt = new AqlTree(query); |
| 175 | map = aqlt.getRequestMap().get("query").toString(); |
| 176 | assertEquals(dom5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 019ba5c | 2014-04-28 14:59:04 +0000 | [diff] [blame] | 177 | } |
| 178 | |
Joachim Bingel | 13421ef | 2014-05-07 16:22:58 +0000 | [diff] [blame] | 179 | @Test |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 180 | public void testMultipleDominance() throws QueryException { |
Joachim Bingel | 949e3a8 | 2014-06-16 13:20:43 +0000 | [diff] [blame] | 181 | query = "cat=\"CP\" & cat=\"VP\" & cat=\"NP\" & #1 > #2 > #3"; |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 182 | String dom1 = |
| 183 | "{@type=korap:group, operation=operation:relation, operands=[" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 184 | "{@type=korap:reference, classRef=[0], operands=[" + |
Joachim Bingel | fc42881 | 2014-06-18 14:50:14 +0000 | [diff] [blame] | 185 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 186 | "{@type=korap:span, layer=cat, key=CP, match=match:eq}," + |
| 187 | "{@type=korap:group, operation=operation:class, class=0, operands=[" + |
| 188 | "{@type=korap:span, layer=cat, key=VP, match=match:eq}" + |
| 189 | "]}" + |
| 190 | "], relation={@type=korap:treeRelation, reltype=dominance}}" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 191 | "]}," + |
Joachim Bingel | 949e3a8 | 2014-06-16 13:20:43 +0000 | [diff] [blame] | 192 | "{@type=korap:span, layer=cat, key=NP, match=match:eq}" + |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 193 | "], relation={@type=korap:treeRelation, reltype=dominance}" + |
| 194 | "}"; |
| 195 | aqlt = new AqlTree(query); |
| 196 | map = aqlt.getRequestMap().get("query").toString(); |
| 197 | assertEquals(dom1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 949e3a8 | 2014-06-16 13:20:43 +0000 | [diff] [blame] | 198 | |
| 199 | query = "cat=\"CP\" & cat=\"VP\" & cat=\"NP\" & cat=\"DP\" & #1 > #2 > #3 > #4"; |
| 200 | String dom2 = |
| 201 | "{@type=korap:group, operation=operation:relation, operands=[" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 202 | "{@type=korap:reference, classRef=[1], operands=[" + |
Joachim Bingel | 949e3a8 | 2014-06-16 13:20:43 +0000 | [diff] [blame] | 203 | "{@type=korap:group, operation=operation:relation, operands=[" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 204 | "{@type=korap:reference, classRef=[0], operands=[" + |
Joachim Bingel | fc42881 | 2014-06-18 14:50:14 +0000 | [diff] [blame] | 205 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 206 | "{@type=korap:span, layer=cat, key=CP, match=match:eq}," + |
| 207 | "{@type=korap:group, operation=operation:class, class=0, operands=[" + |
| 208 | "{@type=korap:span, layer=cat, key=VP, match=match:eq}" + |
| 209 | "]}" + |
| 210 | "], relation={@type=korap:treeRelation, reltype=dominance}}" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 211 | "]}," + |
Joachim Bingel | fc42881 | 2014-06-18 14:50:14 +0000 | [diff] [blame] | 212 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 213 | "{@type=korap:span, layer=cat, key=NP, match=match:eq}" + |
| 214 | "]}" + |
| 215 | "], relation={@type=korap:treeRelation, reltype=dominance}}" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 216 | "]}," + |
Joachim Bingel | 949e3a8 | 2014-06-16 13:20:43 +0000 | [diff] [blame] | 217 | "{@type=korap:span, layer=cat, key=DP, match=match:eq}" + |
| 218 | "], relation={@type=korap:treeRelation, reltype=dominance}" + |
| 219 | "}"; |
| 220 | aqlt = new AqlTree(query); |
| 221 | map = aqlt.getRequestMap().get("query").toString(); |
| 222 | assertEquals(dom2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 223 | } |
| 224 | |
| 225 | @Test |
Joachim Bingel | 13421ef | 2014-05-07 16:22:58 +0000 | [diff] [blame] | 226 | public void testPointingRelations() throws QueryException { |
| 227 | query = "node & node & #2 ->label[coref=\"true\"] #1"; |
| 228 | String dom1 = |
| 229 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 230 | "{@type=korap:span}," + |
| 231 | "{@type=korap:span}" + |
Joachim Bingel | a07b8e7 | 2014-05-09 15:06:07 +0000 | [diff] [blame] | 232 | "], relation={@type=korap:relation, reltype=label, wrap=[{@type=korap:term, layer=coref, key=true, match=match:eq}]}" + |
Joachim Bingel | 13421ef | 2014-05-07 16:22:58 +0000 | [diff] [blame] | 233 | "}"; |
| 234 | aqlt = new AqlTree(query); |
| 235 | map = aqlt.getRequestMap().get("query").toString(); |
| 236 | assertEquals(dom1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 237 | |
Joachim Bingel | 639df9c | 2014-05-12 15:27:00 +0000 | [diff] [blame] | 238 | query = "node & node & #2 ->label[mate/coref=\"true\"] #1"; |
| 239 | String dom2 = |
| 240 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 241 | "{@type=korap:span}," + |
| 242 | "{@type=korap:span}" + |
| 243 | "], relation={@type=korap:relation, reltype=label, wrap=[{@type=korap:term, foundry=mate, layer=coref, key=true, match=match:eq}]}" + |
| 244 | "}"; |
| 245 | aqlt = new AqlTree(query); |
| 246 | map = aqlt.getRequestMap().get("query").toString(); |
| 247 | assertEquals(dom2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 13421ef | 2014-05-07 16:22:58 +0000 | [diff] [blame] | 248 | } |
| 249 | |
| 250 | @Test |
| 251 | public void testSequence() throws QueryException { |
| 252 | query = "node & node & #1 . #2"; |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 253 | String seq1 = |
Joachim Bingel | 13421ef | 2014-05-07 16:22:58 +0000 | [diff] [blame] | 254 | "{@type=korap:group, operation=operation:sequence, " + |
| 255 | "operands=[" + |
| 256 | "{@type=korap:span}," + |
| 257 | "{@type=korap:span}" + |
| 258 | "], inOrder=true" + |
| 259 | "}"; |
| 260 | aqlt = new AqlTree(query); |
| 261 | map = aqlt.getRequestMap().get("query").toString(); |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 262 | assertEquals(seq1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 13421ef | 2014-05-07 16:22:58 +0000 | [diff] [blame] | 263 | |
| 264 | query = "node & node & #1 .* #2"; |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 265 | String seq2 = |
Joachim Bingel | 7503879 | 2014-05-19 15:12:23 +0000 | [diff] [blame] | 266 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 13421ef | 2014-05-07 16:22:58 +0000 | [diff] [blame] | 267 | "{@type=korap:span}," + |
| 268 | "{@type=korap:span}" + |
| 269 | "], distances=[" + |
| 270 | "{@type=korap:distance, key=w, min=0, max=100}" + |
| 271 | "], inOrder=true" + |
| 272 | "}"; |
| 273 | aqlt = new AqlTree(query); |
| 274 | map = aqlt.getRequestMap().get("query").toString(); |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 275 | assertEquals(seq2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 276 | |
| 277 | query = "node & node & #1 .2,3 #2"; |
| 278 | String seq3 = |
| 279 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 280 | "{@type=korap:span}," + |
| 281 | "{@type=korap:span}" + |
| 282 | "], distances=[" + |
| 283 | "{@type=korap:distance, key=w, min=2, max=3}" + |
| 284 | "], inOrder=true" + |
| 285 | "}"; |
| 286 | aqlt = new AqlTree(query); |
| 287 | map = aqlt.getRequestMap().get("query").toString(); |
| 288 | assertEquals(seq3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 289 | |
| 290 | } |
| 291 | |
| 292 | @Test |
| 293 | public void testMultipleSequence() throws QueryException { |
| 294 | query = "tok=\"Sonne\" & tok=\"Mond\" & tok=\"Sterne\" & #1 .0,2 #2 .0,4 #3"; |
| 295 | String seq4 = |
| 296 | "{@type=korap:group, operation=operation:sequence," + |
Joachim Bingel | fc42881 | 2014-06-18 14:50:14 +0000 | [diff] [blame] | 297 | "operands=[" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 298 | "{@type=korap:reference, classRef=[0], operands=[" + |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 299 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 949e3a8 | 2014-06-16 13:20:43 +0000 | [diff] [blame] | 300 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Sonne, match=match:eq}}," + |
Joachim Bingel | fc42881 | 2014-06-18 14:50:14 +0000 | [diff] [blame] | 301 | "{@type=korap:group, operation=operation:class, class=0, operands=[" + |
| 302 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mond, match=match:eq}}" + |
| 303 | "]}" + |
Joachim Bingel | 949e3a8 | 2014-06-16 13:20:43 +0000 | [diff] [blame] | 304 | "], distances=[" + |
| 305 | "{@type=korap:distance, key=w, min=0, max=2}" + |
Joachim Bingel | fc42881 | 2014-06-18 14:50:14 +0000 | [diff] [blame] | 306 | "], inOrder=true}" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 307 | "]}," + |
Joachim Bingel | fc42881 | 2014-06-18 14:50:14 +0000 | [diff] [blame] | 308 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Sterne, match=match:eq}}" + |
| 309 | "],distances=[" + |
| 310 | "{@type=korap:distance, key=w, min=0, max=4}" + |
| 311 | "], inOrder=true" + |
| 312 | "}"; |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 313 | aqlt = new AqlTree(query); |
| 314 | map = aqlt.getRequestMap().get("query").toString(); |
| 315 | assertEquals(seq4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 316 | |
| 317 | query = "node & node & node & #1 . #2 .1,3 #3"; |
| 318 | String seq5 = |
| 319 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 320 | "{@type=korap:reference, classRef=[0], operands=[" + |
Joachim Bingel | fc42881 | 2014-06-18 14:50:14 +0000 | [diff] [blame] | 321 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 322 | "{@type=korap:span}," + |
| 323 | "{@type=korap:group, operation=operation:class, class=0, operands=[" + |
| 324 | "{@type=korap:span}" + |
| 325 | "]} "+ |
| 326 | "], inOrder=true}" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 327 | "]}," + |
Joachim Bingel | 949e3a8 | 2014-06-16 13:20:43 +0000 | [diff] [blame] | 328 | "{@type=korap:span}" + |
| 329 | "], distances=[" + |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 330 | "{@type=korap:distance, key=w, min=1, max=3}" + |
Joachim Bingel | 949e3a8 | 2014-06-16 13:20:43 +0000 | [diff] [blame] | 331 | "], inOrder=true" + |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 332 | "}"; |
| 333 | aqlt = new AqlTree(query); |
| 334 | map = aqlt.getRequestMap().get("query").toString(); |
| 335 | assertEquals(seq5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 336 | |
| 337 | query = "tok=\"Sonne\" & tok=\"Mond\" & tok=\"Sterne\" & tok=\"Himmel\" & #1 .0,2 #2 .0,4 #3 . #4"; |
| 338 | String seq6 = |
| 339 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 340 | "{@type=korap:reference, classRef=[1], operands=[" + |
| 341 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 342 | "{@type=korap:reference, classRef=[0], operands=[" + |
| 343 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 344 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Sonne, match=match:eq}}," + |
| 345 | "{@type=korap:group, operation=operation:class, class=0, operands=[" + |
| 346 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mond, match=match:eq}}" + |
| 347 | "]}" + |
| 348 | "], distances=[" + |
| 349 | "{@type=korap:distance, key=w, min=0, max=2}" + |
| 350 | "], inOrder=true}" + |
| 351 | "]}," + |
| 352 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 353 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Sterne, match=match:eq}}" + |
| 354 | "]}" + |
| 355 | "],distances=[" + |
| 356 | "{@type=korap:distance, key=w, min=0, max=4}" + |
| 357 | "], inOrder=true}" + |
| 358 | "]}," + |
| 359 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Himmel, match=match:eq}}" + |
| 360 | "], inOrder=true}" ; |
| 361 | aqlt = new AqlTree(query); |
| 362 | map = aqlt.getRequestMap().get("query").toString(); |
| 363 | assertEquals(seq6.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 7503879 | 2014-05-19 15:12:23 +0000 | [diff] [blame] | 364 | } |
| 365 | |
| 366 | @Test |
Joachim Bingel | 949e3a8 | 2014-06-16 13:20:43 +0000 | [diff] [blame] | 367 | public void testMultipleMixedOperators() throws QueryException { |
| 368 | query = "tok=\"Sonne\" & tok=\"Mond\" & tok=\"Sterne\" & #1 > #2 .0,4 #3"; |
| 369 | String seq4 = |
Joachim Bingel | fc42881 | 2014-06-18 14:50:14 +0000 | [diff] [blame] | 370 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 371 | "{@type=korap:reference, classRef=[0], operands=[" + |
Joachim Bingel | fc42881 | 2014-06-18 14:50:14 +0000 | [diff] [blame] | 372 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 373 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Sonne, match=match:eq}}," + |
| 374 | "{@type=korap:group, operation=operation:class, class=0, operands=[" + |
| 375 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mond, match=match:eq}}" + |
| 376 | "]}" + |
| 377 | "], relation={@type=korap:treeRelation, reltype=dominance}}" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 378 | "]}," + |
Joachim Bingel | 949e3a8 | 2014-06-16 13:20:43 +0000 | [diff] [blame] | 379 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Sterne, match=match:eq}}" + |
| 380 | "], distances=[" + |
| 381 | "{@type=korap:distance, key=w, min=0, max=4}" + |
| 382 | "], inOrder=true" + |
| 383 | "}"; |
| 384 | aqlt = new AqlTree(query); |
| 385 | map = aqlt.getRequestMap().get("query").toString(); |
| 386 | assertEquals(seq4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | fc42881 | 2014-06-18 14:50:14 +0000 | [diff] [blame] | 387 | |
| 388 | query = "tok=\"Sonne\" & tok=\"Mond\" & #1 > #2 .0,4 tok=\"Sterne\""; |
| 389 | String seq5 = |
| 390 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 391 | "{@type=korap:reference, classRef=[0], operands=[" + |
Joachim Bingel | fc42881 | 2014-06-18 14:50:14 +0000 | [diff] [blame] | 392 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 393 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Sonne, match=match:eq}}," + |
| 394 | "{@type=korap:group, operation=operation:class, class=0, operands=[" + |
| 395 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mond, match=match:eq}}" + |
| 396 | "]}" + |
| 397 | "], relation={@type=korap:treeRelation, reltype=dominance}}" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 398 | "]}," + |
Joachim Bingel | fc42881 | 2014-06-18 14:50:14 +0000 | [diff] [blame] | 399 | "{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Sterne, match=match:eq}}" + |
| 400 | "], distances=[" + |
| 401 | "{@type=korap:distance, key=w, min=0, max=4}" + |
| 402 | "], inOrder=true" + |
| 403 | "}"; |
| 404 | aqlt = new AqlTree(query); |
| 405 | map = aqlt.getRequestMap().get("query").toString(); |
| 406 | assertEquals(seq5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 949e3a8 | 2014-06-16 13:20:43 +0000 | [diff] [blame] | 407 | } |
| 408 | |
| 409 | @Test |
Joachim Bingel | 7503879 | 2014-05-19 15:12:23 +0000 | [diff] [blame] | 410 | public void testPositions() throws QueryException { |
| 411 | query = "node & node & #2 _=_ #1"; |
| 412 | String pos1 = |
| 413 | "{@type=korap:group, operation=operation:position, operands=[" + |
| 414 | "{@type=korap:span}," + |
| 415 | "{@type=korap:span}" + |
| 416 | "], frame=frame:matches" + |
| 417 | "}"; |
| 418 | aqlt = new AqlTree(query); |
| 419 | map = aqlt.getRequestMap().get("query").toString(); |
| 420 | assertEquals(pos1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 421 | |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 422 | query = "node & node & #2 _i_ #1"; |
| 423 | String pos2 = |
| 424 | "{@type=korap:group, operation=operation:position, operands=[" + |
| 425 | "{@type=korap:span}," + |
| 426 | "{@type=korap:span}" + |
| 427 | "], frame=frame:contains" + |
| 428 | "}"; |
| 429 | aqlt = new AqlTree(query); |
| 430 | map = aqlt.getRequestMap().get("query").toString(); |
| 431 | assertEquals(pos2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 7503879 | 2014-05-19 15:12:23 +0000 | [diff] [blame] | 432 | |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 433 | query = "node & node & #2 _l_ #1"; |
| 434 | String pos3 = |
| 435 | "{@type=korap:group, operation=operation:position, operands=[" + |
| 436 | "{@type=korap:span}," + |
| 437 | "{@type=korap:span}" + |
| 438 | "], inOrder=false, frame=frame:startswith" + |
| 439 | "}"; |
| 440 | aqlt = new AqlTree(query); |
| 441 | map = aqlt.getRequestMap().get("query").toString(); |
| 442 | assertEquals(pos3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 443 | |
| 444 | query = "node & \"Mann\" & #1 _r_ #2"; |
Joachim Bingel | 7503879 | 2014-05-19 15:12:23 +0000 | [diff] [blame] | 445 | String pos4 = |
Joachim Bingel | 7503879 | 2014-05-19 15:12:23 +0000 | [diff] [blame] | 446 | "{@type=korap:group, operation=operation:position, operands=[" + |
| 447 | "{@type=korap:span}," + |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 448 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, match=match:eq}}" + |
| 449 | "], inOrder=false, frame=frame:endswith" + |
| 450 | "}"; |
Joachim Bingel | 7503879 | 2014-05-19 15:12:23 +0000 | [diff] [blame] | 451 | aqlt = new AqlTree(query); |
| 452 | map = aqlt.getRequestMap().get("query").toString(); |
| 453 | assertEquals(pos4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 13421ef | 2014-05-07 16:22:58 +0000 | [diff] [blame] | 454 | |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 455 | query = "node & \"Mann\" & #2 _r_ #1"; |
| 456 | String pos5 = |
| 457 | "{@type=korap:group, operation=operation:position, operands=[" + |
| 458 | "{@type=korap:token, wrap={@type=korap:term, key=Mann, match=match:eq}}," + |
| 459 | "{@type=korap:span}" + |
| 460 | "], inOrder=false, frame=frame:endswith" + |
| 461 | "}"; |
| 462 | aqlt = new AqlTree(query); |
| 463 | map = aqlt.getRequestMap().get("query").toString(); |
| 464 | assertEquals(pos5.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 13421ef | 2014-05-07 16:22:58 +0000 | [diff] [blame] | 465 | } |
| 466 | |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 467 | @Test |
| 468 | public void testMultiplePredications() throws QueryException { |
Joachim Bingel | 9c3ddb9 | 2014-06-23 13:49:58 +0000 | [diff] [blame] | 469 | // a noun before a verb before a preposition |
Joachim Bingel | fc42881 | 2014-06-18 14:50:14 +0000 | [diff] [blame] | 470 | query = "pos=\"N\" & pos=\"V\" & pos=\"P\" & #1 . #2 & #2 . #3"; |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 471 | String mult1 = |
Joachim Bingel | 9c3ddb9 | 2014-06-23 13:49:58 +0000 | [diff] [blame] | 472 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 473 | "{@type=korap:reference, classRef=[0], operands=[" + |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 474 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | 9c3ddb9 | 2014-06-23 13:49:58 +0000 | [diff] [blame] | 475 | "{@type=korap:token, wrap={@type=korap:term, layer=pos, key=N, match=match:eq}}," + |
| 476 | "{@type=korap:group, operation=operation:class, class=0, operands=[" + |
| 477 | "{@type=korap:token, wrap={@type=korap:term, layer=pos, key=V, match=match:eq}}" + |
| 478 | "]}" + |
| 479 | "], inOrder=true}" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 480 | "]}," + |
Joachim Bingel | 9c3ddb9 | 2014-06-23 13:49:58 +0000 | [diff] [blame] | 481 | "{@type=korap:token, wrap={@type=korap:term, layer=pos, key=P, match=match:eq}}" + |
| 482 | "], inOrder=true}"; |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 483 | aqlt = new AqlTree(query); |
| 484 | map = aqlt.getRequestMap().get("query").toString(); |
| 485 | assertEquals(mult1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | 9c3ddb9 | 2014-06-23 13:49:58 +0000 | [diff] [blame] | 486 | |
| 487 | // a noun before a verb before a preposition |
| 488 | query = "pos=\"N\" & pos=\"V\" & #1 . #2 & #2 . pos=\"P\""; |
| 489 | String mult2 = |
| 490 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 491 | "{@type=korap:reference, classRef=[0], operands=[" + |
Joachim Bingel | 9c3ddb9 | 2014-06-23 13:49:58 +0000 | [diff] [blame] | 492 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 493 | "{@type=korap:token, wrap={@type=korap:term, layer=pos, key=N, match=match:eq}}," + |
| 494 | "{@type=korap:group, operation=operation:class, class=0, operands=[" + |
| 495 | "{@type=korap:token, wrap={@type=korap:term, layer=pos, key=V, match=match:eq}}" + |
| 496 | "]}" + |
| 497 | "], inOrder=true}" + |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 498 | "]}," + |
Joachim Bingel | 9c3ddb9 | 2014-06-23 13:49:58 +0000 | [diff] [blame] | 499 | "{@type=korap:token, wrap={@type=korap:term, layer=pos, key=P, match=match:eq}}" + |
| 500 | "], inOrder=true}"; |
| 501 | aqlt = new AqlTree(query); |
| 502 | map = aqlt.getRequestMap().get("query").toString(); |
| 503 | assertEquals(mult2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | aee38ae | 2014-06-25 09:32:56 +0000 | [diff] [blame] | 504 | |
| 505 | query = "pos=\"N\" & pos=\"V\" & pos=\"P\" & #1 > #2 & #1 > #3"; |
| 506 | String mult3 = |
| 507 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 508 | "{@type=korap:reference, classRef=[0], operands=[" + |
| 509 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 510 | "{@type=korap:group, operation=operation:class, class=0, operands=[" + |
| 511 | "{@type=korap:token, wrap={@type=korap:term, layer=pos, key=N, match=match:eq}}" + |
| 512 | "]}," + |
| 513 | "{@type=korap:token, wrap={@type=korap:term, layer=pos, key=V, match=match:eq}}" + |
| 514 | "], relation={@type=korap:treeRelation, reltype=dominance}}" + |
| 515 | "]}," + |
| 516 | "{@type=korap:token, wrap={@type=korap:term, layer=pos, key=P, match=match:eq}}" + |
| 517 | "], relation={@type=korap:treeRelation, reltype=dominance}}"; |
| 518 | aqlt = new AqlTree(query); |
| 519 | map = aqlt.getRequestMap().get("query").toString(); |
| 520 | assertEquals(mult3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 521 | |
| 522 | query = "cat=\"NP\" & pos=\"V\" & pos=\"P\" & #1 > #2 & #1 > #3 & #2 . #3"; |
| 523 | String mult4 = |
| 524 | "{@type=korap:group, operation=operation:sequence, operands=[" + |
| 525 | // reduce dominance relations "#1 > #2 & #1 > #3" to operand #2 in order to make it accessible for #2 . #3 (the last/outermost relation) |
| 526 | "{@type=korap:reference, classRef=[1], operands=[" + |
| 527 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 528 | // dominance relation #1 > #2 is reduced to #1, for expressing #1 > #3 |
| 529 | "{@type=korap:reference, classRef=[0], operands=[" + |
| 530 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 531 | "{@type=korap:group, operation=operation:class, class=0, operands=[" + |
| 532 | "{@type=korap:span, layer=cat, key=NP, match=match:eq}" + |
| 533 | "]}," + |
| 534 | "{@type=korap:group, operation=operation:class, class=1, operands=[" + |
| 535 | "{@type=korap:token, wrap={@type=korap:term, layer=pos, key=V, match=match:eq}}" + |
| 536 | "]}" + |
| 537 | "], relation={@type=korap:treeRelation, reltype=dominance}}" + |
| 538 | "]}," + |
| 539 | // establish class 2 around P for later reference |
| 540 | "{@type=korap:group, operation=operation:class, class=2, operands=[" + |
| 541 | "{@type=korap:token, wrap={@type=korap:term, layer=pos, key=P, match=match:eq}}" + |
| 542 | "]}" + |
| 543 | "], relation={@type=korap:treeRelation, reltype=dominance}}" + |
| 544 | "]}," + |
| 545 | // refer back to class 2 as second operand |
| 546 | "{@type=korap:reference, classRef=[2]}" + |
| 547 | "], inOrder=true}"; |
| 548 | aqlt = new AqlTree(query); |
| 549 | map = aqlt.getRequestMap().get("query").toString(); |
| 550 | assertEquals(mult4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 551 | } |
Joachim Bingel | eee549e | 2014-04-29 11:15:37 +0000 | [diff] [blame] | 552 | |
Joachim Bingel | ca4944e | 2014-06-13 13:55:10 +0000 | [diff] [blame] | 553 | @Test |
| 554 | public void testUnaryRelations() throws QueryException { |
| 555 | query = "node & #1:tokenarity=2"; |
| 556 | String unary1 = |
| 557 | "{@type=korap:span, attr={@type=korap:term, tokenarity={@type=korap:boundary,min=2,max=2}}}"; |
| 558 | aqlt = new AqlTree(query); |
| 559 | map = aqlt.getRequestMap().get("query").toString(); |
| 560 | assertEquals(unary1.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 561 | |
| 562 | query = "cnx/cat=\"NP\" & #1:tokenarity=2"; |
| 563 | String unary2 = |
| 564 | "{@type=korap:span, foundry=cnx, layer=cat, key=NP, match=match:eq, attr={@type=korap:term, tokenarity={@type=korap:boundary,min=2,max=2}}}"; |
| 565 | aqlt = new AqlTree(query); |
| 566 | map = aqlt.getRequestMap().get("query").toString(); |
| 567 | assertEquals(unary2.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 568 | |
| 569 | query = "cnx/cat=\"NP\" & #1:root"; |
| 570 | String unary3 = |
| 571 | "{@type=korap:span, foundry=cnx, layer=cat, key=NP, match=match:eq, attr={@type=korap:term, root=true}}"; |
| 572 | aqlt = new AqlTree(query); |
| 573 | map = aqlt.getRequestMap().get("query").toString(); |
| 574 | assertEquals(unary3.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 575 | |
| 576 | query = "cnx/cat=\"NP\" & node & #1>#2 & #1:tokenarity=2"; |
| 577 | String unary4 = |
| 578 | "{@type=korap:group, operation=operation:relation, operands=[" + |
| 579 | "{@type=korap:span, foundry=cnx, layer=cat, key=NP, match=match:eq, attr={@type=korap:term, tokenarity={@type=korap:boundary,min=2,max=2}}}," + |
| 580 | "{@type=korap:span}" + |
| 581 | "], relation={@type=korap:treeRelation, reltype=dominance}" + |
| 582 | "}"; |
| 583 | aqlt = new AqlTree(query); |
| 584 | map = aqlt.getRequestMap().get("query").toString(); |
| 585 | assertEquals(unary4.replaceAll(" ", ""), map.replaceAll(" ", "")); |
| 586 | } |
| 587 | |
| 588 | // TODO commonparent, commonancestor |
| 589 | |
| 590 | } |