SPARQL is a flexible query language for extracting data from RDF data stores. Kasabi supports provision of a fully-compliant SPARQL 1.1 endpoint against hosted datasets.

Overview

The SPARQL Endpoints exposed by Kasabi all conform to the SPARQL HTTP protocol. This specifies that queries are submitted to a SPARQL endpoint via a query parameter, as follows:

http://api.kasabi.com/dataset/nasa/apis/sparql?apikey=...&query=...

The SPARQL query should conform to the SPARQL 1.1 query language. The value for the query parameter should be URL encoded before constructing the request URL

Response formats from the endpoint will depend on the type of query being submitted. SPARQL supports 4 forms of query. Two of these (SELECT and ASK) can be returned in standard XML and JSON formats. The remaining two (CONSTRUCT and DESCRIBE) can be returned in any of the available RDF serializations supported by Kasabi: RDF/XML, RDF/JSON, Turtle, and Ntriples.

Further Reading

Quick Examples

Basic API Reference

Endpoint URL

The exact URI of the SPARQL API will be displayed on the homepage for the API itself. But will have the form:

http://api.kasabi.com/dataset/[dataset]/apis/sparql?[parameters]

Authentication

Accessing the API will require your API key. For more information on Kasabi authentication options read the authentication documentation.

Your API key is shown on your dashboard

Parameters

query (required)

As defined in the SPARQL HTTP Protocol, all SPARQL endpoints accept a query parameter whose value is a url-encoded SPARQL query.

output (optional)

An optional parameter to choose the response format. These formats can be requested using the usual content negotiation options.

HTTP Response Codes

Clients should be prepared to receive any valid HTTP response code. The following table lists the most frequently used codes

Code Meaning
200 Success Request has been successful
400 Bad Request Invalid data, missing or invalid parameters
401 Not Authorized API key is not authorized to access the data
403 Forbidden Your API key has not been given in the request

Please also review our additional notes on response codes and error reporting.

Response Formats

Responses are a available in a range of different formats. The specific formats available depend on the type of SPARQL query being executed. SPARQL defines four different types of query: CONSTRUCT, DESCRIBE, SELECT and ASK.

CONSTRUCT and DESCRIBE queries both return RDF graphs and so the usual range of RDF serializations are available, including RDF/XML, RDF/JSON, Turtle and Ntriples.

SELECT queries return a tabular result set, while ASK queries return a boolean value. Results from both of these query types can be returned in either SPARQL XML Results Format or SPARQL JSON Results Format.

These formats can be requested using the usual content negotiation options.