n3 1.21.0 → 1.21.2
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 +3 -5
- package/browser/n3.min.js +1 -1
- package/lib/N3Store.js +78 -2
- package/package.json +3 -3
- package/src/N3Store.js +85 -2
package/README.md
CHANGED
|
@@ -119,8 +119,7 @@ parser.parse(tomAndJerry, {
|
|
|
119
119
|
});
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
If no callbacks are provided, parsing happens synchronously returning an array of quads.
|
|
122
|
+
If no callbacks are provided, parsing happens synchronously returning an array of quads:
|
|
124
123
|
|
|
125
124
|
```JavaScript
|
|
126
125
|
const parser = new N3.Parser();
|
|
@@ -192,7 +191,6 @@ function SlowConsumer() {
|
|
|
192
191
|
```
|
|
193
192
|
|
|
194
193
|
A dedicated `prefix` event signals every prefix with `prefix` and `term` arguments.
|
|
195
|
-
|
|
196
194
|
A dedicated `comment` event can be enabled by setting `comments: true` in the N3.StreamParser constructor.
|
|
197
195
|
|
|
198
196
|
## Writing
|
|
@@ -200,11 +198,11 @@ A dedicated `comment` event can be enabled by setting `comments: true` in the N3
|
|
|
200
198
|
### From quads to a string
|
|
201
199
|
|
|
202
200
|
`N3.Writer` serializes quads as an RDF document.
|
|
203
|
-
Write quads through `
|
|
201
|
+
Write quads through `addQuad`.
|
|
204
202
|
|
|
205
203
|
```JavaScript
|
|
206
204
|
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#`
|
|
207
|
-
writer.
|
|
205
|
+
writer.addQuad(quad(
|
|
208
206
|
namedNode('http://example.org/cartoons#Tom'), // Subject
|
|
209
207
|
namedNode('http://example.org/cartoons#name'), // Predicate
|
|
210
208
|
literal('Tom') // Object
|