Interface IQueryEngine<QueryContext, QueryStringContextInner, QueryAlgebraContextInner>

Base interface for a Comunica query engine.

interface IQueryEngine {
    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

  • StringQueryable<RDF.AllMetadataSupport, QueryStringContextInner>
  • AlgebraQueryable<Algebra.Operation, RDF.AllMetadataSupport, QueryAlgebraContextInner>
  • StringSparqlQueryable<RDF.SparqlResultSupport, QueryStringContextInner>
  • AlgebraSparqlQueryable<Algebra.Operation, RDF.SparqlResultSupport, QueryAlgebraContextInner>
    • IQueryEngine

Properties

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

Type declaration

    • <QueryFormatTypeInner>(query, context, explainMode): Promise<IQueryExplained>
    • Explain the given query

      Type Parameters

      • QueryFormatTypeInner extends QueryFormatType

      Parameters

      • query: QueryFormatTypeInner

        A query string or algebra.

      • context: QueryFormatTypeInner extends string
            ? QueryStringContextInner
            : QueryAlgebraContextInner

        A query context.

      • explainMode: QueryExplainMode

        The explain mode.

      Returns Promise<IQueryExplained>

      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.

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.

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

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.

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

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

      • query: QueryFormatTypeInner

        A query string or algebra object.

      • Optional context: QueryFormatTypeInner extends string
            ? QueryStringContextInner
            : QueryAlgebraContextInner

        A context.

      Returns Promise<QueryType>

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

Type declaration

    • <QueryFormatTypeInner>(query, context?): Promise<BindingsStream>
    • Query the bindings results of a SELECT query.

      Type Parameters

      • QueryFormatTypeInner extends QueryFormatType

      Parameters

      • query: QueryFormatTypeInner

        A query string or algebra object.

      • Optional context: QueryFormatTypeInner extends string
            ? QueryStringContextInner
            : QueryAlgebraContextInner

        A context.

      Returns Promise<BindingsStream>

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

Type declaration

    • <QueryFormatTypeInner>(query, context?): Promise<boolean>
    • Query the boolean result of an ASK query.

      Type Parameters

      • QueryFormatTypeInner extends QueryFormatType

      Parameters

      • query: QueryFormatTypeInner

        A query string or algebra object.

      • Optional context: QueryFormatTypeInner extends string
            ? QueryStringContextInner
            : QueryAlgebraContextInner

        A context.

      Returns Promise<boolean>

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

Type declaration

    • <QueryFormatTypeInner>(query, context?): Promise<AsyncIterator<Quad> & ResultStream<Quad>>
    • Query the quad results of a CONSTRUCT or DESCRIBE query.

      Type Parameters

      • QueryFormatTypeInner extends QueryFormatType

      Parameters

      • query: QueryFormatTypeInner

        A query string or algebra object.

      • Optional context: QueryFormatTypeInner extends string
            ? QueryStringContextInner
            : QueryAlgebraContextInner

        A context.

      Returns Promise<AsyncIterator<Quad> & ResultStream<Quad>>

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

Type declaration

    • <QueryFormatTypeInner>(query, context?): Promise<void>
    • Execute an UPDATE query.

      Type Parameters

      • QueryFormatTypeInner extends QueryFormatType

      Parameters

      • query: QueryFormatTypeInner

        A query string or algebra object.

      • Optional context: QueryFormatTypeInner extends string
            ? QueryStringContextInner
            : QueryAlgebraContextInner

        A context.

      Returns Promise<void>

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

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.