source: gs2-extensions/afrepo/trunk/src/src/html/sparql.php@ 27984

Last change on this file since 27984 was 27984, checked in by davidb, 11 years ago

Next round of changes after fruther testing and extra example development

File size: 4.6 KB
RevLine 
[27679]1<?php
2 require_once "setup.php";
3 $base = parse_url($repo->getURIPrefix());
4 $basepath = $base["path"];
5?>
6<!DOCTYPE HTML>
7<html>
8 <head>
9 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10
[27943]11 <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Pacifico">
12
[27679]13 <link rel="stylesheet" href="css/core-style.css" type="text/css" media="screen" />
14
15
16 <title>SALAMI SPARQL Endpoint</title>
[27693]17
18 <script src="js/jquery-1.10.1.js" > </script>
19
20 <script>
21
22
23 function onSubmit() {
24
25 $.ajax({
[27745]26 type: "GET",
27
[27984]28 /*
[27693]29 beforeSend: function (request) {
30 //request.setRequestHeader("Authority", authorizationToken);
[27745]31 //request.setRequestHeader("origin", "http://nema.lis.illinois.edu");
32 },
[27984]33 */
[27745]34
[27984]35 url: "<?php echo $repo->getSparqlEndpoint();?>",
36 data: { "query": $('#rdf-query').val(), "output": $('#rdf-output').val(), "soft-limit": $('#rdf-soft-limit').val() },
37 //processData: false,
[27745]38
[27984]39
[27745]40 /*
41 xhrFields: {
42 withCredentials: true
[27693]43 },
[27745]44 crossDomain: true,
45 */
[27693]46
[27745]47 // accepts: "text/plain",
48 //converters: {},
49 dataType: "text",
50
[27693]51 success: function(msg) {
[27745]52 //var $msg = $(msg);
53 //alert("msg = " +msg);
54
55 //$('#rdf-results').val(msg.documentElement.outerHTML);
56 $('#rdf-results').val(msg);
57 },
58
59
60 error: function(err) {
[27984]61 //alert(err.toString());
62 //if (err.status == 200) {
63 // ParseResult(err);
64 //}
65 //else { }
66
67 alert('Error:' + err.responseText + ' Status: ' + err.status);
[27745]68 }
69
[27693]70 });
71
[27984]72
[27693]73 return false;
74
75 }
76
77
78 </script>
79
[27679]80 </head>
81
82 <body>
83 <div id="container">
84
85 <div id="header">
[27943]86<!--
[27679]87 <h1>The SALAMI SPARQL Endpoint</h1>
[27943]88-->
89 <h1>The Salami SPARQL Endpoint</h1>
[27679]90 </div>
91
92 <div id="navigation">
93 <ul>
[27693]94 <li><a href="index.php">Home</a></li>
95 <li class="selected"><a href="#">SPARQL</a></li>
[27984]96 <li><a href="examples.php">Examples</a></li>
[27679]97 <li><a href="contact.php">Contact</a></li>
98 </ul>
99 </div>
100
101 <div id="content-container">
102
103 <div id="content">
104
[27693]105 <p>
106 RDF Query:
107 </p>
[27679]108
[27693]109<!--
110 action="<?php echo htmlspecialchars($repo->getSparqlEndpoint()); ?>" method="post"
111-->
[27679]112
[27693]113 <form onsubmit="return onSubmit()">
114
115 <textarea name="query" id="rdf-query"
116 style="width: 97%; margin-left: 10px; margin-right: 20px;" rows="8">
117PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
118PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
[27984]119PREFIX mo: <http://purl.org/ontology/mo/>
120PREFIX salami: <http://nema.lis.illinois.edu/salamiEndpoint/>
[27693]121
[27679]122SELECT * WHERE {
[27984]123 ?s ?p ?o.
124}
[27693]125 </textarea>
126 <br/>
[27679]127
[27693]128 <span style="margin: 5px 20px 5px 20px;">
129 Output type:
[27745]130 <select name="output" id="rdf-output">
[27693]131 <option>xml</option>
132 <option>json</option>
133 <option>text</option>
134 </select>
135 </span>
[27679]136
[27693]137 <span style="margin: 5px 20px 5px 20px;">
138 Maximum results returned:
[27984]139 <select name="soft-limit" id="rdf-soft-limit">
[27693]140 <option>10</option>
141 <option>100</option>
142 <option>1000</option>
[27984]143 <option>10000</option>
144 <option>50000</option>
[27693]145 </select>
146 </span>
[27679]147
[27693]148 <span style="margin: 5px 40px 5px 40px;">
149 <input type="submit" value="Execute">
150 </span>
[27679]151
[27693]152 <span style="margin: 5px 40px 5px 40px;">
153 <input type="reset">
154 </span>
155
156
[27679]157 </form>
158
159
[27693]160 <p>
161 RDF Results:
162 </p>
163 <textarea id="rdf-results"
[27943]164 style="width: 97%; margin-left: 10px; margin-right: 20px;" rows="16">
[27693]165 </textarea>
166
167 <p>
168 The <code>Accept</code> header you send is taken into account.
169 Various types of RDF are available, plus an HTML representation and
170 potentially the audio data (use <code>audio/*</code> to accept any
171 format of audio).
172 </p>
173
174
175 <p>
176 The machine-interfacable Sparql endpoint, which operates without
177 a limit on the number of tripples returned, is available at
178 <code><?php echo htmlspecialchars($repo->getSparqlEndpoint()); ?></code>.
179 </p>
180
181
182</div>
183
184
185 <div id="footer" style="border-top: 8px groove #7ECDF3;">
186 <table cellpadding="0px" cellspacing="0px" width="100%">
187 <tbody>
188 <tr style="background: white;">
189 <td align="center">
190 <a href="http://www.sshrc-crsh.gc.ca/Default.aspx">
191 <img width="400px" src="images/sshrc_logo.jpeg">
192 </a>
193 </td>
194 <td align="center">
195 <a href="http://www.nsf.gov/index.jsp">
196 <img width="100px" src="images/nsf_logo.jpeg">
197 </a>
198 </td>
199 <td align="center">
200 <a href="http://www.jisc.ac.uk/">
201 <img height="100px" src="images//jisc_logo.jpeg">
202 </a>
203 </td>
204 </tr>
205 </tbody>
206 </table>
207
208 </div>
209
210 </div>
[27679]211 </body>
212</html>
Note: See TracBrowser for help on using the repository browser.