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 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
- By default, an empty formula `{}` is kept as a blank node graph term.
221
- 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
- read it as the boolean literal `"true"^^xsd:boolean` instead;
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: true });
225
+ const parser = new N3.Parser({ format: 'text/n3', emptyFormulaAsTrue: false });
227
226
  ```
228
227
 
229
- In N3 documents, the parser by default rescopes blank node labels
230
- in lists and blank node property lists, in addition to formulas,
231
- so `_:a` inside a list does not co-reference `_:a` outside of it.
232
- The `formulaScopedBlankNodes` flag scopes blank node labels to formulas only,
233
- matching N3's formula-scoped blank node semantics
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: true });
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/TriG serializations. Pass `writeBase: true` to also write the base as an `@base` directive at the top of the document (N-Triples and N-Quads remain directive-free).
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: true });
335
+ const writer = new N3.Writer({ baseIRI: 'http://example.org/', writeBase: false });
338
336
  ```
339
337
 
340
338
  ### From quads to an RDF stream