n3 1.17.6 → 1.19.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 +7 -13
- package/browser/n3.min.js +1 -1
- package/lib/N3Store.js +205 -9
- package/lib/N3StoreFactory.js +14 -0
- package/lib/N3Writer.js +3 -3
- package/lib/index.js +9 -0
- package/package.json +1 -1
- package/src/N3Store.js +236 -9
- package/src/N3StoreFactory.js +7 -0
- package/src/N3Writer.js +4 -3
- package/src/index.js +4 -0
package/README.md
CHANGED
|
@@ -174,16 +174,11 @@ A dedicated `prefix` event signals every prefix with `prefix` and `term` argumen
|
|
|
174
174
|
### From quads to a string
|
|
175
175
|
|
|
176
176
|
`N3.Writer` serializes quads as an RDF document.
|
|
177
|
-
Write quads through `
|
|
177
|
+
Write quads through `add`.
|
|
178
178
|
|
|
179
179
|
```JavaScript
|
|
180
180
|
const writer = new N3.Writer({ prefixes: { c: 'http://example.org/cartoons#' } }); // Create a writer which uses `c` as a prefix for the namespace `http://example.org/cartoons#`
|
|
181
|
-
writer.
|
|
182
|
-
namedNode('http://example.org/cartoons#Tom'), // Subject
|
|
183
|
-
namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), // Predicate
|
|
184
|
-
namedNode('http://example.org/cartoons#Cat') // Object
|
|
185
|
-
);
|
|
186
|
-
writer.addQuad(quad(
|
|
181
|
+
writer.add(quad(
|
|
187
182
|
namedNode('http://example.org/cartoons#Tom'), // Subject
|
|
188
183
|
namedNode('http://example.org/cartoons#name'), // Predicate
|
|
189
184
|
literal('Tom') // Object
|
|
@@ -202,7 +197,7 @@ const writer2 = new N3.Writer({ format: 'application/trig' });
|
|
|
202
197
|
|
|
203
198
|
### From quads to an RDF stream
|
|
204
199
|
|
|
205
|
-
`N3.Writer` can also write quads to a Node.js stream
|
|
200
|
+
`N3.Writer` can also write quads to a Node.js stream through `addQuad`.
|
|
206
201
|
|
|
207
202
|
```JavaScript
|
|
208
203
|
const writer = new N3.Writer(process.stdout, { end: false, prefixes: { c: 'http://example.org/cartoons#' } });
|
|
@@ -311,8 +306,8 @@ const store1 = new N3.Store([], { entityIndex });
|
|
|
311
306
|
const store2 = new N3.Store([], { entityIndex });
|
|
312
307
|
```
|
|
313
308
|
|
|
314
|
-
### [`
|
|
315
|
-
This store adheres to the `
|
|
309
|
+
### [`Dataset` Interface](https://rdf.js.org/dataset-spec/#dataset-interface)
|
|
310
|
+
This store adheres to the `Dataset` interface which exposes the following properties
|
|
316
311
|
|
|
317
312
|
Attributes:
|
|
318
313
|
- `size` — A non-negative integer that specifies the number of quads in the set.
|
|
@@ -325,7 +320,7 @@ Methods:
|
|
|
325
320
|
- `[Symbol.iterator]` — Implements the iterator protocol to allow iteration over all `quads` in the dataset as in the example above.
|
|
326
321
|
|
|
327
322
|
### Addition and deletion of quads
|
|
328
|
-
The store
|
|
323
|
+
The store implements the following manipulation methods in addition to the standard [`Dataset` Interface](https://rdf.js.org/dataset-spec/#dataset-interface)
|
|
329
324
|
([documentation](http://rdfjs.github.io/N3.js/docs/N3Store.html)):
|
|
330
325
|
- `addQuad` to insert one quad
|
|
331
326
|
- `addQuads` to insert an array of quads
|
|
@@ -339,9 +334,8 @@ The store provides the following manipulation methods in addition to implementin
|
|
|
339
334
|
### Searching quads or entities
|
|
340
335
|
The store provides the following search methods
|
|
341
336
|
([documentation](http://rdfjs.github.io/N3.js/docs/N3Store.html)):
|
|
342
|
-
- `
|
|
337
|
+
- `match` returns a stream and generator of quads matching the given pattern
|
|
343
338
|
- `getQuads` returns an array of quads matching the given pattern
|
|
344
|
-
- `match` returns a stream of quads matching the given pattern
|
|
345
339
|
- `countQuads` counts the number of quads matching the given pattern
|
|
346
340
|
- `forEach` executes a callback on all matching quads
|
|
347
341
|
- `every` returns whether a callback on matching quads always returns true
|