@faubulous/mentor-rdf 2.1.5 → 2.1.6

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/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "ontology",
11
11
  "vocabulary"
12
12
  ],
13
- "version": "2.1.5",
13
+ "version": "2.1.6",
14
14
  "private": false,
15
15
  "author": {
16
16
  "name": "Sebastian Faubel"
@@ -49,14 +49,14 @@
49
49
  "serve:docs": "npx --yes serve docs"
50
50
  },
51
51
  "devDependencies": {
52
- "@types/node": "^26.6.2",
53
- "@vitest/coverage-v8": "^4.1.11",
52
+ "@types/node": "^26.6.5",
53
+ "@vitest/coverage-v8": "^5.0.5",
54
54
  "esbuild": "^0.28.2",
55
55
  "ts-node": "^10.9.2",
56
56
  "tslib": "^2.8.1",
57
57
  "typedoc": "^0.28.20",
58
58
  "typescript": "^6.0.3",
59
- "vitest": "^4.1.11"
59
+ "vitest": "^5.0.5"
60
60
  },
61
61
  "overrides": {
62
62
  "got": "^11.8.6",
@@ -68,10 +68,10 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "@faubulous/mentor-cli": "^0.2.1",
71
- "@faubulous/mentor-rdf-parsers": "^2.0.3",
71
+ "@faubulous/mentor-rdf-parsers": "^2.1.1",
72
72
  "memory-level": "^3.1.0",
73
73
  "quadstore": "^15.4.1",
74
- "rdf-stores": "^2.5.0",
74
+ "rdf-stores": "^2.8.0",
75
75
  "rdflib": "^2.4.1",
76
76
  "rdfxml-streaming-parser": "^3.3.0",
77
77
  "rxjs": "^7.8.2"
@@ -1,625 +0,0 @@
1
- import { NamedNode } from '@rdfjs/types';
2
- /** Namespace URI of the SPS vocabulary. */
3
- export declare const _SPS = "https://w3id.org/sparql-syntax#";
4
- export declare const SPS: {
5
- /** A vocabulary for representing the syntax of SPARQL 1.2 queries and updates as RDF. */
6
- sparql_syntax: string;
7
- ABS: string;
8
- /** An ADD operation. SPARQL 1.2 Update grammar production [37]. */
9
- Add: string;
10
- /** An arithmetic + expression. */
11
- Addition: string;
12
- /** Abstract superclass of the SPARQL aggregates. SPARQL 1.2 grammar production [137]. */
13
- Aggregate: string;
14
- /** An (expression AS ?variable) alias in a SELECT clause or GROUP BY condition. */
15
- Alias: string;
16
- /** All graphs as target of CLEAR or DROP (ALL keyword). */
17
- AllGraphs: string;
18
- /** A property path alternative (elt1 | elt2). SPARQL 1.2 grammar production [92]. */
19
- AltPath: string;
20
- /** A logical && expression. */
21
- And: string;
22
- /** An explicit ASC(...) order condition. */
23
- Asc: string;
24
- /** An ASK query. SPARQL 1.2 grammar production [14]. */
25
- AskQuery: string;
26
- Avg: string;
27
- BNODE: string;
28
- BOUND: string;
29
- /** A BIND assignment. SPARQL 1.2 grammar production [63]. */
30
- Bind: string;
31
- /** A blank node written in query syntax (_:label, [], [...] or a collection cell), as opposed to the structural blank nodes of the representation itself. */
32
- BlankNode: string;
33
- /** A call of a SPARQL built-in function; sps:function points to the built-in function individual. SPARQL 1.2 grammar production [131]. */
34
- BuiltInCall: string;
35
- /** The class of SPARQL built-in function individuals. */
36
- BuiltInFunction: string;
37
- CEIL: string;
38
- COALESCE: string;
39
- CONCAT: string;
40
- CONTAINS: string;
41
- /** A CLEAR operation. SPARQL 1.2 Update grammar production [34]. */
42
- Clear: string;
43
- /** A CONSTRUCT query. SPARQL 1.2 grammar production [12]. */
44
- ConstructQuery: string;
45
- /** A COPY operation. SPARQL 1.2 Update grammar production [39]. */
46
- Copy: string;
47
- Count: string;
48
- /** A CREATE operation. SPARQL 1.2 Update grammar production [36]. */
49
- Create: string;
50
- DATATYPE: string;
51
- DAY: string;
52
- /** The default graph as target of an update operation (DEFAULT keyword). */
53
- DefaultGraph: string;
54
- /** A DELETE DATA operation. SPARQL 1.2 Update grammar production [41]. */
55
- DeleteData: string;
56
- /** A DELETE WHERE operation. SPARQL 1.2 Update grammar production [42]. */
57
- DeleteWhere: string;
58
- /** A DESC(...) order condition. */
59
- Desc: string;
60
- /** A DESCRIBE query. SPARQL 1.2 grammar production [13]. */
61
- DescribeQuery: string;
62
- /** An arithmetic / expression. */
63
- Division: string;
64
- /** A DROP operation. SPARQL 1.2 Update grammar production [35]. */
65
- Drop: string;
66
- ENCODE_FOR_URI: string;
67
- /** An = comparison. */
68
- Eq: string;
69
- /** An EXISTS expression with an embedded graph pattern. SPARQL 1.2 grammar production [135]. */
70
- Exists: string;
71
- /** Abstract superclass of all compound SPARQL expressions. Atomic expressions (variables, IRIs, literals) appear directly as terms. */
72
- Expression: string;
73
- FLOOR: string;
74
- /** A FILTER constraint. SPARQL 1.2 grammar production [71]. */
75
- Filter: string;
76
- /** A call of a custom function identified by IRI. SPARQL 1.2 grammar production [73]. */
77
- FunctionCall: string;
78
- /** A >= comparison. */
79
- Geq: string;
80
- /** A GRAPH graph pattern, also used for GRAPH blocks inside update quad templates. SPARQL 1.2 grammar production [61]. */
81
- Graph: string;
82
- /** An explicit nested group graph pattern { ... }, including the branches of a UNION. SPARQL 1.2 grammar production [55]. */
83
- Group: string;
84
- GroupConcat: string;
85
- /** A > comparison. */
86
- Gt: string;
87
- HOURS: string;
88
- IF: string;
89
- IRI: string;
90
- /** An IN expression; sps:arg1 holds the tested expression, sps:args the list of candidates. */
91
- In: string;
92
- /** An INSERT DATA operation. SPARQL 1.2 Update grammar production [40]. */
93
- InsertData: string;
94
- /** An inverse property path (^elt). SPARQL 1.2 grammar production [95]. */
95
- InversePath: string;
96
- LANG: string;
97
- LANGDIR: string;
98
- LANGMATCHES: string;
99
- LCASE: string;
100
- /** A <= comparison. */
101
- Leq: string;
102
- /** A LOAD operation. SPARQL 1.2 Update grammar production [33]. */
103
- Load: string;
104
- /** A < comparison. */
105
- Lt: string;
106
- MD5: string;
107
- MINUTES: string;
108
- MONTH: string;
109
- Max: string;
110
- Min: string;
111
- /** A MINUS graph pattern. SPARQL 1.2 grammar production [69]. */
112
- Minus: string;
113
- /** A DELETE/INSERT operation with a WHERE clause. SPARQL 1.2 Update grammar production [43]. */
114
- Modify: string;
115
- /** A MOVE operation. SPARQL 1.2 Update grammar production [38]. */
116
- Move: string;
117
- /** An arithmetic * expression. */
118
- Multiplication: string;
119
- NOW: string;
120
- /** All named graphs as target of CLEAR or DROP (NAMED keyword). */
121
- NamedGraphs: string;
122
- /** A negated property set (!iri or !(iri1 | ^iri2 | ...)). SPARQL 1.2 grammar production [98]. */
123
- NegatedPath: string;
124
- /** A != comparison. */
125
- Neq: string;
126
- /** A NOT EXISTS expression with an embedded graph pattern. SPARQL 1.2 grammar production [136]. */
127
- NotExists: string;
128
- /** A NOT IN expression; sps:arg1 holds the tested expression, sps:args the list of candidates. */
129
- NotIn: string;
130
- OBJECT: string;
131
- /** A property path with the + modifier. SPARQL 1.2 grammar production [96]. */
132
- OneOrMorePath: string;
133
- /** An OPTIONAL graph pattern. SPARQL 1.2 grammar production [60]. */
134
- Optional: string;
135
- /** A logical || expression. */
136
- Or: string;
137
- PREDICATE: string;
138
- /** Abstract superclass of the four SPARQL query forms. */
139
- Query: string;
140
- RAND: string;
141
- REGEX: string;
142
- REPLACE: string;
143
- ROUND: string;
144
- SECONDS: string;
145
- SHA1: string;
146
- SHA256: string;
147
- SHA384: string;
148
- SHA512: string;
149
- STR: string;
150
- STRAFTER: string;
151
- STRBEFORE: string;
152
- STRDT: string;
153
- STRENDS: string;
154
- STRLANG: string;
155
- STRLANGDIR: string;
156
- STRLEN: string;
157
- STRSTARTS: string;
158
- STRUUID: string;
159
- SUBJECT: string;
160
- SUBSTR: string;
161
- Sample: string;
162
- /** A SELECT query. SPARQL 1.2 grammar production [9]. */
163
- SelectQuery: string;
164
- /** A property path sequence (elt1 / elt2). SPARQL 1.2 grammar production [93]. */
165
- SeqPath: string;
166
- /** A SERVICE graph pattern. SPARQL 1.2 grammar production [62]. */
167
- Service: string;
168
- /** A sub-select appearing as a group graph pattern element. SPARQL 1.2 grammar production [10]. */
169
- SubSelect: string;
170
- /** An arithmetic - expression. */
171
- Subtraction: string;
172
- Sum: string;
173
- TIMEZONE: string;
174
- TRIPLE: string;
175
- TZ: string;
176
- /** A single subject-predicate-object pattern or template triple. */
177
- TriplePattern: string;
178
- /** An RDF 1.2 triple term <<( s p o )>>. Represented structurally because its components may be variables. SPARQL 1.2 grammar production [113]. */
179
- TripleTerm: string;
180
- UCASE: string;
181
- URI: string;
182
- UUID: string;
183
- /** A unary - expression. */
184
- UnaryMinus: string;
185
- /** A unary ! expression. */
186
- UnaryNot: string;
187
- /** A unary + expression. */
188
- UnaryPlus: string;
189
- /** A UNION of two or more group graph patterns. SPARQL 1.2 grammar production [70]. */
190
- Union: string;
191
- /** The root node of a SPARQL update request; holds the ordered sequence of update operations. SPARQL 1.2 Update grammar production [31]. */
192
- Update: string;
193
- /** An inline data block (VALUES), either inside a group graph pattern or trailing a query. SPARQL 1.2 grammar productions [64]-[67]. */
194
- Values: string;
195
- /** A SPARQL variable (?name or $name). One node is shared per distinct variable name within a query. */
196
- Variable: string;
197
- YEAR: string;
198
- /** A property path with the * modifier. SPARQL 1.2 grammar production [96]. */
199
- ZeroOrMorePath: string;
200
- /** A property path with the ? modifier. SPARQL 1.2 grammar production [96]. */
201
- ZeroOrOnePath: string;
202
- /** The operand of a unary operator expression. */
203
- arg: string;
204
- /** The left operand of a binary operator expression. */
205
- arg1: string;
206
- /** The right operand of a binary operator expression. */
207
- arg2: string;
208
- /** The ordered arguments of a function call, built-in call, or IN/NOT IN expression: an rdf:List. */
209
- args: string;
210
- /** The binding rows of a VALUES block: an rdf:List of rows, each row an rdf:List of terms or sps:undef. */
211
- bindings: string;
212
- /** True for COUNT(*). */
213
- countStar: string;
214
- /** The quad data of an INSERT DATA or DELETE DATA operation: an rdf:List of sps:TriplePattern and sps:Graph nodes. */
215
- data: string;
216
- /** The DELETE template of a DELETE/INSERT operation: an rdf:List of sps:TriplePattern and sps:Graph nodes. */
217
- deleteTemplate: string;
218
- /** The targets of a DESCRIBE query: an rdf:List of sps:Variable nodes or IRIs. */
219
- describeTargets: string;
220
- /** True if the SELECT clause, aggregate or argument list carries the DISTINCT modifier. */
221
- distinct: string;
222
- /** The ordered elements of a group, OPTIONAL, MINUS, GRAPH, SERVICE, EXISTS, NOT EXISTS or UNION: an rdf:List. */
223
- elements: string;
224
- /** The endpoint (variable or IRI) of a SERVICE pattern. */
225
- endpoint: string;
226
- /** The expression of a FILTER, BIND, alias, order condition or aggregate. */
227
- expression: string;
228
- /** A FROM dataset clause IRI (repeated for multiple clauses). */
229
- from: string;
230
- /** The source graph of an ADD, MOVE or COPY operation: a graph IRI or sps:DefaultGraph. */
231
- fromGraph: string;
232
- /** A FROM NAMED dataset clause IRI (repeated for multiple clauses). */
233
- fromNamed: string;
234
- /** The function of a call: an IRI for custom functions, a sps:BuiltInFunction individual for built-ins. */
235
- function: string;
236
- /** The graph name (variable or IRI) of a GRAPH pattern or graph block, or the IRI of a CREATE or GRAPH reference. */
237
- graph: string;
238
- /** The target of a CLEAR or DROP operation: a graph IRI, sps:DefaultGraph, sps:NamedGraphs or sps:AllGraphs. */
239
- graphTarget: string;
240
- /** The GROUP BY conditions: an rdf:List of variables, expressions or sps:Alias nodes. */
241
- groupBy: string;
242
- hasLANG: string;
243
- hasLANGDIR: string;
244
- /** The HAVING conditions: an rdf:List of expressions. */
245
- having: string;
246
- /** The INSERT template of a DELETE/INSERT operation: an rdf:List of sps:TriplePattern and sps:Graph nodes. */
247
- insertTemplate: string;
248
- /** The target graph IRI of a LOAD ... INTO GRAPH operation. */
249
- into: string;
250
- isBLANK: string;
251
- isIRI: string;
252
- isLITERAL: string;
253
- isNUMERIC: string;
254
- isTRIPLE: string;
255
- isURI: string;
256
- /** The label of a syntactic blank node, without the _: prefix. Absent for anonymous blank nodes. */
257
- label: string;
258
- /** The LIMIT of a query. */
259
- limit: string;
260
- /** The object of a triple pattern or triple term. */
261
- object: string;
262
- /** The OFFSET of a query. */
263
- offset: string;
264
- /** The ordered update operations of an update request: an rdf:List. */
265
- operations: string;
266
- /** The ORDER BY conditions: an rdf:List of variables, expressions, or sps:Asc/sps:Desc nodes. */
267
- orderBy: string;
268
- /** The sub-path of an inverse or modified property path. */
269
- path: string;
270
- /** The ordered sub-paths of a sequence, alternative or negated property path: an rdf:List. */
271
- pathElements: string;
272
- /** The predicate of a triple pattern or triple term: an IRI, sps:Variable, or property path node. */
273
- predicate: string;
274
- /** The projection of a SELECT query: an rdf:List of sps:Variable or sps:Alias nodes. */
275
- projection: string;
276
- /** True if the SELECT clause carries the REDUCED modifier. */
277
- reduced: string;
278
- sameTerm: string;
279
- /** The SEPARATOR of a GROUP_CONCAT aggregate. */
280
- separator: string;
281
- /** True if the operation or SERVICE pattern carries the SILENT modifier. */
282
- silent: string;
283
- /** The source document IRI of a LOAD operation. */
284
- source: string;
285
- /** True if the query uses SELECT * or DESCRIBE *. */
286
- star: string;
287
- /** The subject of a triple pattern or triple term. */
288
- subject: string;
289
- /** The template of a CONSTRUCT query: an rdf:List of sps:TriplePattern nodes. */
290
- template: string;
291
- /** The target graph of an ADD, MOVE or COPY operation: a graph IRI or sps:DefaultGraph. */
292
- toGraph: string;
293
- /** The UNDEF marker in a VALUES binding row. */
294
- undef: string;
295
- /** A USING clause IRI of a DELETE/INSERT operation (repeated for multiple clauses). */
296
- using: string;
297
- /** A USING NAMED clause IRI of a DELETE/INSERT operation (repeated for multiple clauses). */
298
- usingNamed: string;
299
- /** The trailing VALUES clause of a query or sub-select. */
300
- values: string;
301
- /** The name of a variable, without the ? or $ sigil. */
302
- varName: string;
303
- /** The target variable of a BIND or alias. */
304
- variable: string;
305
- /** The variables of a VALUES block: an rdf:List of sps:Variable nodes. */
306
- variables: string;
307
- /** The version string of a VERSION declaration. SPARQL 1.2 grammar production [7]. */
308
- version: string;
309
- /** The WHERE clause of a query, sub-select, DELETE/INSERT or DELETE WHERE operation: an rdf:List of graph pattern elements. */
310
- where: string;
311
- /** The WITH graph IRI of a DELETE/INSERT operation. */
312
- withGraph: string;
313
- };
314
- /** Namespace URI of the sps vocabulary. */
315
- export declare const _sps: NamedNode;
316
- export declare const sps: {
317
- /** A vocabulary for representing the syntax of SPARQL 1.2 queries and updates as RDF. */
318
- sparql_syntax: NamedNode;
319
- ABS: NamedNode;
320
- /** An ADD operation. SPARQL 1.2 Update grammar production [37]. */
321
- Add: NamedNode;
322
- /** An arithmetic + expression. */
323
- Addition: NamedNode;
324
- /** Abstract superclass of the SPARQL aggregates. SPARQL 1.2 grammar production [137]. */
325
- Aggregate: NamedNode;
326
- /** An (expression AS ?variable) alias in a SELECT clause or GROUP BY condition. */
327
- Alias: NamedNode;
328
- /** All graphs as target of CLEAR or DROP (ALL keyword). */
329
- AllGraphs: NamedNode;
330
- /** A property path alternative (elt1 | elt2). SPARQL 1.2 grammar production [92]. */
331
- AltPath: NamedNode;
332
- /** A logical && expression. */
333
- And: NamedNode;
334
- /** An explicit ASC(...) order condition. */
335
- Asc: NamedNode;
336
- /** An ASK query. SPARQL 1.2 grammar production [14]. */
337
- AskQuery: NamedNode;
338
- Avg: NamedNode;
339
- BNODE: NamedNode;
340
- BOUND: NamedNode;
341
- /** A BIND assignment. SPARQL 1.2 grammar production [63]. */
342
- Bind: NamedNode;
343
- /** A blank node written in query syntax (_:label, [], [...] or a collection cell), as opposed to the structural blank nodes of the representation itself. */
344
- BlankNode: NamedNode;
345
- /** A call of a SPARQL built-in function; sps:function points to the built-in function individual. SPARQL 1.2 grammar production [131]. */
346
- BuiltInCall: NamedNode;
347
- /** The class of SPARQL built-in function individuals. */
348
- BuiltInFunction: NamedNode;
349
- CEIL: NamedNode;
350
- COALESCE: NamedNode;
351
- CONCAT: NamedNode;
352
- CONTAINS: NamedNode;
353
- /** A CLEAR operation. SPARQL 1.2 Update grammar production [34]. */
354
- Clear: NamedNode;
355
- /** A CONSTRUCT query. SPARQL 1.2 grammar production [12]. */
356
- ConstructQuery: NamedNode;
357
- /** A COPY operation. SPARQL 1.2 Update grammar production [39]. */
358
- Copy: NamedNode;
359
- Count: NamedNode;
360
- /** A CREATE operation. SPARQL 1.2 Update grammar production [36]. */
361
- Create: NamedNode;
362
- DATATYPE: NamedNode;
363
- DAY: NamedNode;
364
- /** The default graph as target of an update operation (DEFAULT keyword). */
365
- DefaultGraph: NamedNode;
366
- /** A DELETE DATA operation. SPARQL 1.2 Update grammar production [41]. */
367
- DeleteData: NamedNode;
368
- /** A DELETE WHERE operation. SPARQL 1.2 Update grammar production [42]. */
369
- DeleteWhere: NamedNode;
370
- /** A DESC(...) order condition. */
371
- Desc: NamedNode;
372
- /** A DESCRIBE query. SPARQL 1.2 grammar production [13]. */
373
- DescribeQuery: NamedNode;
374
- /** An arithmetic / expression. */
375
- Division: NamedNode;
376
- /** A DROP operation. SPARQL 1.2 Update grammar production [35]. */
377
- Drop: NamedNode;
378
- ENCODE_FOR_URI: NamedNode;
379
- /** An = comparison. */
380
- Eq: NamedNode;
381
- /** An EXISTS expression with an embedded graph pattern. SPARQL 1.2 grammar production [135]. */
382
- Exists: NamedNode;
383
- /** Abstract superclass of all compound SPARQL expressions. Atomic expressions (variables, IRIs, literals) appear directly as terms. */
384
- Expression: NamedNode;
385
- FLOOR: NamedNode;
386
- /** A FILTER constraint. SPARQL 1.2 grammar production [71]. */
387
- Filter: NamedNode;
388
- /** A call of a custom function identified by IRI. SPARQL 1.2 grammar production [73]. */
389
- FunctionCall: NamedNode;
390
- /** A >= comparison. */
391
- Geq: NamedNode;
392
- /** A GRAPH graph pattern, also used for GRAPH blocks inside update quad templates. SPARQL 1.2 grammar production [61]. */
393
- Graph: NamedNode;
394
- /** An explicit nested group graph pattern { ... }, including the branches of a UNION. SPARQL 1.2 grammar production [55]. */
395
- Group: NamedNode;
396
- GroupConcat: NamedNode;
397
- /** A > comparison. */
398
- Gt: NamedNode;
399
- HOURS: NamedNode;
400
- IF: NamedNode;
401
- IRI: NamedNode;
402
- /** An IN expression; sps:arg1 holds the tested expression, sps:args the list of candidates. */
403
- In: NamedNode;
404
- /** An INSERT DATA operation. SPARQL 1.2 Update grammar production [40]. */
405
- InsertData: NamedNode;
406
- /** An inverse property path (^elt). SPARQL 1.2 grammar production [95]. */
407
- InversePath: NamedNode;
408
- LANG: NamedNode;
409
- LANGDIR: NamedNode;
410
- LANGMATCHES: NamedNode;
411
- LCASE: NamedNode;
412
- /** A <= comparison. */
413
- Leq: NamedNode;
414
- /** A LOAD operation. SPARQL 1.2 Update grammar production [33]. */
415
- Load: NamedNode;
416
- /** A < comparison. */
417
- Lt: NamedNode;
418
- MD5: NamedNode;
419
- MINUTES: NamedNode;
420
- MONTH: NamedNode;
421
- Max: NamedNode;
422
- Min: NamedNode;
423
- /** A MINUS graph pattern. SPARQL 1.2 grammar production [69]. */
424
- Minus: NamedNode;
425
- /** A DELETE/INSERT operation with a WHERE clause. SPARQL 1.2 Update grammar production [43]. */
426
- Modify: NamedNode;
427
- /** A MOVE operation. SPARQL 1.2 Update grammar production [38]. */
428
- Move: NamedNode;
429
- /** An arithmetic * expression. */
430
- Multiplication: NamedNode;
431
- NOW: NamedNode;
432
- /** All named graphs as target of CLEAR or DROP (NAMED keyword). */
433
- NamedGraphs: NamedNode;
434
- /** A negated property set (!iri or !(iri1 | ^iri2 | ...)). SPARQL 1.2 grammar production [98]. */
435
- NegatedPath: NamedNode;
436
- /** A != comparison. */
437
- Neq: NamedNode;
438
- /** A NOT EXISTS expression with an embedded graph pattern. SPARQL 1.2 grammar production [136]. */
439
- NotExists: NamedNode;
440
- /** A NOT IN expression; sps:arg1 holds the tested expression, sps:args the list of candidates. */
441
- NotIn: NamedNode;
442
- OBJECT: NamedNode;
443
- /** A property path with the + modifier. SPARQL 1.2 grammar production [96]. */
444
- OneOrMorePath: NamedNode;
445
- /** An OPTIONAL graph pattern. SPARQL 1.2 grammar production [60]. */
446
- Optional: NamedNode;
447
- /** A logical || expression. */
448
- Or: NamedNode;
449
- PREDICATE: NamedNode;
450
- /** Abstract superclass of the four SPARQL query forms. */
451
- Query: NamedNode;
452
- RAND: NamedNode;
453
- REGEX: NamedNode;
454
- REPLACE: NamedNode;
455
- ROUND: NamedNode;
456
- SECONDS: NamedNode;
457
- SHA1: NamedNode;
458
- SHA256: NamedNode;
459
- SHA384: NamedNode;
460
- SHA512: NamedNode;
461
- STR: NamedNode;
462
- STRAFTER: NamedNode;
463
- STRBEFORE: NamedNode;
464
- STRDT: NamedNode;
465
- STRENDS: NamedNode;
466
- STRLANG: NamedNode;
467
- STRLANGDIR: NamedNode;
468
- STRLEN: NamedNode;
469
- STRSTARTS: NamedNode;
470
- STRUUID: NamedNode;
471
- SUBJECT: NamedNode;
472
- SUBSTR: NamedNode;
473
- Sample: NamedNode;
474
- /** A SELECT query. SPARQL 1.2 grammar production [9]. */
475
- SelectQuery: NamedNode;
476
- /** A property path sequence (elt1 / elt2). SPARQL 1.2 grammar production [93]. */
477
- SeqPath: NamedNode;
478
- /** A SERVICE graph pattern. SPARQL 1.2 grammar production [62]. */
479
- Service: NamedNode;
480
- /** A sub-select appearing as a group graph pattern element. SPARQL 1.2 grammar production [10]. */
481
- SubSelect: NamedNode;
482
- /** An arithmetic - expression. */
483
- Subtraction: NamedNode;
484
- Sum: NamedNode;
485
- TIMEZONE: NamedNode;
486
- TRIPLE: NamedNode;
487
- TZ: NamedNode;
488
- /** A single subject-predicate-object pattern or template triple. */
489
- TriplePattern: NamedNode;
490
- /** An RDF 1.2 triple term <<( s p o )>>. Represented structurally because its components may be variables. SPARQL 1.2 grammar production [113]. */
491
- TripleTerm: NamedNode;
492
- UCASE: NamedNode;
493
- URI: NamedNode;
494
- UUID: NamedNode;
495
- /** A unary - expression. */
496
- UnaryMinus: NamedNode;
497
- /** A unary ! expression. */
498
- UnaryNot: NamedNode;
499
- /** A unary + expression. */
500
- UnaryPlus: NamedNode;
501
- /** A UNION of two or more group graph patterns. SPARQL 1.2 grammar production [70]. */
502
- Union: NamedNode;
503
- /** The root node of a SPARQL update request; holds the ordered sequence of update operations. SPARQL 1.2 Update grammar production [31]. */
504
- Update: NamedNode;
505
- /** An inline data block (VALUES), either inside a group graph pattern or trailing a query. SPARQL 1.2 grammar productions [64]-[67]. */
506
- Values: NamedNode;
507
- /** A SPARQL variable (?name or $name). One node is shared per distinct variable name within a query. */
508
- Variable: NamedNode;
509
- YEAR: NamedNode;
510
- /** A property path with the * modifier. SPARQL 1.2 grammar production [96]. */
511
- ZeroOrMorePath: NamedNode;
512
- /** A property path with the ? modifier. SPARQL 1.2 grammar production [96]. */
513
- ZeroOrOnePath: NamedNode;
514
- /** The operand of a unary operator expression. */
515
- arg: NamedNode;
516
- /** The left operand of a binary operator expression. */
517
- arg1: NamedNode;
518
- /** The right operand of a binary operator expression. */
519
- arg2: NamedNode;
520
- /** The ordered arguments of a function call, built-in call, or IN/NOT IN expression: an rdf:List. */
521
- args: NamedNode;
522
- /** The binding rows of a VALUES block: an rdf:List of rows, each row an rdf:List of terms or sps:undef. */
523
- bindings: NamedNode;
524
- /** True for COUNT(*). */
525
- countStar: NamedNode;
526
- /** The quad data of an INSERT DATA or DELETE DATA operation: an rdf:List of sps:TriplePattern and sps:Graph nodes. */
527
- data: NamedNode;
528
- /** The DELETE template of a DELETE/INSERT operation: an rdf:List of sps:TriplePattern and sps:Graph nodes. */
529
- deleteTemplate: NamedNode;
530
- /** The targets of a DESCRIBE query: an rdf:List of sps:Variable nodes or IRIs. */
531
- describeTargets: NamedNode;
532
- /** True if the SELECT clause, aggregate or argument list carries the DISTINCT modifier. */
533
- distinct: NamedNode;
534
- /** The ordered elements of a group, OPTIONAL, MINUS, GRAPH, SERVICE, EXISTS, NOT EXISTS or UNION: an rdf:List. */
535
- elements: NamedNode;
536
- /** The endpoint (variable or IRI) of a SERVICE pattern. */
537
- endpoint: NamedNode;
538
- /** The expression of a FILTER, BIND, alias, order condition or aggregate. */
539
- expression: NamedNode;
540
- /** A FROM dataset clause IRI (repeated for multiple clauses). */
541
- from: NamedNode;
542
- /** The source graph of an ADD, MOVE or COPY operation: a graph IRI or sps:DefaultGraph. */
543
- fromGraph: NamedNode;
544
- /** A FROM NAMED dataset clause IRI (repeated for multiple clauses). */
545
- fromNamed: NamedNode;
546
- /** The function of a call: an IRI for custom functions, a sps:BuiltInFunction individual for built-ins. */
547
- function: NamedNode;
548
- /** The graph name (variable or IRI) of a GRAPH pattern or graph block, or the IRI of a CREATE or GRAPH reference. */
549
- graph: NamedNode;
550
- /** The target of a CLEAR or DROP operation: a graph IRI, sps:DefaultGraph, sps:NamedGraphs or sps:AllGraphs. */
551
- graphTarget: NamedNode;
552
- /** The GROUP BY conditions: an rdf:List of variables, expressions or sps:Alias nodes. */
553
- groupBy: NamedNode;
554
- hasLANG: NamedNode;
555
- hasLANGDIR: NamedNode;
556
- /** The HAVING conditions: an rdf:List of expressions. */
557
- having: NamedNode;
558
- /** The INSERT template of a DELETE/INSERT operation: an rdf:List of sps:TriplePattern and sps:Graph nodes. */
559
- insertTemplate: NamedNode;
560
- /** The target graph IRI of a LOAD ... INTO GRAPH operation. */
561
- into: NamedNode;
562
- isBLANK: NamedNode;
563
- isIRI: NamedNode;
564
- isLITERAL: NamedNode;
565
- isNUMERIC: NamedNode;
566
- isTRIPLE: NamedNode;
567
- isURI: NamedNode;
568
- /** The label of a syntactic blank node, without the _: prefix. Absent for anonymous blank nodes. */
569
- label: NamedNode;
570
- /** The LIMIT of a query. */
571
- limit: NamedNode;
572
- /** The object of a triple pattern or triple term. */
573
- object: NamedNode;
574
- /** The OFFSET of a query. */
575
- offset: NamedNode;
576
- /** The ordered update operations of an update request: an rdf:List. */
577
- operations: NamedNode;
578
- /** The ORDER BY conditions: an rdf:List of variables, expressions, or sps:Asc/sps:Desc nodes. */
579
- orderBy: NamedNode;
580
- /** The sub-path of an inverse or modified property path. */
581
- path: NamedNode;
582
- /** The ordered sub-paths of a sequence, alternative or negated property path: an rdf:List. */
583
- pathElements: NamedNode;
584
- /** The predicate of a triple pattern or triple term: an IRI, sps:Variable, or property path node. */
585
- predicate: NamedNode;
586
- /** The projection of a SELECT query: an rdf:List of sps:Variable or sps:Alias nodes. */
587
- projection: NamedNode;
588
- /** True if the SELECT clause carries the REDUCED modifier. */
589
- reduced: NamedNode;
590
- sameTerm: NamedNode;
591
- /** The SEPARATOR of a GROUP_CONCAT aggregate. */
592
- separator: NamedNode;
593
- /** True if the operation or SERVICE pattern carries the SILENT modifier. */
594
- silent: NamedNode;
595
- /** The source document IRI of a LOAD operation. */
596
- source: NamedNode;
597
- /** True if the query uses SELECT * or DESCRIBE *. */
598
- star: NamedNode;
599
- /** The subject of a triple pattern or triple term. */
600
- subject: NamedNode;
601
- /** The template of a CONSTRUCT query: an rdf:List of sps:TriplePattern nodes. */
602
- template: NamedNode;
603
- /** The target graph of an ADD, MOVE or COPY operation: a graph IRI or sps:DefaultGraph. */
604
- toGraph: NamedNode;
605
- /** The UNDEF marker in a VALUES binding row. */
606
- undef: NamedNode;
607
- /** A USING clause IRI of a DELETE/INSERT operation (repeated for multiple clauses). */
608
- using: NamedNode;
609
- /** A USING NAMED clause IRI of a DELETE/INSERT operation (repeated for multiple clauses). */
610
- usingNamed: NamedNode;
611
- /** The trailing VALUES clause of a query or sub-select. */
612
- values: NamedNode;
613
- /** The name of a variable, without the ? or $ sigil. */
614
- varName: NamedNode;
615
- /** The target variable of a BIND or alias. */
616
- variable: NamedNode;
617
- /** The variables of a VALUES block: an rdf:List of sps:Variable nodes. */
618
- variables: NamedNode;
619
- /** The version string of a VERSION declaration. SPARQL 1.2 grammar production [7]. */
620
- version: NamedNode;
621
- /** The WHERE clause of a query, sub-select, DELETE/INSERT or DELETE WHERE operation: an rdf:List of graph pattern elements. */
622
- where: NamedNode;
623
- /** The WITH graph IRI of a DELETE/INSERT operation. */
624
- withGraph: NamedNode;
625
- };
@@ -1,75 +0,0 @@
1
- import { Store } from "./store";
2
- import { PropertySchema, PropertyUsage } from "./property-schema";
3
- /**
4
- * Memoized results for one set of graphs, valid for one store fingerprint.
5
- */
6
- export interface PropertySchemaCacheEntry {
7
- /**
8
- * Property schemas keyed by property IRI and the option values that affect the result.
9
- */
10
- schemas: Map<string, PropertySchema>;
11
- /**
12
- * Usage statistics keyed by property IRI and the statement cap.
13
- */
14
- usage: Map<string, PropertyUsage>;
15
- /**
16
- * Literal class verdicts keyed by class IRI.
17
- */
18
- literalClasses: Map<string, boolean>;
19
- /**
20
- * Transitive sub class verdicts keyed by `sub|super`.
21
- */
22
- subClassOf: Map<string, boolean>;
23
- /**
24
- * Transitive super properties keyed by property IRI and depth limit.
25
- */
26
- superProperties: Map<string, Array<{
27
- iri: string;
28
- depth: number;
29
- }>>;
30
- }
31
- /**
32
- * Caches property schema computations per graph set. An entry is discarded as soon as any of its
33
- * graphs changes: the store has no change events, so the version counters are compared on every
34
- * access. `Store.version` fingerprints the all-graphs entry, `Store.getGraphVersion` (of each
35
- * graph and of its inference graph) fingerprints explicit graph sets, so edits to unrelated
36
- * documents do not evict document-scoped entries.
37
- */
38
- export declare class PropertySchemaCache {
39
- /**
40
- * Key of the entry that covers all graphs of the store.
41
- */
42
- static readonly ALL_GRAPHS_KEY = "*";
43
- private readonly _store;
44
- private readonly _slots;
45
- private readonly _maxEntries;
46
- private readonly _maxSchemasPerEntry;
47
- /**
48
- * @param store The store whose versions fingerprint the entries.
49
- * @param maxEntries Maximum number of graph sets kept (least recently used is evicted).
50
- * @param maxSchemasPerEntry Number of schemas after which an entry is reset.
51
- */
52
- constructor(store: Store, maxEntries?: number, maxSchemasPerEntry?: number);
53
- /**
54
- * Number of graph sets currently cached.
55
- */
56
- get size(): number;
57
- /**
58
- * Get the key that identifies a set of graphs. `undefined` means all graphs.
59
- * @param graphUris Graph URI(s) or `undefined` for all graphs.
60
- * @param extraGraphUris Additional graphs whose contents also affect the result (e.g. usage graphs).
61
- */
62
- getKey(graphUris: string | string[] | undefined, extraGraphUris?: string | string[]): string;
63
- /**
64
- * Get the memo entry for a set of graphs, creating or replacing it when the graphs changed.
65
- * @param graphUris Graph URI(s) or `undefined` for all graphs.
66
- * @param extraGraphUris Additional graphs whose contents also affect the result.
67
- */
68
- getEntry(graphUris: string | string[] | undefined, extraGraphUris?: string | string[]): PropertySchemaCacheEntry;
69
- /**
70
- * Drop all cached entries.
71
- */
72
- clear(): void;
73
- private _getFingerprint;
74
- private static _createEntry;
75
- }
@@ -1,172 +0,0 @@
1
- import { Term } from "@rdfjs/types";
2
- import { Store } from "./store";
3
- import { ShapeRepository } from "./shape-repository";
4
- import { ClassConstraint, PropertySchema, PropertySchemaOptions, PropertyUsage, SchemaEvidence, SchemaViolation } from "./property-schema";
5
- /**
6
- * A repository that derives what values a property takes from the vocabularies, shapes and data
7
- * in the store, and validates statements against it.
8
- *
9
- * Every verdict is data-driven: `rdfs:range` and `rdfs:domain` (inherited along
10
- * `rdfs:subPropertyOf`), `owl:ObjectProperty` / `owl:DatatypeProperty` typing, OWL restrictions,
11
- * SHACL property shapes and, as a fallback, the values observed in the graphs. The only built-in
12
- * knowledge is what RDF 1.1 itself defines as literal datatypes (see `isLiteralClass`).
13
- *
14
- * Pass `undefined` as `graphUris` to consult every graph in the store (framework ontologies,
15
- * workspace vocabularies and documents alike); pass explicit graphs to restrict the declarations
16
- * that are considered. Results are cached until one of the consulted graphs changes.
17
- */
18
- export declare class PropertySchemaRepository extends ShapeRepository {
19
- private readonly _schemaCache;
20
- constructor(store: Store);
21
- /**
22
- * Get the schema of a property: its value kind, expected datatypes and classes, language and
23
- * cardinality constraints, domains and usage statistics, each with provenance.
24
- * @param graphUris URIs of the graphs to consult, `undefined` for all graphs.
25
- * @param propertyIri IRI of the property.
26
- * @param options Optional schema options.
27
- * @returns The property schema.
28
- */
29
- getPropertySchema(graphUris: string | string[] | undefined, propertyIri: string, options?: PropertySchemaOptions): PropertySchema;
30
- /**
31
- * Get the declared ranges of a property, including those inherited from super properties and
32
- * derived from OWL restrictions. Each constraint lists alternative class or datatype IRIs.
33
- * @param graphUris URIs of the graphs to consult, `undefined` for all graphs.
34
- * @param propertyIri IRI of the property.
35
- * @param options Optional schema options; only `maxInheritanceDepth` applies.
36
- * @returns The range constraints with provenance, nearest declaration first.
37
- */
38
- getRanges(graphUris: string | string[] | undefined, propertyIri: string, options?: PropertySchemaOptions): SchemaEvidence<ClassConstraint>[];
39
- /**
40
- * Get the declared domains of a property, including those inherited from super properties.
41
- * Each constraint lists alternative class IRIs.
42
- * @param graphUris URIs of the graphs to consult, `undefined` for all graphs.
43
- * @param propertyIri IRI of the property.
44
- * @param options Optional schema options; only `maxInheritanceDepth` applies.
45
- * @returns The domain constraints with provenance, nearest declaration first.
46
- */
47
- getDomains(graphUris: string | string[] | undefined, propertyIri: string, options?: PropertySchemaOptions): SchemaEvidence<ClassConstraint>[];
48
- /**
49
- * Get all super properties of a property, following `rdfs:subPropertyOf` transitively.
50
- * @param graphUris URIs of the graphs to consult, `undefined` for all graphs.
51
- * @param propertyIri IRI of the property.
52
- * @param maxDepth Maximum distance to follow (default: 8).
53
- * @returns The super property IRIs, nearest first; cycles and self references are ignored.
54
- */
55
- getSuperPropertiesTransitive(graphUris: string | string[] | undefined, propertyIri: string, maxDepth?: number): string[];
56
- /**
57
- * Indicate if instances of a class are literals.
58
- *
59
- * A class is a literal class if it is `rdfs:Literal`, one of the datatypes defined by RDF 1.1
60
- * itself (`rdf:langString`, `rdf:HTML`, `rdf:XMLLiteral`, `rdf:JSON`, `rdf:PlainLiteral`), in
61
- * the XSD namespace, typed `rdfs:Datatype` in the consulted graphs, or a transitive sub class
62
- * of `rdfs:Literal`. The first three rules are the only built-in knowledge of this repository:
63
- * RDF 1.1 Concepts defines them as what a literal is, independent of any loaded vocabulary.
64
- * @param graphUris URIs of the graphs to consult, `undefined` for all graphs.
65
- * @param classIri IRI of the class.
66
- * @returns `true` if instances of the class are literals, `false` otherwise.
67
- */
68
- isLiteralClass(graphUris: string | string[] | undefined, classIri: string): boolean;
69
- /**
70
- * Count the values a property has in the given graphs by term kind, datatype and language.
71
- * @param graphUris URIs of the graphs to consult, `undefined` for all graphs.
72
- * @param propertyIri IRI of the property.
73
- * @param maxQuads Stop counting after this many statements (default: 10 000).
74
- * @returns The usage statistics.
75
- */
76
- getPropertyUsage(graphUris: string | string[] | undefined, propertyIri: string, maxQuads?: number): PropertyUsage;
77
- /**
78
- * Get the declared class constraints on the values of a property.
79
- * @param graphUris URIs of the graphs to consult, `undefined` for all graphs.
80
- * @param propertyIri IRI of the property.
81
- * @param options Optional schema options.
82
- * @returns The class constraints; all of them apply.
83
- */
84
- getExpectedClasses(graphUris: string | string[] | undefined, propertyIri: string, options?: PropertySchemaOptions): ClassConstraint[];
85
- /**
86
- * Get the declared datatypes of the values of a property.
87
- * @param graphUris URIs of the graphs to consult, `undefined` for all graphs.
88
- * @param propertyIri IRI of the property.
89
- * @param options Optional schema options.
90
- * @returns The datatype IRIs; a literal value must have one of them.
91
- */
92
- getExpectedDatatypes(graphUris: string | string[] | undefined, propertyIri: string, options?: PropertySchemaOptions): string[];
93
- /**
94
- * Validate the object of a statement against the schema of its property.
95
- *
96
- * Reports a literal where resources are expected (and vice versa), node kind mismatches,
97
- * datatype mismatches, missing or unexpected language tags, and IRI or blank node objects
98
- * whose types in the consulted graphs do not satisfy an expected class. Objects without any
99
- * type are never reported for class constraints; blank nodes are always accepted where
100
- * resources are expected; conflicting declarations suppress kind checks.
101
- * @param graphUris URIs of the graphs to consult, `undefined` for all graphs.
102
- * @param propertyIri IRI of the property.
103
- * @param object The object term.
104
- * @param options Optional schema options.
105
- * @returns The violations; empty if the object conforms.
106
- */
107
- validateObject(graphUris: string | string[] | undefined, propertyIri: string, object: Term, options?: PropertySchemaOptions): SchemaViolation[];
108
- /**
109
- * Validate the subject of a statement against the domains of its property.
110
- * @param graphUris URIs of the graphs to consult, `undefined` for all graphs.
111
- * @param propertyIri IRI of the property.
112
- * @param subjectTypes The types of the subject; nothing is reported when unknown (empty).
113
- * @param options Optional schema options.
114
- * @returns The violations; empty if the subject conforms or has no known types.
115
- */
116
- validateSubject(graphUris: string | string[] | undefined, propertyIri: string, subjectTypes: string[], options?: PropertySchemaOptions): SchemaViolation[];
117
- /**
118
- * Drop all cached schema computations.
119
- */
120
- invalidateSchemaCache(): void;
121
- private _resolveOptions;
122
- private _getSchemaKey;
123
- private _buildSchema;
124
- private _getDeclaredConstraints;
125
- /**
126
- * Collect the range or domain expressions declared on one property of the inheritance chain.
127
- * Ranges include those derived from OWL restrictions on the property; an `rdfs:range` that
128
- * repeats a restriction (as the OWL reasoner materializes it) is reported once.
129
- */
130
- private _collectDeclaredExpressions;
131
- /**
132
- * Expand a class expression into constraints. Named classes are themselves; `owl:unionOf`
133
- * yields one constraint with all alternatives; `owl:intersectionOf` yields one constraint per
134
- * member; `owl:onDatatype` yields the restricted datatype; `owl:oneOf` yields the datatypes of
135
- * enumerated literals or a bare resource verdict for enumerated IRIs. Other blank nodes are
136
- * counted as unresolved.
137
- */
138
- private _expandClassExpression;
139
- private _applyRangeExpression;
140
- private _applyDomainExpression;
141
- /**
142
- * Decide whether a set of alternative range classes describes literals, resources or anything.
143
- */
144
- private _classifyAlternatives;
145
- private _applyShapes;
146
- private _getNodeKindValueKind;
147
- /**
148
- * Derive kind, datatype and language evidence from observed values. A verdict needs at least
149
- * `minimumUsage` observations of which a share of `dominance` must agree.
150
- */
151
- private _applyUsage;
152
- /**
153
- * The key whose count reaches the dominance share of the total, if any.
154
- */
155
- private _getDominant;
156
- private _getPropertyUsage;
157
- private _resolveValueKind;
158
- private _pushKind;
159
- private _pushDatatype;
160
- private _pushClass;
161
- private _getSuperPropertiesWithDepth;
162
- private _isLiteralClass;
163
- /**
164
- * Test class membership with a breadth-first walk over all super classes. Unlike
165
- * `ClassRepository.isSubClassOf`, every branch of a multiple inheritance hierarchy is followed.
166
- */
167
- private _isSubClassOfTransitive;
168
- private _satisfiesConstraint;
169
- private _validateLiteral;
170
- private _validateResource;
171
- private _formatAlternatives;
172
- }
@@ -1,248 +0,0 @@
1
- /**
2
- * The kind of values a property takes: resources (IRIs or blank nodes), literals, or either.
3
- */
4
- export type ValueKind = 'resource' | 'literal' | 'any';
5
- /**
6
- * Where a schema fact was derived from.
7
- *
8
- * - `rdfs:range` / `rdfs:domain`: a direct declaration on the property.
9
- * - `rdfs:subPropertyOf`: inherited from a super property; `via` names the property the fact was declared on.
10
- * - `owl:PropertyType`: the property is typed `owl:ObjectProperty` or `owl:DatatypeProperty`.
11
- * - `owl:Restriction`: an `owl:Restriction` on the property declares `owl:allValuesFrom`, `owl:onClass` or `owl:onDataRange`.
12
- * - `owl:FunctionalProperty`: the property is functional, so it takes at most one value.
13
- * - `sh:*`: a SHACL property shape whose `sh:path` is the property declares the constraint.
14
- * - `usage`: observed from the values the property has in the queried graphs.
15
- */
16
- export type SchemaSource = 'rdfs:range' | 'rdfs:domain' | 'rdfs:subPropertyOf' | 'owl:PropertyType' | 'owl:Restriction' | 'owl:FunctionalProperty' | 'sh:datatype' | 'sh:class' | 'sh:nodeKind' | 'sh:node' | 'sh:minCount' | 'sh:maxCount' | 'sh:languageIn' | 'usage';
17
- /**
18
- * How trustworthy a schema fact is: `declared` facts come from vocabulary or shape statements,
19
- * `inferred` facts are derived from observed usage and should be reported as hints only.
20
- */
21
- export type SchemaConfidence = 'declared' | 'inferred';
22
- /**
23
- * A schema fact together with its provenance.
24
- */
25
- export interface SchemaEvidence<T> {
26
- /**
27
- * The fact.
28
- */
29
- value: T;
30
- /**
31
- * The statement kind the fact was derived from.
32
- */
33
- source: SchemaSource;
34
- /**
35
- * Whether the fact is declared or inferred from usage.
36
- */
37
- confidence: SchemaConfidence;
38
- /**
39
- * The super property the fact was inherited from when `source` is `rdfs:subPropertyOf`.
40
- */
41
- via?: string;
42
- /**
43
- * The inheritance distance; `0` for facts declared on the property itself.
44
- */
45
- depth: number;
46
- }
47
- /**
48
- * A class constraint on the values of a property. The value must be an instance of at least one
49
- * of the listed classes (union semantics). When a property carries several constraints, all of
50
- * them apply (intersection semantics).
51
- */
52
- export interface ClassConstraint {
53
- /**
54
- * IRIs of the alternative classes; a single entry for a plain class.
55
- */
56
- classes: string[];
57
- }
58
- /**
59
- * Cardinality constraints on the values of a property.
60
- */
61
- export interface CardinalityConstraint {
62
- /**
63
- * The minimum number of values, if declared.
64
- */
65
- minCount?: number;
66
- /**
67
- * The maximum number of values, if declared.
68
- */
69
- maxCount?: number;
70
- }
71
- /**
72
- * Statistics about the values a property has in a set of graphs.
73
- */
74
- export interface PropertyUsage {
75
- /**
76
- * IRI of the property.
77
- */
78
- propertyIri: string;
79
- /**
80
- * Total number of statements counted.
81
- */
82
- total: number;
83
- /**
84
- * Number of statements whose object is an IRI.
85
- */
86
- namedNodes: number;
87
- /**
88
- * Number of statements whose object is a blank node.
89
- */
90
- blankNodes: number;
91
- /**
92
- * Number of statements whose object is a literal.
93
- */
94
- literals: number;
95
- /**
96
- * Number of literal objects per datatype IRI.
97
- */
98
- datatypes: Record<string, number>;
99
- /**
100
- * Number of literal objects per language tag; the empty string counts untagged literals.
101
- */
102
- languages: Record<string, number>;
103
- /**
104
- * `true` when counting stopped at the configured maximum, so the counts are partial.
105
- */
106
- truncated: boolean;
107
- }
108
- /**
109
- * Everything the store knows about the values a property takes, with provenance for each fact.
110
- * The object is plain data and can be serialized as JSON.
111
- */
112
- export interface PropertySchema {
113
- /**
114
- * IRI of the property.
115
- */
116
- propertyIri: string;
117
- /**
118
- * The effective value kind after resolving all evidence.
119
- */
120
- valueKind: SchemaEvidence<ValueKind>;
121
- /**
122
- * Every kind verdict that was considered, highest priority first.
123
- */
124
- kindEvidence: SchemaEvidence<ValueKind>[];
125
- /**
126
- * `true` when declared evidence disagrees about the value kind; `valueKind` is then `any`.
127
- */
128
- conflicting: boolean;
129
- /**
130
- * Datatype IRIs a literal value must have. `rdfs:Literal` itself is never listed. Inferred
131
- * entries are only present when nothing is declared.
132
- */
133
- expectedDatatypes: SchemaEvidence<string>[];
134
- /**
135
- * Class constraints a resource value must satisfy.
136
- */
137
- expectedClasses: SchemaEvidence<ClassConstraint>[];
138
- /**
139
- * The `sh:nodeKind` of the property, if declared.
140
- */
141
- nodeKind?: SchemaEvidence<string>;
142
- /**
143
- * `true` when literal values must carry a language tag, `false` when they must not; absent when unknown.
144
- */
145
- languageTagged?: SchemaEvidence<boolean>;
146
- /**
147
- * Cardinality constraints, if declared.
148
- */
149
- cardinality?: SchemaEvidence<CardinalityConstraint>;
150
- /**
151
- * Class constraints the subject of the property must satisfy.
152
- */
153
- domains: SchemaEvidence<ClassConstraint>[];
154
- /**
155
- * The `rdf:type` values of the property in the queried graphs.
156
- */
157
- propertyTypes: string[];
158
- /**
159
- * Transitive super properties, nearest first.
160
- */
161
- superProperties: string[];
162
- /**
163
- * Usage statistics, when requested.
164
- */
165
- usage?: PropertyUsage;
166
- /**
167
- * Number of range or domain expressions (blank nodes) that could not be expanded.
168
- */
169
- unresolvedExpressions: number;
170
- }
171
- /**
172
- * Options for building a property schema.
173
- */
174
- export interface PropertySchemaOptions {
175
- /**
176
- * Maximum `rdfs:subPropertyOf` distance to inherit declarations from (default: 8).
177
- */
178
- maxInheritanceDepth?: number;
179
- /**
180
- * Whether to compute usage statistics (default: `true`).
181
- */
182
- includeUsage?: boolean;
183
- /**
184
- * Graphs to compute usage statistics over; defaults to the graphs the schema is requested for.
185
- */
186
- usageGraphUris?: string | string[];
187
- /**
188
- * Stop counting usage after this many statements (default: 10 000).
189
- */
190
- maxUsageQuads?: number;
191
- /**
192
- * Minimum number of observed values before usage may decide the value kind (default: 1).
193
- */
194
- minimumUsage?: number;
195
- /**
196
- * Share of the observed values that must agree before usage decides the value kind, datatype
197
- * or language tagging, between 0.5 and 1 (default: 0.9). Below 1, a few outliers do not stop
198
- * the majority from deciding, which is what lets them be reported as hints.
199
- */
200
- usageDominance?: number;
201
- /**
202
- * Bypass the schema cache (default: `false`).
203
- */
204
- noCache?: boolean;
205
- }
206
- /**
207
- * The kinds of schema violations.
208
- *
209
- * - `objectKind`: a literal where a resource is expected or vice versa, or a node kind mismatch.
210
- * - `datatype`: a literal with a datatype other than the expected ones.
211
- * - `language`: a literal with a missing or unexpected language tag.
212
- * - `objectClass`: a resource that is not an instance of an expected class.
213
- * - `domain`: a subject that is not an instance of the property's domain.
214
- */
215
- export type SchemaViolationKind = 'objectKind' | 'datatype' | 'language' | 'objectClass' | 'domain';
216
- /**
217
- * A violation of a property schema by a statement.
218
- */
219
- export interface SchemaViolation {
220
- /**
221
- * The kind of violation.
222
- */
223
- kind: SchemaViolationKind;
224
- /**
225
- * IRI of the property whose schema was violated.
226
- */
227
- propertyIri: string;
228
- /**
229
- * What was expected: value kinds, datatype IRIs, class IRIs (alternatives) or a language requirement.
230
- */
231
- expected: string[];
232
- /**
233
- * What was found: `literal`, `iri` or `blankNode`, a datatype IRI, a language tag, or type IRIs.
234
- */
235
- actual: string;
236
- /**
237
- * Where the violated expectation came from.
238
- */
239
- source: SchemaSource;
240
- /**
241
- * Whether the violated expectation was declared or inferred from usage.
242
- */
243
- confidence: SchemaConfidence;
244
- /**
245
- * A human-readable description of the violation.
246
- */
247
- message: string;
248
- }