A lazy query source.

interface IQuerySource {
    getSelectorShape: (
        context: IActionContext,
    ) => Promise<FragmentSelectorShape>;
    queryBindings: (
        operation: Operation,
        context: IActionContext,
        options?: IQueryBindingsOptions,
    ) => BindingsStream;
    queryBoolean: (operation: Ask, context: IActionContext) => Promise<boolean>;
    queryQuads: (
        operation: Operation,
        context: IActionContext,
    ) => AsyncIterator<Quad>;
    queryVoid: (operation: Update, context: IActionContext) => Promise<void>;
    referenceValue: QuerySourceReference;
    toString: () => string;
}

Implemented by

Properties

getSelectorShape: (context: IActionContext) => Promise<FragmentSelectorShape>

Get the selector type that is supported by this source.

Type declaration

queryBindings: (
    operation: Operation,
    context: IActionContext,
    options?: IQueryBindingsOptions,
) => BindingsStream

Returns a (possibly lazy) stream that returns all bindings matching the operation.

Passed operations MUST conform to the query shape exposed by the selector type returned from getSelectorShape. The given operation represents a Linked Data Fragments selector.

The returned stream MUST expose the property 'metadata' of type MetadataBindings. The implementor is reponsible for handling cases where 'metadata' is being called without the stream being in flow-mode. This metadata object can become invalidated (see metadata.state), in which case the 'metadata' property must and will be updated.

Type declaration

queryBoolean: (operation: Ask, context: IActionContext) => Promise<boolean>

Returns a promise resolving to the ask response of the given operation.

This method should only be supported if the selector type returned from getSelectorShape supports ask queries.

Type declaration

    • (operation: Ask, context: IActionContext): Promise<boolean>
    • Parameters

      • operation: Ask

        The query operation to execute.

      • context: IActionContext

        The query context.

      Returns Promise<boolean>

      The resulting ask reply.

queryQuads: (
    operation: Operation,
    context: IActionContext,
) => AsyncIterator<Quad>

Returns a (possibly lazy) stream that returns all quads matching the operation.

This method should only be supported if the selector type returned from getSelectorShape supports construct queries.

Type declaration

    • (operation: Operation, context: IActionContext): AsyncIterator<Quad>
    • Parameters

      • operation: Operation

        The query operation to execute.

      • context: IActionContext

        The query context.

      Returns AsyncIterator<Quad>

      The resulting quads stream.

queryVoid: (operation: Update, context: IActionContext) => Promise<void>

Returns a promise resolving when the given update operation succeeds.

This method should only be supported if the selector type returned from getSelectorShape supports update queries.

Type declaration

    • (operation: Update, context: IActionContext): Promise<void>
    • Parameters

      • operation: Update

        The query operation to execute.

      • context: IActionContext

        The query context.

      Returns Promise<void>

      The void response.

referenceValue: QuerySourceReference

The URL of RDF source of this source.

toString: () => string

Returns a string representation of this source.