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 | |
Akron | 48b1e4d | 2015-06-17 18:47:01 +0200 | [diff] [blame^] | 67 | var collections = [ |
| 68 | { |
| 69 | "statistics":{ |
| 70 | "paragraphs":2034752, |
| 71 | "documents":196510, |
| 72 | "tokens":51545081, |
| 73 | "sentences":4116282 |
| 74 | }, |
| 75 | "query":[ |
| 76 | { |
| 77 | "@value":{ |
| 78 | "@field":"korap:field#corpusID", |
| 79 | "@value":"WPD", |
| 80 | "@type":"korap:term" |
| 81 | }, |
| 82 | "@type":"korap:meta-filter" |
| 83 | } |
| 84 | ], |
| 85 | "name":"Wikipedia", |
| 86 | "path":"Wikipedia", |
| 87 | "description":"Die freie Enzyklopädie", |
| 88 | "shared":false, |
| 89 | "managed":true, |
| 90 | "created":"2015-04-01T23:04:32.000+02:00", |
| 91 | "foundries":"", |
| 92 | "id":"ZGU0ZTllNTFkYzc3M2VhZmViYzdkYWE2ODI5NDc3NTk4NGQ1YThhOTMwOTNhOWYxNWMwN2M3Y2YyZmE3N2RlNQ==" |
| 93 | } |
| 94 | ]; |
| 95 | |
Nils Diewald | 652e5f4 | 2015-05-10 18:11:45 +0000 | [diff] [blame] | 96 | require(['vc','lib/domReady', 'lib/highlight/highlight.pack'], function (vcClass, domReady) { |
Nils Diewald | 4c22125 | 2015-04-21 20:19:25 +0000 | [diff] [blame] | 97 | |
| 98 | var loc = KorAP.Locale; |
| 99 | |
Nils Diewald | 652e5f4 | 2015-05-10 18:11:45 +0000 | [diff] [blame] | 100 | /* |
Nils Diewald | 4c22125 | 2015-04-21 20:19:25 +0000 | [diff] [blame] | 101 | loc.AND = 'und'; |
| 102 | loc.OR = 'oder'; |
| 103 | loc.VC_subTitle = 'Untertitel'; |
| 104 | loc.VC_title = 'Titel'; |
| 105 | loc.VC_pubDate = 'Veröffentlichungsdatum'; |
| 106 | loc.VC_pubPlace = 'Veröffentlichungsort'; |
Nils Diewald | 652e5f4 | 2015-05-10 18:11:45 +0000 | [diff] [blame] | 107 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 108 | |
| 109 | domReady(function() { |
Nils Diewald | 4c22125 | 2015-04-21 20:19:25 +0000 | [diff] [blame] | 110 | |
| 111 | // Create a new virtual collection by passing a based json object and |
| 112 | // field menu information |
Nils Diewald | 6283d69 | 2015-04-23 20:32:53 +0000 | [diff] [blame] | 113 | var vc = vcClass.create([ |
Nils Diewald | 4c22125 | 2015-04-21 20:19:25 +0000 | [diff] [blame] | 114 | ['title', 'string'], |
| 115 | ['subTitle', 'string'], |
| 116 | ['pubDate', 'date'], |
| 117 | ['author', 'string'] |
Nils Diewald | 6283d69 | 2015-04-23 20:32:53 +0000 | [diff] [blame] | 118 | ]).fromJson(json); |
Nils Diewald | 8750783 | 2015-05-01 23:36:41 +0000 | [diff] [blame] | 119 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 120 | document.getElementById('vc').appendChild(vc.element()); |
Nils Diewald | 1fcb2ad | 2015-04-20 19:19:18 +0000 | [diff] [blame] | 121 | |
Nils Diewald | 4c22125 | 2015-04-21 20:19:25 +0000 | [diff] [blame] | 122 | // show the current JSON serialization |
Nils Diewald | 1fcb2ad | 2015-04-20 19:19:18 +0000 | [diff] [blame] | 123 | KorAP.showJSON = function () { |
Nils Diewald | 652e5f4 | 2015-05-10 18:11:45 +0000 | [diff] [blame] | 124 | var json = document.getElementById("json"); |
| 125 | json.innerHTML = JSON.stringify(vc.root().toJson(), null, ' '); |
| 126 | hljs.highlightBlock(json); |
Nils Diewald | 1fcb2ad | 2015-04-20 19:19:18 +0000 | [diff] [blame] | 127 | }; |
| 128 | |
Nils Diewald | 4c22125 | 2015-04-21 20:19:25 +0000 | [diff] [blame] | 129 | // show the current query serialization |
Nils Diewald | 1fcb2ad | 2015-04-20 19:19:18 +0000 | [diff] [blame] | 130 | KorAP.showQuery = function () { |
| 131 | document.getElementById("query").innerHTML = vc.root().toQuery(); |
| 132 | }; |
Nils Diewald | 845282c | 2015-05-14 07:53:03 +0000 | [diff] [blame] | 133 | |
| 134 | // make the current vc persistant |
| 135 | KorAP.makeVCPersistant = function () { |
| 136 | vc.makePersistant(); |
| 137 | }; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 138 | }); |
| 139 | }); |