UNPKG

@faubulous/mentor-rdf

Version:

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

100 lines (99 loc) 5.22 kB
import * as n3 from "n3"; import { ClassRepository } from "./class-repository"; import { Store } from "./store"; import { DefinitionQueryOptions } from "./resource-repository"; /** * A repository for retrieving properties from graphs. */ export declare class PropertyRepository extends ClassRepository { /** * The predicate used to indicate the domain of a property. */ domainPredicate: n3.NamedNode<"http://www.w3.org/2000/01/rdf-schema#domain">; /** * The predicate used to indicate the range of a property. */ rangePredicate: n3.NamedNode<"http://www.w3.org/2000/01/rdf-schema#range">; constructor(store: Store); /** * Get all properties in the repository. * @param options Optional options for retrieving properties. * @returns A list of all properties in the repository. */ getProperties(graphUris: string | string[] | undefined, options?: DefinitionQueryOptions): string[]; /** * Get properties of a given type. * @param typeUri URI of a property type. * @param includeInferred Indicate if properties of a more specific type should be included in the result. * @returns A list of properties of the given type. */ getRootPropertiesOfType(graphUris: string | string[] | undefined, typeUri: string, options?: DefinitionQueryOptions): string[]; /** * Get the super properties of a given property. * @param subjectUri URI of a property. * @param options Optional options for retrieving properties. * @returns An array of super properties of the given property, an empty array if the property has no super properties. */ getSuperProperties(graphUris: string | string[] | undefined, subjectUri: string, options?: DefinitionQueryOptions): string[]; /** * Recursively find the first path from a given property to a root property. * @param subjectUri URI of a property. * @param path The current property path. * @param backtrack Set of URIs that have already been visited. * @param options Optional options for retrieving properties. * @returns The first path that is found from the given property to a root class. */ private _getRootPropertyPath; /** * Get the first discovered path from a given property to a root property. * @param subjectUri URI of a property. * @param options Optional options for retrieving properties. * @returns A string array containing the first path that is found from the given property to a root property. */ getRootPropertiesPath(graphUris: string | string[] | undefined, subjectUri: string, options?: DefinitionQueryOptions): string[]; /** * Indicate if there are sub properties of a given property. * @param subjectUri URI of a property. * @param options Optional options for retrieving properties. * @returns true if the property has sub properties, false otherwise. */ hasSubProperties(graphUris: string | string[] | undefined, subjectUri: string, options?: DefinitionQueryOptions): boolean; /** * Get the sub properties of a given property or all root properties. * @param subjectUri URI of a property or undefined to get all root properties. * @param options Optional options for retrieving properties. * @returns An array of sub properties of the given property, an empty array if the property has no sub properties. */ getSubProperties(graphUris: string | string[] | undefined, subjectUri?: string, options?: DefinitionQueryOptions): string[]; /** * Get all properties from the repository that have no super properties. * @param options Optional options for retrieving properties. * @returns An array of root properties in the repository. */ getRootProperties(graphUris: string | string[] | undefined, options?: DefinitionQueryOptions): string[]; /** * Indicate if there is an equivalent property of a given property. * @param propertyUri URI of a property. * @returns true if the property has an equivalent property, false otherwise. */ hasEquivalentProperty(graphUris: string | string[] | undefined, propertyUri: string): boolean; /** * Get the domain of a given property. * @param propertyUri URI of a property. * @returns The URI of the domain of the given property. If no domain is specified, rdfs:Resource is returned. */ getDomain(graphUris: string | string[] | undefined, propertyUri: string): string; /** * Get the range of a given property. * @param propertyUri URI of a property. * @returns The URI of the range of the given property. If no range is specified, `undefined` is returned. */ getRange(graphUris: string | string[] | undefined, propertyUri: string): string | undefined; /** * Get all asserted and inferred property types. * @param graphUris The URI of the graph or an array of graphs to search for property types. * @param options Optional options for retrieving properties. * @returns A list of all property types in the repository. */ getPropertyTypes(graphUris: string | string[] | undefined, options?: DefinitionQueryOptions): string[]; }