n3 2.0.4 → 2.1.1
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/.babelrc +1 -1
- package/README.md +7 -1
- package/browser/n3.esm.min.js +38 -0
- package/browser/n3.min.js +1 -1
- package/lib/N3Reasoner.js +0 -2
- package/lib/N3Writer.js +4 -2
- package/package.json +17 -9
- package/src/N3Reasoner.js +0 -1
- package/src/N3Writer.js +4 -2
package/lib/N3Reasoner.js
CHANGED
|
@@ -36,8 +36,6 @@ class N3Reasoner {
|
|
|
36
36
|
this._store._addToIndex(graphItem.objects, object, subject, predicate);
|
|
37
37
|
cb();
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
// eslint-disable-next-line no-warning-comments
|
|
41
39
|
_evaluatePremise(rule, content, cb, i = 0) {
|
|
42
40
|
let v1, v2, value, index1, index2;
|
|
43
41
|
const [val0, val1, val2] = rule.premise[i].value,
|
package/lib/N3Writer.js
CHANGED
|
@@ -102,7 +102,9 @@ class N3Writer {
|
|
|
102
102
|
_writeQuad(subject, predicate, object, graph, done) {
|
|
103
103
|
try {
|
|
104
104
|
// Write the graph's label if it has changed
|
|
105
|
-
|
|
105
|
+
// (the id-based fast path of `equals` would conflate
|
|
106
|
+
// the empty named node `<>` with the default graph)
|
|
107
|
+
if (!graph.equals(this._graph) || graph.termType !== this._graph.termType) {
|
|
106
108
|
// Close the previous graph and start the new one
|
|
107
109
|
this._write((this._subject === null ? '' : this._inDefaultGraph ? '.\n' : '\n}\n') + (DEFAULTGRAPH.equals(graph) ? '' : `${this._encodeIriOrBlank(graph)} {\n`));
|
|
108
110
|
this._graph = graph;
|
|
@@ -131,7 +133,7 @@ class N3Writer {
|
|
|
131
133
|
|
|
132
134
|
// ### `quadToString` serializes a quad as a string
|
|
133
135
|
quadToString(subject, predicate, object, graph) {
|
|
134
|
-
return `${this._encodeSubject(subject)} ${this._encodeIriOrBlank(predicate)} ${this._encodeObject(object)}${graph && graph
|
|
136
|
+
return `${this._encodeSubject(subject)} ${this._encodeIriOrBlank(predicate)} ${this._encodeObject(object)}${graph && !(0, _N3Util.isDefaultGraph)(graph) ? ` ${this._encodeIriOrBlank(graph)} .\n` : ' .\n'}`;
|
|
135
137
|
}
|
|
136
138
|
|
|
137
139
|
// ### `quadsToString` serializes an array of quads as a string
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n3",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Lightning fast, asynchronous, streaming Turtle / N3 / RDF library.",
|
|
5
5
|
"author": "Ruben Verborgh <ruben.verborgh@gmail.com>",
|
|
6
6
|
"keywords": [
|
|
@@ -28,19 +28,21 @@
|
|
|
28
28
|
"readable-stream": "^4.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@babel/cli": "^
|
|
32
|
-
"@babel/core": "^
|
|
33
|
-
"@babel/preset-env": "^
|
|
34
|
-
"@babel/register": "^
|
|
31
|
+
"@babel/cli": "^8.0.1",
|
|
32
|
+
"@babel/core": "^8.0.1",
|
|
33
|
+
"@babel/preset-env": "^8.0.2",
|
|
34
|
+
"@babel/register": "^8.0.1",
|
|
35
35
|
"@rdfjs/data-model": "^1",
|
|
36
36
|
"arrayify-stream": "^3.0.0",
|
|
37
37
|
"browserify": "^17.0.0",
|
|
38
38
|
"deep-taxonomy-benchmark": "^2.0.0",
|
|
39
39
|
"docco": "^0.9.1",
|
|
40
|
-
"
|
|
41
|
-
"eslint
|
|
40
|
+
"esbuild": "^0.28.1",
|
|
41
|
+
"eslint": "^10.4.1",
|
|
42
|
+
"eslint-plugin-import-x": "^4.16.2",
|
|
42
43
|
"eslint-plugin-jest": "^29.15.0",
|
|
43
|
-
"
|
|
44
|
+
"globals": "^17.6.0",
|
|
45
|
+
"jest": "^30.4.2",
|
|
44
46
|
"pre-commit": "^2.0.0",
|
|
45
47
|
"rdf-isomorphic": "^2.0.0",
|
|
46
48
|
"rdf-test-suite": "^2.1.4",
|
|
@@ -50,7 +52,9 @@
|
|
|
50
52
|
"scripts": {
|
|
51
53
|
"build": "npm run build:node && npm run build:browser",
|
|
52
54
|
"build:node": "babel src -d lib",
|
|
53
|
-
"build:browser": "rm -rf browser && mkdir browser &&
|
|
55
|
+
"build:browser": "rm -rf browser && mkdir browser && npm run build:browser:umd && npm run build:browser:esm",
|
|
56
|
+
"build:browser:umd": "browserify -s N3 lib/index.js | uglifyjs > browser/n3.min.js",
|
|
57
|
+
"build:browser:esm": "node scripts/build-esm.js",
|
|
54
58
|
"test": "jest",
|
|
55
59
|
"lint": "eslint src perf test spec",
|
|
56
60
|
"prepare": "npm run build",
|
|
@@ -94,6 +98,10 @@
|
|
|
94
98
|
"**/test/*-test.js"
|
|
95
99
|
],
|
|
96
100
|
"collectCoverage": true,
|
|
101
|
+
"coveragePathIgnorePatterns": [
|
|
102
|
+
"/node_modules/",
|
|
103
|
+
"/browser/"
|
|
104
|
+
],
|
|
97
105
|
"coverageReporters": [
|
|
98
106
|
"json-summary",
|
|
99
107
|
"text",
|
package/src/N3Reasoner.js
CHANGED
|
@@ -26,7 +26,6 @@ export default class N3Reasoner {
|
|
|
26
26
|
cb();
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
// eslint-disable-next-line no-warning-comments
|
|
30
29
|
_evaluatePremise(rule, content, cb, i = 0) {
|
|
31
30
|
let v1, v2, value, index1, index2;
|
|
32
31
|
const [val0, val1, val2] = rule.premise[i].value, index = content[rule.premise[i].content];
|
package/src/N3Writer.js
CHANGED
|
@@ -85,7 +85,9 @@ export default class N3Writer {
|
|
|
85
85
|
_writeQuad(subject, predicate, object, graph, done) {
|
|
86
86
|
try {
|
|
87
87
|
// Write the graph's label if it has changed
|
|
88
|
-
|
|
88
|
+
// (the id-based fast path of `equals` would conflate
|
|
89
|
+
// the empty named node `<>` with the default graph)
|
|
90
|
+
if (!graph.equals(this._graph) || graph.termType !== this._graph.termType) {
|
|
89
91
|
// Close the previous graph and start the new one
|
|
90
92
|
this._write((this._subject === null ? '' : (this._inDefaultGraph ? '.\n' : '\n}\n')) +
|
|
91
93
|
(DEFAULTGRAPH.equals(graph) ? '' : `${this._encodeIriOrBlank(graph)} {\n`));
|
|
@@ -125,7 +127,7 @@ export default class N3Writer {
|
|
|
125
127
|
return `${this._encodeSubject(subject)} ${
|
|
126
128
|
this._encodeIriOrBlank(predicate)} ${
|
|
127
129
|
this._encodeObject(object)
|
|
128
|
-
}${graph && graph
|
|
130
|
+
}${graph && !isDefaultGraph(graph) ? ` ${this._encodeIriOrBlank(graph)} .\n` : ' .\n'}`;
|
|
129
131
|
}
|
|
130
132
|
|
|
131
133
|
// ### `quadsToString` serializes an array of quads as a string
|