blob: db33a1ac134cee108e15562c44168b48074c4444 [file] [log] [blame]
Michael Hanlbadd79c2015-06-19 07:41:03 +02001import de.ids_mannheim.korap.config.BeanConfiguration;
2import de.ids_mannheim.korap.query.serialize.QuerySerializer;
3import de.ids_mannheim.korap.resource.LayerMapper;
4import de.ids_mannheim.korap.resource.RewriteProcessor;
5import de.ids_mannheim.korap.utils.CollectionQueryBuilder3;
6import org.junit.BeforeClass;
7import org.junit.Test;
8
Michael Hanl704211e2015-06-19 07:26:04 +02009/**
10 * @author hanl
11 * @date 18/06/2015
12 */
13public class RewriteTest {
Michael Hanlbadd79c2015-06-19 07:41:03 +020014
15 private static String simple_add_query = "[pos=ADJA]";
16 private static String simple_rewrite_query = "[base=Haus]";
17 private static String complex_rewrite_query = "<c=INFC>";
18 private static String complex_rewrite_query2 = "[orth=laufe/i & base!=Lauf]";
19
20 public RewriteTest() {
21
22 }
23
24 @BeforeClass
25 public static void init() {
26 BeanConfiguration.loadFileContext(
27 "/Users/hanl/Projects/KorAP-project/KorAP-modules/Kustvakt-core/src/main/resources/default-config.xml");
28 }
29
30 @Test
31 public void testQuery() {
32 QuerySerializer s = new QuerySerializer();
33 s.setQuery(simple_add_query, "poliqarp");
34 System.out.println("query " + s.toJSON());
35
36 CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
37 b.add("textClass=politik & corpusID=WPD");
38 System.out.println("collection query " + b.toJSON());
39 }
40
41 @Test
42 public void testLayerMapper() {
43 LayerMapper m = new LayerMapper();
44 System.out.println("foundry " + m.findFoundry("lemma"));
45 System.out.println("foundry " + m.findFoundry("surface"));
46 System.out.println("foundry " + m.findFoundry("pos"));
47 }
48
49 @Test
50 public void testRewrite() {
51 RewriteProcessor processor = new RewriteProcessor();
52
53 QuerySerializer s = new QuerySerializer();
54 s.setQuery(complex_rewrite_query2, "poliqarp");
55 System.out.println("query " + s.toJSON());
56 System.out.println("finished node " + processor.process(s.toJSON()));
57 }
Michael Hanl704211e2015-06-19 07:26:04 +020058}