Interface IQueryEngine<QueryStringContextInner, QueryAlgebraContextInner>

Base interface for a Comunica query engine.

interface IQueryEngine<
    QueryStringContextInner extends
        RDF.QueryStringContext = QueryStringContext,
    QueryAlgebraContextInner extends
        RDF.QueryAlgebraContext = QueryAlgebraContext,
> {
    explain: <QueryFormatTypeInner extends QueryFormatType>(
        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 extends QueryFormatType>(
        query: QueryFormatTypeInner,
        context?: QueryFormatTypeInner extends string
            ? QueryStringContextInner
            : QueryAlgebraContextInner,
    ) => Promise<QueryType>;
    queryBindings: <QueryFormatTypeInner extends QueryFormatType>(
        query: QueryFormatTypeInner,
        context?: QueryFormatTypeInner extends string
            ? QueryStringContextInner
            : QueryAlgebraContextInner,
    ) => Promise<BindingsStream>;
    queryBoolean: <QueryFormatTypeInner extends QueryFormatType>(
        query: QueryFormatTypeInner,
        context?: QueryFormatTypeInner extends string
            ? QueryStringContextInner
            : QueryAlgebraContextInner,
    ) => Promise<boolean>;
    queryQuads: <QueryFormatTypeInner extends QueryFormatType>(
        query: QueryFormatTypeInner,
        context?: QueryFormatTypeInner extends string
            ? QueryStringContextInner
            : QueryAlgebraContextInner,
    ) => Promise<AsyncIterator<Quad> & ResultStream<Quad>>;
    queryVoid: <QueryFormatTypeInner extends QueryFormatType>(
        query: QueryFormatTypeInner,
        context?: QueryFormatTypeInner extends string
            ? QueryStringContextInner
            : QueryAlgebraContextInner,
    ) => Promise<void>;
    resultToString: (
        queryResult: QueryType,
        mediaType?: string,
        context?: any,
    ) => any;
}

Type Parameters

Hierarchy

Implemented by

Properties

explain: <QueryFormatTypeInner extends QueryFormatType>(
    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?: IActionContext): Promise<Record<string, string>>
    • Parameters

      Returns Promise<Record<string, string>>

      All available SPARQL result media type formats.

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

Type declaration

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

      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?: string): Promise<any>
    • Parameters

      • Optionalurl: string

        The page URL to invalidate.

      Returns Promise<any>

      A promise resolving when the caches have been invalidated.

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

Query the bindings results of a SELECT query.

Type declaration

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

Query the boolean result of an ASK query.

Type declaration

queryQuads: <QueryFormatTypeInner extends QueryFormatType>(
    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 extends QueryFormatType>(
    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: QueryType, mediaType?: string, context?: any): any
    • Parameters

      • queryResult: QueryType

        A query result.

      • OptionalmediaType: string

        A media type.

      • Optionalcontext: any

        An optional context.

      Returns any

      A text stream.