sparnatural
Version:
Visual client-side SPARQL query builder and knowledge graph exploration tool
46 lines (45 loc) • 2.35 kB
TypeScript
import { LabelledCriteria, Criteria, RdfTermCriteria, BooleanCriteria, VariableExpression } from "../SparnaturalQueryIfc";
import { PatternBind, ObjectCriteria, GraphTerm, ValuePatternRow, LabelledFilter } from "../SparnaturalQueryIfc-v13";
/**
* e.g. TermIri or TermLiteral to LabelledCriteria<RdfTermCriteria>
* @param term The graph term to convert
* @returns The labelled criteria, or null if the term type is unsupported
*/
export declare function graphTermToLabelledCriteria(term: GraphTerm): LabelledCriteria<RdfTermCriteria | BooleanCriteria> | null;
/**
* Translates the object values in a v13 ObjectCriteria to labelled criteria in v1
* @param variableName The variable name to extract from each value row
* @param obj The ObjectCriteria containing the values
* @returns An array of labelled criteria
*/
export declare function translateObjectValues(variableName: string, obj: ObjectCriteria): LabelledCriteria<Criteria>[];
/**
* Translates v13 VALUES rows to labelled criteria in v1
* @param variableName The variable name to extract from each value row
* @param rows The VALUES rows
* @returns An array of labelled criteria
*/
export declare function translateValueRows(variableName: string, rows: ValuePatternRow[]): LabelledCriteria<Criteria>[];
/** Translates v13 labelled filters to v1 labelled criteria
* @param filters The labelled filters to translate
* @returns An array of labelled criteria
*/
export declare function translateFilters(filters: LabelledFilter[]): LabelledCriteria<Criteria>[];
/**
* Converts a v13 PatternBind to a v1 VariableExpression
* @param bind A v13 PatternBind
* @returns A v1 VariableExpression
*/
export declare function patternBindToVariableExpression(bind: PatternBind): VariableExpression;
/**
* Converts labelled criteria to labelled filters (v1 to v13)
* @param vals An array of labelled criteria v1
* @returns An array of labelled filters v13
*/
export declare function labelledCriteriaToFilters(vals: LabelledCriteria<Criteria>[]): LabelledFilter[];
/**
* Converts labelled criteria with RDFTerm to flat values (v1 to v13)
* @param vals An array of labelled criteria v1
* @returns An array of GraphTerm with label (TermLabelledIri or TermLiteral with label)
*/
export declare function labelledCriteriaToFlatValues(vals: LabelledCriteria<Criteria>[]): GraphTerm[];