lincd
Version:
LINCD is a JavaScript library for building user interfaces with linked data (also known as 'structured data', or RDF)
99 lines (98 loc) • 5.3 kB
TypeScript
import { IQuadStore } from '../interfaces/IQuadStore';
import { Graph, NamedNode, Node } from '../models';
import { QuadSet } from '../collections/QuadSet';
import { CoreMap } from '../collections/CoreMap';
import { NodeSet } from '../collections/NodeSet';
import { Shape } from '../shapes/Shape';
import { ICoreIterable } from '../interfaces/ICoreIterable';
import { QuadArray } from '../collections/QuadArray';
import { CoreSet } from '../collections/CoreSet';
import { ShapeSet } from '../collections/ShapeSet';
import { LinkedDataRequest } from '../interfaces/Component';
export declare abstract class LinkedStorage {
private static defaultStore;
private static _initialized;
private static graphToStore;
private static shapesToGraph;
private static nodeShapesToGraph;
private static graphToTargetClasses;
private static defaultStorageGraph;
private static processingPromise;
private static storedEvents;
private static nodeToPropertyRequests;
private static fullyLoadedNodes;
private static propShapeMap;
static init(): void;
/**
* Returns true if Storage is set up to use any specific store
* returns false if storage is managed manually, and no call like Storage.setDefaultStore has been made
*/
static isInitialised(): boolean;
static onEvent(eventType: any, ...args: any[]): void;
private static startProcessingOnNextTick;
static processStoredEvents(): Promise<void>;
private static finalizeProcess;
static getDefaultStore(): IQuadStore;
static setDefaultStore(store: IQuadStore): void;
static setDefaultStorageGraph(graph: Graph): void;
static setGraphForShapes(graph: Graph, ...shapeClasses: (typeof Shape)[]): void;
static setStoreForGraph(store: IQuadStore, graph: any): void;
static getGraphForStore(store: IQuadStore): Graph;
static getStores(): CoreSet<IQuadStore>;
/**
* Set the target store for instances of these shapes
* @param store
* @param shapes
*/
static setStoreForShapes(store: IQuadStore, ...shapes: (typeof Shape)[]): void;
private static assignQuadsToGraph;
private static moveAllQuadsOfNodeIfRequired;
/**
*
* @returns a promise that resolves when all storage events have been processed. For example shapes that are saved() have been stored and received a permanent URI.
*/
static promiseUpdated(): Promise<void>;
private static onQuadsAltered;
static getGraphForNode(subject: NamedNode, checkShapes?: boolean): Graph;
static getDefaultStorageGraph(): Graph;
private static onClearedProperties;
private static onRemoveNodes;
private static onStoreNodes;
static getStoreForNode(node: NamedNode): IQuadStore;
static getStoreForGraph(graph: Graph): IQuadStore;
private static groupQuadsBySubject;
private static getTargetGraphMap;
static getStoreMapForNodes(nodes: ICoreIterable<NamedNode>): CoreMap<IQuadStore, NamedNode[]>;
static getStoreMapForShapes(shapes: ShapeSet): CoreMap<IQuadStore, Shape[]>;
static getShapeToStoreMap(): CoreMap<typeof Shape, IQuadStore>;
private static getStoreMapForIGraphObjects;
private static getTargetStoreMap;
static setURIs(nodeUriMap: CoreMap<NamedNode, string>): Promise<[string, string][]>;
static update(toAdd: QuadSet, toRemove: QuadSet): Promise<void | any>;
static clearProperties(subjectToPredicates: CoreMap<NamedNode, NodeSet<NamedNode>>): Promise<boolean>;
static loadShapes(shapeSet: ShapeSet, shapeOrRequest: LinkedDataRequest, byPassCache?: boolean): Promise<QuadArray>;
/**
* Loads the requested Shape(s) from storage for a specific node.
* To form a request see the LinkedDataRequest interface
* Returns a promise that resolves when the loading has completed.
* Requests are cached so the second time you request the same data you will get the same answer. Use byPassCache if you want to ensure the data is loaded again.
* The returned promise resolves to null if no target store was found for this node (the app may not have a defaultStore set up then)
* @param shapeInstance
* @param shapeOrRequest
* @param byPassCache
*/
static loadShape(shapeInstance: Shape, shapeOrRequest?: LinkedDataRequest, byPassCache?: boolean): Promise<QuadArray>;
static nodesAreLoaded(nodes: NodeSet, dataRequest: any): boolean | Promise<any>;
static setFullyLoaded(node: Node): void;
static isLoaded(node: Node, dataRequest: LinkedDataRequest): boolean | Promise<any>;
private static getPredicateToPropertyShapesMap;
/**
* Sets all the property paths of the subject nodes to be loaded
* Handy for example when the server returned data already and you don't want the automatic loading to kick in.
* WARNING: this assumes that ALL the values of each subject-predicate pair are loaded.
* If the server returned just one and there are more, using this method means the other values will not automatically be loaded.
*/
static setQuadsLoaded(quads: QuadSet): void;
static setNodesLoaded(nodes: NodeSet, dataRequest: LinkedDataRequest, requestState?: true | Promise<any>): void;
static setNodeLoaded(node: Node, request: LinkedDataRequest, requestState?: true | Promise<any>): void;
}