@rubeneschauzier/rdf-stores
Version:
A TypeScript/JavaScript implementation of the RDF/JS store interface with support for quoted triples.
52 lines (51 loc) • 2.35 kB
TypeScript
import type { IRdfStoreOptions } from '../IRdfStoreOptions';
import type { EncodedQuadTerms, QuadPatternTerms, QuadTerms } from '../PatternTerm';
import { RdfStoreIndexNestedMap } from './RdfStoreIndexNestedMap';
export declare class RdfStoreIndexNestedMapSampling<E, V> extends RdfStoreIndexNestedMap<E, V> {
protected readonly protectedCountKey: symbol;
protected readonly protectedArrayKey: symbol;
readonly features: {
quotedTripleFiltering: boolean;
sampling: boolean;
};
constructor(options: IRdfStoreOptions<E>);
set(terms: EncodedQuadTerms<E>, value: V): boolean;
remove(terms: EncodedQuadTerms<E>): boolean;
find(terms: QuadPatternTerms): IterableIterator<QuadTerms>;
findEncoded(ids: EncodedQuadTerms<E | undefined>, terms: QuadPatternTerms): IterableIterator<EncodedQuadTerms<E>>;
count(terms: QuadPatternTerms): number;
/**
* Extracts triple patterns at given indexes. In GSPO index, if terms = [g0, s0, undefined, undefined]
* indexes = [1, 5] and index = g0: {s0:{ p1: [o1, o2], p2: [o3, o4], p3: [o5, o6] } } it will return (s0 p1 o2),
* (s0 p3 o6). Note that the indexes values should be lower than the number of triples existing at the
* non-undefined terms. So for terms [g0, s0, p1, undefined] indexes [1,5] would return nothing as # triples
* for the term = 2
* When passed a term: [undefined, s0, p0, o0] this method will use a slower method to do sampling, as the _size
* based sampling is no longer correct.
* @param terms
* @param n
* @param indexes
* @returns
*/
sample(terms: QuadPatternTerms, indexes: number[]): IterableIterator<QuadTerms>;
private sampleInOrder;
/**
* Function searching the key in a given map that contains the triple at a given index. Returns
* the value of the searchIndex and the key where the result will be located. This assumes that
* any key not undefined exists in the map.
* @param id
* @param map
* @param searchIndex
* @param index
* @returns the key of the map where the triple at index is located, and the incremented search index
*/
private searchMap;
private sampleOutOfOrder;
}
export interface ICount {
count: number;
}
export interface IMapSearchResult<E> {
key: E;
searchIndex: number;
}