@ldhop/core
Version:
Follow your nose through linked data resources - core
31 lines (30 loc) • 1.14 kB
TypeScript
import type { ParserOptions } from 'n3';
import { Quad } from 'n3';
import type { PromiseType, Required } from 'utility-types';
import type { QueryAndStore } from '../index.js';
import { LdhopEngine } from '../LdhopEngine.js';
import type { Variable } from '../types.js';
type URI = string;
export type Fetch = typeof globalThis.fetch;
export declare const getContainer: (uri: URI) => URI;
export declare const removeHashFromURI: (uri: URI) => URI;
/**
* Fetch rdf document
* parse it into rdf Dataset
* add document url as graph
*/
export declare const fetchRdfDocument: (uri: URI, fetch: Fetch) => Promise<{
data: Quad[];
rawData: string;
hash: string;
ok: boolean;
statusCode: number;
response: Response | undefined;
}>;
export type FetchRdfReturnType = PromiseType<ReturnType<typeof fetchRdfDocument>>;
export declare const parseRdfToQuads: (data: string, options: Required<ParserOptions, "baseIRI">) => Quad[];
/**
* Follow your nose through the linked data graph by query
*/
export declare const run: <V extends Variable>(engine: LdhopEngine<V> | QueryAndStore<V>, fetch: Fetch) => Promise<void>;
export {};