blob: 9254d68a97bfe98372bc23cdc14b02b20ac2a338 [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 Diewaldd0770492014-12-19 03:55:00 +00006 <script src="../src/vc.js"></script>
Nils Diewald966abf12014-12-20 02:27:45 +00007 <link href="../../css/vc.css" rel="stylesheet" type="text/css"></link>
Nils Diewald8f6b6102015-01-08 18:25:33 +00008 <style type="text/css" rel="stylesheet">
9.info {
10 background-color:white;
11 color: black;
12 padding: 1em;
13 font-family: mono;
14}
15 </style>
Nils Diewaldd0770492014-12-19 03:55:00 +000016 </head>
17 <body>
18 <div id="vc"></div>
Nils Diewald966abf12014-12-20 02:27:45 +000019
Nils Diewaldd0770492014-12-19 03:55:00 +000020 <script>
21 var json = {
22 "@type":"korap:docGroup",
23 "operation":"operation:or",
24 "operands":[
25 {
26 "@type":"korap:docGroup",
27 "operation":"operation:and",
28 "operands":[
29 {
30 "@type":"korap:doc",
31 "key":"Titel",
32 "value":"Baum",
33 "match":"match:eq"
34 },
35 {
36 "@type":"korap:doc",
37 "key":"Veröffentlichungsort",
38 "value":"hihi",
39 "match":"match:eq"
Nils Diewald0297ba12015-01-05 21:56:12 +000040 },
41 {
42 "@type":"korap:docGroup",
43 "operation":"operation:or",
44 "operands":[
45 {
46 "@type":"korap:doc",
47 "key":"Titel",
48 "value":"Baum",
49 "match":"match:eq"
50 },
51 {
52 "@type":"korap:doc",
53 "key":"Veröffentlichungsort",
54 "value":"hihi",
Nils Diewald86dad5b2015-01-28 15:09:07 +000055 "match":"match:eq",
56 "rewrites" : [
57 {
58 "@type": "korap:rewrite",
59 "src" : "policy",
60 "operation" : "operation:injection",
61 }
62 ]
Nils Diewald0297ba12015-01-05 21:56:12 +000063 }
64 ]
Nils Diewaldd0770492014-12-19 03:55:00 +000065 }
66 ]
67 },
68 {
69 "@type":"korap:doc",
70 "key":"Untertitel",
71 "value":"huhu",
72 "match":"match:eq"
73 }
74 ]
75 };
Nils Diewalde15b7a22015-01-09 21:50:21 +000076 KorAP.Locale.AND = 'und';
77 KorAP.Locale.OR = 'oder';
78
Nils Diewald966abf12014-12-20 02:27:45 +000079 var vc = KorAP.VirtualCollection.render(json);
80 document.getElementById('vc').appendChild(vc.element());
Nils Diewald5c817a42015-01-06 01:08:56 +000081
82 function showJSON() {
83 document.getElementById("json").innerHTML = JSON.stringify(vc.root().toJson());
84 };
85
Nils Diewaldd599d542015-01-08 20:41:34 +000086 function showQuery() {
87 document.getElementById("query").innerHTML = vc.root().toQuery();
Nils Diewald8f6b6102015-01-08 18:25:33 +000088 };
89
Nils Diewaldd0770492014-12-19 03:55:00 +000090 </script>
Nils Diewald5c817a42015-01-06 01:08:56 +000091
Nils Diewald8f6b6102015-01-08 18:25:33 +000092 <hr />
93
Nils Diewald5c817a42015-01-06 01:08:56 +000094 <p><a onclick="showJSON()" style="cursor:pointer">show JSON!</a></p>
Nils Diewald8f6b6102015-01-08 18:25:33 +000095 <div id="json" class="info"></div>
96
97 <hr />
98
Nils Diewaldd599d542015-01-08 20:41:34 +000099 <p><a onclick="showQuery()" style="cursor:pointer">show Query!</a></p>
100 <div id="query" class="info"></div>
Nils Diewald8f6b6102015-01-08 18:25:33 +0000101
Nils Diewaldd0770492014-12-19 03:55:00 +0000102 </body>
103</html>