lincd
Version:
LINCD is a JavaScript library for building user interfaces with linked data (also known as 'structured data', or RDF)
21 lines (20 loc) • 1.44 kB
TypeScript
import { NamedNode } from '../models';
import { Shape } from '../shapes/Shape';
import { NodeShape } from '../shapes/SHACL';
export declare function addNodeShapeToShapeClass(nodeShape: NodeShape, shapeClass: typeof Shape): void;
export declare function getShapeClass(nodeShape: NamedNode): typeof Shape;
export declare function getSubShapesClasses(shape: typeof Shape | (typeof Shape)[], _internalKey?: string): (typeof Shape)[];
export declare function getSuperShapesClasses(shape: typeof Shape | (typeof Shape)[]): (typeof Shape)[];
export declare function hasSuperClass(a: Function, b: Function): boolean;
export declare function hasSubClass(a: Function, b: Function): boolean;
export declare function getMostSpecificSubShapes(shape: typeof Shape | (typeof Shape)[]): (typeof Shape)[];
/**
* Finds the most specific shape class (which extends other shape classes)
* of all shape classes that this node matches with (that is the node is a valid instance of the shape)
* And returns an instance of that shape
* @param property
* @param shape
*/
export declare function getShapeOrSubShape<S extends Shape = Shape>(node: any, shape: typeof Shape | (typeof Shape)[]): S;
export declare function getMostSpecificShapes(node: NamedNode, baseShape?: typeof Shape | (typeof Shape)[]): (typeof Shape)[];
export declare function getMostSpecificShapesByType(node: NamedNode, baseShape?: typeof Shape | (typeof Shape)[]): (typeof Shape)[];