Stardog Reasoning API
Operations for interacting with the inference engine
Operations for interacting with the inference engine
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/stardog-reasoning-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Stardog HTTP Reasoning API
description: '# Overview
Stardog supports the standard SPARQL Protocol HTTP bindings, as well as additional functionality via HTTP.'
contact:
url: https://stardog.com
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0
version: 12.0.3
x-logo:
url: https://d33wubrfki0l68.cloudfront.net/66e9dcff51317cfc11b9f3d4ce2917a11ba81681/543c1/img/stardog-logo-optimized.svg
servers:
- url: http://localhost:5820
tags:
- name: Reasoning
description: Operations for interacting with the inference engine
paths:
/{db}/reasoning/{txid}/explain:
post:
tags:
- Reasoning
summary: Explain inference in transaction
description: Explain how the inference engine inferred a specific piece of data
operationId: explainInferenceInTx
parameters:
- name: db
$ref: '#/components/parameters/db'
- name: txid
$ref: '#/components/parameters/txid'
requestBody:
description: The axiom to explain
content:
text/turtle:
schema:
type: String
examples:
REASONING_AXIOM_TTL:
description: REASONING_AXIOM_TTL
value: null
$ref: '#/components/examples/REASONING_AXIOM_TTL'
application/trig:
schema:
type: String
examples:
REASONING_AXIOM_TTL:
description: REASONING_AXIOM_TTL
value: null
$ref: '#/components/examples/REASONING_AXIOM_TTL'
application/rdf+xml:
schema:
type: String
examples:
REASONING_AXIOM_RDFXML:
description: REASONING_AXIOM_RDFXML
value: null
$ref: '#/components/examples/REASONING_AXIOM_RDFXML'
application/n-triples:
schema:
type: String
examples:
REASONING_AXIOM_TTL:
description: REASONING_AXIOM_TTL
value: null
$ref: '#/components/examples/REASONING_AXIOM_TTL'
application/n-quads:
schema:
type: String
examples:
REASONING_AXIOM_TTL:
description: REASONING_AXIOM_TTL
value: null
$ref: '#/components/examples/REASONING_AXIOM_TTL'
application/ld+json:
schema:
$ref: '#/components/schemas/GENERIC_JSONLD'
examples:
REASONING_AXIOM_JSONLD:
description: REASONING_AXIOM_JSONLD
value: null
$ref: '#/components/examples/REASONING_AXIOM_JSONLD'
required: true
responses:
'200':
$ref: '#/components/responses/REASONING_PROOF_LIST'
'404':
description: Database/Transaction does not exist
content:
application/json:
schema:
required:
- message
- code
properties:
message:
type: string
example: Database does not exist
code:
type: string
example: 0D0DU2
/{db}/reasoning/explain/inconsistency:
get:
tags:
- Reasoning
summary: Explain inconsistency
description: Explain how, if at all, the data are inconsistent with respect to the ontology
operationId: explainInconsistency
parameters:
- name: db
$ref: '#/components/parameters/db'
responses:
'200':
$ref: '#/components/responses/REASONING_PROOF_LIST'
'404':
description: Database does not exist
content:
application/json:
schema:
required:
- message
- code
properties:
message:
type: string
example: Database does not exist
code:
type: string
example: 0D0DU2
/{db}/query/reasoning:
get:
tags:
- Reasoning
summary: Perform SPARQL query with reasoning enabled
operationId: queryGetWithReasoning
parameters:
- name: db
$ref: '#/components/parameters/db'
- $ref: '#/components/parameters/query'
responses:
'200':
description: Query results
content:
application/sparql-results+xml:
schema:
type: String
examples:
SPARQL_RESULTS_XML:
description: SPARQL_RESULTS_XML
value: null
$ref: '#/components/examples/SPARQL_RESULTS_XML'
application/sparql-results+json:
schema:
$ref: '#/components/schemas/SPARQL_RESULTS_JSON'
text/csv:
schema:
type: String
examples:
SPARQL_RESULTS_CSV:
description: SPARQL_RESULTS_CSV
value: null
$ref: '#/components/examples/SPARQL_RESULTS_CSV'
text/tsv:
schema:
type: String
examples:
SPARQL_RESULTS_TSV:
description: SPARQL_RESULTS_TSV
value: null
$ref: '#/components/examples/SPARQL_RESULTS_TSV'
text/turtle:
schema:
type: String
examples:
GENERIC_TURTLE:
description: GENERIC_TURTLE
value: null
$ref: '#/components/examples/GENERIC_TURTLE'
application/trig:
schema:
type: String
examples:
GENERIC_TRIG:
description: GENERIC_TRIG
value: null
$ref: '#/components/examples/GENERIC_TRIG'
application/rdf+xml:
schema:
type: String
examples:
GENERIC_RDFXML:
description: GENERIC_RDFXML
value: null
$ref: '#/components/examples/GENERIC_RDFXML'
application/n-triples:
schema:
type: String
examples:
GENERIC_NTRIPLES:
description: GENERIC_NTRIPLES
value: null
$ref: '#/components/examples/GENERIC_NTRIPLES'
application/n-quads:
schema:
type: String
examples:
GENERIC_NQUADS:
description: GENERIC_NQUADS
value: null
$ref: '#/components/examples/GENERIC_NQUADS'
application/ld+json:
schema:
$ref: '#/components/schemas/GENERIC_JSONLD'
'400':
$ref: '#/components/responses/INVALID_QUERY'
'404':
description: Database does not exist
content:
application/json:
schema:
required:
- message
- code
properties:
message:
type: string
example: Database does not exist
code:
type: string
example: 0D0DU2
'406':
description: Accept header invalid for type of query sent
post:
tags:
- Reasoning
summary: Perform SPARQL query with reasoning enabled
operationId: queryPostWithReasoning
parameters:
- name: db
$ref: '#/components/parameters/db'
- $ref: '#/components/parameters/QUERY_NOT_REQ'
requestBody:
content:
application/sparql-query:
schema:
$ref: '#/components/schemas/SPARQL_QUERY'
examples:
SPARQL_QUERY:
description: SPARQL_QUERY
value: null
$ref: '#/components/examples/SPARQL_QUERY'
multipart/form-data:
schema:
$ref: '#/components/schemas/SPARQL_QUERY'
responses:
'200':
description: Query results
content:
application/sparql-results+xml:
schema:
type: String
examples:
SPARQL_RESULTS_XML:
description: SPARQL_RESULTS_XML
value: null
$ref: '#/components/examples/SPARQL_RESULTS_XML'
application/sparql-results+json:
schema:
$ref: '#/components/schemas/SPARQL_RESULTS_JSON'
text/csv:
schema:
type: String
examples:
SPARQL_RESULTS_CSV:
description: SPARQL_RESULTS_CSV
value: null
$ref: '#/components/examples/SPARQL_RESULTS_CSV'
text/tsv:
schema:
type: String
examples:
SPARQL_RESULTS_TSV:
description: SPARQL_RESULTS_TSV
value: null
$ref: '#/components/examples/SPARQL_RESULTS_TSV'
text/turtle:
schema:
type: String
examples:
GENERIC_TURTLE:
description: GENERIC_TURTLE
value: null
$ref: '#/components/examples/GENERIC_TURTLE'
application/trig:
schema:
type: String
examples:
GENERIC_TRIG:
description: GENERIC_TRIG
value: null
$ref: '#/components/examples/GENERIC_TRIG'
application/rdf+xml:
schema:
type: String
examples:
GENERIC_RDFXML:
description: GENERIC_RDFXML
value: null
$ref: '#/components/examples/GENERIC_RDFXML'
application/n-triples:
schema:
type: String
examples:
GENERIC_NTRIPLES:
description: GENERIC_NTRIPLES
value: null
$ref: '#/components/examples/GENERIC_NTRIPLES'
application/n-quads:
schema:
type: String
examples:
GENERIC_NQUADS:
description: GENERIC_NQUADS
value: null
$ref: '#/components/examples/GENERIC_NQUADS'
application/ld+json:
schema:
$ref: '#/components/schemas/GENERIC_JSONLD'
'400':
$ref: '#/components/responses/INVALID_QUERY'
'404':
description: Database does not exist
content:
application/json:
schema:
required:
- message
- code
properties:
message:
type: string
example: Database does not exist
code:
type: string
example: 0D0DU2
'406':
description: Accept header invalid for type of query sent
/{db}/reasoning/explain:
post:
tags:
- Reasoning
summary: Explain inference
description: Explain how the inference engine inferred a specific piece of data
operationId: explainInference
parameters:
- name: db
$ref: '#/components/parameters/db'
requestBody:
description: The axiom to explain
content:
text/turtle:
schema:
type: String
examples:
REASONING_AXIOM_TTL:
description: REASONING_AXIOM_TTL
value: null
$ref: '#/components/examples/REASONING_AXIOM_TTL'
application/trig:
schema:
type: String
examples:
REASONING_AXIOM_TTL:
description: REASONING_AXIOM_TTL
value: null
$ref: '#/components/examples/REASONING_AXIOM_TTL'
application/rdf+xml:
schema:
type: String
examples:
REASONING_AXIOM_RDFXML:
description: REASONING_AXIOM_RDFXML
value: null
$ref: '#/components/examples/REASONING_AXIOM_RDFXML'
application/n-triples:
schema:
type: String
examples:
REASONING_AXIOM_TTL:
description: REASONING_AXIOM_TTL
value: null
$ref: '#/components/examples/REASONING_AXIOM_TTL'
application/n-quads:
schema:
type: String
examples:
REASONING_AXIOM_TTL:
description: REASONING_AXIOM_TTL
value: null
$ref: '#/components/examples/REASONING_AXIOM_TTL'
application/ld+json:
schema:
type: String
examples:
REASONING_AXIOM_JSONLD:
description: REASONING_AXIOM_JSONLD
value: null
$ref: '#/components/examples/REASONING_AXIOM_JSONLD'
required: true
responses:
'200':
$ref: '#/components/responses/REASONING_PROOF_LIST'
'404':
description: Database does not exist
content:
application/json:
schema:
required:
- message
- code
properties:
message:
type: string
example: Database does not exist
code:
type: string
example: 0D0DU2
/{db}/reasoning/consistency:
get:
tags:
- Reasoning
summary: Check consistency
description: Returns whether or not the data in the database are consistent with respect to the ontology
operationId: isConsistent
parameters:
- name: db
$ref: '#/components/parameters/db'
responses:
'200':
description: Operation successful
content:
text/boolean: {}
application/json:
schema:
$ref: '#/components/schemas/CONSISTENT'
'404':
description: Database does not exist
content:
application/json:
schema:
required:
- message
- code
properties:
message:
type: string
example: Database does not exist
code:
type: string
example: 0D0DU2
/{db}/reasoning/schema:
get:
tags:
- Reasoning
summary: Get reasoning schema
description: Retrieve the reasoning schema in RDF of the given database
operationId: getReasoningSchema
parameters:
- name: db
$ref: '#/components/parameters/db'
responses:
'200':
description: Reasoning schema in RDF
content:
text/turtle:
schema:
type: String
examples:
GENERIC_TURTLE:
description: GENERIC_TURTLE
value: null
$ref: '#/components/examples/GENERIC_TURTLE'
application/trig:
schema:
type: String
examples:
GENERIC_TRIG:
description: GENERIC_TRIG
value: null
$ref: '#/components/examples/GENERIC_TRIG'
application/rdf+xml:
schema:
type: String
examples:
GENERIC_RDFXML:
description: GENERIC_RDFXML
value: null
$ref: '#/components/examples/GENERIC_RDFXML'
application/n-triples:
schema:
type: String
examples:
GENERIC_NTRIPLES:
description: GENERIC_NTRIPLES
value: null
$ref: '#/components/examples/GENERIC_NTRIPLES'
application/n-quads:
schema:
type: String
examples:
GENERIC_NQUADS:
description: GENERIC_NQUADS
value: null
$ref: '#/components/examples/GENERIC_NQUADS'
application/ld+json:
schema:
$ref: '#/components/schemas/GENERIC_JSONLD'
'404':
description: Database does not exist
content:
application/json:
schema:
required:
- message
- code
properties:
message:
type: string
example: Database does not exist
code:
type: string
example: 0D0DU2
/{db}/reasoning/{txid}/explain/inconsistency:
get:
tags:
- Reasoning
summary: Explain inconsistency in transaction
description: Explain how, if at all, the data are inconsistent with respect to the ontology
operationId: explainInconsistencyInTx
parameters:
- name: db
$ref: '#/components/parameters/db'
- name: txid
$ref: '#/components/parameters/txid'
responses:
'200':
$ref: '#/components/responses/REASONING_PROOF_LIST'
'404':
description: Database/Transaction does not exist
content:
application/json:
schema:
required:
- message
- code
properties:
message:
type: string
example: Database does not exist
code:
type: string
example: 0D0DU2
components:
schemas:
REASONING_PROOF:
properties:
status:
type: string
enum:
- INFERRED
- ASSERTED
- VIOLATED
expression:
type: string
children:
type: array
items:
$ref: '#/components/schemas/REASONING_PROOF'
namedGraphs:
type: array
items:
type: string
SPARQL_RESULTS_JSON:
required:
- head
- results
properties:
head:
required:
- vars
properties:
vars:
type: array
items:
type: string
results:
required:
- bindings
properties:
bindings:
type: array
items:
additionalProperties:
required:
- type
- value
properties:
type:
type: string
example: literal
value:
type: string
example: '42'
CONSISTENT:
required:
- consistent
properties:
consistent:
type: boolean
SPARQL_QUERY:
required:
- query
properties:
query:
type: string
example: "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX : <http://example.org/stardog#>\n \nSELECT ?s ?label WHERE {\n ?s a :Example ;\n rdfs:label ?label\n}"
update:
type: string
example: "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX : <http://example.org/stardog#>\n \nSELECT ?s ?label WHERE {\n ?s a :Example ;\n rdfs:label ?label\n}"
reasoning:
type: boolean
description: Enable Reasoning
schema:
type: string
description: The name of the reasoning schema to use. Will automatically enable reasoning even without the 'reasoning' parameter
txid:
type: string
format: uuid
example: 4ea1ebac-48f0-459c-a9a7-6cad7189403d
baseURI:
type: string
format: URI
timeout:
type: integer
description: The number of ms after which the query should timeout
format: int32
example: 42
limit:
type: integer
description: The maximum number of results to return
format: int32
example: 42
offset:
type: integer
description: How far into the result set to offset
format: int32
example: 42
useNamespaces:
type: boolean
description: Use namespace substitution and prefix lines
default: false
default-graph-uri:
type: string
description: URI(s) to be used as the default graph (equivalent to FROM)
named-graph-uri:
type: string
description: URI(s) to be used as named graphs (equivalent to FROM NAMED)
exclude-graph-uri:
type: string
description: URI(s) of graphs to exclude from the query dataset (from both default and named scopes)
REASONING_PROOF_LIST:
required:
- proofs
properties:
proofs:
type: array
items:
$ref: '#/components/schemas/REASONING_PROOF'
GENERIC_RESPONSE_ERROR_MESSAGE:
required:
- message
properties:
message:
type: string
example: Unexpected end of file [L9]
code:
type: string
example: QEIVR2
GENERIC_JSONLD:
properties:
'@id':
type: string
example: urn:example:Entity1
'@type':
type: string
example: urn:example:Entity
urn:example:hasProp:
required:
- '@id'
type: array
items:
required:
- '@value'
properties:
'@type':
type: string
example: http://www.w3.org/2001/XMLSchema#integer
'@value':
type: string
example: '42'
examples:
SPARQL_RESULTS_XML:
value: "<?xml version='1.0' encoding='UTF-8'?>\n<sparql xmlns='http://www.w3.org/2005/sparql-results#'>\n <head>\n <variable name='s'/>\n <variable name='label'/>\n </head>\n <results>\n <result>\n <binding name='s'>\n <uri>http://example.org/stardog#Example1</uri>\n </binding>\n <binding name='label'>\n <literal>42</literal>\n </binding>\n </result>\n <result>\n <binding name='s'>\n <uri>http://example.org/stardog#Example2</uri>\n </binding>\n <binding name='label'>\n <literal>foo</literal>\n </binding>\n </result>\n </results>\n</sparql>"
SPARQL_RESULTS_CSV:
value: 's,label
http://example.org/stardog#Example1,42
http://example.org/stardog#Example2,foo'
GENERIC_RDFXML:
value: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF\n\txmlns=\"http://api.stardog.com/\"\n\txmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n\txmlns:owl=\"http://www.w3.org/2002/07/owl#\"\n\txmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"\n\txmlns:stardog=\"tag:stardog:api:\"\n\txmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\">\n\n<rdf:Description rdf:about=\"urn:example:Entity1\">\n\t<rdf:type rdf:resource=\"urn:example:Entity\"/>\n\t<hasProp xmlns=\"urn:example:\" rdf:datatype=\"http://www.w3.org/2001/XMLSchema#integer\">42</hasProp>\n</rdf:Description>\n\n</rdf:RDF>"
REASONING_AXIOM_RDFXML:
value: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF\n\txmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n <rdf:Description rdf:about=\"urn:Employee1\">\n <rdf:type rdf:resource=\"urn:Person\"/>\n </rdf:Description>\n</rdf:RDF>"
GENERIC_TURTLE:
value: "@prefix : <urn:example:> .\n@prefix owl: <http://www.w3.org/2002/07/owl#> .\n@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n@prefix stardog: <tag:stardog:api:> .\n@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n\n<urn:example:Entity1> a <urn:example:Entity> ;\n\t<urn:example:hasProp> 42 ."
SPARQL_RESULTS_TSV:
value: "?s\t?label\n<http://example.org/stardog#Example1>\t\"42\"\n<http://example.org/stardog#Example2>\t\"foo\""
GENERIC_TRIG:
value: "@prefix : <urn:example:> .\n@prefix owl: <http://www.w3.org/2002/07/owl#> .\n@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n@prefix stardog: <tag:stardog:api:> .\n@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n\n{ \t<urn:example:Entity1> a <urn:example:Entity> ;\n\t\t <urn:example:hasProp> 42 .\n}"
GENERIC_NQUADS:
value: '<urn:context> <urn:example:Entity1> a <urn:example:Entity> .
<urn:context> <urn:example:Entity1> <urn:example:hasProp> 42 .'
REASONING_AXIOM_JSONLD:
value: "[\n {\n \"@id\": \"urn:Employee1\",\n \"@type\": [\n \"urn:Person\"\n ]\n }\n]"
REASONING_AXIOM_TTL:
value: <urn:Employee> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <urn:Person> .
GENERIC_NTRIPLES:
value: '<urn:example:Entity1> a <urn:example:Entity> .
<urn:example:Entity1> <urn:example:hasProp> 42 .'
SPARQL_QUERY:
value: "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX : <http://example.org/stardog#>\n \nSELECT ?s ?label WHERE {\n ?s a :Example ;\n rdfs:label ?label\n}"
parameters:
txid:
name: txid
in: path
description: Transaction ID
required: true
schema:
type: string
format: uuid
example: 4ea1ebac-48f0-459c-a9a7-6cad7189403d
db:
name: db
in: path
description: Database name
required: true
schema:
type: string
example: myDb
query:
name: query
in: query
description: Query to run
required: true
schema:
type: string
QUERY_NOT_REQ:
name: query
in: query
description: Query to run
schema:
type: string
responses:
INVALID_QUERY:
description: Invalid query sent
content:
application/json:
schema:
$ref: '#/components/schemas/GENERIC_RESPONSE_ERROR_MESSAGE'
REASONING_PROOF_LIST:
description: List of reasoning proofs
content:
application/json:
schema:
$ref: '#/components/schemas/REASONING_PROOF_LIST'
externalDocs:
url: https://docs.stardog.com
x-tagGroups:
- name: Data Unification
tags:
- Data Sources
- Virtual Graphs
- name: Virtual Graphs External Compute
tags:
- Virtual Graphs External Compute
- name: Server
tags:
- Monitoring
- Stored Functions
- Server Status/Metrics
- Server Admin
- Queries
- Cluster Admin
- name: Database
tags:
- Checkpoints
- DB Admin
- Integrity Constraints / SHACL
- Data Caching
- Graph Store Protocol
- Matcher, aligning schemas from various data sources
- Reasoning
- Transactions
- GraphQL
- SPARQL
- EntityResolution
- name: Security
tags:
- Roles
- Permissions
- Users
- name: Knowledge Catalog
tags:
- Knowledge Catalog