Sign inSign up

semmtech/sparql-api

By semmtech

Updated over 3 years ago

Simple API for managing SPARQL queries.

Image
0

286

semmtech/sparql-api repository overview

Disclaimer

This image was developed for assessment purposes only! Do not use it for production environments!

Usage

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.

API Definition

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.

NameDescriptionTypeExample
id
required
ID of query (URL-friendly characters)string"all-statements"
creator
required
Creator of the querystring"Mike Henrichs"
name
required
Short name for querystring"Select All"
description
optional
Description of the querystring"This query returns the all statements."
query
required
Creator of querystring"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:

MethodPathDescription
GET/api/sparql/queriesReturns all SPARQL queries in JSON (see Definition).
POST/api/sparql/queriesCreates 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).

API keys

For testing purposes the following keys can be used:

  • 19d8103e-bcf6-4b3a-85d3-b3d8be1733f3
  • 91d6a642-6406-49bd-ae12-447e11194d61
  • cce7f366-cfb7-4dd9-bf50-64535e4ff971
  • ce5b9728-5915-468f-b49b-220a516dba28
  • 63e37753-2a34-4ba8-8c96-43f6a11ff89a

Tag summary

Content type

Image

Digest

sha256:d36fc7b78

Size

174.9 MB

Last updated

over 3 years ago

docker pull semmtech/sparql-api