n3 1.17.6 → 1.18.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 +4 -10
- package/browser/n3.min.js +1 -1
- package/lib/N3Store.js +5 -2
- package/lib/N3StoreFactory.js +14 -0
- package/lib/index.js +9 -0
- package/package.json +1 -1
- package/src/N3Store.js +5 -2
- package/src/N3StoreFactory.js +7 -0
- 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#' } });
|
|
@@ -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
|