n3 1.16.4 → 1.17.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 +17 -17
- package/browser/n3.min.js +1 -1
- package/lib/N3Lexer.js +15 -1
- package/lib/N3Parser.js +17 -0
- package/package.json +1 -1
- package/src/N3Lexer.js +16 -1
- package/src/N3Parser.js +16 -0
package/README.md
CHANGED
|
@@ -61,10 +61,10 @@ N3.js follows the [RDF.js low-level specification](http://rdf.js.org/).
|
|
|
61
61
|
const { DataFactory } = N3;
|
|
62
62
|
const { namedNode, literal, defaultGraph, quad } = DataFactory;
|
|
63
63
|
const myQuad = quad(
|
|
64
|
-
namedNode('https://ruben.verborgh.org/profile/#me'),
|
|
65
|
-
namedNode('http://xmlns.com/foaf/0.1/givenName'),
|
|
66
|
-
literal('Ruben', 'en'),
|
|
67
|
-
defaultGraph(),
|
|
64
|
+
namedNode('https://ruben.verborgh.org/profile/#me'), // Subject
|
|
65
|
+
namedNode('http://xmlns.com/foaf/0.1/givenName'), // Predicate
|
|
66
|
+
literal('Ruben', 'en'), // Object
|
|
67
|
+
defaultGraph(), // Graph
|
|
68
68
|
);
|
|
69
69
|
console.log(myQuad.termType); // Quad
|
|
70
70
|
console.log(myQuad.value); // ''
|
|
@@ -177,16 +177,16 @@ A dedicated `prefix` event signals every prefix with `prefix` and `term` argumen
|
|
|
177
177
|
Write quads through `addQuad`.
|
|
178
178
|
|
|
179
179
|
```JavaScript
|
|
180
|
-
const writer = new N3.Writer({ prefixes: { c: 'http://example.org/cartoons#' } });
|
|
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
181
|
writer.addQuad(
|
|
182
|
-
namedNode('http://example.org/cartoons#Tom'),
|
|
183
|
-
namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
|
|
184
|
-
namedNode('http://example.org/cartoons#Cat')
|
|
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
185
|
);
|
|
186
186
|
writer.addQuad(quad(
|
|
187
|
-
namedNode('http://example.org/cartoons#Tom'),
|
|
188
|
-
namedNode('http://example.org/cartoons#name'),
|
|
189
|
-
literal('Tom')
|
|
187
|
+
namedNode('http://example.org/cartoons#Tom'), // Subject
|
|
188
|
+
namedNode('http://example.org/cartoons#name'), // Predicate
|
|
189
|
+
literal('Tom') // Object
|
|
190
190
|
));
|
|
191
191
|
writer.end((error, result) => console.log(result));
|
|
192
192
|
```
|
|
@@ -207,14 +207,14 @@ const writer2 = new N3.Writer({ format: 'application/trig' });
|
|
|
207
207
|
```JavaScript
|
|
208
208
|
const writer = new N3.Writer(process.stdout, { end: false, prefixes: { c: 'http://example.org/cartoons#' } });
|
|
209
209
|
writer.addQuad(
|
|
210
|
-
namedNode('http://example.org/cartoons#Tom'),
|
|
211
|
-
namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
|
|
212
|
-
namedNode('http://example.org/cartoons#Cat')
|
|
210
|
+
namedNode('http://example.org/cartoons#Tom'), // Subject
|
|
211
|
+
namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), // Predicate
|
|
212
|
+
namedNode('http://example.org/cartoons#Cat') // Object
|
|
213
213
|
);
|
|
214
214
|
writer.addQuad(quad(
|
|
215
|
-
namedNode('http://example.org/cartoons#Tom'),
|
|
216
|
-
namedNode('http://example.org/cartoons#name'),
|
|
217
|
-
literal('Tom')
|
|
215
|
+
namedNode('http://example.org/cartoons#Tom'), // Subject
|
|
216
|
+
namedNode('http://example.org/cartoons#name'), // Predicate
|
|
217
|
+
literal('Tom') // Object
|
|
218
218
|
));
|
|
219
219
|
writer.end();
|
|
220
220
|
```
|