Simple API for managing SPARQL queries.
286
This image was developed for assessment purposes only! Do not use it for production environments!
Simple run the following command to start the API:
docker run -p 8082:8082 semmtech/sparql-api:latest
This should start-up the SPARQL API at http://localhost:8082/api. For more information, see below.
The following table defines the format of a SPARQL Query (JSON) object. You will need to provide this object when creating or modifying queries, or receive it when retrieving queries through the GET operations.
| Name | Description | Type | Example |
|---|---|---|---|
| id required | ID of query (URL-friendly characters) | string | "all-statements" |
| creator required | Creator of the query | string | "Mike Henrichs" |
| name required | Short name for query | string | "Select All" |
| description optional | Description of the query | string | "This query returns the all statements." |
| query required | Creator of query | string | "select ?s ?p ?o { ?s ?p ?o . }" |
Note that the ID must be unique, and that it will also be used in the URL path to retrieve the query later (see Paths), so only use do not use exotic characters, as this will cause problems in the URLs!
The back-end API provides the following five services:
| Method | Path | Description |
|---|---|---|
| GET | /api/sparql/queries | Returns all SPARQL queries in JSON (see Definition). |
| POST | /api/sparql/queries | Creates a new SPARQL query using provided JSON in body. The header 'Content-Type' of request should therefor be set to application/json.The full URI at which the query is available will be returned in the 'Location' header in the response. |
| GET | /api/sparql/queries/{id:[^\/#?]+} | Returns the SPARQL query associated with id |
| PUT | /api/sparql/queries/{id:[^\/#?]+} | Modifies the SPARQL query associated with id using provided JSON in body.The header 'Content-Type' of request should therefor be set to application/json. |
| DELETE | /api/sparql/queries/{id:[^\/#?]+} | Removes the SPARQL query associated with id |
In some of the services above, the path contains a segment{id:[^\/#?]+}, which is used to identify a single query to either retrieve, modify or remove. As stated above it must be a string of minimally one character, which does not contain one of the following characters: /, #, or ?.
All calls listed in the table should be accompanied by a querystring parameter ?api_key={your-api-key} which is needed to authenticate your request. This key will be provided to you before starting with this challenge.
Example: In order to delete the query which has as its ID all-statements, you should do a DELETE request on the following URL (assuming you started the API on port 8082) http://localhost:8082/api/sparql/queries/all-statements?api_key=my-key (my-key is the API key provided to you).
For testing purposes the following keys can be used:
Content type
Image
Digest
sha256:d36fc7b78…
Size
174.9 MB
Last updated
over 3 years ago
docker pull semmtech/sparql-api