UNPKG

sparnatural

Version:

Visual client-side SPARQL query builder and knowledge graph exploration tool

127 lines (126 loc) 3.31 kB
export interface SparnaturalQueryIfc { distinct?: boolean; variables: Array<VariableTerm | VariableExpression>; order?: Order; branches: Array<Branch>; limit?: number; metadata?: { id?: string; lang?: string; label?: { [key: string]: string; }; description?: { [key: string]: string; }; [key: string]: any; }; } export interface Branch { line: CriteriaLine; children?: Array<Branch> | undefined; optional?: boolean; notExists?: boolean; } export interface VariableTerm { termType: "Variable"; value: string; } export interface VariableExpression { expression: { type: "aggregate"; aggregation: string; distinct: boolean; expression: VariableTerm; }; variable: VariableTerm; } export interface CriteriaLine { s: string; p: string; o: string; sType: string; oType: string; criterias?: LabelledCriteria<Criteria>[]; } export interface LabelledCriteria<T extends Criteria> { label: string; criteria: T; } export type Criteria = RdfTermCriteria | DateCriteria | BooleanCriteria | MapCriteria | NumberCriteria | SearchCriteria; export interface RdfTermCriteria { rdfTerm: RDFTerm; } export interface DateCriteria { start?: string | undefined; stop?: string | undefined; } export interface BooleanCriteria { boolean: boolean; } export interface MapCriteria { coordType: 'Polygon' | 'Rectangle'; coordinates: LatLng[][]; } export interface NumberCriteria { min?: number | undefined; max?: number | undefined; } export interface SearchCriteria { search: string; } export interface LatLng { lat: number; lng: number; alt?: number | undefined; } /** * Generic RDFTerm value structure, either an IRI or a Literal with lang or datatype */ export interface RDFTerm { type: 'literal' | 'uri' | 'bnode'; value: string; "xml:lang"?: string; datatype?: string; } export declare enum Order { ASC = "asc", DESC = "desc", NOORDER = "noord" } export declare enum AggregateFunction { COUNT = "count", MAX = "max", MIN = "min", SUM = "sum", GROUP_CONCAT = "group_concat", SAMPLE = "sample", AVG = "avg" } /** * @param t1 * @param t2 * @returns true if both RDF term are equal (same type, same value, same datatype, same language) */ export declare function sameTerm(t1: RDFTerm, t2: RDFTerm): boolean; export declare enum CriteriaType { RdfTermCriteria = "RdfTermCriteria", DateCriteria = "DateCriteria", BooleanCriteria = "BooleanCriteria", MapCriteria = "MapCriteria", NumberCriteria = "NumberCriteria", SearchCriteria = "SearchCriteria" } /** * Returns the type name of the given WidgetValue. * @param value The WidgetValue to check. * @returns The type name as a string ("MapValue", "RdfTermValue", etc.), or undefined if unknown. */ export declare function getCriteriaType(value: Criteria): CriteriaType | undefined; /** * Tests the equality of two WidgetValue objects. * @param v1 The first WidgetValue. * @param v2 The second WidgetValue. * @returns True if both values are equal, false otherwise. */ export declare function equalsCriteria(v1: Criteria, v2: Criteria): boolean;