SPARQL Endpoints
Tentris implements the SPARQL 1.1 Protocol and the SPARQL 1.1 Graph Store HTTP Protocol. It makes the following endpoints available.
-
The
/sparqlendpoint accepts the read operations defined in SPARQL 1.1 Query Language (SELECT,ASK,CONSTRUCTandDESCRIBE). -
The
/streamendpoint also accepts read operations. This endpoint is optimized for large responses, uses less RAM, and its response size is not limited. It should not be used with queries using the (non-silent)SERVICEgraph pattern (SPARQL 1.1 Federated Query). This is due to a fundamental limitation in HTTP streaming, which does not allow responses to report errors that may occur after the streaming of results has started. -
The
/updateendpoint accepts write operations defined in SPARQL 1.1 Update (e.g.,DELETE,INSERT, andLOAD). -
The
/graph-storeendpoint accepts graph store operations (e.g.,GET,POST,PUT, andDELETE).
Tentris supports the following response formats for read operations.
- SPARQL JSON (Content-Type:
application/sparql-results+json), forSELECTandASKqueries - SPARQL XML (Content-Type:
application/sparql-results+xml), forSELECTandASKqueries - SPARQL CSV (Content-Type:
text/csv), forSELECTqueries - SPARQL TSV (Content-Type:
text/tab-separated-values), forSELECTqueries - RDF N-Triples (Content-Type:
application/n-triples), forCONSTRUCTandDESCRIBEqueries - RDF Turtle (Content-Type:
text/turtle), forCONSTRUCTandDESCRIBEqueries
Usage Examples
/sparql
Count all triples in the default graph.
curl -H "Content-Type: application/sparql-query" \
--data "SELECT (COUNT(*) AS ?c) WHERE { ?s ?p ?o }" "http://localhost:9080/sparql"
/stream
Select all triples in the default graph.
curl -H "Content-Type: application/sparql-query" \
--data "SELECT * WHERE { ?s ?p ?o }" "http://localhost:9080/stream"
/update
Add the triple <s> <p> <o> to the default graph.
curl -H "Content-Type: application/sparql-update" \
--data "INSERT DATA { <s> <p> <o> }" "http://localhost:9080/update"
To override the default LOAD strictness (default-online-update-mode) specified in the configuration,
use the mode parameter (the options are strict and lax). The mode parameter goes where the graph specification goes.
curl -H "Content-Type: application/sparql-update" \
--data "LOAD <https://example.com/triples.nt>" \
"http://localhost:9080/update?mode=lax"
/graph-store
GET
Retrieve the contents of the default graph as Turtle.
curl -H "Accept: text/turtle" "http://localhost:9080/graph-store?default"
POST
Insert additional data into the default graph.
curl -H "Content-Type: text/turtle" -X POST -T data.ttl \
"http://localhost:9080/graph-store?default"
To stream data generated by a command to Tentris, use curl's -T - option.
zstdcat compressed.ttl.zst | curl -H "Content-Type: text/turtle" -X POST -T - \
"http://localhost:9080/graph-store?default"
To override the default graph-store-protocol strictness (default-online-update-mode) specified in the configuration,
use the mode parameter (the options are strict and lax).
curl -H "Content-Type: text/turtle" -X POST -T data.ttl \
"http://localhost:9080/graph-store?default&mode=lax"
PUT
Replace the data in the default graph with other data.
curl -H "Content-Type: text/turtle" -X PUT -T data.ttl \
"http://localhost:9080/graph-store?default"
Streaming data generated by a command to Tentris and overriding the default graph-store-protocol strictness work the same way as for POST.
DELETE
Delete the contents of the default graph.
curl -X DELETE "http://localhost:9080/graph-store?default"