API
  • API Index
  • Batch API
  • Content Negotiation
  • Dynamic Paths
  • Query Explanation
  • Hierarchy API
  • List API
  • Quick Reference
  • Time Series API
  • Views
    • Configuration
  • Overview
  • Application Configuration
  • Documentation Configuration
  • Spec Configuration
    • Features
  • API Testing
  • Asynchronous Processing
  • Cassandra Time-Series Engine
  • Cassandra Integration
  • Default Controller Customisation
  • Documentation
  • Query Explanation
  • Geospatial Filtering
  • Model Documentation
  • PostgreSQL Integration
  • Excel Spreadsheet Format
    • Tutorials
  • Step-by-Step Guide
  • Archetype Setup
  • Logging
  • Prometheus
  • Sentry Logging
    • UI Customisation
  • UI Customisation
  • SASS Build Chain
  • Shared Layout
  • API Documentation
  • Model Documentation
  • Results
  • sapi-nt v current

    Query Explanation

    Some Sapi-nt endpoints support query explanation, which enables you to see the serialized query that Sapi-nt would issue to the data source for a given request. This feature is only available when the application is configured to enable it.

    To obtain a query explanation for a request, append /explain to the request path.

    For example, to explain the query for the following request:

    /station?_view=mini&_limit=1
    

    Use the following Explain API request:

    /station/explain?_view=mini&_limit=1
    

    When Sapi-nt is explains the query successfully, it returns a 200 OK response whose body is the raw string serialization of the query, in the relevant syntax (typically SPARQL). For example:

    PREFIX  ...
    
    SELECT  ?id ?label ?type
    WHERE
      { { SELECT  ?id
          WHERE
            { ?id  rdf:type  metro:UndergroundStation
              FILTER EXISTS {  }
            }
          LIMIT   1
        }
        OPTIONAL
          {   { ?id  rdfs:label  ?label}
            UNION
              { ?id  rdf:type  ?type}}
      }
    

    Sapi-nt may fail to explain the query for one of the following reasons:

    In these cases, it returns a 400 Bad Request response.

    Note - If Sapi-nt accepts the original request but returns a 404 Not Found to the explain request, infer that the Explain API is not enabled.