n3 2.1.2 → 2.2.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/README.md CHANGED
@@ -78,6 +78,16 @@ console.log(myQuad.object.datatype.value); // http://www.w3.org/1999/02/22-rdf-s
78
78
  console.log(myQuad.object.language); // en
79
79
  ```
80
80
 
81
+ Always create terms through a data factory such as `N3.DataFactory`,
82
+ and not by instantiating the term classes directly:
83
+ direct construction is deprecated,
84
+ because the factory functions are where term validation can be applied.
85
+ In line with the [RDF/JS specification](http://rdf.js.org/data-model-spec/),
86
+ N3.js assumes that the value of any RDF/JS term it receives —
87
+ whether from its own factory or from another implementation —
88
+ was already validated when the term was created,
89
+ and does not re-validate terms.
90
+
81
91
  In the rest of this document, we will treat “triples” and “quads” equally:
82
92
  we assume that a quad is simply a triple in a named or default graph.
83
93
 
@@ -446,6 +456,23 @@ reasoner.reason(rulesDataset);
446
456
 
447
457
  **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/).
448
458
 
459
+ ### Limiting reasoning cost
460
+
461
+ When reasoning over rules or data that are not fully trusted,
462
+ optional budgets bound the work `reason()` may perform:
463
+
464
+ ```JavaScript
465
+ const reasoner = new Reasoner(store, {
466
+ maxDerivations: 100000, // maximum number of quads reason() may derive
467
+ maxPremiseDepth: 10, // maximum number of premise triples per rule
468
+ });
469
+ reasoner.reason(rulesDataset);
470
+ ```
471
+
472
+ Both budgets are unbounded by default;
473
+ `reason()` throws when one is exceeded,
474
+ leaving any quads derived up to that point in the store.
475
+
449
476
  ## Compatibility
450
477
  ### Format specifications
451
478
  The N3.js parser and writer is fully compatible with the following W3C specifications: