n3 2.10.5 → 2.10.6
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/browser/n3.esm.min.js +1 -1
- package/browser/n3.min.js +1 -1
- package/lib/N3DataFactory.js +12 -5
- package/lib/N3Parser.js +2 -0
- package/package.json +4 -2
- package/src/N3DataFactory.js +10 -3
- package/src/N3Parser.js +3 -0
package/lib/N3DataFactory.js
CHANGED
|
@@ -84,10 +84,14 @@ class NamedNode extends Term {
|
|
|
84
84
|
* the constructor assumes an already-validated IRI.
|
|
85
85
|
*/
|
|
86
86
|
constructor(iri) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
if (iri !== '') super(iri);
|
|
88
|
+
// The empty IRI gets a distinct ID, since '' is the ID of the default graph
|
|
89
|
+
else {
|
|
90
|
+
super(EMPTY_IRI_ID);
|
|
91
|
+
Object.defineProperty(this, 'value', {
|
|
92
|
+
value: ''
|
|
93
|
+
});
|
|
94
|
+
}
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
// ### The term type of this term
|
|
@@ -320,7 +324,10 @@ function termToId(term, nested) {
|
|
|
320
324
|
// Term instantiated with another library
|
|
321
325
|
switch (term.termType) {
|
|
322
326
|
case 'NamedNode':
|
|
323
|
-
|
|
327
|
+
{
|
|
328
|
+
const iri = term.value;
|
|
329
|
+
return iri !== '' ? iri : EMPTY_IRI_ID;
|
|
330
|
+
}
|
|
324
331
|
case 'BlankNode':
|
|
325
332
|
return `_:${term.value}`;
|
|
326
333
|
case 'Variable':
|
package/lib/N3Parser.js
CHANGED
|
@@ -1218,6 +1218,8 @@ class N3Parser {
|
|
|
1218
1218
|
|
|
1219
1219
|
// ### `_readReifier` reads the triple term identifier after a tilde when in a reifying triple.
|
|
1220
1220
|
_readReifier(token) {
|
|
1221
|
+
// Without an identifier, the reifier is a fresh blank node
|
|
1222
|
+
if (token.type === '>>') return this._readReifiedTripleTail(token);
|
|
1221
1223
|
this._reifier = this._readEntity(token);
|
|
1222
1224
|
return this._readReifiedTripleTail;
|
|
1223
1225
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n3",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.6",
|
|
4
4
|
"description": "Lightning fast, asynchronous, streaming Turtle / N3 / RDF library.",
|
|
5
5
|
"author": "Ruben Verborgh <ruben.verborgh@gmail.com>",
|
|
6
6
|
"keywords": [
|
|
@@ -71,12 +71,14 @@
|
|
|
71
71
|
"spec-1-1-earl-nquads": "rdf-test-suite spec/parser.js https://w3c.github.io/rdf-tests/rdf/rdf11/rdf-n-quads/manifest.ttl -i '{ \"format\": \"n-quads\" }' -c .rdf-test-suite-cache/ -o earl -p spec/earl-meta.json > spec/earl-nquads.ttl",
|
|
72
72
|
"spec-1-1-earl-turtle": "rdf-test-suite spec/parser.js https://w3c.github.io/rdf-tests/rdf/rdf11/rdf-turtle/manifest.ttl -i '{ \"format\": \"turtle\" }' -c .rdf-test-suite-cache/ -o earl -p spec/earl-meta.json > spec/earl-turtle.ttl",
|
|
73
73
|
"spec-1-1-earl-trig": "rdf-test-suite spec/parser.js https://w3c.github.io/rdf-tests/rdf/rdf11/rdf-trig/manifest.ttl -i '{ \"format\": \"trig\" }' -c .rdf-test-suite-cache/ -o earl -p spec/earl-meta.json > spec/earl-trig.ttl",
|
|
74
|
-
"spec-1-2": "npm run spec-1-2-turtle && npm run spec-1-2-ntriples && npm run spec-1-2-nquads && npm run spec-1-2-trig",
|
|
74
|
+
"spec-1-2": "npm run spec-1-2-turtle && npm run spec-1-2-ntriples && npm run spec-1-2-nquads && npm run spec-1-2-trig && npm run spec-1-2-turtle-eval && npm run spec-1-2-trig-eval",
|
|
75
75
|
"spec-1-2-earl": "npm run spec-1-2-earl-turtle && npm run spec-1-2-earl-ntriples && npm run spec-1-2-earl-nquads && npm run spec-1-2-earl-trig",
|
|
76
76
|
"spec-1-2-ntriples": "rdf-test-suite spec/parser.js https://w3c.github.io/rdf-tests/rdf/rdf12/rdf-n-triples/syntax/manifest.ttl -i '{ \"format\": \"n-triples\" }' -c .rdf-test-suite-cache/",
|
|
77
77
|
"spec-1-2-nquads": "rdf-test-suite spec/parser.js https://w3c.github.io/rdf-tests/rdf/rdf12/rdf-n-quads/syntax/manifest.ttl -i '{ \"format\": \"n-quads\" }' -c .rdf-test-suite-cache/",
|
|
78
78
|
"spec-1-2-turtle": "rdf-test-suite spec/parser.js https://w3c.github.io/rdf-tests/rdf/rdf12/rdf-turtle/syntax/manifest.ttl -i '{ \"format\": \"turtle\" }' -c .rdf-test-suite-cache/",
|
|
79
79
|
"spec-1-2-trig": "rdf-test-suite spec/parser.js https://w3c.github.io/rdf-tests/rdf/rdf12/rdf-trig/syntax/manifest.ttl -i '{ \"format\": \"trig\" }' -c .rdf-test-suite-cache/",
|
|
80
|
+
"spec-1-2-turtle-eval": "rdf-test-suite spec/parser.js https://w3c.github.io/rdf-tests/rdf/rdf12/rdf-turtle/eval/manifest.ttl -i '{ \"format\": \"turtle\" }' -c .rdf-test-suite-cache/",
|
|
81
|
+
"spec-1-2-trig-eval": "rdf-test-suite spec/parser.js https://w3c.github.io/rdf-tests/rdf/rdf12/rdf-trig/eval/manifest.ttl -i '{ \"format\": \"trig\" }' -c .rdf-test-suite-cache/",
|
|
80
82
|
"spec-1-2-earl-ntriples": "rdf-test-suite spec/parser.js https://w3c.github.io/rdf-tests/rdf/rdf12/rdf-n-triples/syntax/manifest.ttl -i '{ \"format\": \"n-triples\" }' -c .rdf-test-suite-cache/ -o earl -p spec/earl-meta.json > spec/earl-ntriples.ttl",
|
|
81
83
|
"spec-1-2-earl-nquads": "rdf-test-suite spec/parser.js https://w3c.github.io/rdf-tests/rdf/rdf12/rdf-n-quads/syntax/manifest.ttl -i '{ \"format\": \"n-quads\" }' -c .rdf-test-suite-cache/ -o earl -p spec/earl-meta.json > spec/earl-nquads.ttl",
|
|
82
84
|
"spec-1-2-earl-turtle": "rdf-test-suite spec/parser.js https://w3c.github.io/rdf-tests/rdf/rdf12/rdf-turtle/syntax/manifest.ttl -i '{ \"format\": \"turtle\" }' -c .rdf-test-suite-cache/ -o earl -p spec/earl-meta.json > spec/earl-turtle.ttl",
|
package/src/N3DataFactory.js
CHANGED
|
@@ -74,9 +74,13 @@ export class NamedNode extends Term {
|
|
|
74
74
|
* the constructor assumes an already-validated IRI.
|
|
75
75
|
*/
|
|
76
76
|
constructor(iri) {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
if (iri !== '')
|
|
78
|
+
super(iri);
|
|
79
|
+
// The empty IRI gets a distinct ID, since '' is the ID of the default graph
|
|
80
|
+
else {
|
|
81
|
+
super(EMPTY_IRI_ID);
|
|
79
82
|
Object.defineProperty(this, 'value', { value: '' });
|
|
83
|
+
}
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
// ### The term type of this term
|
|
@@ -321,7 +325,10 @@ export function termToId(term, nested) {
|
|
|
321
325
|
|
|
322
326
|
// Term instantiated with another library
|
|
323
327
|
switch (term.termType) {
|
|
324
|
-
case 'NamedNode':
|
|
328
|
+
case 'NamedNode': {
|
|
329
|
+
const iri = term.value;
|
|
330
|
+
return iri !== '' ? iri : EMPTY_IRI_ID;
|
|
331
|
+
}
|
|
325
332
|
case 'BlankNode': return `_:${term.value}`;
|
|
326
333
|
case 'Variable': return `?${term.value}`;
|
|
327
334
|
case 'DefaultGraph': return '';
|
package/src/N3Parser.js
CHANGED
|
@@ -1323,6 +1323,9 @@ export default class N3Parser {
|
|
|
1323
1323
|
|
|
1324
1324
|
// ### `_readReifier` reads the triple term identifier after a tilde when in a reifying triple.
|
|
1325
1325
|
_readReifier(token) {
|
|
1326
|
+
// Without an identifier, the reifier is a fresh blank node
|
|
1327
|
+
if (token.type === '>>')
|
|
1328
|
+
return this._readReifiedTripleTail(token);
|
|
1326
1329
|
this._reifier = this._readEntity(token);
|
|
1327
1330
|
return this._readReifiedTripleTail;
|
|
1328
1331
|
}
|