@faubulous/mentor-rdf
Version:
A library for working with RDF vocabularies with support for basic RDFS and OWL inference.
133 lines (132 loc) • 7.42 kB
TypeScript
import { Store } from "./store";
import { QueryOptions, DefinitionQueryOptions, TypedInstanceQueryOptions } from "./resource-repository";
import { ConceptRepository } from "./concept-repository";
/**
* A repository for retrieving classes from graphs.
*/
export declare class ClassRepository extends ConceptRepository {
constructor(store: Store);
/**
* Get all classes 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 classes in the repository.
*/
getClasses(graphUris: string | string[] | undefined, options?: DefinitionQueryOptions): string[];
/**
* Get the super classes of a given class.
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
* @param subjectUri URI of a class.
* @param options Optional query parameters.
* @returns An array of super classes of the given class, an empty array if the class has no super classes.
*/
getSuperClasses(graphUris: string | string[] | undefined, subjectUri: string, options?: DefinitionQueryOptions): string[];
/**
* Get the first discovered path from a given class to a root class.
* @param subjectUri URI of a class.
* @returns A string array containing the first path that is found from the given class to a root class.
*/
getRootClassPath(graphUris: string | string[] | undefined, subjectUri: string, options?: DefinitionQueryOptions): string[];
/**
* Recursively find the first path from a given class to a root class.
* @param subjectUri URI of a class.
* @param path The current class path.
* @param backtrack Set of URIs that have already been visited.
* @returns The first path that is found from the given class to a root class.
*/
private _getRootClassPath;
/**
* Indicate if there are sub classes of a given class.
* @param subjectUri URI of a class.
* @returns true if the class has sub classes, false otherwise.
*/
hasSubClasses(graphUris: string | string[] | undefined, subjectUri: string, options?: DefinitionQueryOptions): boolean;
/**
* Get the sub classes of a given class or all root classes.
* @param subjectUri URI of a class or undefined to get all root classes.
* @returns An array of sub classes of the given class, an empty array if the class has no sub classes.
*/
getSubClasses(graphUris: string | string[] | undefined, subjectUri?: string, options?: DefinitionQueryOptions): string[];
/**
* Recursively traverse all sub classes of a given class and invoke a callback.
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
* @param superClass The super class to start the traversal from.
* @param callback A function to call for each sub class. If the function returns `false`, the traversal stops.
* @param options Optional query parameters.
* @param visited A set of visited URIs.
* @returns `true` if the traversal was completed, `false` if it was stopped by the callback.
*/
private _traverseSubClasses;
/**
* Get all sub classes of a given class, including indirect sub classes.
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
* @param subjectUri URI of a class.
* @param options Optional query parameters.
* @returns An array of all sub classes of the given class.
*/
getAllSubClasses(graphUris: string | string[] | undefined, subjectUri: string, options?: DefinitionQueryOptions): string[];
/**
* Indicate if there are instances of a given class or any of its sub classes.
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
* @param typeUri URI of the class.
* @param options Optional query parameters.
* @returns `true` if the class has instances, `false` otherwise.
*/
hasSubjectsOfType(graphUris: string | string[] | undefined, typeUri: string, options?: DefinitionQueryOptions & TypedInstanceQueryOptions): boolean;
/**
* Get all subjects of a given class in the repository.
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
* @param typeUri URI of the class.
* @param options Optional query parameters.
* @returns A list of all shapes in the repository.
*/
getSubjectsOfType(graphUris: string | string[] | undefined, typeUri: string, options?: DefinitionQueryOptions & TypedInstanceQueryOptions): string[];
/**
* Indicate if a given class is direct or indirect (inferred) sub class of another class.
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
* @param subjectUri URI of the sub class.
* @param classUri URI of the super class.
* @param options Optional query parameters.
* @returns `true` if the class is a sub class of the other class, false otherwise.
*/
isSubClassOf(graphUris: string | string[] | undefined, subjectUri: string, classUri: string, options?: DefinitionQueryOptions): boolean;
/**
* Indicate if a given class is the intersection of classes.
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
* @param subjectUri URI of a class.
* @returns `true` if the class is the intersection of classes, `false` otherwise.
*/
isIntersectionOfClasses(graphUris: string | string[] | undefined, subjectUri: string): boolean;
private _isIntersectionOfClasses;
/**
* Indicate if a given class is a (disjoint) union of classes.
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
* @param subjectUri URI of a class.
* @returns `true` if the class is a (disjoint) union of classes, `false` otherwise.
*/
isUnionOfClasses(graphUris: string | string[] | undefined, subjectUri: string): boolean;
private _isUnionOfClasses;
/**
* Get all classes from the repository that have no super classes.
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
* @param options Optional query parameters.
* @returns An array of root classes in the repository.
*/
getRootClasses(graphUris: string | string[] | undefined, options?: DefinitionQueryOptions): string[];
/**
* Indicate if there is an equivalent class of a given class.
* @param graphUris URIs of the graphs to search, `undefined` for the default graph.
* @param subjectUri URI of a class.
* @param options Optional query parameters.
* @returns `true` if the class has an equivalent class, `false` otherwise.
*/
hasEquivalentClass(graphUris: string | string[] | undefined, subjectUri: string, options?: QueryOptions): boolean;
/**
* Indicate if a given class has at least one individual defined for it or for one of its sub classes.
* @param graphUris Graph URIs to search in, undefined for the default graph.
* @param classUri URI of a class.
* @param options Optional query parameters.
* @returns `true` if the class has individuals, `false` otherwise.
*/
hasIndividuals(graphUris: string | string[] | undefined, classUri: string, options?: DefinitionQueryOptions): boolean;
}