Retrieve SPARQL metadata endpoint
- Last Updated: December 3, 2026
- 2 minute read
- Documentation
The GET /v1/retrieve/sparql/metadata endpoint returns namespace prefixes and graph IRIs visible to the calling identity. Use it to discover prefixes and graphs before submitting a SPARQL query to the Retrieve SPARQL endpoint.
Overview
The endpoint returns prefixes, the default graph IRI, and visible named graph IRIs. Prefix and named graph lists can be empty. The default graph is returned separately and is not subject to the metadata list limit.
Basic usage
This example requests SPARQL metadata directly from MarkLogic Retrieval API (MRA):
curl --digest -u "<ML_USER>:<ML_PASSWORD>" "http://<ML_HOST>:<REST_PORT>/v1/retrieve/sparql/metadata"
Request parameters
This endpoint does not accept parameters.
Response format
Success response
HTTP status: 200 OK
The response contains the following fields:
| Field | Type | Description |
|---|---|---|
prefixes |
array of objects | Visible namespace prefixes and namespace IRIs |
graphs.defaultGraph |
string | Default graph IRI |
graphs.namedGraphs |
array of strings | Named graph IRIs visible to the calling identity |
truncated |
object | Present when a metadata list is capped; identifies each capped list |
totalRows |
object | Present with truncated; gives the exact count for each capped list |
This example shows the response shape. Values depend on the deployment and the calling identity:
{
"prefixes": [
{ "prefix": "<prefix>", "namespace": "<namespace-IRI>" }
],
"graphs": {
"defaultGraph": "<default-graph-IRI>",
"namedGraphs": ["<visible-named-graph-IRI>"]
}
}
The endpoint does not list named graphs that the calling identity cannot access.
Row limits and truncation
The endpoint independently caps the prefixes and graphs.namedGraphs arrays at sparqlMetadataMaxRows. The default is 500. Set this property in retrieveConfig.json. The default graph is not capped.
When either array exceeds its limit, the response includes the corresponding key in both truncated and totalRows. The totalRows value gives the exact number of entries before truncation.
Error responses
This table summarizes endpoint errors described for SPARQL metadata requests:
| Status | Meaning |
|---|---|
401 |
MarkLogic Server authentication is missing or invalid. |
403 |
The caller lacks the SPARQL execution privilege. |
404 |
An MRA endpoint module is unavailable to the caller or is not deployed. |
405 |
The HTTP method is not allowed. |
500 |
An unexpected MarkLogic Server-side failure occurred. |
See SPARQL tool issues in "Troubleshoot MarkLogic MCP Server" for remedies.