> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wazoo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# SPARQL over the default namespace collection

> JSON body matches `WorldsSparqlInput`. Path scope supplies the default namespace; no world slug is implied.
Omit or leave `query` empty to retrieve a SPARQL 1.1 service description (RDF).




## OpenAPI

````yaml /openapi.yaml post /worlds/sparql
openapi: 3.0.0
info:
  title: Worlds API
  version: 1.0.0
  description: >
    API for managing and querying RDF-based worlds.


    **Namespaces:** Routes under `/namespaces/{namespace}/...` target a specific
    tenant namespace.

    The path segment `_` is reserved: it expands to the authenticated tenant
    default namespace

    (or the platform namespace when no tenant applies). Shorthand routes under
    `/worlds/...`

    use the default namespace and omit the `/namespaces/...` prefix.
servers:
  - url: https://api.wazoo.dev
    description: API
security:
  - bearerAuth: []
paths:
  /worlds/sparql:
    post:
      summary: SPARQL over the default namespace collection
      description: >
        JSON body matches `WorldsSparqlInput`. Path scope supplies the default
        namespace; no world slug is implied.

        Omit or leave `query` empty to retrieve a SPARQL 1.1 service description
        (RDF).
      operationId: sparqlCollectionDefaultNamespace
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SparqlPostBody'
      responses:
        '200':
          description: >-
            SPARQL JSON results, or RDF service description when `query` is
            absent
          content:
            application/sparql-results+json:
              schema:
                $ref: '#/components/schemas/SparqlResults'
            text/turtle:
              schema:
                type: string
            application/rdf+xml:
              schema:
                type: string
            application/trig:
              schema:
                type: string
            application/ld+json:
              schema:
                type: string
        '204':
          description: SPARQL update succeeded with no result body
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    SparqlPostBody:
      type: object
      properties:
        query:
          type: string
          description: >
            SPARQL 1.1 query or update string. If omitted or empty, the server
            returns a SPARQL 1.1

            service description (RDF), with serialization negotiated from
            `Accept`.
        sources:
          type: array
          items:
            $ref: '#/components/schemas/WorldSource'
        namespace:
          type: string
        defaultGraphUris:
          type: array
          items:
            type: string
        namedGraphUris:
          type: array
          items:
            type: string
    SparqlResults:
      type: object
      oneOf:
        - $ref: '#/components/schemas/SparqlSelectResults'
        - $ref: '#/components/schemas/SparqlAskResults'
        - $ref: '#/components/schemas/SparqlQuadsResults'
    WorldSource:
      description: >
        Target world: a qualified string (`namespace/slug`), `{ slug, namespace?
        }`, or `{ name }`

        (same qualified form as `name`).
      oneOf:
        - type: string
        - type: object
          required:
            - slug
          properties:
            slug:
              type: string
            namespace:
              type: string
            write:
              type: boolean
            schema:
              type: boolean
        - type: object
          required:
            - name
          properties:
            name:
              type: string
            write:
              type: boolean
            schema:
              type: boolean
    SparqlSelectResults:
      type: object
      properties:
        head:
          $ref: '#/components/schemas/SparqlHead'
        results:
          type: object
          properties:
            bindings:
              type: array
              items:
                $ref: '#/components/schemas/SparqlBinding'
      required:
        - head
        - results
    SparqlAskResults:
      type: object
      properties:
        head:
          $ref: '#/components/schemas/SparqlHead'
        boolean:
          type: boolean
      required:
        - head
        - boolean
    SparqlQuadsResults:
      type: object
      properties:
        head:
          $ref: '#/components/schemas/SparqlHead'
        results:
          type: object
          properties:
            quads:
              type: array
              items:
                $ref: '#/components/schemas/SparqlQuad'
      required:
        - head
        - results
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
      required:
        - error
    SparqlHead:
      type: object
      properties:
        vars:
          type: array
          items:
            type: string
        link:
          type: array
          items:
            type: string
          nullable: true
    SparqlBinding:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/SparqlValue'
    SparqlQuad:
      type: object
      properties:
        subject:
          $ref: '#/components/schemas/SparqlSubject'
        predicate:
          $ref: '#/components/schemas/SparqlPredicate'
        object:
          $ref: '#/components/schemas/SparqlValue'
        graph:
          $ref: '#/components/schemas/SparqlGraph'
    SparqlValue:
      oneOf:
        - $ref: '#/components/schemas/SparqlUriValue'
        - $ref: '#/components/schemas/SparqlBnodeValue'
        - $ref: '#/components/schemas/SparqlLiteralValue'
        - $ref: '#/components/schemas/SparqlTripleValue'
      discriminator:
        propertyName: type
    SparqlSubject:
      type: object
      properties:
        type:
          enum:
            - uri
            - bnode
        value:
          type: string
      required:
        - type
        - value
    SparqlPredicate:
      type: object
      properties:
        type:
          enum:
            - uri
        value:
          type: string
      required:
        - type
        - value
    SparqlGraph:
      type: object
      properties:
        type:
          enum:
            - default
            - uri
        value:
          type: string
      required:
        - type
        - value
    SparqlUriValue:
      type: object
      properties:
        type:
          enum:
            - uri
        value:
          type: string
      required:
        - type
        - value
    SparqlBnodeValue:
      type: object
      properties:
        type:
          enum:
            - bnode
        value:
          type: string
      required:
        - type
        - value
    SparqlLiteralValue:
      type: object
      properties:
        type:
          enum:
            - literal
        value:
          type: string
        xml:lang:
          type: string
        datatype:
          type: string
      required:
        - type
        - value
    SparqlTripleValue:
      type: object
      properties:
        type:
          enum:
            - triple
        value:
          type: object
          properties:
            subject:
              $ref: '#/components/schemas/SparqlValue'
            predicate:
              $ref: '#/components/schemas/SparqlValue'
            object:
              $ref: '#/components/schemas/SparqlValue'
          required:
            - subject
            - predicate
            - object
      required:
        - type
        - value
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````