n3 1.19.0 → 1.20.1

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/README.md CHANGED
@@ -349,6 +349,33 @@ The store provides the following search methods
349
349
  - `getGraphs` returns an array of unique graphs occurring in matching quad
350
350
  - `forGraphs` executes a callback on unique graphs occurring in matching quads
351
351
 
352
+ ## Reasoning
353
+
354
+ N3.js supports reasoning as follows:
355
+
356
+ ```JavaScript
357
+ import { Reasoner, Store, Parser } from 'n3';
358
+
359
+ const parser = new Parser({ format: 'text/n3' });
360
+ const rules = `
361
+ {
362
+ ?s a ?o .
363
+ ?o <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?o2 .
364
+ } => {
365
+ ?s a ?o2 .
366
+ } .
367
+ `
368
+
369
+ const rulesDataset = new Store(parser.parse(rules));
370
+ const dataset = new Store(/* Dataset */)
371
+
372
+ // Applies the rules to the store; mutating it
373
+ const reasoner = new Reasoner(store);
374
+ reasoner.reason(rules);
375
+ ```
376
+
377
+ **Note**: N3.js currently only supports rules with [Basic Graph Patterns](https://www.w3.org/TR/sparql11-query/#BasicGraphPattern) in the premise and conclusion. Built-ins and backward-chaining are *not* supported. For an RDF/JS reasoner that supports all Notation3 reasoning features, see [eye-js](https://github.com/eyereasoner/eye-js/).
378
+
352
379
  ## Compatibility
353
380
  ### Format specifications
354
381
  The N3.js parser and writer is fully compatible with the following W3C specifications: