Implements a SPARQL Protocol server for ASP.NET.
|
This class implements the System.Web.IHttpHandler interface to provide a SPARQL Protocol query server over HTTP.
To activate the SPARQL server in your ASP.NET site, place the SemWeb.dll, SemWeb.Sparql.dll, and sparql-core.dll assemblies in the bin directory of your ASP.NET application. Then add the following to your web.config file. Note that you must specify a spec string to a data source to serve, as described in SemWeb.Store.CreateForInput(string).
| Example |
<configuration>
<configSections>
<section name="sparqlSources" type="System.Configuration.NameValueSectionHandler,System"/>
</configSections>
<system.web>
<httpHandlers>
<!-- This line associates the SPARQL Protocol implementation with a path on your
website. With this, you get a SPARQL server at http://yourdomain.com/sparql. -->
<add verb="*" path="sparql" type="SemWeb.Query.SparqlProtocolServerHandler, SemWeb.Sparql" />
</httpHandlers>
</system.web>
<sparqlSources>
<!-- This line configures the data source associated with each SPARQL server added above.
This sets the server to query the RDF/XML file at the given path. You can use any
spec string described in SemWeb.Store.CreateForInput(). -->
<add key="/sparql" value="xml:/home/user/datafile.rdf"/>
</sparqlSources>
</configuration>
|
Precede the data source specification string with "rdfs+" to wrap the data source with the SemWeb.Inference.RDFS reasoning engine. And precede that with "noreuse," to create a new instance of the data source on each request, which is good for SQL-backed stores to allow for concurrent queries, but bad for file-backed stores which would be read from disk on each request. For instance:
| Example |
<add key="/sparql" value="noreuse,rdfs+mysql:rdftable:Database=databasename;Server=localhost;User Id=username"/> |
Using Mono's XSP light-weight web server, you can create a standalone SPARQL Protocol server by:
You may want to add this index.html file to create a form to experiment with SPARQL queries:
| Example |
<html>
<body>
<form action="/sparql" method="get">
<input type="hidden" name="outputMimeType" value="text/xml"/>
<textarea name="query" rows="10" cols="80">
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX pol: <tag:govshare.info,2005:rdf/politico/>
SELECT * WHERE {
?s rdf:type pol:Politician .
?s foaf:gender "male" .
?s foaf:name ?name .
}
LIMIT 10
</textarea>
<p><input type="submit"/></p>
</form>
</body>
</html>
|
See Also: Inherited members from object.
| Creates a new SPARQL Protocol implementation class. |
|
MaximumLimit
|
int . The maximum number of bindings to return for any query. |
|
ProcessRequest
(System.Web.HttpContext) Processes an HTTP request from the ASP.NET subsystem. |
|
CreateQuery
(string) Constructs a Query object for a SPARQL query. |
|
|
GetDataSource
(out bool) Gets the data source to query. |
|
|
RunQuery
(Query, SemWeb.SelectableSource, System.IO.TextWriter) Runs a query. |
Creates a new SPARQL Protocol implementation class.
The maximum number of bindings to return for any query.
Processes an HTTP request from the ASP.NET subsystem.
Constructs a Query object for a SPARQL query.
Runs a query.
Gets the data source to query.