blob: dfd69888f01ee951b8659c0afebb72db4d8d1e84 [file] [log] [blame]
Nils Diewald0e6992a2015-04-14 20:13:52 +00001requirejs.config({
2 baseUrl: '../js/src',
3 paths : {
4 'lib': '../lib'
5 }
6});
7
8var json = {
9 "@type":"koral:docGroup",
10 "operation":"operation:or",
11 "operands":[
12 {
13 "@type":"koral:docGroup",
14 "operation":"operation:and",
15 "operands":[
16 {
17 "@type":"koral:doc",
Nils Diewald4c221252015-04-21 20:19:25 +000018 "key":"title",
Nils Diewald0e6992a2015-04-14 20:13:52 +000019 "value":"Der Birnbaum",
20 "match":"match:eq"
21 },
22 {
23 "@type":"koral:doc",
Nils Diewald4c221252015-04-21 20:19:25 +000024 "key":"pubPlace",
Nils Diewald0e6992a2015-04-14 20:13:52 +000025 "value":"Mannheim",
Akronea4e9052017-07-06 16:12:05 +020026 "type" : "type:regex",
27 "match":"match:contains"
Nils Diewald0e6992a2015-04-14 20:13:52 +000028 },
29 {
30 "@type":"koral:docGroup",
31 "operation":"operation:or",
32 "operands":[
33 {
34 "@type":"koral:doc",
Nils Diewald4c221252015-04-21 20:19:25 +000035 "key":"subTitle",
Nils Diewald0e6992a2015-04-14 20:13:52 +000036 "value":"Aufzucht und Pflege",
37 "match":"match:eq"
38 },
39 {
40 "@type":"koral:doc",
Nils Diewald4c221252015-04-21 20:19:25 +000041 "key":"subTitle",
Nils Diewald0e6992a2015-04-14 20:13:52 +000042 "value":"Gedichte",
43 "match":"match:eq",
44 "rewrites" : [
45 {
46 "@type": "koral:rewrite",
47 "src" : "policy",
48 "operation" : "operation:injection",
49 }
50 ]
51 }
52 ]
53 }
54 ]
55 },
56 {
57 "@type":"koral:doc",
Nils Diewald4c221252015-04-21 20:19:25 +000058 "key":"pubDate",
Nils Diewald0e6992a2015-04-14 20:13:52 +000059 "type":"type:date",
60 "value":"2015-03-05",
61 "match":"match:geq"
62 }
63 ]
64};
65
Akron48b1e4d2015-06-17 18:47:01 +020066var collections = [
67 {
68 "statistics":{
69 "paragraphs":2034752,
70 "documents":196510,
71 "tokens":51545081,
72 "sentences":4116282
73 },
74 "query":[
75 {
76 "@value":{
77 "@field":"korap:field#corpusID",
78 "@value":"WPD",
79 "@type":"korap:term"
80 },
81 "@type":"korap:meta-filter"
82 }
83 ],
84 "name":"Wikipedia",
85 "path":"Wikipedia",
86 "description":"Die freie Enzyklopädie",
87 "shared":false,
88 "managed":true,
89 "created":"2015-04-01T23:04:32.000+02:00",
90 "foundries":"",
91 "id":"ZGU0ZTllNTFkYzc3M2VhZmViYzdkYWE2ODI5NDc3NTk4NGQ1YThhOTMwOTNhOWYxNWMwN2M3Y2YyZmE3N2RlNQ=="
92 }
93];
94
Nils Diewald652e5f42015-05-10 18:11:45 +000095require(['vc','lib/domReady', 'lib/highlight/highlight.pack'], function (vcClass, domReady) {
Nils Diewald4c221252015-04-21 20:19:25 +000096
97 var loc = KorAP.Locale;
98
Nils Diewald652e5f42015-05-10 18:11:45 +000099/*
Nils Diewald4c221252015-04-21 20:19:25 +0000100 loc.AND = 'und';
101 loc.OR = 'oder';
102 loc.VC_subTitle = 'Untertitel';
103 loc.VC_title = 'Titel';
104 loc.VC_pubDate = 'Veröffentlichungsdatum';
105 loc.VC_pubPlace = 'Veröffentlichungsort';
Nils Diewald652e5f42015-05-10 18:11:45 +0000106*/
Nils Diewald0e6992a2015-04-14 20:13:52 +0000107
108 domReady(function() {
Nils Diewald4c221252015-04-21 20:19:25 +0000109
110 // Create a new virtual collection by passing a based json object and
111 // field menu information
Nils Diewald6283d692015-04-23 20:32:53 +0000112 var vc = vcClass.create([
Nils Diewald4c221252015-04-21 20:19:25 +0000113 ['title', 'string'],
114 ['subTitle', 'string'],
115 ['pubDate', 'date'],
116 ['author', 'string']
Nils Diewald6283d692015-04-23 20:32:53 +0000117 ]).fromJson(json);
Nils Diewald87507832015-05-01 23:36:41 +0000118
Nils Diewald0e6992a2015-04-14 20:13:52 +0000119 document.getElementById('vc').appendChild(vc.element());
Nils Diewald1fcb2ad2015-04-20 19:19:18 +0000120
Nils Diewald4c221252015-04-21 20:19:25 +0000121 // show the current JSON serialization
Nils Diewald1fcb2ad2015-04-20 19:19:18 +0000122 KorAP.showJSON = function () {
Nils Diewald652e5f42015-05-10 18:11:45 +0000123 var json = document.getElementById("json");
124 json.innerHTML = JSON.stringify(vc.root().toJson(), null, ' ');
125 hljs.highlightBlock(json);
Nils Diewald1fcb2ad2015-04-20 19:19:18 +0000126 };
127
Nils Diewald4c221252015-04-21 20:19:25 +0000128 // show the current query serialization
Nils Diewald1fcb2ad2015-04-20 19:19:18 +0000129 KorAP.showQuery = function () {
130 document.getElementById("query").innerHTML = vc.root().toQuery();
131 };
Nils Diewald845282c2015-05-14 07:53:03 +0000132
133 // make the current vc persistant
134 KorAP.makeVCPersistant = function () {
135 vc.makePersistant();
136 };
Nils Diewald0e6992a2015-04-14 20:13:52 +0000137 });
138});