n3 2.7.12 → 2.8.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 +33 -0
- package/browser/n3.esm.min.js +11 -11
- package/browser/n3.min.js +11 -11
- package/lib/N3Reasoner.js +13 -4
- package/lib/N3Store.js +385 -27
- package/package.json +1 -1
- package/src/N3Reasoner.js +14 -4
- package/src/N3Store.js +418 -32
package/README.md
CHANGED
|
@@ -464,6 +464,39 @@ The store provides the following search methods
|
|
|
464
464
|
- `getGraphs` returns an array of unique graphs occurring in matching quad
|
|
465
465
|
- `forGraphs` executes a callback on unique graphs occurring in matching quads
|
|
466
466
|
|
|
467
|
+
### Configuring `match()` semantics
|
|
468
|
+
|
|
469
|
+
The behaviour of `match()` can be configured as a store-wide default or per-call as follows:
|
|
470
|
+
|
|
471
|
+
```JavaScript
|
|
472
|
+
import { Store, DataFactory } from 'n3';
|
|
473
|
+
const { namedNode } = DataFactory;
|
|
474
|
+
|
|
475
|
+
const store = new Store([], { matchSemantics: 'snapshot' });
|
|
476
|
+
const snapshot = store.match(namedNode('s'));
|
|
477
|
+
const forwarded = store.match(namedNode('s'), null, null, null, { matchSemantics: 'forwarded' });
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
Supported values:
|
|
481
|
+
|
|
482
|
+
- `'lazy'` (default) — the view (return value of `Store#match`) reflects the
|
|
483
|
+
parent store until the first operation that materializes it (a mutation, or a
|
|
484
|
+
materializing read such as `size` or `has`), after which it is frozen to a
|
|
485
|
+
snapshot. Parent mutations made before that point remain visible in the view.
|
|
486
|
+
In the next major version, only mutating operations will materialize a lazy
|
|
487
|
+
view.
|
|
488
|
+
- `'snapshot'` — the view reflects the parent contents *at the time of*
|
|
489
|
+
`match()`. Later parent mutations never affect it. This is the most
|
|
490
|
+
spec-correct interpretation of an RDF/JS dataset and will become the default
|
|
491
|
+
in the next major version.
|
|
492
|
+
- `'forwarded'` — the view always reflects the parent state, and mutations to the view are written through to the parent. Attempts to mutate on the view which do not match the views `#match` pattern result in an error.
|
|
493
|
+
|
|
494
|
+
A sub-view inherits its parent's `matchSemantics`.
|
|
495
|
+
|
|
496
|
+
For `'snapshot'` and `'forwarded'`, an iteration (synchronous or via the
|
|
497
|
+
stream) that is already in progress keeps a stable view of the quads as of when it started.
|
|
498
|
+
|
|
499
|
+
|
|
467
500
|
## Reasoning
|
|
468
501
|
|
|
469
502
|
N3.js supports reasoning as follows:
|