rdf-dataset-fragmenter
Version:
Fragments an RDF dataset into multiple parts
41 lines (40 loc) • 1.28 kB
TypeScript
import type { Writable } from 'node:stream';
import type * as RDF from '@rdfjs/types';
import type { IQuadSink } from './IQuadSink';
/**
* A quad sink that writes to files using an IRI to local file system path mapping.
*/
export declare class QuadSinkFile implements IQuadSink {
private readonly outputFormat;
private readonly iriToPath;
private readonly fileWriter;
protected readonly log: boolean;
protected readonly fileExtension?: string;
private counter;
constructor(options: IQuadSinkFileOptions);
protected attemptLog(newLine?: boolean): void;
protected getFilePath(iri: string): string;
protected getFileStream(path: string): Promise<Writable>;
push(iri: string, quad: RDF.Quad): Promise<void>;
close(): Promise<void>;
}
export interface IQuadSinkFileOptions {
/**
* The RDF format to output, expressed as mimetype.
*/
outputFormat: string;
/**
* Mapping of regular expressions to their replacements,
* for determining the file path from a given IRI.
* @range {json}
*/
iriToPath: Record<string, string>;
/**
* Whether to log quad handling progress.
*/
log?: boolean;
/**
* Optional file extension to use.
*/
fileExtension?: string;
}