2010-01-29 22:13:57 +00:00
|
|
|
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
|
|
|
|
|
|
|
|
<%@page import="com.hp.hpl.jena.rdf.model.ModelMaker"%>
|
|
|
|
<%@page import="java.util.Iterator"%>
|
2010-04-02 18:40:24 +00:00
|
|
|
<%@page import="java.util.ArrayList"%>
|
|
|
|
<%@page import="java.util.List"%>
|
2010-01-29 22:13:57 +00:00
|
|
|
|
2011-04-27 20:20:25 +00:00
|
|
|
<%@taglib prefix="vitro" uri="/WEB-INF/tlds/VitroUtils.tld" %>
|
2011-12-21 23:02:31 +00:00
|
|
|
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission" %>
|
2012-03-22 17:40:21 +00:00
|
|
|
<% request.setAttribute("requestedActions", SimplePermission.USE_SPARQL_QUERY_PAGE.ACTION); %>
|
2011-04-27 20:20:25 +00:00
|
|
|
<vitro:confirmAuthorization />
|
2011-04-15 22:01:08 +00:00
|
|
|
|
2010-01-29 22:13:57 +00:00
|
|
|
<body>
|
|
|
|
<div id="content" class="sparqlform">
|
2010-12-22 17:33:20 +00:00
|
|
|
<h2>SPARQL Query</h2>
|
2011-11-22 17:36:47 +00:00
|
|
|
<form action='sparqlquery' method="get">
|
2011-01-19 15:08:13 +00:00
|
|
|
<h3>Query:</h3>
|
2010-01-29 22:13:57 +00:00
|
|
|
<div>
|
2010-12-22 17:33:20 +00:00
|
|
|
<textarea name='query' rows ='30' cols='100' class="span-23 maxWidth">
|
2010-01-29 22:13:57 +00:00
|
|
|
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
|
|
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
|
|
|
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
|
|
|
|
PREFIX owl: <http://www.w3.org/2002/07/owl#>
|
|
|
|
PREFIX swrl: <http://www.w3.org/2003/11/swrl#>
|
2010-04-08 15:46:39 +00:00
|
|
|
PREFIX swrlb: <http://www.w3.org/2003/11/swrlb#>
|
|
|
|
PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#><%List prefixes = (List)request.getAttribute("prefixList");
|
2010-04-02 18:40:24 +00:00
|
|
|
if(prefixes != null){
|
|
|
|
Iterator prefixItr = prefixes.iterator();
|
|
|
|
Integer count = 0;
|
|
|
|
while (prefixItr.hasNext()){
|
|
|
|
String prefixText = (String) prefixItr.next();
|
|
|
|
if(prefixText.equals("(not yet specified)")){
|
|
|
|
count++;
|
2011-02-09 19:51:36 +00:00
|
|
|
prefixText = "p." + count.toString();
|
2010-04-02 18:40:24 +00:00
|
|
|
}
|
2010-04-05 15:27:49 +00:00
|
|
|
String urlText = (String) prefixItr.next();%>
|
|
|
|
PREFIX <%=prefixText%>: <<%=urlText%>><%}}%>
|
|
|
|
|
2010-01-29 22:13:57 +00:00
|
|
|
#
|
2010-04-02 18:40:24 +00:00
|
|
|
# This example query gets 20 geographic locations
|
|
|
|
# and (if available) their labels
|
2010-01-29 22:13:57 +00:00
|
|
|
#
|
2010-04-02 18:40:24 +00:00
|
|
|
SELECT ?geoLocation ?label
|
|
|
|
WHERE
|
2010-01-29 22:13:57 +00:00
|
|
|
{
|
2011-11-22 17:36:47 +00:00
|
|
|
?geoLocation rdf:type vivo:GeographicLocation
|
2011-02-09 19:51:36 +00:00
|
|
|
OPTIONAL { ?geoLocation rdfs:label ?label }
|
2010-01-29 22:13:57 +00:00
|
|
|
}
|
2010-04-02 18:40:24 +00:00
|
|
|
LIMIT 20
|
2010-01-29 22:13:57 +00:00
|
|
|
</textarea>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>
|
2011-01-19 15:08:13 +00:00
|
|
|
<h3>Format for SELECT query results:</h3>
|
|
|
|
<input id='RS_XML_BUTTON' type='radio' name='resultFormat' value='RS_XML'> <label for='RS_XML_BUTTON'>RS_XML</label>
|
|
|
|
<input id='RS_TEXT_BUTTON' type='radio' name='resultFormat' value='RS_TEXT' checked='checked'> <label for='RS_TEXT_BUTTON'>RS_TEXT</label>
|
|
|
|
<input id='RS_CSV_BUTTON' type='radio' name='resultFormat' value='vitro:csv'> <label for='RS_CSV_BUTTON'>CSV</label>
|
|
|
|
<input id='RS_JSON_BUTTON' type='radio' name='resultFormat' value='RS_JSON'> <label for='RS_JSON_BUTTON'>RS_JSON</label>
|
|
|
|
<input id='RS_RDF_BUTTON' type='radio' name='resultFormat' value='RS_RDF'> <label for='RS_RDF_BUTTON'>RS_RDF</label>
|
|
|
|
</div>
|
2010-01-29 22:13:57 +00:00
|
|
|
|
2011-01-19 15:08:13 +00:00
|
|
|
<div>
|
|
|
|
<h3>Format for CONSTRUCT and DESCRIBE query results:</h3>
|
|
|
|
<input id='RR_RDFXML_BUTTON' type='radio' name='rdfResultFormat' value='RDF/XML'> <label for='RR_RDFXML_BUTTON'>RDF/XML</label>
|
|
|
|
<input id='RR_RDFXMLABBREV_BUTTON' type='radio' name='rdfResultFormat' value='RDF/XML-ABBREV' checked='checked'> <label for='RR_RDFXMLABBREV_BUTTON'>RDF/XML-ABBREV</label>
|
|
|
|
<input id='RR_N3_BUTTON' type='radio' name='rdfResultFormat' value='N3'> <label for='RR_N3_BUTTON'>N3</label>
|
|
|
|
<input id='RR_NTRIPLE_BUTTON' type='radio' name='rdfResultFormat' value='N-TRIPLE'> <label for='RR_NTRIPLE_BUTTON'>N-Triples</label>
|
|
|
|
<input id='RR_TURTLE_BUTTON' type='radio' name='rdfResultFormat' value='TTL'> <label for='RR_TURTLE_BUTTON'>Turtle</label>
|
|
|
|
</div>
|
2010-01-29 22:13:57 +00:00
|
|
|
|
2011-02-02 17:15:05 +00:00
|
|
|
<input class="submit" type="submit" value="Run Query" />
|
2010-01-29 22:13:57 +00:00
|
|
|
</form>
|
|
|
|
<%--
|
|
|
|
<h4>Notes</h4>
|
|
|
|
<p>CONSTRUCT and DESCRIBE queries always return RDF XML</p>
|
|
|
|
<p>The parameter 'resultFormat' must not be null or zero length</p>
|
|
|
|
<p>The parameter 'resultFormat' must be one of the following: <ul>
|
|
|
|
<li>RS_XML</li>
|
|
|
|
<li>RS_TEXT</li>
|
|
|
|
<li>RS_RDF/N3</li>
|
|
|
|
<li>RS_JSON</li>
|
|
|
|
<li>RS_RDF</li>
|
|
|
|
</ul>
|
|
|
|
</p>
|
|
|
|
--%>
|
|
|
|
</div><!-- content -->
|
|
|
|
</body></html>
|
|
|
|
|