Interface IQueryEngine<QueryStringContextInner, QueryAlgebraContextInner>

Base interface for a Comunica query engine.

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

Type Parameters

  • QueryStringContextInner extends RDF.QueryStringContext = QueryStringContext
  • QueryAlgebraContextInner extends RDF.QueryAlgebraContext = QueryAlgebraContext

Hierarchy

Properties

explain: (<QueryFormatTypeInner>(query: QueryFormatTypeInner, context: QueryFormatTypeInner extends string
    ? QueryStringContextInner
    : QueryAlgebraContextInner, explainMode: QueryExplainMode) => Promise<IQueryExplained>)

Explain the given query

Type declaration

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

Type declaration

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

      • Optionalcontext: IActionContext

        An optional context.

      Returns Promise<Record<string, string>>

      All available SPARQL result media type formats.

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

Type declaration

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

      • Optionalcontext: IActionContext

        An optional context.

      Returns Promise<Record<string, number>>

      All available SPARQL (weighted) result media types.

invalidateHttpCache: ((url?: string) => 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>
    • Parameters

      • Optionalurl: string

        The page URL to invalidate.

      Returns Promise<any>

      A promise resolving when the caches have been invalidated.

query: (<QueryFormatTypeInner>(query: QueryFormatTypeInner, context?: QueryFormatTypeInner extends string
    ? QueryStringContextInner
    : QueryAlgebraContextInner) => 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

queryBindings: (<QueryFormatTypeInner>(query: QueryFormatTypeInner, context?: QueryFormatTypeInner extends string
    ? QueryStringContextInner
    : QueryAlgebraContextInner) => Promise<BindingsStream>)

Query the bindings results of a SELECT query.

Type declaration

queryBoolean: (<QueryFormatTypeInner>(query: QueryFormatTypeInner, context?: QueryFormatTypeInner extends string
    ? QueryStringContextInner
    : QueryAlgebraContextInner) => Promise<boolean>)

Query the boolean result of an ASK query.

Type declaration

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

Query the quad results of a CONSTRUCT or DESCRIBE query.

Type declaration

queryVoid: (<QueryFormatTypeInner>(query: QueryFormatTypeInner, context?: QueryFormatTypeInner extends string
    ? QueryStringContextInner
    : QueryAlgebraContextInner) => Promise<void>)

Execute an UPDATE query.

Type declaration

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

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

Type declaration

    • (queryResult, mediaType?, context?): any
    • Parameters

      • queryResult: QueryType

        A query result.

      • OptionalmediaType: string

        A media type.

      • Optionalcontext: any

        An optional context.

      Returns any

      A text stream.