Manta Developers
GitHub
Menu

SPARQL

Read a datastore with a SPARQL query.

What it is

Read the knowledge graph by posting a SPARQL query to the datastore endpoint, /d/<datastore>/sparql. The endpoint accepts read queries only. A write, such as INSERT DATA, and a query that fails to parse are answered with a 403 and { "error": "…" }.

Import

There is no package import. Call the endpoint with curl:

curl https://app.hiremanta.com/d/your-datastore/sparql \
  -H "Authorization: Bearer $MANTA_TOKEN" \
  -H "Content-Type: application/sparql-query" \
  -H "Accept: application/sparql-results+json" \
  --data 'SELECT ?s WHERE { ?s a ?type } LIMIT 10'

Example

SELECT ?s WHERE { ?s a ?type } LIMIT 10

Request

POST /d/<datastore>/sparql with these headers:

  • Authorization: Bearer <access token>
  • Content-Type: application/sparql-query
  • Accept: application/sparql-results+json

The body is the query text. The endpoint is read-only.

Response

A read query returns SPARQL results JSON. head.vars lists the selected variables, and results.bindings holds one object per row:

{
  "head": { "vars": ["s"] },
  "results": {
    "bindings": [
      {
        "s": { "type": "uri", "value": "https://example.org/resource/1" }
      }
    ]
  }
}

Writes and queries that fail to parse are rejected with 403 and { "error": "…" }.