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 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 65 | require(['vc','lib/domReady'], function (vcClass, domReady) { |
| 66 | KorAP.Locale.AND = 'und'; |
| 67 | KorAP.Locale.OR = 'oder'; |
| 68 | |
| 69 | domReady(function() { |
Nils Diewald | 1fcb2ad | 2015-04-20 19:19:18 +0000 | [diff] [blame^] | 70 | var vc = vcClass.render(json, [ |
| 71 | ['Titel', 'title', 'string'], |
| 72 | ['Untertitel', 'subTitle', 'string'], |
| 73 | ['Veröffentlichungsdatum', 'pubDate', 'date'], |
| 74 | ['Autor', 'author', 'string'] |
| 75 | ]); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 76 | document.getElementById('vc').appendChild(vc.element()); |
Nils Diewald | 1fcb2ad | 2015-04-20 19:19:18 +0000 | [diff] [blame^] | 77 | |
| 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 Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 86 | }); |
| 87 | }); |