blob: d136cef0bee2dabb0cc7c120b7a358c580c31d1d [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",
18 "key":"Titel",
19 "value":"Der Birnbaum",
20 "match":"match:eq"
21 },
22 {
23 "@type":"koral:doc",
24 "key":"Veröffentlichungsort",
25 "value":"Mannheim",
26 "match":"match:eq"
27 },
28 {
29 "@type":"koral:docGroup",
30 "operation":"operation:or",
31 "operands":[
32 {
33 "@type":"koral:doc",
34 "key":"Untertitel",
35 "value":"Aufzucht und Pflege",
36 "match":"match:eq"
37 },
38 {
39 "@type":"koral:doc",
40 "key":"Untertitel",
41 "value":"Gedichte",
42 "match":"match:eq",
43 "rewrites" : [
44 {
45 "@type": "koral:rewrite",
46 "src" : "policy",
47 "operation" : "operation:injection",
48 }
49 ]
50 }
51 ]
52 }
53 ]
54 },
55 {
56 "@type":"koral:doc",
57 "key":"Veröffentlichungsdatum",
58 "type":"type:date",
59 "value":"2015-03-05",
60 "match":"match:geq"
61 }
62 ]
63};
64
Nils Diewald0e6992a2015-04-14 20:13:52 +000065require(['vc','lib/domReady'], function (vcClass, domReady) {
66 KorAP.Locale.AND = 'und';
67 KorAP.Locale.OR = 'oder';
68
69 domReady(function() {
Nils Diewald1fcb2ad2015-04-20 19:19:18 +000070 var vc = vcClass.render(json, [
71 ['Titel', 'title', 'string'],
72 ['Untertitel', 'subTitle', 'string'],
73 ['Veröffentlichungsdatum', 'pubDate', 'date'],
74 ['Autor', 'author', 'string']
75 ]);
Nils Diewald0e6992a2015-04-14 20:13:52 +000076 document.getElementById('vc').appendChild(vc.element());
Nils Diewald1fcb2ad2015-04-20 19:19:18 +000077
78 KorAP.showJSON = function () {
79 document.getElementById("json").innerHTML = JSON.stringify(vc.root().toJson());
80 };
81
82 KorAP.showQuery = function () {
83 document.getElementById("query").innerHTML = vc.root().toQuery();
84 };
85
Nils Diewald0e6992a2015-04-14 20:13:52 +000086 });
87});