LiUSemWeb / HeFQUIN

HeFQUIN is a query federation engine for heterogeneous federations of graph data sources, including federations of knowledge graphs.
https://liusemweb.github.io/HeFQUIN/
Apache License 2.0
19 stars 3 forks source link

add a basic web service #332

Closed keski closed 3 months ago

keski commented 5 months ago

Currently, HeFEQUIN provides no easy way of running a service that allows queries to be issued from the web. This issue is about creating a basic server implementation that provides REST-based API based on the SPARQL protocol over HTTP. The service should include the following: 1) an endpoint that accepts SPARQL queries over HTTP and returns results back to the client, and 2) the federation query engine (HeFEQUIN) configured when the service starts up (i.e., users should not provide their own federation descriptions).

The following REST API should be supported in the initial version of the service:

POST/sparql (execute a SPARQL query) ##### Parameters > | name | type | data type | description | > |-----------|-----------|-------------------------|-----------------------------------------------------------------------| > | query | required | string | The SPARQL query string | > | format | required | string | The desired response format (e.g., JSON, XML, CSV) | ##### Responses > | http code | content-type | response | > |---------------|-----------------------------------|---------------------------------------------------------------------| > | 200 | application/sparql-results+json | The query results in JSON format | > | 200 | application/sparql-results+xml | The query results in XML format | > | 200 | text/csv | The query results in CSV format | > | 200 | text/tsv | The query results in TSV format | > | 415 | application/json | {"code":"415", "message":"Unsupported Media Type"} | ##### Example cURL > ```bash > curl -X POST -H "Content-Type: application/x-www-form-urlencoded" --data "query=SELECT+*+WHERE+%7B+%3Fs+%3Fp+%3Fo+%7D" http://localhost:3331/sparql > ```
GET/sparql (execute a SPARQL query via URL parameters) ##### Parameters > | name | type | data type | description | > |-----------|-----------|-------------------------|-----------------------------------------------------------------------| > | query | required | string | The SPARQL query string | > | format | required | string | The desired response format (e.g., JSON, XML, CSV) | ##### Responses > | http code | content-type | response | > |---------------|-----------------------------------|---------------------------------------------------------------------| > | 200 | application/sparql-results+json | The query results in JSON format | > | 200 | application/sparql-results+xml | The query results in XML format | > | 200 | text/csv | The query results in CSV format | > | 200 | text/tsv | The query results in TSV format | > | 415 | application/json | {"code":"415","message":"Unsupported Media Type"} | ##### Example cURL > ```bash > curl -G -H "Accept: application/sparql-results+json" --data-urlencode "query=SELECT * WHERE { ?s ?p ?o }" http://localhost:3331/sparql > ```