An HTTP service that exposes a Comunica engine as a SPARQL endpoint.

Constructors

Properties

context: any
contextOverride: boolean
engine: Promise<
    QueryEngineBase<
        IQueryContextCommon,
        QueryStringContext,
        QueryAlgebraContext,
    >,
>
freshWorkerPerQuery: boolean
lastQueryId: number = 0
port: number
timeout: number
workers: number
MIME_JSON: "application/json" = 'application/json'
MIME_PLAIN: "text/plain" = 'text/plain'

Methods

  • Start the HTTP service.

    Parameters

    • stdout: Writable

      The output stream to log to.

    • stderr: Writable

      The error stream to log errors to.

    Returns Promise<void>

  • Start the HTTP service as master.

    Parameters

    • stdout: Writable

      The output stream to log to.

    • stderr: Writable

      The error stream to log errors to.

    Returns Promise<void>

  • Start the HTTP service as worker.

    Parameters

    • stdout: Writable

      The output stream to log to.

    • stderr: Writable

      The error stream to log errors to.

    Returns Promise<void>

  • Stop after timeout or if the connection is terminated

    Parameters

    • response: ServerResponse<IncomingMessage>

      Response object.

    • queryId: number

      The unique query id.

    • stderr: Writable

      Error stream to write to.

    • OptionaleventEmitter: EventEmitter<DefaultEventMap>

      Query result stream.

    Returns void

  • Writes the result of the given SPARQL query.

    Parameters

    • engine: QueryEngineBase<IQueryContextCommon, QueryStringContext, QueryAlgebraContext>

      A SPARQL engine.

    • stdout: Writable

      Output stream.

    • stderr: Writable

      Error output stream.

    • request: IncomingMessage

      Request object.

    • response: ServerResponse<IncomingMessage>

      Response object.

    • queryBody: undefined | IQueryBody

      The query body.

    • mediaType: string

      The requested response media type.

    • headOnly: boolean

      If only the header should be written.

    • readOnly: boolean

      If only data can be read, but not updated. (i.e., if we're in a GET request)

    • queryId: number

      The unique id of this query.

    Returns Promise<void>

  • Takes parsed commandline arguments and turns them into an object used in the HttpServiceSparqlEndpoint constructor

    Parameters

    • argv: string[]

      The commandline arguments that the script was called with

    • moduleRootPath: string

      The path to the invoking module.

    • env: ProcessEnv

      The process env to get constants from.

    • defaultConfigPath: string

      The path to get the config from if none is defined in the environment.

    • stderr: Writable

      The error stream.

    • exit: (code: number) => void

      An exit process callback.

    • cliArgsHandlers: ICliArgsHandler[]

      Enables manipulation of the CLI arguments and their processing.

    Returns Promise<IHttpServiceSparqlEndpointArgs>

  • Starts the server

    Parameters

    • argv: string[]

      The commandline arguments that the script was called with

    • stdout: Writable

      The output stream to log to.

    • stderr: Writable

      The error stream to log errors to.

    • moduleRootPath: string

      The path to the invoking module.

    • env: ProcessEnv

      The process env to get constants from.

    • defaultConfigPath: string

      The path to get the config from if none is defined in the environment.

    • exit: (code: number) => void

      The callback to invoke to stop the script.

    • cliArgsHandlers: ICliArgsHandler[] = []

      Enables manipulation of the CLI arguments and their processing.

    Returns Promise<void>

    A promise that resolves when the server has been started.