lincd
Version:
LINCD is a JavaScript library for building user interfaces with linked data (also known as 'structured data', or RDF)
57 lines (56 loc) • 2.9 kB
TypeScript
import { QuadSet } from '../collections/QuadSet.js';
import { Graph, NamedNode, Quad } from '../models.js';
import { NodeSet } from '../collections/NodeSet.js';
import { ICoreIterable } from './ICoreIterable.js';
import { Shape } from '../shapes/Shape.js';
import { CoreMap } from '../collections/CoreMap.js';
import { SelectQuery } from '../queries/SelectQuery.js';
import { LinkedDataRequest } from '../utils/TraceShape.js';
import { QuadArray } from '../collections/QuadArray.js';
import { ShapeSet } from '../collections/ShapeSet.js';
import { UpdateQuery } from '../queries/UpdateQuery.js';
import { CreateQuery } from '../queries/CreateQuery.js';
import { DeleteQuery, DeleteResponse } from '../queries/DeleteQuery.js';
export interface IQuadStore {
/**
* Prepares the store to be used.
*/
init?(): Promise<any>;
updateQuery?<RType>(q: UpdateQuery<RType>): Promise<RType>;
createQuery?<R>(q: CreateQuery<R>): Promise<R>;
selectQuery<ResultType>(query: SelectQuery<any>): Promise<ResultType>;
deleteQuery?(query: DeleteQuery): Promise<DeleteResponse>;
update?(toAdd: ICoreIterable<Quad>, toRemove: ICoreIterable<Quad>): Promise<any>;
add?(quad: Quad): Promise<any>;
addMultiple?(quads: QuadSet): Promise<any>;
delete?(quad: Quad): Promise<any>;
deleteMultiple?(quads: QuadSet): Promise<any>;
/**
* Determines the right URI for several nodes
* The URI's are determined by the store, and the store returns a mapping of current URI's to new URI's
* Stores that implement this method should note that the URI's of the nodes used as keys may not be the same as the URI's
* of the nodes in the environment that requested the URI change. Hence, a map is provided. The node (the key) can be used to access properties, whilst the currentUri (the value of the map) should be returned in the resulting [currentUri,newUri] array
* @param nodeToCurrentUriMap
*/
setURIs(nodeToCurrentUriMap: CoreMap<NamedNode, string>): Promise<[string, string][]>;
getDefaultGraph?(): Graph;
removeNodes?(nodes: ICoreIterable<NamedNode>, quads?: QuadSet): Promise<any>;
/**
* Clears all values of specific predicates for specific subjects
* @param subjectToPredicates a map of subjects as keys and sets of properties (predicates) to clear as the values
* @return A promise that resolves to true if properties were cleared, or false if no properties were cleared
*/
clearProperties?(subjectToPredicates: CoreMap<NamedNode, NodeSet<NamedNode>>): Promise<boolean>;
/**
* @deprecated
* @param shapeInstance
* @param shape
*/
loadShape?(shapeInstance: Shape, shape: LinkedDataRequest): Promise<QuadArray>;
/**
* @deprecated
* @param shapeSet
* @param shape
*/
loadShapes?(shapeSet: ShapeSet, shape: LinkedDataRequest): Promise<QuadArray>;
}