import { QuadChange } from "./changemgmt.js"; import { DataSpec, DataSpecFactory, Subject } from "./dataspecAPI.js"; import { TripleStore } from "./triplestore-client.js"; import { GraphEnvironment } from "./fdr.js"; /** * A Graph is a collection of Subjects, each with their properties. * */ export interface Graph { /** * Reference to the FDR environment which created this graph. */ env: GraphEnvironment; factory: DataSpecFactory; /** * Intending to use the specified data, make sure it is * available. * * Note that this function is expected to be async * * @param desc The description of the data to materialize. Must be a * supported DataSpec implementation. * @returns A promise which resolves with the parameter DataSpec object which * is filled with the necessary data and is ready to use. * */ use>(desc: T): Promise; /** * Declare that the DataSpec is no longer in use * * @param desc the DataSpec to be disposed of */ close(desc: DataSpec): void; id: string; } /** * A graph implementation which is a local cache of a remote graph */ export declare class LocalGraph implements Graph { readonly env: GraphEnvironment; id: string; label: string; readonly factory: DataSpecFactory; client: TripleStore; private cache; private _reactivityDecorator; private static factory_impl; /** * This constructor is internal and should not be used directly */ constructor(env: GraphEnvironment, client: TripleStore, id: string, label?: string); /** * Set the reactivity decorators for all working copies created from subjects * in this graph. * * The reactivity decorator is called by the Subject.workingCopy() constructor function. * It should wrap the working copy in whatever reactivity proxy is needed and * return the proxy so that the wrapped working copy can be used whenever changes * to the copy have to be propagated. That way the reactive layer will be * notified correctly. * * This property can be overriden in every invocation of Subject.workingCopy() */ set reactivityDecorator(decorator: (T: any) => T); get reactivityDecrator(): (T: any) => T; clear(): void; /** * Called by the subjects in this graph when their properties change. * A change is defined as a call to the Subject.apply() method. * This callback should modify any internal Graph state so that its state is consistent * with the changes made to the Subject * @param subject * @param key / */ subjectPropertyChangeCallback(subject: Subject, modifiedKeys: string[]): void; use>(desc: T): Promise; close(desc: DataSpec): void; /** * Accept quad changes pushed from a remote source (e.g. BE triplestore) * @param changes */ acceptChanges(changes: QuadChange[]): void; }