n3 1.16.1 → 1.16.3

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
@@ -23,10 +23,9 @@ It offers:
23
23
  - [**Storage**](#storing) of triples/quads in memory
24
24
 
25
25
  Parsing and writing is:
26
- - **asynchronous** – triples arrive as soon as possible
27
- - **streaming** – streams are parsed as data comes in, so you can parse files larger than memory
28
- - **fast** – once the [fastest spec-compatible parser in JavaScript](https://github.com/rdfjs/N3.js/tree/master/perf)
29
- (but then [graphy.js](https://github.com/blake-regalia/graphy.js) came along)
26
+ - 🎛 **asynchronous** – triples arrive as soon as possible
27
+ - 🚰 **streaming** – streams are parsed as data comes in, so you can parse files larger than memory
28
+ - ⚡️ **fast** – triples are flying out at high speeds
30
29
 
31
30
  ## Installation
32
31
  For Node.js, N3.js comes as an [npm package](https://npmjs.org/package/n3).
@@ -282,12 +281,12 @@ Then, we find triples with `:Mickey` as subject.
282
281
 
283
282
  ```JavaScript
284
283
  const store = new N3.Store();
285
- store.addQuad(
284
+ store.add(
286
285
  namedNode('http://ex.org/Pluto'),
287
286
  namedNode('http://ex.org/type'),
288
287
  namedNode('http://ex.org/Dog')
289
288
  );
290
- store.addQuad(
289
+ store.add(
291
290
  namedNode('http://ex.org/Mickey'),
292
291
  namedNode('http://ex.org/type'),
293
292
  namedNode('http://ex.org/Mouse')
@@ -297,12 +296,25 @@ store.addQuad(
297
296
  for (const quad of store)
298
297
  console.log(quad);
299
298
  // Retrieve Mickey's quads
300
- for (const quad of store.readQuads(namedNode('http://ex.org/Mickey'), null, null))
299
+ for (const quad of store.match(namedNode('http://ex.org/Mickey'), null, null))
301
300
  console.log(quad);
302
301
  ```
303
302
 
303
+ ### [`DatasetCore` Interface](https://rdf.js.org/dataset-spec/#datasetcore-interface)
304
+ This store adheres to the `DatasetCore` interface which exposes the following properties
305
+
306
+ Attributes:
307
+ - `size` — A non-negative integer that specifies the number of quads in the set.
308
+
309
+ Methods:
310
+ - `add` — Adds the specified quad to the dataset. Existing quads, as defined in `Quad.equals`, will be ignored.
311
+ - `delete` — Removes the specified quad from the dataset.
312
+ - `has` — Determines whether a dataset includes a certain quad.
313
+ - `match` — Returns a new dataset that is comprised of all quads in the current instance matching the given arguments.
314
+ - `[Symbol.iterator]` — Implements the iterator protocol to allow iteration over all `quads` in the dataset as in the example above.
315
+
304
316
  ### Addition and deletion of quads
305
- The store provides the following manipulation methods
317
+ The store provides the following manipulation methods in addition to implementing the standard [`DatasetCore` Interface](https://rdf.js.org/dataset-spec/#datasetcore-interface)
306
318
  ([documentation](http://rdfjs.github.io/N3.js/docs/N3Store.html)):
307
319
  - `addQuad` to insert one quad
308
320
  - `addQuads` to insert an array of quads
@@ -386,6 +398,7 @@ The N3.js submodules are compatible with the following [RDF.js](http://rdf.js.or
386
398
  [`Store`](http://rdf.js.org/stream-spec/#store-interface)
387
399
  [`Source`](http://rdf.js.org/stream-spec/#source-interface)
388
400
  [`Sink`](http://rdf.js.org/stream-spec/#sink-interface)
401
+ [`DatasetCore`](https://rdf.js.org/dataset-spec/#datasetcore-interface)
389
402
 
390
403
  ## License and contributions
391
404
  The N3.js library is copyrighted by [Ruben Verborgh](https://ruben.verborgh.org/)