UNPKG

@faubulous/mentor-rdf

Version:

A library for working with RDF vocabularies with support for basic RDFS and OWL inference.

114 lines (113 loc) 6.42 kB
import { Store } from "./store"; import { DefinitionQueryOptions, TypedInstanceQueryOptions } from "./resource-repository"; import { IndividualRepository } from "./individual-repository"; import { Quad_Subject } from "@rdfjs/types"; /** * A repository for retrieving SHACL shapes from graphs. */ export declare class ShapeRepository extends IndividualRepository { constructor(store: Store); /** * Get all shapes in the repository. * @param graphUris URIs of the graphs to search, `undefined` for the default graph. * @param options Optional query parameters. * @returns An iterable of all shapes in the repository. */ getShapes(graphUris: string | string[] | undefined, subjectUri?: string, options?: DefinitionQueryOptions): IterableIterator<string>; /** * Get all shape types in the repository. * @param graphUris URIs of the graphs to search, `undefined` for the default graph. * @param options Optional query parameters. * @returns A list of all shape types in the repository. */ getShapeTypes(graphUris: string | string[] | undefined, options?: DefinitionQueryOptions): IterableIterator<string>; /** * Get all validator types in the repository. * @param graphUris URIs of the graphs to search, `undefined` for the default graph. * @param options Optional query parameters. * @returns An iterable of all shape types in the repository. */ getValidatorTypes(graphUris: string | string[] | undefined, options?: DefinitionQueryOptions): IterableIterator<string>; /** * Get all target classes, nodes or properties of a given shape in the repository. * @param graphUris URIs of the graphs to search, `undefined` for the default graph. * @param shape The URI or blank id of the shape. * @param options Optional query parameters. * @returns An iterable of all targeted resources in the repository. */ getShapeTargets(graphUris: string | string[] | undefined, shape: Quad_Subject, options?: DefinitionQueryOptions): IterableIterator<string>; /** * Indicate if there are shapes for a subject in the repository. * @param graphUris URIs of the graphs to search, `undefined` for the default graph. * @param subjectUri The URI of the subject. * @param options Optional query parameters. * @returns `true` if there are shapes for the subject, `false` otherwise. */ hasShapes(graphUris: string | string[] | undefined, subjectUri: string, options?: DefinitionQueryOptions): boolean; /** * Indicate if there validators defined in the vocabulary. * @param graphUris URIs of the graphs to search, `undefined` for the default graph. * @param options Optional query parameters. * @returns A list of all validators in the repository. */ hasValidators(graphUris: string | string[] | undefined, options?: DefinitionQueryOptions & TypedInstanceQueryOptions): boolean; /** * Get all validators in the repository. * @param graphUris URIs of the graphs to search, `undefined` for the default graph. * @param options Optional query parameters. * @returns A list of all validators in the repository. */ getValidators(graphUris: string | string[] | undefined, options?: DefinitionQueryOptions & TypedInstanceQueryOptions): IterableIterator<string>; /** * Indicate if there are rules in the repository. * @param graphUris URIs of the graphs to search, `undefined` for the default graph. * @param subjectUri The URI of the subject. * @param options Optional query parameters. * @returns `true` if there are rules for the subject, `false` otherwise. */ hasRules(graphUris: string | string[] | undefined, options?: DefinitionQueryOptions & TypedInstanceQueryOptions): boolean; /** * Get all rules in the repository. * @param graphUris URIs of the graphs to search, `undefined` for the default graph. * @param options Optional query parameters. * @returns A list of all rules in the repository. */ getRules(graphUris: string | string[] | undefined, options?: DefinitionQueryOptions & TypedInstanceQueryOptions): IterableIterator<string>; /** * Get the SHACL datatype of a given property. * @param graphUris URIs of the graphs to search, `undefined` for the default graph. * @param subjectUri The URI of the subject. * @param options Optional query parameters. * @returns A datatype URI on success, `xsd:anyURI` otherwise. */ getDatatype(graphUris: string | string[] | undefined, subjectUri: string, options?: DefinitionQueryOptions): string | undefined; /** * Get the SHACL cardinality constraints of a given property. * @param graphUris URIs of the graphs to search, `undefined` for the default graph. * @param subjectUri The URI of the subject. * @param options Optional query parameters. * @returns An object with the minimum and maximum cardinalities; values are `-1` if not found. */ getCardinalites(graphUris: string | string[] | undefined, subjectUri: string, options?: DefinitionQueryOptions): { minCount: number; maxCount: number; }; /** * Get the RDF property path representation of the given SHACL property path. This method parses the SHACL property path and * returns the RDF property path as a combination of nodes and strings. * @param graphUris URIs of the graphs to search, `undefined` for the default graph. * @param subject The URI or blank id of the node referred to by sh:path. * @param options Optional query parameters. * @returns A flattened list of all path components, either as URIs or as strings. */ getPropertyPathTokens(graphUris: string | string[] | undefined, subject: Quad_Subject): (string | Quad_Subject)[]; /** * Get the first discovered path from a given shape class to the sh:Shape root. * @param graphUris URIs of the graphs to search (should include the SHACL ontology graph). * @param subjectUri URI of a shape class. * @param options Optional query parameters. * @returns An iterator containing the path from the given class up to sh:Shape. */ getRootShapePath(graphUris: string | string[] | undefined, subjectUri: string, options?: DefinitionQueryOptions): IterableIterator<string>; private _getRootShapePath; }