-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathIQueryEngine.ts
More file actions
46 lines (41 loc) · 1.13 KB
/
IQueryEngine.ts
File metadata and controls
46 lines (41 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import type * as RDF from '@rdfjs/types';
/**
* A query engine handler.
*/
export interface IQueryEngine {
parse: (queryString: string, options: Record<string, any>) => Promise<void>;
query: (data: RDF.Quad[], queryString: string, options: Record<string, any>) => Promise<IQueryResult>;
}
/**
* Super type for all query result types.
*/
export type IQueryResult = IQueryResultBoolean | IQueryResultQuads | IQueryResultBindings;
/**
* Holds a boolean query result.
*/
export interface IQueryResultBoolean {
type: 'boolean';
value: boolean;
equals: (that: IQueryResult, laxCardinality?: boolean) => boolean;
toString: () => string;
}
/**
* Holds quad-based query results.
*/
export interface IQueryResultQuads {
type: 'quads';
value: RDF.Quad[];
equals: (that: IQueryResult, laxCardinality?: boolean) => boolean;
toString: () => string;
}
/**
* Holds bindings-based query results.
*/
export interface IQueryResultBindings {
type: 'bindings';
variables: string[];
value: Record<string, RDF.Term>[];
checkOrder: boolean;
equals: (that: IQueryResult, laxCardinality?: boolean) => boolean;
toString: () => string;
}