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", |
Nils Diewald | 4c22125 | 2015-04-21 20:19:25 +0000 | [diff] [blame] | 18 | "key":"title", |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 19 | "value":"Der Birnbaum", |
| 20 | "match":"match:eq" |
| 21 | }, |
| 22 | { |
| 23 | "@type":"koral:doc", |
Nils Diewald | 4c22125 | 2015-04-21 20:19:25 +0000 | [diff] [blame] | 24 | "key":"pubPlace", |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 25 | "value":"Mannheim", |
| 26 | "match":"match:eq" |
| 27 | }, |
| 28 | { |
| 29 | "@type":"koral:docGroup", |
| 30 | "operation":"operation:or", |
| 31 | "operands":[ |
| 32 | { |
| 33 | "@type":"koral:doc", |
Nils Diewald | 4c22125 | 2015-04-21 20:19:25 +0000 | [diff] [blame] | 34 | "key":"subTitle", |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 35 | "value":"Aufzucht und Pflege", |
| 36 | "match":"match:eq" |
| 37 | }, |
| 38 | { |
| 39 | "@type":"koral:doc", |
Nils Diewald | 4c22125 | 2015-04-21 20:19:25 +0000 | [diff] [blame] | 40 | "key":"subTitle", |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 41 | "value":"Gedichte", |
| 42 | "match":"match:eq", |
Nils Diewald | 652e5f4 | 2015-05-10 18:11:45 +0000 | [diff] [blame^] | 43 | /* |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 44 | "rewrites" : [ |
| 45 | { |
| 46 | "@type": "koral:rewrite", |
| 47 | "src" : "policy", |
| 48 | "operation" : "operation:injection", |
| 49 | } |
| 50 | ] |
Nils Diewald | 652e5f4 | 2015-05-10 18:11:45 +0000 | [diff] [blame^] | 51 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 52 | } |
| 53 | ] |
| 54 | } |
| 55 | ] |
| 56 | }, |
| 57 | { |
| 58 | "@type":"koral:doc", |
Nils Diewald | 4c22125 | 2015-04-21 20:19:25 +0000 | [diff] [blame] | 59 | "key":"pubDate", |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 60 | "type":"type:date", |
| 61 | "value":"2015-03-05", |
| 62 | "match":"match:geq" |
| 63 | } |
| 64 | ] |
| 65 | }; |
| 66 | |
Nils Diewald | 652e5f4 | 2015-05-10 18:11:45 +0000 | [diff] [blame^] | 67 | require(['vc','lib/domReady', 'lib/highlight/highlight.pack'], function (vcClass, domReady) { |
Nils Diewald | 4c22125 | 2015-04-21 20:19:25 +0000 | [diff] [blame] | 68 | |
| 69 | var loc = KorAP.Locale; |
| 70 | |
Nils Diewald | 652e5f4 | 2015-05-10 18:11:45 +0000 | [diff] [blame^] | 71 | /* |
Nils Diewald | 4c22125 | 2015-04-21 20:19:25 +0000 | [diff] [blame] | 72 | loc.AND = 'und'; |
| 73 | loc.OR = 'oder'; |
| 74 | loc.VC_subTitle = 'Untertitel'; |
| 75 | loc.VC_title = 'Titel'; |
| 76 | loc.VC_pubDate = 'Veröffentlichungsdatum'; |
| 77 | loc.VC_pubPlace = 'Veröffentlichungsort'; |
Nils Diewald | 652e5f4 | 2015-05-10 18:11:45 +0000 | [diff] [blame^] | 78 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 79 | |
| 80 | domReady(function() { |
Nils Diewald | 4c22125 | 2015-04-21 20:19:25 +0000 | [diff] [blame] | 81 | |
| 82 | // Create a new virtual collection by passing a based json object and |
| 83 | // field menu information |
Nils Diewald | 6283d69 | 2015-04-23 20:32:53 +0000 | [diff] [blame] | 84 | var vc = vcClass.create([ |
Nils Diewald | 4c22125 | 2015-04-21 20:19:25 +0000 | [diff] [blame] | 85 | ['title', 'string'], |
| 86 | ['subTitle', 'string'], |
| 87 | ['pubDate', 'date'], |
| 88 | ['author', 'string'] |
Nils Diewald | 6283d69 | 2015-04-23 20:32:53 +0000 | [diff] [blame] | 89 | ]).fromJson(json); |
Nils Diewald | 8750783 | 2015-05-01 23:36:41 +0000 | [diff] [blame] | 90 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 91 | document.getElementById('vc').appendChild(vc.element()); |
Nils Diewald | 1fcb2ad | 2015-04-20 19:19:18 +0000 | [diff] [blame] | 92 | |
Nils Diewald | 4c22125 | 2015-04-21 20:19:25 +0000 | [diff] [blame] | 93 | // show the current JSON serialization |
Nils Diewald | 1fcb2ad | 2015-04-20 19:19:18 +0000 | [diff] [blame] | 94 | KorAP.showJSON = function () { |
Nils Diewald | 652e5f4 | 2015-05-10 18:11:45 +0000 | [diff] [blame^] | 95 | var json = document.getElementById("json"); |
| 96 | json.innerHTML = JSON.stringify(vc.root().toJson(), null, ' '); |
| 97 | hljs.highlightBlock(json); |
Nils Diewald | 1fcb2ad | 2015-04-20 19:19:18 +0000 | [diff] [blame] | 98 | }; |
| 99 | |
Nils Diewald | 4c22125 | 2015-04-21 20:19:25 +0000 | [diff] [blame] | 100 | // show the current query serialization |
Nils Diewald | 1fcb2ad | 2015-04-20 19:19:18 +0000 | [diff] [blame] | 101 | KorAP.showQuery = function () { |
| 102 | document.getElementById("query").innerHTML = vc.root().toQuery(); |
| 103 | }; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 104 | }); |
| 105 | }); |