UNPKG

rdf-validate-shacl

Version:
55 lines (54 loc) 2.24 kB
import type { DatasetCore, NamedNode, Term } from '@rdfjs/types'; import type { AnyPointer } from 'clownface'; import type { Environment } from './src/defaultEnv.js'; import type { Namespaces } from './src/namespaces.js'; import ShapesGraph from './src/shapes-graph.js'; import type { ValidatorRegistry } from './src/validation-engine.js'; import ValidationEngine from './src/validation-engine.js'; import type { ShaclPropertyPath } from './src/property-path.js'; interface Options { factory?: Environment; /** * Max number of errors before the engine stops. Defaults to finding all the errors. */ maxErrors?: number; allowNamedNodeInList?: boolean; importGraph?: (url: NamedNode) => Promise<DatasetCore> | DatasetCore; } /** * Validates RDF data based on a set of RDF shapes. */ declare class SHACLValidator { factory: Environment; ns: Namespaces; allowNamedNodeInList: boolean; $shapes: AnyPointer; $data: AnyPointer; shapesGraph: ShapesGraph; validationEngine: ValidationEngine; depth: number; importGraph?: (url: NamedNode) => Promise<DatasetCore> | DatasetCore; validators: ValidatorRegistry; private importsLoaded; /** * @param shapes - Dataset containing the SHACL shapes for validation * @param {object} [options] - Validator options */ constructor(shapes: DatasetCore, options: Options); /** * Validates the provided data graph against the provided shapes graph */ validate(dataGraph: DatasetCore | AnyPointer): Promise<import("./src/validation-report.js").ValidationReport>; /** * Validates the provided focus node against the provided shape */ validateNode(dataGraph: DatasetCore | AnyPointer, focusNode: Term, shapeNode: Term): Promise<import("./src/validation-report.js").ValidationReport>; private setDataGraph; /** * Exposed to be available from validation functions as `SHACL.nodeConformsToShape` */ nodeConformsToShape(focusNode: Term, shapeNode: Term, propertyPathOrEngine?: ValidationEngine | ShaclPropertyPath | null): boolean; validateNodeAgainstShape(focusNode: Term, shapeNode: Term): boolean; private loadOwlImports; } export default SHACLValidator;