n3 2.11.2 → 3.0.0-alpha.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 +10 -9
- package/browser/n3.esm.min.js +12 -12
- package/browser/n3.min.js +12 -12
- package/lib/N3Lexer.js +133 -148
- package/lib/N3Parser.js +5 -4
- package/package.json +29 -2
- package/src/N3Lexer.js +142 -162
- package/src/N3Parser.js +5 -4
package/README.md
CHANGED
|
@@ -190,13 +190,15 @@ This is done by passing a `baseIRI` argument upon creation:
|
|
|
190
190
|
const parser = new N3.Parser({ baseIRI: 'http://example.org/' });
|
|
191
191
|
```
|
|
192
192
|
|
|
193
|
-
In N3 mode,
|
|
194
|
-
document IRI with a `#` fragment
|
|
193
|
+
In N3 mode, an undeclared empty prefix is bound to the
|
|
194
|
+
document IRI with a `#` fragment, so `:term` parses as `<http://example.org/document#term>`
|
|
195
|
+
(see [w3c-cg/N3#235](https://github.com/w3c-cg/N3/issues/235)).
|
|
196
|
+
Setting `implicitEmptyPrefix` to `false` requires an explicit `@prefix :` declaration instead:
|
|
195
197
|
```JavaScript
|
|
196
198
|
const parser = new N3.Parser({
|
|
197
199
|
format: 'text/n3',
|
|
198
200
|
baseIRI: 'http://example.org/document',
|
|
199
|
-
implicitEmptyPrefix:
|
|
201
|
+
implicitEmptyPrefix: false,
|
|
200
202
|
});
|
|
201
203
|
```
|
|
202
204
|
|
|
@@ -215,13 +217,12 @@ The parser can output a backwards chaining rule such as `_:q <= _:p.` in two way
|
|
|
215
217
|
const parser = new N3.Parser({ isImpliedBy: true });
|
|
216
218
|
```
|
|
217
219
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
(and the direction discussed in [w3c-cg/N3#185](https://github.com/w3c-cg/N3/issues/185))
|
|
221
|
-
|
|
222
|
-
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:
|
|
223
224
|
```JavaScript
|
|
224
|
-
const parser = new N3.Parser({ format: 'text/n3', emptyFormulaAsTrue:
|
|
225
|
+
const parser = new N3.Parser({ format: 'text/n3', emptyFormulaAsTrue: false });
|
|
225
226
|
```
|
|
226
227
|
|
|
227
228
|
In N3 documents, the parser by default rescopes blank node labels
|