blob: 048c168c6b16e98f98c8ac2259adbfa3af70a237 [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",
35 "value":"Baum",
36 "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",
41 "value":"hihi",
42 "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 Diewald0297ba12015-01-05 21:56:12 +000050 "key":"Titel",
51 "value":"Baum",
52 "match":"match:eq"
53 },
54 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000055 "@type":"koral:doc",
Nils Diewald0297ba12015-01-05 21:56:12 +000056 "key":"Veröffentlichungsort",
57 "value":"hihi",
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 Diewaldd0770492014-12-19 03:55:00 +000073 "key":"Untertitel",
74 "value":"huhu",
75 "match":"match:eq"
76 }
77 ]
78 };
Nils Diewalde15b7a22015-01-09 21:50:21 +000079 KorAP.Locale.AND = 'und';
80 KorAP.Locale.OR = 'oder';
81
Nils Diewald966abf12014-12-20 02:27:45 +000082 var vc = KorAP.VirtualCollection.render(json);
83 document.getElementById('vc').appendChild(vc.element());
Nils Diewald5c817a42015-01-06 01:08:56 +000084
85 function showJSON() {
86 document.getElementById("json").innerHTML = JSON.stringify(vc.root().toJson());
87 };
88
Nils Diewaldd599d542015-01-08 20:41:34 +000089 function showQuery() {
90 document.getElementById("query").innerHTML = vc.root().toQuery();
Nils Diewald8f6b6102015-01-08 18:25:33 +000091 };
92
Nils Diewaldd0770492014-12-19 03:55:00 +000093 </script>
Nils Diewald5c817a42015-01-06 01:08:56 +000094
Nils Diewald8f6b6102015-01-08 18:25:33 +000095 <hr />
96
Nils Diewald5c817a42015-01-06 01:08:56 +000097 <p><a onclick="showJSON()" style="cursor:pointer">show JSON!</a></p>
Nils Diewald8f6b6102015-01-08 18:25:33 +000098 <div id="json" class="info"></div>
99
100 <hr />
101
Nils Diewaldd599d542015-01-08 20:41:34 +0000102 <p><a onclick="showQuery()" style="cursor:pointer">show Query!</a></p>
103 <div id="query" class="info"></div>
Nils Diewald8f6b6102015-01-08 18:25:33 +0000104
Nils Diewaldd0770492014-12-19 03:55:00 +0000105 </body>
106</html>