@faubulous/mentor-rdf
Version:
A library for working with RDF vocabularies with support for basic RDFS and OWL inference.
48 lines (47 loc) • 2.29 kB
TypeScript
import * as rdfjs from "@rdfjs/types";
import { Reasoner } from "../reasoners/reasoner";
import { Store } from "../store";
/**
* Get the URL of a file.
* @param filePath A file system path.
* @returns A URL to the file.
*/
export declare function pathToFileURL(filePath: string): string;
/**
* Read the content of a file.
* @param filePath A file path.
* @returns The content of the file as a string.
*/
export declare function readFile(filePath: string): Promise<string>;
/**
* Load a Turtle or N3 file into a store.
* @param store An RDF store.
* @param filePath Path to a file containing RDF triples in Turtle or N3 format.
* @param onQuad Callback function that will be called for each parsed triple.
* @returns A promise that resolves to the URI of the graph that was loaded.
*/
export declare function loadFile(store: Store, filePath: string, graphUri?: string, onQuad?: (quad: rdfjs.Quad) => void): Promise<string>;
/**
* Create a RDF triple store from a string.
* @param filePath Path to a file containing RDF triples in Turtle or N3 format.
* @param reasoner A reasoner to be used with the store.
* @param onQuad Callback function that will be called for each parsed triple.
* @returns A promise that resolves to an RDF store.
*/
export declare function createStoreFromString(filePath: string, reasoner?: Reasoner, onQuad?: (quad: rdfjs.Quad) => void): Promise<Store>;
/**
* Create a RDF triple store from a file.
* @param path Path to a file containing RDF triples in Turtle or N3 format.
* @param reasoner A reasoner to be used with the store.
* @param onQuad Callback function that will be called for each parsed triple.
* @returns A promise that resolves to an RDF store.
*/
export declare function createStoreFromFile(filePath: string, reasoner?: Reasoner, onQuad?: (quad: rdfjs.Quad) => void): Promise<Store>;
/**
* Create a RDF triple store from a file.
* @param path Path to a file containing RDF triples in Turtle or N3 format.
* @param reasoner A reasoner to be used with the store.
* @param onQuad Callback function that will be called for each parsed triple.
* @returns A promise that resolves to an RDF store.
*/
export declare function createStoreFromXmlFile(filePath: string, reasoner?: Reasoner, onQuad?: (quad: rdfjs.Quad) => void): Promise<Store>;