Mercurial > code > home > repos > homeauto
comparison service/reasoning/index.html @ 238:7a9836d51b0e
style /reasoning/ page
Ignore-this: e5633a0ed89f61f5f099a46c44ecc32c
author | drewp@bigasterisk.com |
---|---|
date | Mon, 01 Feb 2016 02:54:30 -0800 |
parents | 43f2e21e2225 |
children | 3f355dd1687c |
comparison
equal
deleted
inserted
replaced
237:43f2e21e2225 | 238:7a9836d51b0e |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>reasoning</title> | 4 <title>reasoning</title> |
5 <link rel="import" href="https://bigasterisk.com/lib/polymer/0.5.2/core-splitter/core-splitter.html"> | 5 <script src="/lib/polymer/1.0.9/webcomponentsjs/webcomponents.min.js"></script> |
6 <link rel="import" href="/lib/polymer/1.0.9/iron-collapse/iron-collapse.html" | |
6 <link rel="import" href="https://bigasterisk.com/supdebug/bang/service-rows/main.html"> | 7 <link rel="import" href="https://bigasterisk.com/supdebug/bang/service-rows/main.html"> |
7 <style type="text/css" media="all"> | 8 <style type="text/css" media="all"> |
8 /* <![CDATA[ */ | 9 /* <![CDATA[ */ |
9 body { | 10 body { |
10 font-family: sans-serif; | 11 font-family: sans-serif; |
41 <service-rows nameSubstrs="reasoning"></service-rows> | 42 <service-rows nameSubstrs="reasoning"></service-rows> |
42 </div> | 43 </div> |
43 | 44 |
44 <div class="pane"> | 45 <div class="pane"> |
45 <h2>Input</h2> | 46 <h2>Input</h2> |
46 <pre id="input"/> | 47 <div><input id="inputQ"></div> |
48 <div style="max-height: 600px; margin-right: 30px; overflow: auto"> | |
49 <pre id="input"></pre> | |
50 </div> | |
47 </div> | 51 </div> |
48 | 52 |
49 <core-splitter direction="up"></core-splitter> | |
50 | 53 |
51 <div class="pane"> | 54 <div class="pane"> |
52 <h2>Rules</h2> | 55 <h2>Rules</h2> |
53 <pre id="rules"/> | 56 <div style="max-height: 300px; margin-right: 30px; overflow: auto"> |
57 <pre id="rules"></pre> | |
58 </div> | |
54 </div> | 59 </div> |
55 | 60 |
56 <core-splitter direction="up"></core-splitter> | |
57 | 61 |
58 <div class="pane"> | 62 <div class="pane"> |
59 <h2>Output</h2> | 63 <h2>Output</h2> |
60 <pre id="output"/> | 64 <div><input id="outputQ"></div> |
65 <div style="max-height: 300px; margin-right: 30px; overflow: auto"> | |
66 <pre id="output"></pre> | |
67 </div> | |
61 </div> | 68 </div> |
62 | 69 |
63 <div> | 70 <div> |
64 <input id="auto" type="checkbox"/> <label for="auto">auto refresh</label> | 71 <label><input id="auto" type="checkbox"> auto refresh</label> |
65 </div> | 72 </div> |
66 | 73 |
67 <script src="//bigasterisk.com/lib/jquery-2.0.3.min.js"></script> | 74 <script src="//bigasterisk.com/lib/jquery-2.0.3.min.js"></script> |
68 <script> | 75 <script> |
69 window.NS = { | 76 window.NS = { |
77 </script> | 84 </script> |
78 <link rel="import" href="/rdf/rdf-uri.html"> | 85 <link rel="import" href="/rdf/rdf-uri.html"> |
79 <script type="text/javascript"> | 86 <script type="text/javascript"> |
80 // <![CDATA[ | 87 // <![CDATA[ |
81 $(function () { | 88 $(function () { |
89 | |
90 function makeAddStmts(elem, q) { | |
91 return function (stmts) { | |
92 elem.empty(); | |
93 $.each(stmts, function (i, stmt) { | |
94 var s = BigastUri.compactUri(stmt[0]); | |
95 var p = BigastUri.compactUri(stmt[1]); | |
96 var o = BigastUri.compactUri(stmt[2]); | |
97 | |
98 if (q.toLowerCase() && | |
99 s.toLowerCase().indexOf(q) == -1 && | |
100 p.toLowerCase().indexOf(q) == -1 && | |
101 o.toLowerCase().indexOf(q) == -1) { | |
102 return; | |
103 } | |
104 | |
105 elem.append( | |
106 $("<div>") | |
107 .append($("<span>").text(s)) | |
108 .append(" ") | |
109 .append($("<span>").addClass("pred").text(p)) | |
110 .append(" ") | |
111 .append($("<span>").addClass("obj").text(o))); | |
112 }) | |
113 } | |
114 } | |
115 | |
116 function updateIn() { | |
117 $.get("lastInputGraph", makeAddStmts($("#input"), $("#inputQ").val())); | |
118 } | |
119 function updateOut() { | |
120 $.get("lastOutputGraph", makeAddStmts($("#output"), $("#outputQ").val())); | |
121 } | |
122 | |
82 function update() { | 123 function update() { |
83 function makeAddStmts(elem) { | 124 updateIn(); |
84 return function (stmts) { | 125 updateOut(); |
85 elem.empty(); | |
86 $.each(stmts, function (i, s) { | |
87 elem.append($("<div>").html( | |
88 "<span>"+BigastUri.compactUri(s[0])+"</span> "+ | |
89 "<span class=\"pred\">"+BigastUri.compactUri(s[1])+"</span> "+ | |
90 "<span class=\"obj\">"+BigastUri.compactUri(s[2])+"</span>")); | |
91 }) | |
92 } | |
93 } | |
94 | |
95 $.get("lastInputGraph", makeAddStmts($("#input"))); | |
96 $.get("lastOutputGraph", makeAddStmts($("#output"))); | |
97 $.get("rules", function (txt) { | 126 $.get("rules", function (txt) { |
98 $("#rules").empty().text(txt); | 127 $("#rules").empty().text(txt); |
99 }); | 128 }); |
100 } | 129 } |
130 $("#inputQ").on('keyup', updateIn); | |
101 function loop() { | 131 function loop() { |
102 update(); | 132 update(); |
103 if ($("input#auto").is(":checked")) { | 133 if ($("input#auto").is(":checked")) { |
104 setTimeout(loop, 2000); | 134 setTimeout(loop, 2000); |
105 } | 135 } |