@faubulous/mentor-rdf 2.4.0 → 2.5.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.
@@ -26,9 +26,10 @@ export interface DatasetViewOptions {
26
26
  */
27
27
  object?: rdfjs.Term | null;
28
28
  /**
29
- * Whether to include inferred triples from the inference graphs associated with the scoped
30
- * graphs. If undefined, inferred triples are included when a reasoner is available. If `true`
31
- * without a reasoner, an error is thrown. Only applies when the view is scoped to graphs.
29
+ * Whether to include inferred triples. If undefined, inferred triples are included when a
30
+ * reasoner is available. With graphs, `false` leaves their inference graphs out; without
31
+ * graphs, the view spans every graph of the store and `false` leaves every inference graph
32
+ * out. If `true` without a reasoner, an error is thrown.
32
33
  */
33
34
  includeInferred?: boolean;
34
35
  }
@@ -48,6 +49,10 @@ export declare class DatasetView implements rdfjs.DatasetCore<rdfjs.Quad> {
48
49
  * `undefined` means the view spans all graphs; an empty array means the view is provably empty.
49
50
  */
50
51
  private readonly _scope?;
52
+ /**
53
+ * Whether the quads of the inference graphs are left out of a view that spans all graphs.
54
+ */
55
+ private readonly _excludeInferred;
51
56
  private _cachedSize?;
52
57
  private _cachedSizeVersion;
53
58
  constructor(store: Store, options?: DatasetViewOptions);
@@ -57,6 +62,10 @@ export declare class DatasetView implements rdfjs.DatasetCore<rdfjs.Quad> {
57
62
  * until the store is modified.
58
63
  */
59
64
  get size(): number;
65
+ /**
66
+ * Count the quads of the view's pattern in the inference graphs of the store.
67
+ */
68
+ private _countInferred;
60
69
  /**
61
70
  * Not supported: the view is read-only.
62
71
  * @throws An error indicating that the view is read-only.
@@ -8,6 +8,12 @@ export interface GraphUriGenerator {
8
8
  * @param uri A URI.
9
9
  */
10
10
  getGraphUri(uri: string | rdfjs.Quad_Graph): string;
11
+ /**
12
+ * Check if a given URI is the URI of an inference graph generated by this handler.
13
+ * @param uri A URI.
14
+ * @returns `true` if the URI is an inference graph URI, `false` otherwise.
15
+ */
16
+ isInferenceGraphUri(uri: string | rdfjs.Quad_Graph): boolean;
11
17
  }
12
18
  /**
13
19
  * Default implementation of the InferenceGraphHandler interface. It generates URIs
@@ -180,6 +180,20 @@ export declare class Store implements rdfjs.DatasetCore<rdfjs.Quad> {
180
180
  * @returns `true` if the store contains triples in the graph URI, `false` otherwise.
181
181
  */
182
182
  hasGraph(graphUri: rdfjs.Quad_Graph | string): boolean;
183
+ /**
184
+ * Indicates whether a graph holds the triples the reasoner inferred from another graph.
185
+ * @param graph A graph term or URI.
186
+ * @returns `true` if the graph is an inference graph of the reasoner of this store, `false` otherwise or without a reasoner.
187
+ */
188
+ isInferenceGraph(graph: rdfjs.Quad_Graph | string): boolean;
189
+ /**
190
+ * Indicates whether a quad was inferred by the reasoner, i.e. whether it is stored in an inference
191
+ * graph. A triple that is asserted and inferred exists as two quads; only the quad in the inference
192
+ * graph is inferred.
193
+ * @param quad A quad.
194
+ * @returns `true` if the quad is stored in an inference graph, `false` otherwise.
195
+ */
196
+ isInferred(quad: rdfjs.Quad): boolean;
183
197
  /**
184
198
  * Apply inference to the given graph and store the triples in the associated inference graph.
185
199
  * @param graphUri A graph URI.
@@ -223,10 +237,11 @@ export declare class Store implements rdfjs.DatasetCore<rdfjs.Quad> {
223
237
  countQuads(subject?: rdfjs.Term | null, predicate?: rdfjs.Term | null, object?: rdfjs.Term | null, graph?: rdfjs.Term | null): number;
224
238
  /**
225
239
  * Returns a lazy, read-only dataset view of the quads matching the given pattern.
226
- * Implements the RDF/JS `DatasetCore.match` semantics: the result reflects the
227
- * current contents of the store and does not copy any quads. Because the view
228
- * iterates the live indexes, do not add or delete quads while iterating it;
229
- * take a snapshot with `Array.from(...)` first.
240
+ * Implements the RDF/JS `DatasetCore.match` semantics: a graph names exactly that
241
+ * graph and no graph means every graph of the store, inference graphs included.
242
+ * The result reflects the current contents of the store and does not copy any
243
+ * quads. Because the view iterates the live indexes, do not add or delete quads
244
+ * while iterating it; take a snapshot with `Array.from(...)` first.
230
245
  * @param subject The optional subject.
231
246
  * @param predicate The optional predicate.
232
247
  * @param object The optional object.
@@ -257,6 +272,10 @@ export declare class Store implements rdfjs.DatasetCore<rdfjs.Quad> {
257
272
  * @param subject A subject URI or null to match any subject.
258
273
  * @param predicate A predicate URI or null to match any predicate.
259
274
  * @param object An object URI or null to match any object.
275
+ * @param includeInferred Whether to read the inference graphs. With graphs given, `undefined` and
276
+ * `true` add the inference graph of each graph when a reasoner is available and `false` reads only
277
+ * the given graphs. Without graphs, `undefined` and `true` read every graph of the store and `false`
278
+ * reads every graph except the inference graphs. `true` without a reasoner throws.
260
279
  */
261
280
  matchAll(graphUris: string | string[] | undefined, subject: rdfjs.Quad_Subject | null, predicate: rdfjs.Quad_Predicate | null, object: rdfjs.Quad_Object | null, includeInferred?: boolean): Generator<rdfjs.Quad, void, any>;
262
281
  /**
@@ -273,9 +292,11 @@ export declare class Store implements rdfjs.DatasetCore<rdfjs.Quad> {
273
292
  * The view is lazy and live: it reflects the current contents of the store without
274
293
  * copying any quads. If you need an immutable snapshot, copy the view into a new
275
294
  * dataset, e.g. `RdfStore.createDefault().asDataset()`.
276
- * @param graphUris Optional graph URI or array of graph URIs. If undefined, all quads are included.
295
+ * @param graphUris Optional graph URI or array of graph URIs. If undefined, all graphs are included.
277
296
  * @param includeInferred Whether to include inferred triples. If undefined, inferred triples
278
- * are included when a reasoner is available. If `true` without a reasoner, an error is thrown.
297
+ * are included when a reasoner is available. If `false`, the inference graphs of the given
298
+ * graphs are left out, or, without graphs, every inference graph of the store. If `true`
299
+ * without a reasoner, an error is thrown.
279
300
  * @returns A read-only dataset view of the matching quads.
280
301
  */
281
302
  getDataset(graphUris?: string | string[], includeInferred?: boolean): DatasetView;
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "ontology",
11
11
  "vocabulary"
12
12
  ],
13
- "version": "2.4.0",
13
+ "version": "2.5.0",
14
14
  "private": false,
15
15
  "author": {
16
16
  "name": "Sebastian Faubel"