HTTP Web Services Based on the SPARQL Endpoint
HTTP Web Services Based on the SPARQL Endpoint
In this section we show how to use PoolParty's SPARQL endpoint as http web service. You should read the section about the SPARQL endpoint before you read this chapter.
Getting Started
Thesaurus data can be accessed via the SPARQL endpoint by simply posting queries to the endpoint URL via a HTTP POST or HTTP GET.
These are the steps necessary to retrieve the data:
Formulate a SPARQL query
Execute an HTTP GET request with request parameters:
query
: your SPARQL query (UTF-8) URL-encodedformat
: your desired return format, for example:application/xml
,application/json
Use the header to describe the format of the mime type of the request body:
content-type:
application/x-www-form-urlencoded
Provide authentication information when needed.
Parse the SPARQL results in your application code using one of the Available SPARQL Clients
Example Request Using curl
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -H "Accept: text/html" -d 'format=application/json&query=PREFIX skos:<http://www.w3.org/2004/02/skos/core#> SELECT ?n ?prefLabel WHERE { <http://reegle.info/glossary/246> skos:narrower ?n . ?n skos:prefLabel ?prefLabel . }limit 100' http://vocabulary.semantic-web.at/PoolParty/sparql/glossary
Example
Screenshot of a query performed via browser based REST Console:
Note
In the chapter Examples for Thesaurus Services you can find several query templates which can be used and adapted to fit your needs.