Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame^] | 1 | requirejs.config({ |
| 2 | baseUrl: '../js/src', |
| 3 | paths : { |
| 4 | 'lib': '../lib' |
| 5 | } |
| 6 | }); |
| 7 | |
| 8 | var 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 | |
| 65 | function showJSON() { |
| 66 | document.getElementById("json").innerHTML = JSON.stringify(vc.root().toJson()); |
| 67 | }; |
| 68 | |
| 69 | function showQuery() { |
| 70 | document.getElementById("query").innerHTML = vc.root().toQuery(); |
| 71 | }; |
| 72 | |
| 73 | require(['vc','lib/domReady'], function (vcClass, domReady) { |
| 74 | KorAP.Locale.AND = 'und'; |
| 75 | KorAP.Locale.OR = 'oder'; |
| 76 | |
| 77 | domReady(function() { |
| 78 | var vc = vcClass.render(json); |
| 79 | document.getElementById('vc').appendChild(vc.element()); |
| 80 | }); |
| 81 | }); |