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

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

Next round of changes after fruther testing and extra example development

File size: 4.6 KB
Line 
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
11 <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Pacifico">
12
13 <link rel="stylesheet" href="css/core-style.css" type="text/css" media="screen" />
14
15
16 <title>SALAMI SPARQL Endpoint</title>
17
18 <script src="js/jquery-1.10.1.js" > </script>
19
20 <script>
21
22
23 function onSubmit() {
24
25 $.ajax({
26 type: "GET",
27
28 /*
29 beforeSend: function (request) {
30 //request.setRequestHeader("Authority", authorizationToken);
31 //request.setRequestHeader("origin", "http://nema.lis.illinois.edu");
32 },
33 */
34
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,
38
39
40 /*
41 xhrFields: {
42 withCredentials: true
43 },
44 crossDomain: true,
45 */
46
47 // accepts: "text/plain",
48 //converters: {},
49 dataType: "text",
50
51 success: function(msg) {
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) {
61 //alert(err.toString());
62 //if (err.status == 200) {
63 // ParseResult(err);
64 //}
65 //else { }
66
67 alert('Error:' + err.responseText + ' Status: ' + err.status);
68 }
69
70 });
71
72
73 return false;
74
75 }
76
77
78 </script>
79
80 </head>
81
82 <body>
83 <div id="container">
84
85 <div id="header">
86<!--
87 <h1>The SALAMI SPARQL Endpoint</h1>
88-->
89 <h1>The Salami SPARQL Endpoint</h1>
90 </div>
91
92 <div id="navigation">
93 <ul>
94 <li><a href="index.php">Home</a></li>
95 <li class="selected"><a href="#">SPARQL</a></li>
96 <li><a href="examples.php">Examples</a></li>
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
105 <p>
106 RDF Query:
107 </p>
108
109<!--
110 action="<?php echo htmlspecialchars($repo->getSparqlEndpoint()); ?>" method="post"
111-->
112
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;
119PREFIX mo: <http://purl.org/ontology/mo/>
120PREFIX salami: <http://nema.lis.illinois.edu/salamiEndpoint/>
121
122SELECT * WHERE {
123 ?s ?p ?o.
124}
125 </textarea>
126 <br/>
127
128 <span style="margin: 5px 20px 5px 20px;">
129 Output type:
130 <select name="output" id="rdf-output">
131 <option>xml</option>
132 <option>json</option>
133 <option>text</option>
134 </select>
135 </span>
136
137 <span style="margin: 5px 20px 5px 20px;">
138 Maximum results returned:
139 <select name="soft-limit" id="rdf-soft-limit">
140 <option>10</option>
141 <option>100</option>
142 <option>1000</option>
143 <option>10000</option>
144 <option>50000</option>
145 </select>
146 </span>
147
148 <span style="margin: 5px 40px 5px 40px;">
149 <input type="submit" value="Execute">
150 </span>
151
152 <span style="margin: 5px 40px 5px 40px;">
153 <input type="reset">
154 </span>
155
156
157 </form>
158
159
160 <p>
161 RDF Results:
162 </p>
163 <textarea id="rdf-results"
164 style="width: 97%; margin-left: 10px; margin-right: 20px;" rows="16">
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>
211 </body>
212</html>
Note: See TracBrowser for help on using the repository browser.