Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 /sparql endpoint accepts the read operations defined in SPARQL 1.1 Query Language (SELECT, ASK, CONSTRUCT and DESCRIBE).

  • The /stream endpoint 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) SERVICE graph 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 /update endpoint accepts write operations defined in SPARQL 1.1 Update (e.g., DELETE, INSERT, and LOAD).

  • The /graph-store endpoint accepts graph store operations (e.g., GET, POST, PUT, and DELETE).

Tentris supports the following response formats for read operations.

  • SPARQL JSON (Content-Type: application/sparql-results+json), for SELECT and ASK queries
  • SPARQL XML (Content-Type: application/sparql-results+xml), for SELECT and ASK queries
  • SPARQL CSV (Content-Type: text/csv), for SELECT queries
  • SPARQL TSV (Content-Type: text/tab-separated-values), for SELECT queries
  • RDF N-Triples (Content-Type: application/n-triples), for CONSTRUCT and DESCRIBE queries
  • RDF Turtle (Content-Type: text/turtle), for CONSTRUCT and DESCRIBE queries

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"

/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"

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"

DELETE

Delete the contents of the default graph.

curl -X DELETE "http://localhost:9080/graph-store?default"