UNPKG

@faubulous/mentor-rdf

Version:

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

132 lines (131 loc) 4.81 kB
import * as rdfjs from "@rdfjs/types"; /** * An RDF/JS compliant NamedNode implementation. */ export declare class NamedNode implements rdfjs.NamedNode { readonly termType: "NamedNode"; readonly value: string; constructor(value: string); equals(other: rdfjs.Term | null | undefined): boolean; } /** * An RDF/JS compliant BlankNode implementation. */ export declare class BlankNode implements rdfjs.BlankNode { readonly termType: "BlankNode"; readonly value: string; constructor(value: string); equals(other: rdfjs.Term | null | undefined): boolean; } /** * An RDF/JS compliant Literal implementation. */ export declare class Literal implements rdfjs.Literal { readonly termType: "Literal"; readonly value: string; readonly language: string; readonly datatype: rdfjs.NamedNode; constructor(value: string, languageOrDatatype?: string | rdfjs.NamedNode); equals(other: rdfjs.Term | null | undefined): boolean; } /** * An RDF/JS compliant Variable implementation. */ export declare class Variable implements rdfjs.Variable { readonly termType: "Variable"; readonly value: string; constructor(value: string); equals(other: rdfjs.Term | null | undefined): boolean; } /** * An RDF/JS compliant DefaultGraph implementation (singleton). */ export declare class DefaultGraph implements rdfjs.DefaultGraph { readonly termType: "DefaultGraph"; readonly value = ""; equals(other: rdfjs.Term | null | undefined): boolean; } /** * An RDF/JS compliant Quad implementation. */ export declare class Quad implements rdfjs.Quad { readonly termType: "Quad"; readonly value = ""; readonly subject: rdfjs.Quad_Subject; readonly predicate: rdfjs.Quad_Predicate; readonly object: rdfjs.Quad_Object; readonly graph: rdfjs.Quad_Graph; constructor(subject: rdfjs.Quad_Subject, predicate: rdfjs.Quad_Predicate, object: rdfjs.Quad_Object, graph?: rdfjs.Quad_Graph); equals(other: rdfjs.Term | null | undefined): boolean; } /** * An RDF/JS compliant DataFactory implementation. * * This factory provides methods to create RDF terms (named nodes, blank nodes, literals, variables) * and quads according to the RDF/JS specification. * * @see https://rdf.js.org/data-model-spec/ */ export declare class DataFactory implements rdfjs.DataFactory<rdfjs.Quad, rdfjs.Quad> { blankNodeCounter: number; /** * Creates a new named node with the given IRI. * @param value The IRI of the named node. * @returns A new NamedNode instance. */ namedNode<Iri extends string = string>(value: Iri): rdfjs.NamedNode<Iri>; /** * Creates a new blank node with the given identifier. * If no identifier is provided, a unique one will be generated. * @param value Optional blank node identifier. * @returns A new BlankNode instance. */ blankNode(value?: string): rdfjs.BlankNode; /** * Creates a new literal with the given value and optional language tag or datatype. * @param value The lexical value of the literal. * @param languageOrDatatype Either a language tag (string) or a datatype (NamedNode). * @returns A new Literal instance. */ literal(value: string, languageOrDatatype?: string | rdfjs.NamedNode): rdfjs.Literal; /** * Creates a new variable with the given name. * @param value The name of the variable (without the leading '?'). * @returns A new Variable instance. */ variable(value: string): rdfjs.Variable; /** * Returns the singleton default graph instance. * @returns The default graph instance. */ defaultGraph(): rdfjs.DefaultGraph; /** * Creates a new quad with the given subject, predicate, object, and optional graph. * @param subject The subject of the quad. * @param predicate The predicate of the quad. * @param object The object of the quad. * @param graph The graph of the quad (defaults to the default graph). * @returns A new Quad instance. */ quad(subject: rdfjs.Quad_Subject, predicate: rdfjs.Quad_Predicate, object: rdfjs.Quad_Object, graph?: rdfjs.Quad_Graph): rdfjs.Quad; /** * Creates a copy of an existing term. * @param original The term to copy. * @returns A new term instance with the same value. */ fromTerm<T extends rdfjs.Term>(original: T): T; /** * Creates a copy of an existing quad. * @param original The quad to copy. * @returns A new quad instance with the same values. */ fromQuad(original: rdfjs.Quad): rdfjs.Quad; /** * Resets the blank node counter. Useful for testing. */ resetBlankNodeCounter(): void; } /** * A default DataFactory instance for convenient use. */ export declare const dataFactory: DataFactory;