@manta-eu/datalog-parser 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +57 -0
- package/dist/index.d.ts +1599 -0
- package/dist/index.js +2871 -0
- package/package.json +59 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1599 @@
|
|
|
1
|
+
import { CstNode } from 'chevrotain';
|
|
2
|
+
import { CstParser } from 'chevrotain';
|
|
3
|
+
import { ICstVisitor } from 'chevrotain';
|
|
4
|
+
import { ILexingResult } from 'chevrotain';
|
|
5
|
+
import { IToken } from 'chevrotain';
|
|
6
|
+
import { ParserMethod } from 'chevrotain';
|
|
7
|
+
import { TokenType } from 'chevrotain';
|
|
8
|
+
import { UpdateOperation } from '@traqula/rules-sparql-1-1';
|
|
9
|
+
|
|
10
|
+
export declare type AdditiveExpressionCstChildren = {
|
|
11
|
+
multiplicativeExpression: MultiplicativeExpressionCstNode[];
|
|
12
|
+
PLUS?: IToken[];
|
|
13
|
+
MINUS?: IToken[];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export declare interface AdditiveExpressionCstNode extends CstNode {
|
|
17
|
+
name: "additiveExpression";
|
|
18
|
+
children: AdditiveExpressionCstChildren;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export declare const AGGREGATE: TokenType;
|
|
22
|
+
|
|
23
|
+
export declare type AggregateBindCstChildren = {
|
|
24
|
+
BIND?: IToken[];
|
|
25
|
+
aggregateFunction?: AggregateFunctionCstNode[];
|
|
26
|
+
expression?: ExpressionCstNode[];
|
|
27
|
+
AS: IToken[];
|
|
28
|
+
VARIABLE?: IToken[];
|
|
29
|
+
groundedAsTarget?: GroundedAsTargetCstNode[];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export declare interface AggregateBindCstNode extends CstNode {
|
|
33
|
+
name: "aggregateBind";
|
|
34
|
+
children: AggregateBindCstChildren;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export declare type AggregateBinding = AggregateFunctionBinding | ExpressionAggregateBinding;
|
|
38
|
+
|
|
39
|
+
export declare type AggregateBindingTarget = {
|
|
40
|
+
/** Target variable name without its `?`, or the value's text when `groundedTarget` is set. */
|
|
41
|
+
variable: string;
|
|
42
|
+
/** Set only when the expanded grammar read a value in `AS` position, as RDFox's grounded rules do. */
|
|
43
|
+
groundedTarget?: DatalogTerm;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export declare type AggregateCstChildren = {
|
|
47
|
+
AGGREGATE: IToken[];
|
|
48
|
+
LPAREN: IToken[];
|
|
49
|
+
atomList?: AtomListCstNode[];
|
|
50
|
+
onClause?: OnClauseCstNode[];
|
|
51
|
+
aggregateBind?: AggregateBindCstNode[];
|
|
52
|
+
RPAREN: IToken[];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export declare interface AggregateCstNode extends CstNode {
|
|
56
|
+
name: "aggregate";
|
|
57
|
+
children: AggregateCstChildren;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export declare type AggregateFunction = UnaryAggregateFunction | BinaryAggregateFunction;
|
|
61
|
+
|
|
62
|
+
export declare type AggregateFunction1CstChildren = {
|
|
63
|
+
COUNT_MIN?: IToken[];
|
|
64
|
+
COUNT_MAX?: IToken[];
|
|
65
|
+
COUNT?: IToken[];
|
|
66
|
+
MIN?: IToken[];
|
|
67
|
+
MAX?: IToken[];
|
|
68
|
+
SUM?: IToken[];
|
|
69
|
+
MUL?: IToken[];
|
|
70
|
+
AVG?: IToken[];
|
|
71
|
+
LPAREN: IToken[];
|
|
72
|
+
DISTINCT?: IToken[];
|
|
73
|
+
STAR?: IToken[];
|
|
74
|
+
expression?: ExpressionCstNode[];
|
|
75
|
+
RPAREN: IToken[];
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export declare interface AggregateFunction1CstNode extends CstNode {
|
|
79
|
+
name: "aggregateFunction1";
|
|
80
|
+
children: AggregateFunction1CstChildren;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export declare type AggregateFunction2CstChildren = {
|
|
84
|
+
MIN_ARGMIN?: IToken[];
|
|
85
|
+
MAX_ARGMIN?: IToken[];
|
|
86
|
+
MIN_ARGMAX?: IToken[];
|
|
87
|
+
MAX_ARGMAX?: IToken[];
|
|
88
|
+
LPAREN: IToken[];
|
|
89
|
+
DISTINCT?: IToken[];
|
|
90
|
+
firstExpr: ExpressionCstNode[];
|
|
91
|
+
COMMA: IToken[];
|
|
92
|
+
secondExpr: ExpressionCstNode[];
|
|
93
|
+
RPAREN: IToken[];
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export declare interface AggregateFunction2CstNode extends CstNode {
|
|
97
|
+
name: "aggregateFunction2";
|
|
98
|
+
children: AggregateFunction2CstChildren;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export declare type AggregateFunctionBinding = UnaryAggregateBinding | BinaryAggregateBinding;
|
|
102
|
+
|
|
103
|
+
export declare type AggregateFunctionCstChildren = {
|
|
104
|
+
aggregateFunction1?: AggregateFunction1CstNode[];
|
|
105
|
+
aggregateFunction2?: AggregateFunction2CstNode[];
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export declare interface AggregateFunctionCstNode extends CstNode {
|
|
109
|
+
name: "aggregateFunction";
|
|
110
|
+
children: AggregateFunctionCstChildren;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export declare const allTokens: TokenType[];
|
|
114
|
+
|
|
115
|
+
export declare const AND: TokenType;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Check if two rules are semantically equivalent (ignoring whitespace)
|
|
119
|
+
*/
|
|
120
|
+
export declare function areRulesEquivalent(rule1: string, rule2: string): boolean;
|
|
121
|
+
|
|
122
|
+
export declare type ArgumentListCstChildren = {
|
|
123
|
+
expression: ExpressionCstNode[];
|
|
124
|
+
COMMA?: IToken[];
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export declare interface ArgumentListCstNode extends CstNode {
|
|
128
|
+
name: "argumentList";
|
|
129
|
+
children: ArgumentListCstChildren;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export declare const AS: TokenType;
|
|
133
|
+
|
|
134
|
+
export declare function assertNoGroundedTargets(body: DatalogBodyFormula[]): void;
|
|
135
|
+
|
|
136
|
+
export declare function astBuilder(): DatalogAstBuilder;
|
|
137
|
+
|
|
138
|
+
export declare const AT: TokenType;
|
|
139
|
+
|
|
140
|
+
export declare type AtomCstChildren = {
|
|
141
|
+
tupleTableAtom?: TupleTableAtomCstNode[];
|
|
142
|
+
filterAtom?: FilterAtomCstNode[];
|
|
143
|
+
bindAtom?: BindAtomCstNode[];
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export declare interface AtomCstNode extends CstNode {
|
|
147
|
+
name: "atom";
|
|
148
|
+
children: AtomCstChildren;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export declare type AtomListCstChildren = {
|
|
152
|
+
atom: AtomCstNode[];
|
|
153
|
+
COMMA?: IToken[];
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export declare interface AtomListCstNode extends CstNode {
|
|
157
|
+
name: "atomList";
|
|
158
|
+
children: AtomListCstChildren;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export declare function atomToDatalogText(atom: DatalogAtom, options?: DatalogTextOptions): string;
|
|
162
|
+
|
|
163
|
+
/** A rule AST that may be passed to SPARQL translators (excludes grounded ASTs). */
|
|
164
|
+
export declare type AuthoredDatalogRule = DatalogRule & {
|
|
165
|
+
grounded?: false;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export declare const AVG: TokenType;
|
|
169
|
+
|
|
170
|
+
export declare const BaseDatalogVisitor: new (...args: any[]) => ICstVisitor<any, any>;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Begin a read-write transaction on a connection
|
|
174
|
+
*/
|
|
175
|
+
export declare function beginTransaction(params: RDFoxTransactionParams): Promise<void>;
|
|
176
|
+
|
|
177
|
+
export declare type BinaryAggregateBinding = AggregateBindingTarget & {
|
|
178
|
+
function: BinaryAggregateFunction;
|
|
179
|
+
distinct?: boolean;
|
|
180
|
+
expression: DatalogExpression;
|
|
181
|
+
secondExpression: DatalogExpression;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export declare type BinaryAggregateFunction = "MIN_ARGMIN" | "MAX_ARGMIN" | "MIN_ARGMAX" | "MAX_ARGMAX";
|
|
185
|
+
|
|
186
|
+
export declare type BinaryExpression = {
|
|
187
|
+
type: "binary";
|
|
188
|
+
operator: "||" | "&&" | "=" | "!=" | "<" | ">" | "<=" | ">=" | "+" | "-" | "*" | "/";
|
|
189
|
+
left: DatalogExpression;
|
|
190
|
+
right: DatalogExpression;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export declare function binaryOperandNeedsParentheses(operand: DatalogExpression, parentOperator: BinaryExpression["operator"], side: "left" | "right"): boolean;
|
|
194
|
+
|
|
195
|
+
export declare const BIND: TokenType;
|
|
196
|
+
|
|
197
|
+
export declare type BindAtomCstChildren = {
|
|
198
|
+
BIND: IToken[];
|
|
199
|
+
LPAREN: IToken[];
|
|
200
|
+
expression: ExpressionCstNode[];
|
|
201
|
+
AS: IToken[];
|
|
202
|
+
VARIABLE?: IToken[];
|
|
203
|
+
groundedAsTarget?: GroundedAsTargetCstNode[];
|
|
204
|
+
RPAREN: IToken[];
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export declare interface BindAtomCstNode extends CstNode {
|
|
208
|
+
name: "bindAtom";
|
|
209
|
+
children: BindAtomCstChildren;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export declare const BLANK_NODE: TokenType;
|
|
213
|
+
|
|
214
|
+
export declare type BlankNodeTerm = {
|
|
215
|
+
type: "blank";
|
|
216
|
+
label: string;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export declare type BodyFormulaCstChildren = {
|
|
220
|
+
negation?: NegationCstNode[];
|
|
221
|
+
filterAtom?: FilterAtomCstNode[];
|
|
222
|
+
bindAtom?: BindAtomCstNode[];
|
|
223
|
+
aggregate?: AggregateCstNode[];
|
|
224
|
+
skolemAtom?: SkolemAtomCstNode[];
|
|
225
|
+
tupleTableAtom?: TupleTableAtomCstNode[];
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export declare interface BodyFormulaCstNode extends CstNode {
|
|
229
|
+
name: "bodyFormula";
|
|
230
|
+
children: BodyFormulaCstChildren;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export declare type BodyFormulaListCstChildren = {
|
|
234
|
+
bodyFormula: BodyFormulaCstNode[];
|
|
235
|
+
COMMA?: IToken[];
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
export declare interface BodyFormulaListCstNode extends CstNode {
|
|
239
|
+
name: "bodyFormulaList";
|
|
240
|
+
children: BodyFormulaListCstChildren;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export declare type BooleanLiteralCstChildren = {
|
|
244
|
+
TRUE?: IToken[];
|
|
245
|
+
FALSE?: IToken[];
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
export declare interface BooleanLiteralCstNode extends CstNode {
|
|
249
|
+
name: "booleanLiteral";
|
|
250
|
+
children: BooleanLiteralCstChildren;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export declare const booleanLiteralTokenTypes: Set<TokenType>;
|
|
254
|
+
|
|
255
|
+
export declare const builtinFunctionTokenTypes: Set<TokenType>;
|
|
256
|
+
|
|
257
|
+
export declare type ClassAssertion = {
|
|
258
|
+
className: string;
|
|
259
|
+
instance: DatalogTerm;
|
|
260
|
+
graph?: DatalogTerm;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export declare function classAssertionFromAtom(atom: DatalogAtom): ClassAssertion | null;
|
|
264
|
+
|
|
265
|
+
export declare type ClassAtom = {
|
|
266
|
+
type: "class";
|
|
267
|
+
className: string;
|
|
268
|
+
instance: DatalogTerm;
|
|
269
|
+
graph?: DatalogTerm;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
export declare function collectVariableTypeEvidence(ast: DatalogRule): VariableTypeEvidence[];
|
|
273
|
+
|
|
274
|
+
export declare const COLON: TokenType;
|
|
275
|
+
|
|
276
|
+
export declare const COMMA: TokenType;
|
|
277
|
+
|
|
278
|
+
export declare const COMMENT: TokenType;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Commit a transaction on a connection
|
|
282
|
+
*/
|
|
283
|
+
export declare function commitTransaction(params: RDFoxTransactionParams): Promise<void>;
|
|
284
|
+
|
|
285
|
+
export declare type ComparisonOperator = Extract<BinaryExpression["operator"], "=" | "!=" | "<" | ">" | "<=" | ">=">;
|
|
286
|
+
|
|
287
|
+
export declare const CONCAT: TokenType;
|
|
288
|
+
|
|
289
|
+
export declare type ConcatFunctionCstChildren = {
|
|
290
|
+
CONCAT: IToken[];
|
|
291
|
+
LPAREN: IToken[];
|
|
292
|
+
argumentList: ArgumentListCstNode[];
|
|
293
|
+
RPAREN: IToken[];
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
export declare interface ConcatFunctionCstNode extends CstNode {
|
|
297
|
+
name: "concatFunction";
|
|
298
|
+
children: ConcatFunctionCstChildren;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export declare type ConditionalAndExpressionCstChildren = {
|
|
302
|
+
relationalExpression: RelationalExpressionCstNode[];
|
|
303
|
+
AND?: IToken[];
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
export declare interface ConditionalAndExpressionCstNode extends CstNode {
|
|
307
|
+
name: "conditionalAndExpression";
|
|
308
|
+
children: ConditionalAndExpressionCstChildren;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export declare type ConditionalOrExpressionCstChildren = {
|
|
312
|
+
conditionalAndExpression: ConditionalAndExpressionCstNode[];
|
|
313
|
+
OR?: IToken[];
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
export declare interface ConditionalOrExpressionCstNode extends CstNode {
|
|
317
|
+
name: "conditionalOrExpression";
|
|
318
|
+
children: ConditionalOrExpressionCstChildren;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export declare const COUNT: TokenType;
|
|
322
|
+
|
|
323
|
+
export declare const COUNT_MAX: TokenType;
|
|
324
|
+
|
|
325
|
+
export declare const COUNT_MIN: TokenType;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Create a connection to a datastore
|
|
329
|
+
*/
|
|
330
|
+
export declare function createConnection(params: RDFoxConnectionParams): Promise<string>;
|
|
331
|
+
|
|
332
|
+
export declare type DatalogAggregate = {
|
|
333
|
+
type: "aggregate";
|
|
334
|
+
atoms: DatalogAggregateAtom[];
|
|
335
|
+
/**
|
|
336
|
+
* Grouping keys from `ON …`. Entries are variable names without `?`, or the value's
|
|
337
|
+
* text when the expanded grammar read a substituted ON term (e.g. `":Company_42"`).
|
|
338
|
+
* Order is not source order: the visitor lists all variables, then all grounded
|
|
339
|
+
* targets. Do not feed grounded ASTs into SPARQL helpers that treat every entry as a
|
|
340
|
+
* variable name (`datalog-to-sparql-select`, `ast-utils`) — use authored/strict ASTs there.
|
|
341
|
+
*/
|
|
342
|
+
onVars?: string[];
|
|
343
|
+
/** Set only when the expanded grammar read values in `ON` position, as RDFox's grounded rules do. */
|
|
344
|
+
groundedOnTargets?: DatalogTerm[];
|
|
345
|
+
bindings?: AggregateBinding[];
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
export declare type DatalogAggregateAtom = DatalogAtom | DatalogFilter | DatalogBind;
|
|
349
|
+
|
|
350
|
+
export declare class DatalogAstBuilder extends BaseDatalogVisitor {
|
|
351
|
+
rule(children: RuleCstChildren): DatalogRuleAst;
|
|
352
|
+
ruleHead(children: RuleHeadCstChildren): DatalogAtom[];
|
|
353
|
+
ruleBody(children: RuleBodyCstChildren): DatalogBodyFormula[];
|
|
354
|
+
bodyFormula(children: BodyFormulaCstChildren): DatalogBodyFormula;
|
|
355
|
+
tupleTableAtom(children: TupleTableAtomCstChildren): DatalogAtom;
|
|
356
|
+
graphName(children: GraphNameCstChildren): DatalogTerm;
|
|
357
|
+
defaultGraphAtom(children: DefaultGraphAtomCstChildren): DatalogAtom;
|
|
358
|
+
generalAtom(children: GeneralAtomCstChildren): GeneralAtom;
|
|
359
|
+
term(children: TermCstChildren): DatalogTerm;
|
|
360
|
+
iri(children: IriCstChildren): IriTerm;
|
|
361
|
+
literal(children: LiteralCstChildren): LiteralTerm;
|
|
362
|
+
numericLiteral(children: NumericLiteralCstChildren): LiteralTerm;
|
|
363
|
+
booleanLiteral(children: BooleanLiteralCstChildren): LiteralTerm;
|
|
364
|
+
stringLiteral(children: StringLiteralCstChildren): LiteralTerm;
|
|
365
|
+
negation(children: NegationCstChildren): DatalogNegation;
|
|
366
|
+
existsClause(children: ExistsClauseCstChildren): string[];
|
|
367
|
+
atomList(children: AtomListCstChildren): DatalogAggregateAtom[];
|
|
368
|
+
atom(children: Record<string, CstNode[]>): DatalogAggregateAtom;
|
|
369
|
+
bodyFormulaList(children: BodyFormulaListCstChildren): DatalogBodyFormula[];
|
|
370
|
+
filterAtom(children: FilterAtomCstChildren): DatalogFilter;
|
|
371
|
+
bindAtom(children: BindAtomCstChildren): DatalogBind;
|
|
372
|
+
asTarget(children: {
|
|
373
|
+
VARIABLE?: IToken[];
|
|
374
|
+
groundedAsTarget?: CstNode[];
|
|
375
|
+
}, missingMessage: string): {
|
|
376
|
+
variable: string;
|
|
377
|
+
groundedTarget?: DatalogTerm;
|
|
378
|
+
};
|
|
379
|
+
groundedAsTarget(children: GroundedAsTargetCstChildren): DatalogTerm;
|
|
380
|
+
skolemAtom(children: SkolemAtomCstChildren): DatalogSkolem;
|
|
381
|
+
aggregate(children: AggregateCstChildren): DatalogAggregate;
|
|
382
|
+
onClause(children: OnClauseCstChildren): {
|
|
383
|
+
onVars: string[];
|
|
384
|
+
groundedOnTargets?: DatalogTerm[];
|
|
385
|
+
};
|
|
386
|
+
aggregateBind(children: AggregateBindCstChildren): AggregateBinding;
|
|
387
|
+
aggregateFunction(children: AggregateFunctionCstChildren): Omit<UnaryAggregateBinding, "variable" | "groundedTarget"> | Omit<BinaryAggregateBinding, "variable" | "groundedTarget">;
|
|
388
|
+
aggregateFunction1(children: AggregateFunction1CstChildren): Omit<UnaryAggregateBinding, "variable" | "groundedTarget">;
|
|
389
|
+
aggregateFunction2(children: AggregateFunction2CstChildren): Omit<BinaryAggregateBinding, "variable" | "groundedTarget">;
|
|
390
|
+
expression(children: ExpressionCstChildren): DatalogExpression;
|
|
391
|
+
conditionalOrExpression(children: ConditionalOrExpressionCstChildren): DatalogExpression;
|
|
392
|
+
conditionalAndExpression(children: ConditionalAndExpressionCstChildren): DatalogExpression;
|
|
393
|
+
relationalExpression(children: RelationalExpressionCstChildren): DatalogExpression;
|
|
394
|
+
additiveExpression(children: AdditiveExpressionCstChildren): DatalogExpression;
|
|
395
|
+
multiplicativeExpression(children: MultiplicativeExpressionCstChildren): DatalogExpression;
|
|
396
|
+
unaryExpression(children: UnaryExpressionCstChildren): DatalogExpression;
|
|
397
|
+
functionCall(children: FunctionCallCstChildren): DatalogExpression;
|
|
398
|
+
concatFunction(children: ConcatFunctionCstChildren): DatalogExpression;
|
|
399
|
+
strFunction(children: StrFunctionCstChildren): DatalogExpression;
|
|
400
|
+
ifFunction(children: IfFunctionCstChildren): DatalogExpression;
|
|
401
|
+
iriFunction(children: IriFunctionCstChildren): DatalogExpression;
|
|
402
|
+
skolemFunction(children: SkolemFunctionCstChildren): DatalogExpression;
|
|
403
|
+
roundFunction(children: RoundFunctionCstChildren): DatalogExpression;
|
|
404
|
+
regexFunction(children: RegexFunctionCstChildren): DatalogExpression;
|
|
405
|
+
argumentList(children: ArgumentListCstChildren): DatalogExpression[];
|
|
406
|
+
primaryExpression(children: PrimaryExpressionCstChildren): DatalogExpression;
|
|
407
|
+
private extractIriValue;
|
|
408
|
+
private numericTokenLiteral;
|
|
409
|
+
private unquoteString;
|
|
410
|
+
private unquoteTripleString;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
export declare type DatalogAtom = TripleAtom | PropertyAtom | ClassAtom | GeneralAtom;
|
|
414
|
+
|
|
415
|
+
export declare type DatalogBind = {
|
|
416
|
+
type: "bind";
|
|
417
|
+
expression: DatalogExpression;
|
|
418
|
+
/** Target variable name without its `?`, or the value's text when `groundedTarget` is set. */
|
|
419
|
+
variable: string;
|
|
420
|
+
/** Set only when the expanded grammar read a value in `AS` position, as RDFox's grounded rules do. */
|
|
421
|
+
groundedTarget?: DatalogTerm;
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
export declare type DatalogBodyFormula = DatalogAtom | DatalogNegation | DatalogAggregate | DatalogFilter | DatalogBind | DatalogSkolem;
|
|
425
|
+
|
|
426
|
+
export declare function datalogBodyToSparqlSelect(bodyFormulas: DatalogBodyFormula[], prefixes?: Record<string, string>): SparqlSelectResult;
|
|
427
|
+
|
|
428
|
+
export declare type DatalogExpression = BinaryExpression | UnaryExpression | TermExpression | FunctionCallExpression | InExpression;
|
|
429
|
+
|
|
430
|
+
export declare type DatalogFilter = {
|
|
431
|
+
type: "filter";
|
|
432
|
+
expression: DatalogExpression;
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
export declare type DatalogNegation = {
|
|
436
|
+
type: "negation";
|
|
437
|
+
formulas: DatalogBodyFormula[];
|
|
438
|
+
existentialVars?: string[];
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
export declare type DatalogParseIssue = {
|
|
442
|
+
message: string;
|
|
443
|
+
line?: number;
|
|
444
|
+
column?: number;
|
|
445
|
+
offset?: number;
|
|
446
|
+
endOffset?: number;
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
export declare class DatalogParser extends CstParser {
|
|
450
|
+
constructor(config?: DatalogParserConfig);
|
|
451
|
+
get atEndOfInput(): boolean;
|
|
452
|
+
rule: ParserMethod<[], CstNode>;
|
|
453
|
+
private ruleHead;
|
|
454
|
+
private ruleBody;
|
|
455
|
+
private bodyFormula;
|
|
456
|
+
private tupleTableAtom;
|
|
457
|
+
private graphName;
|
|
458
|
+
private defaultGraphAtom;
|
|
459
|
+
private generalAtom;
|
|
460
|
+
term: ParserMethod<[], CstNode>;
|
|
461
|
+
protected iri: ParserMethod<[], CstNode>;
|
|
462
|
+
protected literal: ParserMethod<[], CstNode>;
|
|
463
|
+
private numericLiteral;
|
|
464
|
+
private booleanLiteral;
|
|
465
|
+
private stringLiteral;
|
|
466
|
+
private negation;
|
|
467
|
+
private existsClause;
|
|
468
|
+
protected atomList: ParserMethod<[], CstNode>;
|
|
469
|
+
private atom;
|
|
470
|
+
private bodyFormulaList;
|
|
471
|
+
private filterAtom;
|
|
472
|
+
protected bindAtom: ParserMethod<[], CstNode>;
|
|
473
|
+
private skolemAtom;
|
|
474
|
+
private aggregate;
|
|
475
|
+
protected onClause: ParserMethod<[], CstNode>;
|
|
476
|
+
protected aggregateBind: ParserMethod<[], CstNode>;
|
|
477
|
+
protected aggregateFunction: ParserMethod<[], CstNode>;
|
|
478
|
+
protected aggregateFunction1: ParserMethod<[], CstNode>;
|
|
479
|
+
protected aggregateFunction2: ParserMethod<[], CstNode>;
|
|
480
|
+
protected expression: ParserMethod<[], CstNode>;
|
|
481
|
+
private conditionalOrExpression;
|
|
482
|
+
private conditionalAndExpression;
|
|
483
|
+
private relationalExpression;
|
|
484
|
+
private additiveExpression;
|
|
485
|
+
private multiplicativeExpression;
|
|
486
|
+
private unaryExpression;
|
|
487
|
+
protected functionCall: ParserMethod<[], CstNode>;
|
|
488
|
+
private concatFunction;
|
|
489
|
+
private strFunction;
|
|
490
|
+
private ifFunction;
|
|
491
|
+
private iriFunction;
|
|
492
|
+
private skolemFunction;
|
|
493
|
+
private roundFunction;
|
|
494
|
+
private regexFunction;
|
|
495
|
+
private argumentList;
|
|
496
|
+
protected primaryExpression: ParserMethod<[], CstNode>;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
export declare type DatalogParserConfig = {
|
|
500
|
+
selfAnalysis?: boolean;
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
export declare type DatalogParseResult = {
|
|
504
|
+
ok: true;
|
|
505
|
+
rule: DatalogRule;
|
|
506
|
+
} | {
|
|
507
|
+
ok: false;
|
|
508
|
+
issues: DatalogParseIssue[];
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
export declare type DatalogRule = DatalogRuleAst & {
|
|
512
|
+
raw: string;
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
export declare type DatalogRuleAst = {
|
|
516
|
+
head: DatalogAtom[];
|
|
517
|
+
body: DatalogBodyFormula[];
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
export declare type DatalogSkolem = {
|
|
521
|
+
type: "skolem";
|
|
522
|
+
args: DatalogExpression[];
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
export declare type DatalogTerm = VariableTerm | IriTerm | LiteralTerm | BlankNodeTerm;
|
|
526
|
+
|
|
527
|
+
export declare type DatalogTextOptions = {
|
|
528
|
+
stripSimpleLiteralDatatypes?: boolean;
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
export declare type DatalogTextPart = {
|
|
532
|
+
type: "text";
|
|
533
|
+
text: string;
|
|
534
|
+
} | {
|
|
535
|
+
type: "variable";
|
|
536
|
+
name: string;
|
|
537
|
+
} | {
|
|
538
|
+
type: "literal";
|
|
539
|
+
literal: LiteralTerm;
|
|
540
|
+
text: string;
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
export declare type DatalogToken = IToken;
|
|
544
|
+
|
|
545
|
+
export declare type DataManipulationSubType = "insertdata" | "deletedata" | "modify";
|
|
546
|
+
|
|
547
|
+
export declare function datatypeToTermText(datatype: string): string;
|
|
548
|
+
|
|
549
|
+
export declare const DECIMAL: TokenType;
|
|
550
|
+
|
|
551
|
+
export declare const DEFAULT_NS_IRI: TokenType;
|
|
552
|
+
|
|
553
|
+
export declare type DefaultGraphAtomCstChildren = {
|
|
554
|
+
LBRACKET?: IToken[];
|
|
555
|
+
subject?: TermCstNode[];
|
|
556
|
+
COMMA?: IToken[];
|
|
557
|
+
predicate?: TermCstNode[];
|
|
558
|
+
object?: TermCstNode[];
|
|
559
|
+
RBRACKET?: IToken[];
|
|
560
|
+
predicateOrClass?: IriCstNode[];
|
|
561
|
+
firstTerm?: TermCstNode[];
|
|
562
|
+
secondTerm?: TermCstNode[];
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
export declare interface DefaultGraphAtomCstNode extends CstNode {
|
|
566
|
+
name: "defaultGraphAtom";
|
|
567
|
+
children: DefaultGraphAtomCstChildren;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Delete a connection
|
|
572
|
+
*/
|
|
573
|
+
export declare function deleteConnection(params: RDFoxTransactionParams): Promise<void>;
|
|
574
|
+
|
|
575
|
+
export declare const delimiterTokenTypes: Set<TokenType>;
|
|
576
|
+
|
|
577
|
+
export declare const DISTINCT: TokenType;
|
|
578
|
+
|
|
579
|
+
export declare const DOT: TokenType;
|
|
580
|
+
|
|
581
|
+
export declare const DOUBLE: TokenType;
|
|
582
|
+
|
|
583
|
+
export declare const EQUALS: TokenType;
|
|
584
|
+
|
|
585
|
+
export declare const EXCLAMATION: TokenType;
|
|
586
|
+
|
|
587
|
+
export declare const EXISTS: TokenType;
|
|
588
|
+
|
|
589
|
+
export declare type ExistsClauseCstChildren = {
|
|
590
|
+
EXISTS: IToken[];
|
|
591
|
+
VARIABLE: IToken[];
|
|
592
|
+
COMMA?: IToken[];
|
|
593
|
+
IN: IToken[];
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
export declare interface ExistsClauseCstNode extends CstNode {
|
|
597
|
+
name: "existsClause";
|
|
598
|
+
children: ExistsClauseCstChildren;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Grammar variant for the grounded rules RDFox returns.
|
|
603
|
+
*
|
|
604
|
+
* Grounding substitutes an `AS` target with the value it computed, so
|
|
605
|
+
* `BIND(?spend > 500 AS ?highSpend)` comes back as `BIND(901.22 > 500 AS true)`.
|
|
606
|
+
* It also emits atom-free aggregates (`AGGREGATE(AVG(9.0) AS 9.0)`) and
|
|
607
|
+
* expression-only bindings (`AGGREGATE(13 / 100 AS 0.13)`). That is not valid
|
|
608
|
+
* authored Datalog, and rules written by hand or by the agent must keep being
|
|
609
|
+
* rejected, so the permissive grammar lives here rather than relaxing the strict one.
|
|
610
|
+
*/
|
|
611
|
+
export declare class ExpandedDatalogParser extends DatalogParser {
|
|
612
|
+
constructor();
|
|
613
|
+
protected groundedAsTarget: ParserMethod<[], CstNode>;
|
|
614
|
+
protected variableOrGroundedTarget(): void;
|
|
615
|
+
protected expandedOnClause: ParserMethod<[], CstNode>;
|
|
616
|
+
protected expandedBindAtom: ParserMethod<[], CstNode>;
|
|
617
|
+
protected expandedAggregate: ParserMethod<[], CstNode>;
|
|
618
|
+
protected expandedAggregateBind: ParserMethod<[], CstNode>;
|
|
619
|
+
protected expandedPrimaryExpression: ParserMethod<[], CstNode>;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
export declare function expandedParserInstance(): ExpandedDatalogParser;
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Generate meaningful error messages for inference verification failures
|
|
626
|
+
*/
|
|
627
|
+
export declare function explainInferenceFailure(result: InferenceVerificationResult): string;
|
|
628
|
+
|
|
629
|
+
export declare type ExpressionAggregateBinding = AggregateBindingTarget & {
|
|
630
|
+
function?: never;
|
|
631
|
+
distinct?: never;
|
|
632
|
+
expression: DatalogExpression;
|
|
633
|
+
secondExpression?: never;
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
export declare type ExpressionCstChildren = {
|
|
637
|
+
conditionalOrExpression: ConditionalOrExpressionCstNode[];
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
export declare interface ExpressionCstNode extends CstNode {
|
|
641
|
+
name: "expression";
|
|
642
|
+
children: ExpressionCstChildren;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
export declare function expressionToDatalogParts(expression: DatalogExpression, options?: DatalogTextOptions): DatalogTextPart[];
|
|
646
|
+
|
|
647
|
+
export declare function expressionToDatalogText(expression: DatalogExpression, options?: DatalogTextOptions): string;
|
|
648
|
+
|
|
649
|
+
export declare function extractRuleVocabulary(ruleText: string): RuleVocabularyExtractionResult;
|
|
650
|
+
|
|
651
|
+
export declare function extractRuleVocabularyFromAst(rule: DatalogRuleAst): RuleVocabulary;
|
|
652
|
+
|
|
653
|
+
export declare function extractRuleVocabularyFromAtom(atom: DatalogAtom): RuleVocabularyPosition;
|
|
654
|
+
|
|
655
|
+
export declare function extractVariables(rule: DatalogRule): string[];
|
|
656
|
+
|
|
657
|
+
export declare const FALSE: TokenType;
|
|
658
|
+
|
|
659
|
+
export declare const FILTER: TokenType;
|
|
660
|
+
|
|
661
|
+
export declare type FilterAtomCstChildren = {
|
|
662
|
+
FILTER: IToken[];
|
|
663
|
+
LPAREN: IToken[];
|
|
664
|
+
expression: ExpressionCstNode[];
|
|
665
|
+
RPAREN: IToken[];
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
export declare interface FilterAtomCstNode extends CstNode {
|
|
669
|
+
name: "filterAtom";
|
|
670
|
+
children: FilterAtomCstChildren;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
export declare function formulaContainsSkolem(formula: DatalogBodyFormula): boolean;
|
|
674
|
+
|
|
675
|
+
export declare type FunctionCallCstChildren = {
|
|
676
|
+
concatFunction?: ConcatFunctionCstNode[];
|
|
677
|
+
strFunction?: StrFunctionCstNode[];
|
|
678
|
+
ifFunction?: IfFunctionCstNode[];
|
|
679
|
+
iriFunction?: IriFunctionCstNode[];
|
|
680
|
+
skolemFunction?: SkolemFunctionCstNode[];
|
|
681
|
+
roundFunction?: RoundFunctionCstNode[];
|
|
682
|
+
regexFunction?: RegexFunctionCstNode[];
|
|
683
|
+
iri?: IriCstNode[];
|
|
684
|
+
LPAREN?: IToken[];
|
|
685
|
+
argumentList?: ArgumentListCstNode[];
|
|
686
|
+
RPAREN?: IToken[];
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
export declare interface FunctionCallCstNode extends CstNode {
|
|
690
|
+
name: "functionCall";
|
|
691
|
+
children: FunctionCallCstChildren;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
export declare type FunctionCallExpression = {
|
|
695
|
+
type: "function";
|
|
696
|
+
name: string;
|
|
697
|
+
args: DatalogExpression[];
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
export declare type GeneralAtom = {
|
|
701
|
+
type: "general";
|
|
702
|
+
tableName: string;
|
|
703
|
+
terms: DatalogTerm[];
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
export declare type GeneralAtomCstChildren = {
|
|
707
|
+
IDENTIFIER?: IToken[];
|
|
708
|
+
STRING_LITERAL?: IToken[];
|
|
709
|
+
LPAREN: IToken[];
|
|
710
|
+
term: TermCstNode[];
|
|
711
|
+
COMMA?: IToken[];
|
|
712
|
+
RPAREN: IToken[];
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
export declare interface GeneralAtomCstNode extends CstNode {
|
|
716
|
+
name: "generalAtom";
|
|
717
|
+
children: GeneralAtomCstChildren;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
export declare const getAggregateFunction: (binding: AggregateBinding) => AggregateBinding["function"];
|
|
721
|
+
|
|
722
|
+
export declare const getAtomType: (atom: DatalogAtom) => string;
|
|
723
|
+
|
|
724
|
+
export declare const getExpressionType: (expr: DatalogExpression) => string;
|
|
725
|
+
|
|
726
|
+
export declare function getRelatedVariables(rule: DatalogRule, targetVariableName: string): Set<string>;
|
|
727
|
+
|
|
728
|
+
export declare const getTermType: (term: DatalogTerm) => string;
|
|
729
|
+
|
|
730
|
+
export declare const getVariablesFromAtom: (atom: DatalogAtom) => VariableTerm[];
|
|
731
|
+
|
|
732
|
+
export declare const getVariablesFromAtomIncludingGraph: (atom: DatalogAtom) => VariableTerm[];
|
|
733
|
+
|
|
734
|
+
export declare type GraphNameCstChildren = {
|
|
735
|
+
VARIABLE?: IToken[];
|
|
736
|
+
iri?: IriCstNode[];
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
export declare interface GraphNameCstNode extends CstNode {
|
|
740
|
+
name: "graphName";
|
|
741
|
+
children: GraphNameCstChildren;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
export declare const GREATER_THAN: TokenType;
|
|
745
|
+
|
|
746
|
+
export declare const GREATER_THAN_OR_EQUAL: TokenType;
|
|
747
|
+
|
|
748
|
+
export declare type GroundedAsTargetCstChildren = {
|
|
749
|
+
iri?: IriCstNode[];
|
|
750
|
+
literal?: LiteralCstNode[];
|
|
751
|
+
BLANK_NODE?: IToken[];
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
export declare interface GroundedAsTargetCstNode extends CstNode {
|
|
755
|
+
name: "groundedAsTarget";
|
|
756
|
+
children: GroundedAsTargetCstChildren;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/** A rule AST produced by `parseGroundedDatalogRule` — not safe for SPARQL translation. */
|
|
760
|
+
export declare type GroundedDatalogRule = DatalogRule & {
|
|
761
|
+
readonly grounded: true;
|
|
762
|
+
};
|
|
763
|
+
|
|
764
|
+
export declare const HAT: TokenType;
|
|
765
|
+
|
|
766
|
+
export declare interface ICstNodeVisitor<IN, OUT> extends ICstVisitor<IN, OUT> {
|
|
767
|
+
rule(children: RuleCstChildren, param?: IN): OUT;
|
|
768
|
+
ruleHead(children: RuleHeadCstChildren, param?: IN): OUT;
|
|
769
|
+
ruleBody(children: RuleBodyCstChildren, param?: IN): OUT;
|
|
770
|
+
bodyFormula(children: BodyFormulaCstChildren, param?: IN): OUT;
|
|
771
|
+
tupleTableAtom(children: TupleTableAtomCstChildren, param?: IN): OUT;
|
|
772
|
+
graphName(children: GraphNameCstChildren, param?: IN): OUT;
|
|
773
|
+
defaultGraphAtom(children: DefaultGraphAtomCstChildren, param?: IN): OUT;
|
|
774
|
+
generalAtom(children: GeneralAtomCstChildren, param?: IN): OUT;
|
|
775
|
+
term(children: TermCstChildren, param?: IN): OUT;
|
|
776
|
+
iri(children: IriCstChildren, param?: IN): OUT;
|
|
777
|
+
literal(children: LiteralCstChildren, param?: IN): OUT;
|
|
778
|
+
numericLiteral(children: NumericLiteralCstChildren, param?: IN): OUT;
|
|
779
|
+
booleanLiteral(children: BooleanLiteralCstChildren, param?: IN): OUT;
|
|
780
|
+
stringLiteral(children: StringLiteralCstChildren, param?: IN): OUT;
|
|
781
|
+
negation(children: NegationCstChildren, param?: IN): OUT;
|
|
782
|
+
existsClause(children: ExistsClauseCstChildren, param?: IN): OUT;
|
|
783
|
+
atomList(children: AtomListCstChildren, param?: IN): OUT;
|
|
784
|
+
atom(children: AtomCstChildren, param?: IN): OUT;
|
|
785
|
+
bodyFormulaList(children: BodyFormulaListCstChildren, param?: IN): OUT;
|
|
786
|
+
filterAtom(children: FilterAtomCstChildren, param?: IN): OUT;
|
|
787
|
+
bindAtom(children: BindAtomCstChildren, param?: IN): OUT;
|
|
788
|
+
skolemAtom(children: SkolemAtomCstChildren, param?: IN): OUT;
|
|
789
|
+
aggregate(children: AggregateCstChildren, param?: IN): OUT;
|
|
790
|
+
onClause(children: OnClauseCstChildren, param?: IN): OUT;
|
|
791
|
+
aggregateBind(children: AggregateBindCstChildren, param?: IN): OUT;
|
|
792
|
+
aggregateFunction(children: AggregateFunctionCstChildren, param?: IN): OUT;
|
|
793
|
+
aggregateFunction1(children: AggregateFunction1CstChildren, param?: IN): OUT;
|
|
794
|
+
aggregateFunction2(children: AggregateFunction2CstChildren, param?: IN): OUT;
|
|
795
|
+
expression(children: ExpressionCstChildren, param?: IN): OUT;
|
|
796
|
+
conditionalOrExpression(children: ConditionalOrExpressionCstChildren, param?: IN): OUT;
|
|
797
|
+
conditionalAndExpression(children: ConditionalAndExpressionCstChildren, param?: IN): OUT;
|
|
798
|
+
relationalExpression(children: RelationalExpressionCstChildren, param?: IN): OUT;
|
|
799
|
+
additiveExpression(children: AdditiveExpressionCstChildren, param?: IN): OUT;
|
|
800
|
+
multiplicativeExpression(children: MultiplicativeExpressionCstChildren, param?: IN): OUT;
|
|
801
|
+
unaryExpression(children: UnaryExpressionCstChildren, param?: IN): OUT;
|
|
802
|
+
functionCall(children: FunctionCallCstChildren, param?: IN): OUT;
|
|
803
|
+
concatFunction(children: ConcatFunctionCstChildren, param?: IN): OUT;
|
|
804
|
+
strFunction(children: StrFunctionCstChildren, param?: IN): OUT;
|
|
805
|
+
ifFunction(children: IfFunctionCstChildren, param?: IN): OUT;
|
|
806
|
+
iriFunction(children: IriFunctionCstChildren, param?: IN): OUT;
|
|
807
|
+
skolemFunction(children: SkolemFunctionCstChildren, param?: IN): OUT;
|
|
808
|
+
roundFunction(children: RoundFunctionCstChildren, param?: IN): OUT;
|
|
809
|
+
regexFunction(children: RegexFunctionCstChildren, param?: IN): OUT;
|
|
810
|
+
argumentList(children: ArgumentListCstChildren, param?: IN): OUT;
|
|
811
|
+
primaryExpression(children: PrimaryExpressionCstChildren, param?: IN): OUT;
|
|
812
|
+
groundedAsTarget(children: GroundedAsTargetCstChildren, param?: IN): OUT;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
export declare const IDENTIFIER: TokenType;
|
|
816
|
+
|
|
817
|
+
export declare const IF: TokenType;
|
|
818
|
+
|
|
819
|
+
export declare type IfFunctionCstChildren = {
|
|
820
|
+
IF: IToken[];
|
|
821
|
+
LPAREN: IToken[];
|
|
822
|
+
condition: ExpressionCstNode[];
|
|
823
|
+
COMMA: IToken[];
|
|
824
|
+
thenExpr: ExpressionCstNode[];
|
|
825
|
+
elseExpr: ExpressionCstNode[];
|
|
826
|
+
RPAREN: IToken[];
|
|
827
|
+
};
|
|
828
|
+
|
|
829
|
+
export declare interface IfFunctionCstNode extends CstNode {
|
|
830
|
+
name: "ifFunction";
|
|
831
|
+
children: IfFunctionCstChildren;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
export declare const IN: TokenType;
|
|
835
|
+
|
|
836
|
+
export declare type InExpression = {
|
|
837
|
+
type: "in";
|
|
838
|
+
negated: boolean;
|
|
839
|
+
expression: DatalogExpression;
|
|
840
|
+
list: DatalogExpression[];
|
|
841
|
+
};
|
|
842
|
+
|
|
843
|
+
export declare type InferenceVerificationResult = {
|
|
844
|
+
verified: boolean;
|
|
845
|
+
testTriple?: {
|
|
846
|
+
subject: string;
|
|
847
|
+
predicate: string;
|
|
848
|
+
object: string;
|
|
849
|
+
};
|
|
850
|
+
sparqlQuery?: string;
|
|
851
|
+
candidateQuery?: string;
|
|
852
|
+
error?: string;
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
export declare const INTEGER: TokenType;
|
|
856
|
+
|
|
857
|
+
export declare const INTERNAL_FUNCTION: TokenType;
|
|
858
|
+
|
|
859
|
+
export declare function invertComparisonOperator(operator: ComparisonOperator): ComparisonOperator;
|
|
860
|
+
|
|
861
|
+
export declare const IRI: TokenType;
|
|
862
|
+
|
|
863
|
+
export declare const IRI_REF: TokenType;
|
|
864
|
+
|
|
865
|
+
export declare const iriBodyCharClass = "[^\\s<>\"{}|^`\\\\]";
|
|
866
|
+
|
|
867
|
+
export declare type IriCstChildren = {
|
|
868
|
+
IRI_REF?: IToken[];
|
|
869
|
+
INTERNAL_FUNCTION?: IToken[];
|
|
870
|
+
PREFIXED_NAME?: IToken[];
|
|
871
|
+
DEFAULT_NS_IRI?: IToken[];
|
|
872
|
+
PREFIX_ONLY?: IToken[];
|
|
873
|
+
IDENTIFIER?: IToken[];
|
|
874
|
+
};
|
|
875
|
+
|
|
876
|
+
export declare interface IriCstNode extends CstNode {
|
|
877
|
+
name: "iri";
|
|
878
|
+
children: IriCstChildren;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
export declare type IriFunctionCstChildren = {
|
|
882
|
+
IRI: IToken[];
|
|
883
|
+
LPAREN: IToken[];
|
|
884
|
+
iriExpr: ExpressionCstNode[];
|
|
885
|
+
COMMA?: IToken[];
|
|
886
|
+
baseIri?: ExpressionCstNode[];
|
|
887
|
+
RPAREN: IToken[];
|
|
888
|
+
};
|
|
889
|
+
|
|
890
|
+
export declare interface IriFunctionCstNode extends CstNode {
|
|
891
|
+
name: "iriFunction";
|
|
892
|
+
children: IriFunctionCstChildren;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
export declare type IriTerm = {
|
|
896
|
+
type: "iri";
|
|
897
|
+
value: string;
|
|
898
|
+
prefixed: boolean;
|
|
899
|
+
};
|
|
900
|
+
|
|
901
|
+
export declare const iriTokenTypes: Set<TokenType>;
|
|
902
|
+
|
|
903
|
+
export declare const isAggregateFormula: (formula: DatalogBodyFormula) => formula is DatalogAggregate;
|
|
904
|
+
|
|
905
|
+
export declare function isBareNumericLiteral(literal: LiteralTerm): boolean;
|
|
906
|
+
|
|
907
|
+
export declare const isBinaryExpression: (expr: DatalogExpression) => expr is BinaryExpression;
|
|
908
|
+
|
|
909
|
+
export declare const isBindFormula: (formula: DatalogBodyFormula) => formula is DatalogBind;
|
|
910
|
+
|
|
911
|
+
export declare const isBlankNodeTerm: (term: DatalogTerm) => term is BlankNodeTerm;
|
|
912
|
+
|
|
913
|
+
export declare function isBooleanLiteral(literal: LiteralTerm): boolean;
|
|
914
|
+
|
|
915
|
+
export declare const isClassAtom: (atom: DatalogAtom) => atom is ClassAtom;
|
|
916
|
+
|
|
917
|
+
export declare function isComparisonOperator(operator: BinaryExpression["operator"]): operator is ComparisonOperator;
|
|
918
|
+
|
|
919
|
+
export declare function isDatalogAtom(formula: DatalogBodyFormula): formula is DatalogAtom;
|
|
920
|
+
|
|
921
|
+
export declare function isDateLiteral(literal: LiteralTerm): boolean;
|
|
922
|
+
|
|
923
|
+
export declare function isDateTimeLiteral(literal: LiteralTerm): boolean;
|
|
924
|
+
|
|
925
|
+
export declare const isFilterFormula: (formula: DatalogBodyFormula) => formula is DatalogFilter;
|
|
926
|
+
|
|
927
|
+
export declare function isFullIri(value: string): boolean;
|
|
928
|
+
|
|
929
|
+
export declare const isFunctionCallExpression: (expr: DatalogExpression) => expr is FunctionCallExpression;
|
|
930
|
+
|
|
931
|
+
export declare const isGeneralAtom: (atom: DatalogAtom) => atom is GeneralAtom;
|
|
932
|
+
|
|
933
|
+
export declare const isIriTerm: (term: DatalogTerm) => term is IriTerm;
|
|
934
|
+
|
|
935
|
+
export declare const isLiteralTerm: (term: DatalogTerm) => term is LiteralTerm;
|
|
936
|
+
|
|
937
|
+
export declare const isLogicalOperator: (operator: BinaryExpression["operator"]) => boolean;
|
|
938
|
+
|
|
939
|
+
export declare const isNegationFormula: (formula: DatalogBodyFormula) => formula is DatalogNegation;
|
|
940
|
+
|
|
941
|
+
export declare function isNumericLiteral(literal: LiteralTerm): boolean;
|
|
942
|
+
|
|
943
|
+
export declare function isNumericLiteralTerm(term: DatalogTerm): term is LiteralTerm;
|
|
944
|
+
|
|
945
|
+
export declare const isNumericOperator: (operator: BinaryExpression["operator"]) => boolean;
|
|
946
|
+
|
|
947
|
+
export declare function isNumericRdfValue(value: string): boolean;
|
|
948
|
+
|
|
949
|
+
export declare const isPropertyAtom: (atom: DatalogAtom) => atom is PropertyAtom;
|
|
950
|
+
|
|
951
|
+
export declare function isQueryableTermIri(iri: string): boolean;
|
|
952
|
+
|
|
953
|
+
export declare function isReadOnlySparqlQuery(query: string): {
|
|
954
|
+
allowed: boolean;
|
|
955
|
+
error?: string;
|
|
956
|
+
queryType?: SparqlQueryType;
|
|
957
|
+
};
|
|
958
|
+
|
|
959
|
+
export declare const isSkolemFormula: (formula: DatalogBodyFormula) => formula is DatalogSkolem;
|
|
960
|
+
|
|
961
|
+
export declare const isTermExpression: (expr: DatalogExpression) => expr is TermExpression;
|
|
962
|
+
|
|
963
|
+
export declare const isTripleAtom: (atom: DatalogAtom) => atom is TripleAtom;
|
|
964
|
+
|
|
965
|
+
export declare const isUnaryExpression: (expr: DatalogExpression) => expr is UnaryExpression;
|
|
966
|
+
|
|
967
|
+
export declare const isVariableTerm: (term: DatalogTerm) => term is VariableTerm;
|
|
968
|
+
|
|
969
|
+
export declare function isXsdDatatype(datatype: string | undefined, localName: XsdDatatypeLocalName): boolean;
|
|
970
|
+
|
|
971
|
+
export declare const keywordTokenTypes: Set<TokenType>;
|
|
972
|
+
|
|
973
|
+
export declare const LANGTAG: TokenType;
|
|
974
|
+
|
|
975
|
+
export declare const LBRACKET: TokenType;
|
|
976
|
+
|
|
977
|
+
export declare const LESS_THAN: TokenType;
|
|
978
|
+
|
|
979
|
+
export declare const LESS_THAN_OR_EQUAL: TokenType;
|
|
980
|
+
|
|
981
|
+
export declare type LiteralCstChildren = {
|
|
982
|
+
numericLiteral?: NumericLiteralCstNode[];
|
|
983
|
+
booleanLiteral?: BooleanLiteralCstNode[];
|
|
984
|
+
stringLiteral?: StringLiteralCstNode[];
|
|
985
|
+
};
|
|
986
|
+
|
|
987
|
+
export declare interface LiteralCstNode extends CstNode {
|
|
988
|
+
name: "literal";
|
|
989
|
+
children: LiteralCstChildren;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
export declare type LiteralSetComparison = {
|
|
993
|
+
subject: DatalogTerm;
|
|
994
|
+
literals: LiteralTerm[];
|
|
995
|
+
negated: boolean;
|
|
996
|
+
};
|
|
997
|
+
|
|
998
|
+
export declare function literalSetComparisonFromExpression(expression: DatalogExpression): LiteralSetComparison | null;
|
|
999
|
+
|
|
1000
|
+
export declare type LiteralTerm = {
|
|
1001
|
+
type: "literal";
|
|
1002
|
+
value: string;
|
|
1003
|
+
datatype?: string;
|
|
1004
|
+
language?: string;
|
|
1005
|
+
termSpan?: SourceSpan;
|
|
1006
|
+
valueSpan?: SourceSpan;
|
|
1007
|
+
};
|
|
1008
|
+
|
|
1009
|
+
export declare function literalToDisplayText(literal: LiteralTerm): string;
|
|
1010
|
+
|
|
1011
|
+
export declare const LPAREN: TokenType;
|
|
1012
|
+
|
|
1013
|
+
export declare const MAX: TokenType;
|
|
1014
|
+
|
|
1015
|
+
export declare const MAX_ARGMAX: TokenType;
|
|
1016
|
+
|
|
1017
|
+
export declare const MAX_ARGMIN: TokenType;
|
|
1018
|
+
|
|
1019
|
+
export declare const MIN: TokenType;
|
|
1020
|
+
|
|
1021
|
+
export declare const MIN_ARGMAX: TokenType;
|
|
1022
|
+
|
|
1023
|
+
export declare const MIN_ARGMIN: TokenType;
|
|
1024
|
+
|
|
1025
|
+
export declare const MINUS: TokenType;
|
|
1026
|
+
|
|
1027
|
+
export declare const MUL: TokenType;
|
|
1028
|
+
|
|
1029
|
+
export declare type MultiplicativeExpressionCstChildren = {
|
|
1030
|
+
unaryExpression: UnaryExpressionCstNode[];
|
|
1031
|
+
STAR?: IToken[];
|
|
1032
|
+
SLASH?: IToken[];
|
|
1033
|
+
};
|
|
1034
|
+
|
|
1035
|
+
export declare interface MultiplicativeExpressionCstNode extends CstNode {
|
|
1036
|
+
name: "multiplicativeExpression";
|
|
1037
|
+
children: MultiplicativeExpressionCstChildren;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
export declare type NegationCstChildren = {
|
|
1041
|
+
NOT: IToken[];
|
|
1042
|
+
existsClause?: ExistsClauseCstNode[];
|
|
1043
|
+
LPAREN?: IToken[];
|
|
1044
|
+
bodyFormulaList?: BodyFormulaListCstNode[];
|
|
1045
|
+
RPAREN?: IToken[];
|
|
1046
|
+
tupleTableAtom?: TupleTableAtomCstNode[];
|
|
1047
|
+
};
|
|
1048
|
+
|
|
1049
|
+
export declare interface NegationCstNode extends CstNode {
|
|
1050
|
+
name: "negation";
|
|
1051
|
+
children: NegationCstChildren;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
export declare const NOT: TokenType;
|
|
1055
|
+
|
|
1056
|
+
export declare const NOT_EQUALS: TokenType;
|
|
1057
|
+
|
|
1058
|
+
export declare type NumericLiteralCstChildren = {
|
|
1059
|
+
DOUBLE?: IToken[];
|
|
1060
|
+
DECIMAL?: IToken[];
|
|
1061
|
+
INTEGER?: IToken[];
|
|
1062
|
+
};
|
|
1063
|
+
|
|
1064
|
+
export declare interface NumericLiteralCstNode extends CstNode {
|
|
1065
|
+
name: "numericLiteral";
|
|
1066
|
+
children: NumericLiteralCstChildren;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
export declare const numericLiteralTokenTypes: Set<TokenType>;
|
|
1070
|
+
|
|
1071
|
+
export declare const ON: TokenType;
|
|
1072
|
+
|
|
1073
|
+
export declare type OnClauseCstChildren = {
|
|
1074
|
+
ON: IToken[];
|
|
1075
|
+
VARIABLE?: IToken[];
|
|
1076
|
+
groundedAsTarget?: GroundedAsTargetCstNode[];
|
|
1077
|
+
};
|
|
1078
|
+
|
|
1079
|
+
export declare interface OnClauseCstNode extends CstNode {
|
|
1080
|
+
name: "onClause";
|
|
1081
|
+
children: OnClauseCstChildren;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
export declare const operatorTokenTypes: Set<TokenType>;
|
|
1085
|
+
|
|
1086
|
+
export declare const OR: TokenType;
|
|
1087
|
+
|
|
1088
|
+
export declare function parseBooleanLiteral(value: string): boolean | undefined;
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
* Parse a Datalog rule string into a type-safe AST
|
|
1092
|
+
*/
|
|
1093
|
+
export declare function parseDatalogRule(ruleText: string): DatalogRule;
|
|
1094
|
+
|
|
1095
|
+
/**
|
|
1096
|
+
* Parse a Datalog rule string, returning structured issues with source
|
|
1097
|
+
* positions instead of throwing on invalid input
|
|
1098
|
+
*/
|
|
1099
|
+
export declare function parseDatalogRuleWithIssues(ruleText: string): DatalogParseResult;
|
|
1100
|
+
|
|
1101
|
+
/**
|
|
1102
|
+
* Parse a single Datalog term (IRI, literal, blank node, or variable) from its
|
|
1103
|
+
* text form.
|
|
1104
|
+
*
|
|
1105
|
+
* Fact values reach the UI as Datalog term text rather than bare strings, so
|
|
1106
|
+
* rendering one means recovering its structure first: a literal carries quotes
|
|
1107
|
+
* and an optional datatype or language suffix around the value to display,
|
|
1108
|
+
* while an IRI denotes an entity and is rendered as a chip instead. Literal
|
|
1109
|
+
* source spans are relative to the input text.
|
|
1110
|
+
*
|
|
1111
|
+
* Returns undefined when the text is not exactly one term.
|
|
1112
|
+
*/
|
|
1113
|
+
export declare function parseDatalogTermText(termText: string): DatalogTerm | undefined;
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Parse a grounded rule returned by RDFox, where `AS` targets have been
|
|
1117
|
+
* substituted with the values they evaluated to. Authored rules must go through
|
|
1118
|
+
* `parseDatalogRule` so that those substitutions stay invalid.
|
|
1119
|
+
*/
|
|
1120
|
+
export declare function parseGroundedDatalogRule(ruleText: string): GroundedDatalogRule;
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* Parse a grounded rule and return its CST, accepting values in `AS` target
|
|
1124
|
+
* position. Use `parseRule` for anything a human or the agent authored.
|
|
1125
|
+
*/
|
|
1126
|
+
export declare function parseGroundedRule(text: string): CstNode;
|
|
1127
|
+
|
|
1128
|
+
export declare function parserInstance(): DatalogParser;
|
|
1129
|
+
|
|
1130
|
+
export declare function parseRule(text: string): CstNode;
|
|
1131
|
+
|
|
1132
|
+
/** Lex and parse `text` with the given parser instance (strict or expanded). */
|
|
1133
|
+
export declare function parseRuleWith(parser: DatalogParser, text: string): CstNode;
|
|
1134
|
+
|
|
1135
|
+
export declare function plainDecimalText(value: string): string;
|
|
1136
|
+
|
|
1137
|
+
export declare const PLUS: TokenType;
|
|
1138
|
+
|
|
1139
|
+
export declare function positiveBodyContainsSkolem(body: DatalogBodyFormula[]): boolean;
|
|
1140
|
+
|
|
1141
|
+
export declare type PredicateEvidence = {
|
|
1142
|
+
term: string;
|
|
1143
|
+
position: PredicatePosition;
|
|
1144
|
+
};
|
|
1145
|
+
|
|
1146
|
+
export declare type PredicatePosition = "domain" | "range";
|
|
1147
|
+
|
|
1148
|
+
export declare const PREFIX_ONLY: TokenType;
|
|
1149
|
+
|
|
1150
|
+
export declare const PREFIXED_NAME: TokenType;
|
|
1151
|
+
|
|
1152
|
+
export declare type PrimaryExpressionCstChildren = {
|
|
1153
|
+
LPAREN?: IToken[];
|
|
1154
|
+
expression?: ExpressionCstNode[];
|
|
1155
|
+
RPAREN?: IToken[];
|
|
1156
|
+
functionCall?: FunctionCallCstNode[];
|
|
1157
|
+
literal?: LiteralCstNode[];
|
|
1158
|
+
VARIABLE?: IToken[];
|
|
1159
|
+
BLANK_NODE?: IToken[];
|
|
1160
|
+
iri?: IriCstNode[];
|
|
1161
|
+
};
|
|
1162
|
+
|
|
1163
|
+
export declare interface PrimaryExpressionCstNode extends CstNode {
|
|
1164
|
+
name: "primaryExpression";
|
|
1165
|
+
children: PrimaryExpressionCstChildren;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
export declare type PropertyAssertion = {
|
|
1169
|
+
predicate: string;
|
|
1170
|
+
subject: DatalogTerm;
|
|
1171
|
+
object: DatalogTerm;
|
|
1172
|
+
graph?: DatalogTerm;
|
|
1173
|
+
};
|
|
1174
|
+
|
|
1175
|
+
export declare function propertyAssertionFromAtom(atom: DatalogAtom): PropertyAssertion | null;
|
|
1176
|
+
|
|
1177
|
+
export declare type PropertyAtom = {
|
|
1178
|
+
type: "property";
|
|
1179
|
+
predicate: string;
|
|
1180
|
+
subject: DatalogTerm;
|
|
1181
|
+
object: DatalogTerm;
|
|
1182
|
+
graph?: DatalogTerm;
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
export declare const RBRACKET: TokenType;
|
|
1186
|
+
|
|
1187
|
+
/**
|
|
1188
|
+
* RDFox Transaction Management Library
|
|
1189
|
+
*
|
|
1190
|
+
* This module provides side-effecty functions for managing RDFox connections and transactions
|
|
1191
|
+
* via the RESTful API. It follows RDFox's connection-based transaction model where transactions
|
|
1192
|
+
* are associated with data store connections.
|
|
1193
|
+
*
|
|
1194
|
+
* @see https://docs.oxfordsemantic.tech/apis.html#transactions-in-the-restful-api
|
|
1195
|
+
*/
|
|
1196
|
+
export declare type RDFoxConnectionParams = {
|
|
1197
|
+
rdfoxUrl: string;
|
|
1198
|
+
datastoreName: string;
|
|
1199
|
+
authorization: string;
|
|
1200
|
+
};
|
|
1201
|
+
|
|
1202
|
+
export declare type RDFoxTransactionParams = RDFoxConnectionParams & {
|
|
1203
|
+
connectionId: string;
|
|
1204
|
+
};
|
|
1205
|
+
|
|
1206
|
+
export declare const REGEX: TokenType;
|
|
1207
|
+
|
|
1208
|
+
export declare type RegexFunctionCstChildren = {
|
|
1209
|
+
REGEX: IToken[];
|
|
1210
|
+
LPAREN: IToken[];
|
|
1211
|
+
textExpr: ExpressionCstNode[];
|
|
1212
|
+
COMMA: IToken[];
|
|
1213
|
+
patternExpr: ExpressionCstNode[];
|
|
1214
|
+
flagsExpr?: ExpressionCstNode[];
|
|
1215
|
+
RPAREN: IToken[];
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
export declare interface RegexFunctionCstNode extends CstNode {
|
|
1219
|
+
name: "regexFunction";
|
|
1220
|
+
children: RegexFunctionCstChildren;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
export declare type RelationalExpressionCstChildren = {
|
|
1224
|
+
additiveExpression: AdditiveExpressionCstNode[];
|
|
1225
|
+
EQUALS?: IToken[];
|
|
1226
|
+
NOT_EQUALS?: IToken[];
|
|
1227
|
+
LESS_THAN?: IToken[];
|
|
1228
|
+
GREATER_THAN?: IToken[];
|
|
1229
|
+
LESS_THAN_OR_EQUAL?: IToken[];
|
|
1230
|
+
GREATER_THAN_OR_EQUAL?: IToken[];
|
|
1231
|
+
IN?: IToken[];
|
|
1232
|
+
LPAREN?: IToken[];
|
|
1233
|
+
argumentList?: ArgumentListCstNode[];
|
|
1234
|
+
RPAREN?: IToken[];
|
|
1235
|
+
NOT?: IToken[];
|
|
1236
|
+
};
|
|
1237
|
+
|
|
1238
|
+
export declare interface RelationalExpressionCstNode extends CstNode {
|
|
1239
|
+
name: "relationalExpression";
|
|
1240
|
+
children: RelationalExpressionCstChildren;
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
export declare type ResolvableTerm = {
|
|
1244
|
+
domainIncludes: string[];
|
|
1245
|
+
rangeIncludes: string[];
|
|
1246
|
+
};
|
|
1247
|
+
|
|
1248
|
+
export declare function resolveVariableTypes(evidence: VariableTypeEvidence[], lookupTerm: (term: string) => ResolvableTerm | undefined): VariableType[];
|
|
1249
|
+
|
|
1250
|
+
/**
|
|
1251
|
+
* Rollback a transaction on a connection
|
|
1252
|
+
*/
|
|
1253
|
+
export declare function rollbackTransaction(params: RDFoxTransactionParams): Promise<void>;
|
|
1254
|
+
|
|
1255
|
+
export declare const ROUND: TokenType;
|
|
1256
|
+
|
|
1257
|
+
export declare type RoundFunctionCstChildren = {
|
|
1258
|
+
ROUND: IToken[];
|
|
1259
|
+
LPAREN: IToken[];
|
|
1260
|
+
expression: ExpressionCstNode[];
|
|
1261
|
+
RPAREN: IToken[];
|
|
1262
|
+
};
|
|
1263
|
+
|
|
1264
|
+
export declare interface RoundFunctionCstNode extends CstNode {
|
|
1265
|
+
name: "roundFunction";
|
|
1266
|
+
children: RoundFunctionCstChildren;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
export declare const RPAREN: TokenType;
|
|
1270
|
+
|
|
1271
|
+
export declare const RULE_ARROW: TokenType;
|
|
1272
|
+
|
|
1273
|
+
export declare type RuleBodyCstChildren = {
|
|
1274
|
+
bodyFormula: BodyFormulaCstNode[];
|
|
1275
|
+
COMMA?: IToken[];
|
|
1276
|
+
};
|
|
1277
|
+
|
|
1278
|
+
export declare interface RuleBodyCstNode extends CstNode {
|
|
1279
|
+
name: "ruleBody";
|
|
1280
|
+
children: RuleBodyCstChildren;
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
export declare type RuleCstChildren = {
|
|
1284
|
+
ruleHead: RuleHeadCstNode[];
|
|
1285
|
+
RULE_ARROW: IToken[];
|
|
1286
|
+
ruleBody?: RuleBodyCstNode[];
|
|
1287
|
+
DOT: IToken[];
|
|
1288
|
+
};
|
|
1289
|
+
|
|
1290
|
+
export declare interface RuleCstNode extends CstNode {
|
|
1291
|
+
name: "rule";
|
|
1292
|
+
children: RuleCstChildren;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
export declare type RuleHeadCstChildren = {
|
|
1296
|
+
tupleTableAtom: TupleTableAtomCstNode[];
|
|
1297
|
+
COMMA?: IToken[];
|
|
1298
|
+
};
|
|
1299
|
+
|
|
1300
|
+
export declare interface RuleHeadCstNode extends CstNode {
|
|
1301
|
+
name: "ruleHead";
|
|
1302
|
+
children: RuleHeadCstChildren;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
export declare type RuleVocabulary = {
|
|
1306
|
+
head: RuleVocabularyPosition;
|
|
1307
|
+
body: RuleVocabularyPosition;
|
|
1308
|
+
};
|
|
1309
|
+
|
|
1310
|
+
export declare type RuleVocabularyExtractionResult = {
|
|
1311
|
+
ok: true;
|
|
1312
|
+
vocabulary: RuleVocabulary;
|
|
1313
|
+
} | {
|
|
1314
|
+
ok: false;
|
|
1315
|
+
issues: DatalogParseIssue[];
|
|
1316
|
+
};
|
|
1317
|
+
|
|
1318
|
+
export declare type RuleVocabularyPosition = {
|
|
1319
|
+
classes: RuleVocabularyReference[];
|
|
1320
|
+
predicates: RuleVocabularyReference[];
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1323
|
+
export declare type RuleVocabularyReference = {
|
|
1324
|
+
term: string;
|
|
1325
|
+
graph?: DatalogTerm;
|
|
1326
|
+
};
|
|
1327
|
+
|
|
1328
|
+
export declare type SimpleComparison = {
|
|
1329
|
+
variableName: string;
|
|
1330
|
+
operator: ComparisonOperator;
|
|
1331
|
+
literal: LiteralTerm;
|
|
1332
|
+
};
|
|
1333
|
+
|
|
1334
|
+
export declare function simpleComparisonFromExpression(expression: DatalogExpression): SimpleComparison | null;
|
|
1335
|
+
|
|
1336
|
+
export declare function simpleComparisonFromFilter(filter: DatalogFilter): SimpleComparison | null;
|
|
1337
|
+
|
|
1338
|
+
export declare const SKOLEM: TokenType;
|
|
1339
|
+
|
|
1340
|
+
export declare type SkolemAtomCstChildren = {
|
|
1341
|
+
SKOLEM: IToken[];
|
|
1342
|
+
LPAREN: IToken[];
|
|
1343
|
+
argumentList: ArgumentListCstNode[];
|
|
1344
|
+
RPAREN: IToken[];
|
|
1345
|
+
};
|
|
1346
|
+
|
|
1347
|
+
export declare interface SkolemAtomCstNode extends CstNode {
|
|
1348
|
+
name: "skolemAtom";
|
|
1349
|
+
children: SkolemAtomCstChildren;
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
export declare type SkolemFunctionCstChildren = {
|
|
1353
|
+
SKOLEM: IToken[];
|
|
1354
|
+
LPAREN: IToken[];
|
|
1355
|
+
argumentList: ArgumentListCstNode[];
|
|
1356
|
+
RPAREN: IToken[];
|
|
1357
|
+
};
|
|
1358
|
+
|
|
1359
|
+
export declare interface SkolemFunctionCstNode extends CstNode {
|
|
1360
|
+
name: "skolemFunction";
|
|
1361
|
+
children: SkolemFunctionCstChildren;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
export declare function skolemMintedVariable(formula: DatalogBodyFormula): string | null;
|
|
1365
|
+
|
|
1366
|
+
export declare const SLASH: TokenType;
|
|
1367
|
+
|
|
1368
|
+
export declare type SourceSpan = {
|
|
1369
|
+
start: number;
|
|
1370
|
+
end: number;
|
|
1371
|
+
};
|
|
1372
|
+
|
|
1373
|
+
export declare type SparqlQueryType = "select" | "construct" | "describe" | "ask" | "update";
|
|
1374
|
+
|
|
1375
|
+
export declare interface SparqlSelectResult {
|
|
1376
|
+
query: string;
|
|
1377
|
+
variables: string[];
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
export declare type SparqlUpdateValidationResult = {
|
|
1381
|
+
allowed: true;
|
|
1382
|
+
operationTypes: DataManipulationSubType[];
|
|
1383
|
+
} | {
|
|
1384
|
+
allowed: false;
|
|
1385
|
+
error: string;
|
|
1386
|
+
blockedOperations?: UpdateSubType[];
|
|
1387
|
+
};
|
|
1388
|
+
|
|
1389
|
+
export declare type SparqlValidationResult = {
|
|
1390
|
+
valid: true;
|
|
1391
|
+
queryType: SparqlQueryType;
|
|
1392
|
+
isReadOnly: boolean;
|
|
1393
|
+
} | {
|
|
1394
|
+
valid: false;
|
|
1395
|
+
error: string;
|
|
1396
|
+
};
|
|
1397
|
+
|
|
1398
|
+
export declare const STAR: TokenType;
|
|
1399
|
+
|
|
1400
|
+
export declare const STR: TokenType;
|
|
1401
|
+
|
|
1402
|
+
export declare type StrFunctionCstChildren = {
|
|
1403
|
+
STR: IToken[];
|
|
1404
|
+
LPAREN: IToken[];
|
|
1405
|
+
expression: ExpressionCstNode[];
|
|
1406
|
+
RPAREN: IToken[];
|
|
1407
|
+
};
|
|
1408
|
+
|
|
1409
|
+
export declare interface StrFunctionCstNode extends CstNode {
|
|
1410
|
+
name: "strFunction";
|
|
1411
|
+
children: StrFunctionCstChildren;
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
export declare const STRING_LITERAL: TokenType;
|
|
1415
|
+
|
|
1416
|
+
export declare const STRING_LITERAL_LONG: TokenType;
|
|
1417
|
+
|
|
1418
|
+
export declare type StringLiteralCstChildren = {
|
|
1419
|
+
STRING_LITERAL_LONG?: IToken[];
|
|
1420
|
+
STRING_LITERAL?: IToken[];
|
|
1421
|
+
LANGTAG?: IToken[];
|
|
1422
|
+
HAT?: IToken[];
|
|
1423
|
+
iri?: IriCstNode[];
|
|
1424
|
+
};
|
|
1425
|
+
|
|
1426
|
+
export declare interface StringLiteralCstNode extends CstNode {
|
|
1427
|
+
name: "stringLiteral";
|
|
1428
|
+
children: StringLiteralCstChildren;
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
export declare const stringLiteralTokenTypes: Set<TokenType>;
|
|
1432
|
+
|
|
1433
|
+
export declare const SUM: TokenType;
|
|
1434
|
+
|
|
1435
|
+
export declare type TermCstChildren = {
|
|
1436
|
+
VARIABLE?: IToken[];
|
|
1437
|
+
iri?: IriCstNode[];
|
|
1438
|
+
literal?: LiteralCstNode[];
|
|
1439
|
+
BLANK_NODE?: IToken[];
|
|
1440
|
+
};
|
|
1441
|
+
|
|
1442
|
+
export declare interface TermCstNode extends CstNode {
|
|
1443
|
+
name: "term";
|
|
1444
|
+
children: TermCstChildren;
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
export declare type TermExpression = {
|
|
1448
|
+
type: "term";
|
|
1449
|
+
term: DatalogTerm;
|
|
1450
|
+
};
|
|
1451
|
+
|
|
1452
|
+
export declare function termsEqual(left: DatalogTerm, right: DatalogTerm): boolean;
|
|
1453
|
+
|
|
1454
|
+
/**
|
|
1455
|
+
* Compare two serialized terms by meaning rather than by text, so `1.2`,
|
|
1456
|
+
* `"1.2"^^xsd:decimal` and `"1.2"^^<http://www.w3.org/2001/XMLSchema#decimal>`
|
|
1457
|
+
* all count as the same value. Returns undefined when either side is not a
|
|
1458
|
+
* single term, so callers can tell "different" apart from "not comparable".
|
|
1459
|
+
* Prefixed and absolute IRIs are not resolved against each other - normalize
|
|
1460
|
+
* IRIs to one form before calling.
|
|
1461
|
+
*/
|
|
1462
|
+
export declare function termTextsEqual(left: string, right: string): boolean | undefined;
|
|
1463
|
+
|
|
1464
|
+
export declare function termToDatalogText(term: DatalogTerm, options?: DatalogTextOptions): string;
|
|
1465
|
+
|
|
1466
|
+
export declare const termTokenTypes: Set<TokenType>;
|
|
1467
|
+
|
|
1468
|
+
export declare function termToSparql(term: DatalogTerm): string;
|
|
1469
|
+
|
|
1470
|
+
export declare function tokenizeDatalog(text: string): ILexingResult;
|
|
1471
|
+
|
|
1472
|
+
export declare type TripleAtom = {
|
|
1473
|
+
type: "triple";
|
|
1474
|
+
subject: DatalogTerm;
|
|
1475
|
+
predicate: DatalogTerm;
|
|
1476
|
+
object: DatalogTerm;
|
|
1477
|
+
graph?: DatalogTerm;
|
|
1478
|
+
};
|
|
1479
|
+
|
|
1480
|
+
export declare const TRUE: TokenType;
|
|
1481
|
+
|
|
1482
|
+
export declare type TupleTableAtomCstChildren = {
|
|
1483
|
+
defaultGraphAtom?: DefaultGraphAtomCstNode[];
|
|
1484
|
+
generalAtom?: GeneralAtomCstNode[];
|
|
1485
|
+
graph?: GraphNameCstNode[];
|
|
1486
|
+
};
|
|
1487
|
+
|
|
1488
|
+
export declare interface TupleTableAtomCstNode extends CstNode {
|
|
1489
|
+
name: "tupleTableAtom";
|
|
1490
|
+
children: TupleTableAtomCstChildren;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
export declare type UnaryAggregateBinding = AggregateBindingTarget & {
|
|
1494
|
+
function: UnaryAggregateFunction;
|
|
1495
|
+
distinct?: boolean;
|
|
1496
|
+
expression: DatalogExpression | "*";
|
|
1497
|
+
secondExpression?: never;
|
|
1498
|
+
};
|
|
1499
|
+
|
|
1500
|
+
export declare type UnaryAggregateFunction = "COUNT" | "MIN" | "MAX" | "SUM" | "MUL" | "AVG" | "COUNT_MIN" | "COUNT_MAX";
|
|
1501
|
+
|
|
1502
|
+
export declare type UnaryExpression = {
|
|
1503
|
+
type: "unary";
|
|
1504
|
+
operator: "!" | "+" | "-";
|
|
1505
|
+
operand: DatalogExpression;
|
|
1506
|
+
};
|
|
1507
|
+
|
|
1508
|
+
export declare type UnaryExpressionCstChildren = {
|
|
1509
|
+
EXCLAMATION?: IToken[];
|
|
1510
|
+
PLUS?: IToken[];
|
|
1511
|
+
MINUS?: IToken[];
|
|
1512
|
+
primaryExpression: PrimaryExpressionCstNode[];
|
|
1513
|
+
};
|
|
1514
|
+
|
|
1515
|
+
export declare interface UnaryExpressionCstNode extends CstNode {
|
|
1516
|
+
name: "unaryExpression";
|
|
1517
|
+
children: UnaryExpressionCstChildren;
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
export declare function unaryOperandNeedsParentheses(operand: DatalogExpression): boolean;
|
|
1521
|
+
|
|
1522
|
+
export declare function unwrapTermExpression(expression: DatalogExpression): DatalogTerm | null;
|
|
1523
|
+
|
|
1524
|
+
export declare type UpdateSubType = UpdateOperation["subType"];
|
|
1525
|
+
|
|
1526
|
+
/**
|
|
1527
|
+
* Validate Datalog rule syntax and that every required variable is bound.
|
|
1528
|
+
*/
|
|
1529
|
+
export declare function validateDatalogRule(ruleText: string): {
|
|
1530
|
+
valid: boolean;
|
|
1531
|
+
error?: string;
|
|
1532
|
+
};
|
|
1533
|
+
|
|
1534
|
+
export declare function validateDataManipulationUpdate(update: string): SparqlUpdateValidationResult;
|
|
1535
|
+
|
|
1536
|
+
export declare function validateRuleSyntax(text: string): {
|
|
1537
|
+
valid: boolean;
|
|
1538
|
+
error?: string;
|
|
1539
|
+
};
|
|
1540
|
+
|
|
1541
|
+
export declare function validateSparqlQuery(query: string): SparqlValidationResult;
|
|
1542
|
+
|
|
1543
|
+
export declare const VARIABLE: TokenType;
|
|
1544
|
+
|
|
1545
|
+
export declare function variableNameFromTermExpression(expression: DatalogExpression): string | null;
|
|
1546
|
+
|
|
1547
|
+
export declare function variableNamesFromAtom(atom: DatalogAtom): string[];
|
|
1548
|
+
|
|
1549
|
+
export declare function variableNamesFromExpression(expression: DatalogExpression): string[];
|
|
1550
|
+
|
|
1551
|
+
export declare type VariableTerm = {
|
|
1552
|
+
type: "variable";
|
|
1553
|
+
name: string;
|
|
1554
|
+
};
|
|
1555
|
+
|
|
1556
|
+
export declare type VariableType = {
|
|
1557
|
+
variable: string;
|
|
1558
|
+
typeTerm: string;
|
|
1559
|
+
source: VariableTypeSource;
|
|
1560
|
+
};
|
|
1561
|
+
|
|
1562
|
+
export declare type VariableTypeEvidence = {
|
|
1563
|
+
variable: string;
|
|
1564
|
+
classTerm?: string;
|
|
1565
|
+
bodyClassTerm?: string;
|
|
1566
|
+
predicateEvidence: PredicateEvidence[];
|
|
1567
|
+
};
|
|
1568
|
+
|
|
1569
|
+
export declare type VariableTypeSource = "class" | PredicatePosition;
|
|
1570
|
+
|
|
1571
|
+
/**
|
|
1572
|
+
* Verify that a rule produces the expected inference
|
|
1573
|
+
*/
|
|
1574
|
+
export declare function verifyRuleInference(rule: DatalogRule, rdfoxUrl: string, datastoreId: string, authorization: string, testTriple?: {
|
|
1575
|
+
subject: string;
|
|
1576
|
+
predicate: string;
|
|
1577
|
+
object: string;
|
|
1578
|
+
}): Promise<InferenceVerificationResult>;
|
|
1579
|
+
|
|
1580
|
+
export declare const WHITESPACE: TokenType;
|
|
1581
|
+
|
|
1582
|
+
/**
|
|
1583
|
+
* Execute a function within a transaction context, automatically handling commit/rollback
|
|
1584
|
+
*/
|
|
1585
|
+
export declare function withTransaction<T>(params: RDFoxConnectionParams, fn: (connectionId: string) => Promise<T>): Promise<T>;
|
|
1586
|
+
|
|
1587
|
+
export declare type XsdDatatypeLocalName = keyof typeof xsdDatatypes;
|
|
1588
|
+
|
|
1589
|
+
export declare const xsdDatatypes: {
|
|
1590
|
+
readonly integer: "xsd:integer";
|
|
1591
|
+
readonly decimal: "xsd:decimal";
|
|
1592
|
+
readonly double: "xsd:double";
|
|
1593
|
+
readonly boolean: "xsd:boolean";
|
|
1594
|
+
readonly string: "xsd:string";
|
|
1595
|
+
readonly date: "xsd:date";
|
|
1596
|
+
readonly dateTime: "xsd:dateTime";
|
|
1597
|
+
};
|
|
1598
|
+
|
|
1599
|
+
export { }
|