rdf-dataset-fragmenter
Version:
Fragments an RDF dataset into multiple parts
47 lines (46 loc) • 2.17 kB
TypeScript
import type * as RDF from '@rdfjs/types';
import type { QuadTermName } from 'rdf-terms';
import type { IQuadSink } from '../io/IQuadSink';
/**
* Buffers quads with blank nodes keys, and makes connections to non-blank node keys.
*/
export declare class FragmentationBlankNodeBuffer<TA extends QuadTermName, TB extends QuadTermName> {
private readonly keyKey;
private readonly keyValue;
private readonly valueKeyLinks;
private readonly pendingBlankKeyQuads;
private readonly eagerFlushing;
/**
* @param keyKey @ignored The quad term key that should be checked for blank nodes.
* @param keyValue @ignored The quad term value that may have a connection to the key.
* @param eagerFlushing @ignored If the pending quads in the buffer should be flushed as soon as possible.
*/
constructor(keyKey: TA, keyValue: TB, eagerFlushing: boolean);
/**
* Add the given quad into the buffer.
* If the quad's key is a blank node, it will be stored inside the internal buffer.
* @param quad An RDF quad.
* @param quadSink The quad sink to push into.
*/
push(quad: RDF.Quad, quadSink: IQuadSink): Promise<void>;
/**
* If the given term value is a blank node, it will be stored in the internal link registry.
* @param value A quad value term.
* @param key A quad key term.
* @param quadSink The quad sink to push into.
*/
materializeValueForNamedKey(value: RDF.Term, key: RDF.NamedNode, quadSink: IQuadSink): Promise<void>;
/**
* Try to flush all quads connected to the given blank node label.
* All flushed quads will be removed from the queue (`pendingBlankKeyQuads`).
* The value key links will remain unchanged.
* @param blankNodeLabel A blank node label.
* @param quadSink The sink to push into.
*/
protected attemptFlushQuadsForLabel(blankNodeLabel: string, quadSink: IQuadSink): Promise<boolean>;
/**
* Iterate over the buffer, and emit all quads with blank node keys that have a connection to a non-blank node key.
* @param quadSink The quad sink to push into.
*/
flush(quadSink: IQuadSink): Promise<void>;
}