extract-cbd-shape
Version:
Extract an entity based on CBD and a SHACL shape
69 lines (68 loc) • 3.06 kB
TypeScript
import { Quad, Term } from "@rdfjs/types";
import { RdfStore } from "rdf-stores";
import { CbdExtracted } from "./CBDShapeExtractor";
export interface Path {
toString(): string;
found(cbd: CbdExtracted, inverse?: boolean): CbdExtracted | undefined;
match(store: RdfStore, extracted: CbdExtracted, focusNode: Term, graphsToIgnore?: Array<string>, inverse?: boolean): PathResult[];
}
export declare class PredicatePath implements Path {
private predicate;
constructor(predicate: Term);
toString(): string;
found(cbd: CbdExtracted, inverse?: boolean): CbdExtracted | undefined;
match(store: RdfStore, extracted: CbdExtracted, focusNode: Term, graphsToIgnore: Array<string>, inverse?: boolean): PathResult[];
}
export declare class SequencePath implements Path {
private sequence;
constructor(sequence: Path[]);
found(cbd: CbdExtracted, inverse?: boolean): CbdExtracted | undefined;
toString(): string;
match(store: RdfStore, extracted: CbdExtracted, focusNode: Term, graphsToIgnore: Array<string>, inverse?: boolean): PathResult[];
}
export declare class AlternativePath implements Path {
private alternatives;
constructor(alternatives: Path[]);
found(cbd: CbdExtracted, inverse?: boolean): CbdExtracted | undefined;
toString(): string;
match(store: RdfStore, extracted: CbdExtracted, focusNode: Term, graphsToIgnore: Array<string>, inverse?: boolean): PathResult[];
}
export declare class InversePath implements Path {
private path;
constructor(path: Path);
found(cbd: CbdExtracted, inverse?: boolean): CbdExtracted | undefined;
toString(): string;
match(store: RdfStore, extracted: CbdExtracted, focusNode: Term, graphsToIgnore: Array<string>, inverse?: boolean): PathResult[];
}
export declare abstract class MultiPath implements Path {
protected path: Path;
private maxCount?;
protected constructor(path: Path, maxCount?: number);
abstract filter(times: number, res: PathResult): boolean;
abstract toString(): string;
abstract found(cbd: CbdExtracted): CbdExtracted | undefined;
match(store: RdfStore, extracted: CbdExtracted, focusNode: Term, graphsToIgnore: Array<string>, inverse?: boolean): PathResult[];
}
export declare class OneOrMorePath extends MultiPath {
constructor(path: Path);
filter(times: number, _res: PathResult): boolean;
toString(): string;
found(cbd: CbdExtracted, inverse?: boolean): CbdExtracted | undefined;
}
export declare class ZeroOrMorePath extends MultiPath {
constructor(path: Path);
filter(_times: number, _res: PathResult): boolean;
toString(): string;
found(cbd: CbdExtracted, inverse?: boolean): CbdExtracted | undefined;
}
export declare class ZeroOrOnePath extends MultiPath {
constructor(path: Path);
filter(times: number, _res: PathResult): boolean;
toString(): string;
found(cbd: CbdExtracted, inverse?: boolean): CbdExtracted | undefined;
}
export interface PathResult {
path: Array<Quad>;
target: Term;
cbdExtracted: CbdExtracted;
}