n3 3.0.0-alpha.1 → 3.0.0-alpha.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 +13 -15
- package/browser/n3.esm.min.js +1 -1
- package/browser/n3.min.js +1 -1
- package/lib/N3Parser.js +5 -5
- package/lib/N3Writer.js +1 -1
- package/package.json +1 -1
- package/src/N3Parser.js +5 -5
- package/src/N3Writer.js +1 -1
package/README.md
CHANGED
|
@@ -217,23 +217,21 @@ The parser can output a backwards chaining rule such as `_:q <= _:p.` in two way
|
|
|
217
217
|
const parser = new N3.Parser({ isImpliedBy: true });
|
|
218
218
|
```
|
|
219
219
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
(and the direction discussed in [w3c-cg/N3#185](https://github.com/w3c-cg/N3/issues/185))
|
|
223
|
-
|
|
224
|
-
the `emptyFormulaAsTrue` flag enables that behavior:
|
|
220
|
+
An empty formula `{}` is read as the boolean literal `"true"^^xsd:boolean`,
|
|
221
|
+
following the [N3 spec tests](https://w3c-cg.github.io/N3/tests/)
|
|
222
|
+
(and the direction discussed in [w3c-cg/N3#185](https://github.com/w3c-cg/N3/issues/185)).
|
|
223
|
+
Setting the `emptyFormulaAsTrue` flag to `false` keeps it as a blank node graph term instead:
|
|
225
224
|
```JavaScript
|
|
226
|
-
const parser = new N3.Parser({ format: 'text/n3', emptyFormulaAsTrue:
|
|
225
|
+
const parser = new N3.Parser({ format: 'text/n3', emptyFormulaAsTrue: false });
|
|
227
226
|
```
|
|
228
227
|
|
|
229
|
-
In N3 documents,
|
|
230
|
-
|
|
231
|
-
so `_:a` inside a list
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
(this will become the default in the next major version):
|
|
228
|
+
In N3 documents, blank node labels are scoped to formulas,
|
|
229
|
+
matching N3's formula-scoped blank node semantics,
|
|
230
|
+
so `_:a` inside a list or blank node property list co-references `_:a` outside of it.
|
|
231
|
+
Setting the `formulaScopedBlankNodes` flag to `false` restores the legacy behavior
|
|
232
|
+
of also rescoping blank node labels in lists and blank node property lists:
|
|
235
233
|
```JavaScript
|
|
236
|
-
const parser = new N3.Parser({ format: 'N3', formulaScopedBlankNodes:
|
|
234
|
+
const parser = new N3.Parser({ format: 'N3', formulaScopedBlankNodes: false });
|
|
237
235
|
```
|
|
238
236
|
|
|
239
237
|
### From an RDF stream to quads
|
|
@@ -331,10 +329,10 @@ const writer1 = new N3.Writer({ format: 'N-Triples' });
|
|
|
331
329
|
const writer2 = new N3.Writer({ format: 'application/trig' });
|
|
332
330
|
```
|
|
333
331
|
|
|
334
|
-
A `baseIRI` argument makes the writer abbreviate IRIs relative to that base in Turtle
|
|
332
|
+
A `baseIRI` argument makes the writer abbreviate IRIs relative to that base in Turtle, TriG and N3 serializations, and write the base as an `@base` directive at the top of the document so the output parses back to the same IRIs (N-Triples and N-Quads remain directive-free). Pass `writeBase: false` to omit the directive, for instance for a document that will be served at its base IRI:
|
|
335
333
|
|
|
336
334
|
```JavaScript
|
|
337
|
-
const writer = new N3.Writer({ baseIRI: 'http://example.org/', writeBase:
|
|
335
|
+
const writer = new N3.Writer({ baseIRI: 'http://example.org/', writeBase: false });
|
|
338
336
|
```
|
|
339
337
|
|
|
340
338
|
### From quads to an RDF stream
|