import { IConnectedLdoDataset } from "../types/IConnectedLdoDataset.mjs"; import { ConnectedPlugin } from "../types/ConnectedPlugin.mjs"; import { ExpandDeep, ILinkQuery, LQInput, LQReturn } from "../types/ILinkQuery.mjs"; import { IConnectedLdoBuilder } from "../types/IConnectedLdoBuilder.mjs"; import { LdoBase, ShapeType } from "@ldo/ldo"; import { SubjectNode } from "@ldo/rdf-utils"; import { nodeEventListener } from "@ldo/subscribable-dataset"; import { Quad } from "@rdfjs/types"; //#region src/linkTraversal/ResourceLinkQuery.d.ts /** * Represents a query over multiple datasources and constituting muliple * resources. * * @example * ```typescript * import { ProfileShapeType } from "./_ldo/Profile.shapeType.ts"; * * // Create a link query * const linkQuery = ldoDataset * .usingType(ProfileShapeType) * .startLinkQuery( * "http://example.com/profile/card", * "http://example.com/profile/card#me", * { * name: true, * knows: { * name: true, * }, * }, * } * ); * // Susbscribe to this link query, automaticically updating the dataset when * // something from the link query is changed. * await linkQuery.subscribe(); * ``` */ declare class ResourceLinkQuery, Plugins extends ConnectedPlugin[]> implements ILinkQuery { protected parentDataset: IConnectedLdoDataset; protected shapeType: ShapeType; protected ldoBuilder: IConnectedLdoBuilder; protected startingResource: Plugins[number]["types"]["resource"]; protected startingSubject: SubjectNode | string; protected linkQueryInput: QueryInput; protected previousTransactionId: string; protected activeResourceSubscriptions: Record; protected thisUnsubscribeIds: Set; protected curOnDataChanged: nodeEventListener | undefined; protected resourcesWithSubscriptionInProgress: Record | undefined>; /** * @internal * @param parentDataset The dataset for which this link query is a part * @param shapeType A ShapeType for the link query to follow * @param ldoBuilder An LdoBuilder associated with the dataset * @param startingResource The resource to explore first in the link query * @param startingSubject The starting point of the link query * @param linkQueryInput A definition of the link query */ constructor(parentDataset: IConnectedLdoDataset, shapeType: ShapeType, ldoBuilder: IConnectedLdoBuilder, startingResource: Plugins[number]["types"]["resource"], startingSubject: SubjectNode | string, linkQueryInput: QueryInput); /** * Runs this link query, returning the result * @param options Options for how to run the link query * @returns A subset of the ShapeType as defined by the LinkQuery * * @example * ``` * import { ProfileShapeType } from "./_ldo/Profile.shapeType.ts"; * * // Create a link query * const linkQuery = ldoDataset * .usingType(ProfileShapeType) * .startLinkQuery( * "http://example.com/profile/card", * "http://example.com/profile/card#me", * { * name: true, * knows: { * name: true, * }, * }, * } * ); * // Susbscribe to this link query, automaticically updating the dataset when * // something from the link query is changed. * const result = await linkQuery.read(); * console.log(result.name); * result.knows.forEach((person) => console.log(person.name)); * // The following will type-error. Despite "phone" existing on a Profile, * // it was not covered by the link query. * console.log(result.phone); * ``` */ run(options?: { reload?: boolean; }): Promise>>; /** * Subscribes to the data defined by the link query, updating the dataset if * any changes are made. * @returns An unsubscribeId * * @example * ``` * import { ProfileShapeType } from "./_ldo/Profile.shapeType.ts"; * * // Create a link query * const linkQuery = ldoDataset * .usingType(ProfileShapeType) * .startLinkQuery( * "http://example.com/profile/card", * "http://example.com/profile/card#me", * { * name: true, * knows: { * name: true, * }, * }, * } * ); * // Susbscribe to this link query, automaticically updating the dataset when * // something from the link query is changed. * const unsubscribeId = await linkQuery.subscribe(); * * // Now, let's imagine the following triple was added to * "http://example.com/profile/card": * * Because you're subscribed, the dataset will automatically be updated. * * // End subscription * linkQuery.unsubscribe(unsubscribeId); * ``` */ subscribe(): Promise; private unsubscribeFromResource; private fullUnsubscribe; unsubscribe(unsubscribeId: string): Promise; unsubscribeAll(): Promise; fromSubject(): ExpandDeep>; getSubscribedResources(): Plugins[number]["types"]["resource"][]; } //#endregion export { ResourceLinkQuery }; //# sourceMappingURL=ResourceLinkQuery.d.mts.map