UNPKG

rdf-validate-shacl

Version:
42 lines (41 loc) 1.47 kB
import type { AnyPointer, MultiPointer } from 'clownface'; import type { Term } from '@rdfjs/types'; import type { Namespaces } from './namespaces.js'; export type ShaclPropertyPath = Term | SequencePath | AlternativePath | InversePath | ZeroOrOnePath | ZeroOrMorePath | OneOrMorePath; type SequencePath = ShaclPropertyPath[]; type AlternativePath = { or: ShaclPropertyPath[]; }; type InversePath = { inverse: ShaclPropertyPath; }; type ZeroOrOnePath = { zeroOrOne: ShaclPropertyPath; }; type ZeroOrMorePath = { zeroOrMore: ShaclPropertyPath; }; type OneOrMorePath = { oneOrMore: ShaclPropertyPath; }; /** * Extracts all the nodes of a property path from a graph and returns a * property path object. * * @param pathNode - Pointer to the start node of the path * @param ns - Namespaces * @param allowNamedNodeInList - Allow named node in lists. By default, only blank nodes are allowed * @return Property path object */ export declare function extractPropertyPath(pathNode: MultiPointer, ns: Namespaces, allowNamedNodeInList: boolean): ShaclPropertyPath; /** * Follows a property path in a graph, starting from a given node, and returns * all the nodes it points to. * * @param graph * @param subject - Start node * @param path - Property path object * @return - Nodes that are reachable through the property path */ export declare function getPathObjects(graph: AnyPointer, subject: Term, path: ShaclPropertyPath): Term[]; export {};