Interface IQueryEngine<QueryContext, QueryStringContextInner, QueryAlgebraContextInner>

Base interface for a Comunica query engine.

interface IQueryEngine<QueryContext, QueryStringContextInner, QueryAlgebraContextInner> {
    explain: (<QueryFormatTypeInner>(query, context, explainMode) => Promise<IQueryExplained>);
    getResultMediaTypeFormats: ((context?) => Promise<Record<string, string>>);
    getResultMediaTypes: ((context?) => Promise<Record<string, number>>);
    invalidateHttpCache: ((url?) => Promise<any>);
    query: (<QueryFormatTypeInner>(query, context?) => Promise<QueryType>);
    queryBindings: (<QueryFormatTypeInner>(query, context?) => Promise<BindingsStream>);
    queryBoolean: (<QueryFormatTypeInner>(query, context?) => Promise<boolean>);
    queryQuads: (<QueryFormatTypeInner>(query, context?) => Promise<AsyncIterator<Quad> & ResultStream<Quad>>);
    queryVoid: (<QueryFormatTypeInner>(query, context?) => Promise<void>);
    resultToString: ((queryResult, mediaType?, context?) => any);
}

Type Parameters

  • QueryContext extends IQueryContextCommon = IQueryContextCommon

  • QueryStringContextInner extends RDF.QueryStringContext = QueryStringContext

  • QueryAlgebraContextInner extends RDF.QueryAlgebraContext = QueryAlgebraContext

Hierarchy

Properties

explain: (<QueryFormatTypeInner>(query, context, explainMode) => Promise<IQueryExplained>)

Explain the given query

Type declaration

Param: query

A query string or algebra.

Param: context

A query context.

Param: explainMode

The explain mode.

Returns

A promise that resolves to the query output.

getResultMediaTypeFormats: ((context?) => Promise<Record<string, string>>)

Type declaration

    • (context?): Promise<Record<string, string>>
    • Parameters

      • Optional context: IActionContext

        An optional context.

      Returns Promise<Record<string, string>>

      All available SPARQL result media type formats.

Param: context

An optional context.

Returns

All available SPARQL result media type formats.

getResultMediaTypes: ((context?) => Promise<Record<string, number>>)

Type declaration

    • (context?): Promise<Record<string, number>>
    • Parameters

      • Optional context: IActionContext

        An optional context.

      Returns Promise<Record<string, number>>

      All available SPARQL (weighted) result media types.

Param: context

An optional context.

Returns

All available SPARQL (weighted) result media types.

invalidateHttpCache: ((url?) => Promise<any>)

Invalidate all internal caches related to the given page URL. If no page URL is given, then all pages will be invalidated.

Type declaration

    • (url?): Promise<any>
    • Invalidate all internal caches related to the given page URL. If no page URL is given, then all pages will be invalidated.

      Parameters

      • Optional url: string

        The page URL to invalidate.

      Returns Promise<any>

      A promise resolving when the caches have been invalidated.

Param: url

The page URL to invalidate.

Returns

A promise resolving when the caches have been invalidated.

query: (<QueryFormatTypeInner>(query, context?) => Promise<QueryType>)

Initiate a given query. This will produce a future to a query result, which has to be executed to obtain the query results. This can reject given an unsupported or invalid query.

This method is prefered in case you don't know beforehand what type of query will be executed, or if you require access to the metadata of the results.

Type declaration

    • <QueryFormatTypeInner>(query, context?): Promise<QueryType>
    • Initiate a given query. This will produce a future to a query result, which has to be executed to obtain the query results. This can reject given an unsupported or invalid query.

      This method is prefered in case you don't know beforehand what type of query will be executed, or if you require access to the metadata of the results.

      Type Parameters

      • QueryFormatTypeInner extends QueryFormatType

      Parameters

      Returns Promise<QueryType>

Param: query

A query string or algebra object.

Param: context

A context.

queryBindings: (<QueryFormatTypeInner>(query, context?) => Promise<BindingsStream>)

Query the bindings results of a SELECT query.

Type declaration

Param: query

A query string or algebra object.

Param: context

A context.

queryBoolean: (<QueryFormatTypeInner>(query, context?) => Promise<boolean>)

Query the boolean result of an ASK query.

Type declaration

Param: query

A query string or algebra object.

Param: context

A context.

queryQuads: (<QueryFormatTypeInner>(query, context?) => Promise<AsyncIterator<Quad> & ResultStream<Quad>>)

Query the quad results of a CONSTRUCT or DESCRIBE query.

Type declaration

Param: query

A query string or algebra object.

Param: context

A context.

queryVoid: (<QueryFormatTypeInner>(query, context?) => Promise<void>)

Execute an UPDATE query.

Type declaration

Param: query

A query string or algebra object.

Param: context

A context.

resultToString: ((queryResult, mediaType?, context?) => any)

Convert a query result to a string stream based on a certain media type.

Type declaration

    • (queryResult, mediaType?, context?): any
    • Convert a query result to a string stream based on a certain media type.

      Parameters

      • queryResult: QueryType

        A query result.

      • Optional mediaType: string

        A media type.

      • Optional context: any

        An optional context.

      Returns any

      A text stream.

Param: queryResult

A query result.

Param: mediaType

A media type.

Param: context

An optional context.

Returns

A text stream.