Class: QueryService

QueryService(httpRequestExecutor, parseExecutor)

Service for executing queries via GetQueryPayload or UpdateQueryPayload.

Constructor

new QueryService(httpRequestExecutor, parseExecutor)

Instantiates the query service.

Parameters:
Name Type Description
httpRequestExecutor function

used to execute HTTP requests

parseExecutor function

function that will parse provided data

Author:
  • Mihail Radkov
  • Svilen Velikov
Source:

Methods

getServiceName()

Source:

query(payload) → {ServiceRequest}

Executes request to query a repository.

Only POST request with a valid QueryPayload is supported.

Parameters:
Name Type Description
payload GetQueryPayload

is an object holding request parameters required by the query POST endpoint.

Source:
Throws:

if the payload is misconfigured

Type
Error
Returns:

a service request that will resolve to a readable stream to which the client can subscribe and consume the emitted strings or Quads depending on the provided response type as soon as they are available.

Type
ServiceRequest

update(payload) → {ServiceRequest}

Executes a request with a sparql query against /statements endpoint to update repository data.

If contentType is set to application/x-www-form-urlencoded then query and request parameters from the payload are encoded as query string and sent as request body.

If contentType is set to application/sparql-update then the query is sent unencoded as request body.

Parameters:
Name Type Description
payload UpdateQueryPayload
Source:
Throws:

if the payload is misconfigured

Type
Error
Returns:

service request that will be resolved if the update is successful or rejected in case of failure

Type
ServiceRequest