blob: 0a7efa9e6b5352bb62cd7803484dc92072c9bb61 [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 Diewald966abf12014-12-20 02:27:45 +00008 <link href="../../css/vc.css" rel="stylesheet" type="text/css"></link>
Nils Diewaldd2b57372015-03-10 20:09:48 +00009 <link href="../../css/menu.css" rel="stylesheet" type="text/css"></link>
Nils Diewald8f6b6102015-01-08 18:25:33 +000010 <style type="text/css" rel="stylesheet">
11.info {
12 background-color:white;
13 color: black;
14 padding: 1em;
15 font-family: mono;
16}
17 </style>
Nils Diewaldd0770492014-12-19 03:55:00 +000018 </head>
19 <body>
20 <div id="vc"></div>
Nils Diewald59c02fc2015-03-07 01:29:09 +000021 <div id="menu" class="vc"></div>
Nils Diewald966abf12014-12-20 02:27:45 +000022
Nils Diewaldd0770492014-12-19 03:55:00 +000023 <script>
24 var json = {
Nils Diewald2fe12e12015-03-06 16:47:06 +000025 "@type":"koral:docGroup",
Nils Diewaldd0770492014-12-19 03:55:00 +000026 "operation":"operation:or",
27 "operands":[
28 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000029 "@type":"koral:docGroup",
Nils Diewaldd0770492014-12-19 03:55:00 +000030 "operation":"operation:and",
31 "operands":[
32 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000033 "@type":"koral:doc",
Nils Diewaldd0770492014-12-19 03:55:00 +000034 "key":"Titel",
Nils Diewaldedb78012015-03-11 20:06:08 +000035 "value":"Der Birnbaum",
Nils Diewaldd0770492014-12-19 03:55:00 +000036 "match":"match:eq"
37 },
38 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000039 "@type":"koral:doc",
Nils Diewaldd0770492014-12-19 03:55:00 +000040 "key":"Veröffentlichungsort",
Nils Diewaldedb78012015-03-11 20:06:08 +000041 "value":"Mannheim",
Nils Diewaldd0770492014-12-19 03:55:00 +000042 "match":"match:eq"
Nils Diewald0297ba12015-01-05 21:56:12 +000043 },
44 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000045 "@type":"koral:docGroup",
Nils Diewald0297ba12015-01-05 21:56:12 +000046 "operation":"operation:or",
47 "operands":[
48 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000049 "@type":"koral:doc",
Nils Diewaldedb78012015-03-11 20:06:08 +000050 "key":"Untertitel",
51 "value":"Aufzucht und Pflege",
Nils Diewald0297ba12015-01-05 21:56:12 +000052 "match":"match:eq"
53 },
54 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000055 "@type":"koral:doc",
Nils Diewaldedb78012015-03-11 20:06:08 +000056 "key":"Untertitel",
57 "value":"Gedichte",
Nils Diewald86dad5b2015-01-28 15:09:07 +000058 "match":"match:eq",
59 "rewrites" : [
60 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000061 "@type": "koral:rewrite",
Nils Diewald86dad5b2015-01-28 15:09:07 +000062 "src" : "policy",
63 "operation" : "operation:injection",
64 }
65 ]
Nils Diewald0297ba12015-01-05 21:56:12 +000066 }
67 ]
Nils Diewaldd0770492014-12-19 03:55:00 +000068 }
69 ]
70 },
71 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000072 "@type":"koral:doc",
Nils Diewaldedb78012015-03-11 20:06:08 +000073 "key":"Veröffentlichungsdatum",
74 "type":"type:date",
75 "value":"2015-03-05",
76 "match":"match:geq"
Nils Diewaldd0770492014-12-19 03:55:00 +000077 }
78 ]
79 };
Nils Diewalde15b7a22015-01-09 21:50:21 +000080 KorAP.Locale.AND = 'und';
81 KorAP.Locale.OR = 'oder';
82
Nils Diewald966abf12014-12-20 02:27:45 +000083 var vc = KorAP.VirtualCollection.render(json);
84 document.getElementById('vc').appendChild(vc.element());
Nils Diewald5c817a42015-01-06 01:08:56 +000085
86 function showJSON() {
87 document.getElementById("json").innerHTML = JSON.stringify(vc.root().toJson());
88 };
89
Nils Diewaldd599d542015-01-08 20:41:34 +000090 function showQuery() {
91 document.getElementById("query").innerHTML = vc.root().toQuery();
Nils Diewald8f6b6102015-01-08 18:25:33 +000092 };
93
Nils Diewaldd0770492014-12-19 03:55:00 +000094 </script>
Nils Diewald5c817a42015-01-06 01:08:56 +000095
Nils Diewald8f6b6102015-01-08 18:25:33 +000096 <hr />
97
Nils Diewald5c817a42015-01-06 01:08:56 +000098 <p><a onclick="showJSON()" style="cursor:pointer">show JSON!</a></p>
Nils Diewald8f6b6102015-01-08 18:25:33 +000099 <div id="json" class="info"></div>
100
101 <hr />
102
Nils Diewaldd599d542015-01-08 20:41:34 +0000103 <p><a onclick="showQuery()" style="cursor:pointer">show Query!</a></p>
104 <div id="query" class="info"></div>
Nils Diewald8f6b6102015-01-08 18:25:33 +0000105
Nils Diewaldd0770492014-12-19 03:55:00 +0000106 </body>
107</html>