UNPKG

extract-cbd-shape

Version:

Extract an entity based on CBD and a SHACL shape

75 lines (74 loc) 3.36 kB
import { Quad, Term } from "@rdfjs/types"; import { RdfStore } from "rdf-stores"; import { CbdExtracted } from "./CBDShapeExtractor"; export interface Path { literalType?: 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 PredicatePath implements Path { literalType?: Term; private predicate; constructor(predicate: Term, literalType?: 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 { literalType?: Term; private sequence; constructor(sequence: Path[], literalType?: Term); 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 { literalType?: Term; private alternatives; constructor(alternatives: Path[], literalType?: Term); 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 { literalType?: Term; private path; constructor(path: Path, literalType?: Term); 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 { literalType?: Term; protected path: Path; private maxCount?; protected constructor(path: Path, maxCount?: number, literalType?: Term); 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, literalType?: Term); filter(times: number, _res: PathResult): boolean; toString(): string; found(cbd: CbdExtracted, inverse?: boolean): CbdExtracted | undefined; } export declare class ZeroOrMorePath extends MultiPath { constructor(path: Path, literalType?: Term); filter(_times: number, _res: PathResult): boolean; toString(): string; found(cbd: CbdExtracted, inverse?: boolean): CbdExtracted | undefined; } export declare class ZeroOrOnePath extends MultiPath { constructor(path: Path, literalType?: Term); 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; }