blob: ae6aef1eef29e3112017d710772fa906782be2c5 [file] [log] [blame]
Nils Diewaldd0770492014-12-19 03:55:00 +00001<!DOCTYPE html>
2<html>
3 <head>
4 <title>Virtual Collection demo</title>
Nils Diewald966abf12014-12-20 02:27:45 +00005 <meta charset="utf-8" />
Nils Diewald2fe12e12015-03-06 16:47:06 +00006 <script src="../src/menu.js"></script>
Nils Diewaldd0770492014-12-19 03:55:00 +00007 <script src="../src/vc.js"></script>
Nils Diewald5c5a7472015-04-02 22:13:38 +00008 <link href="../../css/build/kalamar.css" rel="stylesheet" type="text/css"></link>
Nils Diewald8f6b6102015-01-08 18:25:33 +00009 <style type="text/css" rel="stylesheet">
Nils Diewald5c5a7472015-04-02 22:13:38 +000010
11body {
12 background-color: #7ba400;
13 color: white;
14 font-family: tahoma, verdana, arial;
15 font-size: 10pt;
16 margin: 20px;
17}
18
Nils Diewald8f6b6102015-01-08 18:25:33 +000019.info {
20 background-color:white;
21 color: black;
22 padding: 1em;
23 font-family: mono;
24}
25 </style>
Nils Diewaldd0770492014-12-19 03:55:00 +000026 </head>
27 <body>
28 <div id="vc"></div>
Nils Diewald59c02fc2015-03-07 01:29:09 +000029 <div id="menu" class="vc"></div>
Nils Diewald966abf12014-12-20 02:27:45 +000030
Nils Diewaldd0770492014-12-19 03:55:00 +000031 <script>
32 var json = {
Nils Diewald2fe12e12015-03-06 16:47:06 +000033 "@type":"koral:docGroup",
Nils Diewaldd0770492014-12-19 03:55:00 +000034 "operation":"operation:or",
35 "operands":[
36 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000037 "@type":"koral:docGroup",
Nils Diewaldd0770492014-12-19 03:55:00 +000038 "operation":"operation:and",
39 "operands":[
40 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000041 "@type":"koral:doc",
Nils Diewaldd0770492014-12-19 03:55:00 +000042 "key":"Titel",
Nils Diewaldedb78012015-03-11 20:06:08 +000043 "value":"Der Birnbaum",
Nils Diewaldd0770492014-12-19 03:55:00 +000044 "match":"match:eq"
45 },
46 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000047 "@type":"koral:doc",
Nils Diewaldd0770492014-12-19 03:55:00 +000048 "key":"Veröffentlichungsort",
Nils Diewaldedb78012015-03-11 20:06:08 +000049 "value":"Mannheim",
Nils Diewaldd0770492014-12-19 03:55:00 +000050 "match":"match:eq"
Nils Diewald0297ba12015-01-05 21:56:12 +000051 },
52 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000053 "@type":"koral:docGroup",
Nils Diewald0297ba12015-01-05 21:56:12 +000054 "operation":"operation:or",
55 "operands":[
56 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000057 "@type":"koral:doc",
Nils Diewaldedb78012015-03-11 20:06:08 +000058 "key":"Untertitel",
59 "value":"Aufzucht und Pflege",
Nils Diewald0297ba12015-01-05 21:56:12 +000060 "match":"match:eq"
61 },
62 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000063 "@type":"koral:doc",
Nils Diewaldedb78012015-03-11 20:06:08 +000064 "key":"Untertitel",
65 "value":"Gedichte",
Nils Diewald86dad5b2015-01-28 15:09:07 +000066 "match":"match:eq",
67 "rewrites" : [
68 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000069 "@type": "koral:rewrite",
Nils Diewald86dad5b2015-01-28 15:09:07 +000070 "src" : "policy",
71 "operation" : "operation:injection",
72 }
73 ]
Nils Diewald0297ba12015-01-05 21:56:12 +000074 }
75 ]
Nils Diewaldd0770492014-12-19 03:55:00 +000076 }
77 ]
78 },
79 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000080 "@type":"koral:doc",
Nils Diewaldedb78012015-03-11 20:06:08 +000081 "key":"Veröffentlichungsdatum",
82 "type":"type:date",
83 "value":"2015-03-05",
84 "match":"match:geq"
Nils Diewaldd0770492014-12-19 03:55:00 +000085 }
86 ]
87 };
Nils Diewalde15b7a22015-01-09 21:50:21 +000088 KorAP.Locale.AND = 'und';
89 KorAP.Locale.OR = 'oder';
90
Nils Diewald966abf12014-12-20 02:27:45 +000091 var vc = KorAP.VirtualCollection.render(json);
92 document.getElementById('vc').appendChild(vc.element());
Nils Diewald5c817a42015-01-06 01:08:56 +000093
94 function showJSON() {
95 document.getElementById("json").innerHTML = JSON.stringify(vc.root().toJson());
96 };
97
Nils Diewaldd599d542015-01-08 20:41:34 +000098 function showQuery() {
99 document.getElementById("query").innerHTML = vc.root().toQuery();
Nils Diewald8f6b6102015-01-08 18:25:33 +0000100 };
101
Nils Diewaldd0770492014-12-19 03:55:00 +0000102 </script>
Nils Diewald5c817a42015-01-06 01:08:56 +0000103
Nils Diewald8f6b6102015-01-08 18:25:33 +0000104 <hr />
105
Nils Diewald5c817a42015-01-06 01:08:56 +0000106 <p><a onclick="showJSON()" style="cursor:pointer">show JSON!</a></p>
Nils Diewald8f6b6102015-01-08 18:25:33 +0000107 <div id="json" class="info"></div>
108
109 <hr />
110
Nils Diewaldd599d542015-01-08 20:41:34 +0000111 <p><a onclick="showQuery()" style="cursor:pointer">show Query!</a></p>
112 <div id="query" class="info"></div>
Nils Diewald8f6b6102015-01-08 18:25:33 +0000113
Nils Diewaldd0770492014-12-19 03:55:00 +0000114 </body>
115</html>