public void webWriter(HttpListenerContext context, TextWriter writer, string action, string query, string path, string mt, string serverRoot) { writer = WebLinksWriter.AddWarnWriter(writer); mt = mt ?? "rdfMT"; BeginsWith("./xrdf/", ref path); SIProlog.PNode graph = prologEngine.FindOrCreateKB(mt); if (query == "rdf2pl") { graph.pushRdfGraphToPrologKB(true); } if (query == "pl2rdf") { graph.pushPrologKBToRdfGraph(true); } if (query == "syncfromremote") { graph.populateRDFMemoryFromRepository(); } if (graph != null) { graph.RdfStore.prologEngine.webWriter(writer, null, null, graph.id, serverRoot); } WebLinksWriter.RemoveWarnWriter(writer); return; }
public void webWriter(TextWriter writer, string action, string query, string mt, string serverRoot) { writer = WebLinksWriter.AddWarnWriter(writer); serverRoot = "/"; if ((action == "remotequery") || (action == "jsonquery")) { jsonQuery(writer, query, mt, serverRoot); return; } if ((action == "autorefresh") || (action == "autoquery")) { writer.WriteLine("<META HTTP-EQUIV=\"REFRESH\" content=\"10\">"); } writer.WriteLine("<html>"); var s = @"<head> <script> function showtip(current,e,text) { if (document.all) { thetitle=text.split('<br>') if (thetitle.length > 1) { thetitles="""" for (i=0; i<thetitle.length-1; i++) thetitles += thetitle[i] + ""\r\n"" current.title = thetitles } else current.title = text } else if (document.layers) { document.tooltip.document.write( '<layer bgColor=""#FFFFE7"" style=""border:1px ' + 'solid black; font-size:12px;color:#000000;"">' + text + '</layer>') document.tooltip.document.close() document.tooltip.left=e.pageX+5 document.tooltip.top=e.pageY+5 document.tooltip.visibility=""show"" } } function hidetip() { if (document.layers) document.tooltip.visibility=""hidden"" } function setIframeSource() { var theSelect = document.getElementById('location'); var theIframe = document.getElementById('myIframe'); var theUrl; theUrl = theSelect.options[theSelect.selectedIndex].value; theIframe.src = theUrl; } function validateBrowserForm() { var theAction = document.getElementById('action'); var theQuery = document.getElementById('query'); var theMt = document.getElementById('mt'); var theIframe = document.getElementById('myIframe'); var theUrl; var theActionValue = theAction.value; var theMtValue = theMt.value; var theQueryValue =theQuery.value; theUrl = ""/siprolog/?a=""+theActionValue+""&mt=""+theMtValue+""&q=""+theQueryValue; if (theActionValue =='clear') {theUrl =""/plot/?mt=""+theMtValue+""&q=clear""; }; if (theActionValue =='plot') {theUrl =""/plot/?mt=""+theMtValue+""&q=plot(X,Y)""; }; if (theActionValue =='scope') {theUrl =""/plot/?mt=""+theMtValue+""&a=autorefresh&q=plot(X,Y)""; }; if (theActionValue =='watch') {theUrl =""/siprolog/?mt=""+theMtValue+""&a=autorefresh""; }; if (theActionValue =='clearcache') {theUrl =""/xrdf/?mt=""+theMtValue+""&q=clearcache""; }; if (theActionValue =='syncfromremote') {theUrl =""/xrdf/?mt=""+theMtValue+""&q=syncfromremote""; }; if (theActionValue =='synctoremote') {theUrl =""/xrdf/?mt=""+theMtValue+""&q=synctoremote""; }; if (theActionValue =='pl2rdf') {theUrl =""/xrdf/?mt=""+theMtValue+""&q=pl2rdf""; }; if (theActionValue =='rdf2pl') {theUrl =""/xrdf/?mt=""+theMtValue+""&q=rdf2pl""; }; theIframe.src = theUrl; return false; } </script> </head> "; writer.WriteLine(s); TOCmenu(writer, serverRoot); webWriter0(writer, action, query, mt, serverRoot, true); writer.WriteLine("</html>"); WebLinksWriter.RemoveWarnWriter(writer); }