rdflib 2.3.1 → 2.3.2-075b5109
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/dist/515.rdflib.min.js +1 -1
- package/dist/515.rdflib.min.js.LICENSE.txt +6 -2
- package/dist/515.rdflib.min.js.map +1 -1
- package/dist/rdflib.min.js +1 -1
- package/dist/rdflib.min.js.LICENSE.txt +0 -9
- package/dist/rdflib.min.js.map +1 -1
- package/esm/factories/rdflib-data-factory.js +1 -3
- package/esm/fetcher.js +20 -17
- package/esm/formula.js +2 -11
- package/esm/n3parser.js +1 -2
- package/esm/parse.js +1 -3
- package/esm/serializer.js +7 -9
- package/esm/store.js +1 -2
- package/esm/update-manager.js +5 -10
- package/esm/utils.js +1 -2
- package/esm/variable.js +1 -2
- package/esm/xsd.js +1 -2
- package/lib/collection.d.ts +1 -1
- package/lib/factories/rdflib-data-factory.js +1 -3
- package/lib/fetcher.js +20 -17
- package/lib/formula.js +2 -11
- package/lib/index.d.ts +1 -1
- package/lib/n3parser.js +1 -2
- package/lib/parse.js +1 -3
- package/lib/rdfaparser.d.ts +9 -9
- package/lib/rdfxmlparser.d.ts +1 -1
- package/lib/serializer.d.ts +10 -11
- package/lib/serializer.js +7 -9
- package/lib/store.js +1 -2
- package/lib/update-manager.js +5 -10
- package/lib/utils.js +1 -2
- package/lib/variable.js +1 -2
- package/lib/xsd-internal.d.ts +7 -7
- package/lib/xsd.d.ts +7 -7
- package/lib/xsd.js +1 -2
- package/package.json +41 -36
- package/src/fetcher.ts +11 -2
- package/src/jsonldparser.js +2 -2
- package/src/n3parser.js +669 -670
- package/src/serializer.js +19 -20
- package/src/xsd-internal.js +1 -1
- package/src/xsd.js +4 -4
- package/dist/789.rdflib.min.js +0 -1
package/lib/update-manager.js
CHANGED
|
@@ -387,8 +387,7 @@ class UpdateManager {
|
|
|
387
387
|
/**
|
|
388
388
|
* @private
|
|
389
389
|
*/
|
|
390
|
-
fire(uri, query, callbackFunction) {
|
|
391
|
-
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
390
|
+
fire(uri, query, callbackFunction, options = {}) {
|
|
392
391
|
return Promise.resolve().then(() => {
|
|
393
392
|
if (!uri) {
|
|
394
393
|
throw new Error('No URI given for remote editing operation: ' + query);
|
|
@@ -676,8 +675,7 @@ class UpdateManager {
|
|
|
676
675
|
* @param insertions - Statement or statements to be inserted.
|
|
677
676
|
* @returns a promise
|
|
678
677
|
*/
|
|
679
|
-
updateMany(deletions) {
|
|
680
|
-
let insertions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
678
|
+
updateMany(deletions, insertions = []) {
|
|
681
679
|
const docs = deletions.concat(insertions).map(st => st.why);
|
|
682
680
|
const thisUpdater = this;
|
|
683
681
|
const uniqueDocs = [];
|
|
@@ -790,8 +788,7 @@ _:patch
|
|
|
790
788
|
* OR returns a promise
|
|
791
789
|
* @param options - Options for the fetch call
|
|
792
790
|
*/
|
|
793
|
-
update(deletions, insertions, callback, secondTry) {
|
|
794
|
-
let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
791
|
+
update(deletions, insertions, callback, secondTry, options = {}) {
|
|
795
792
|
if (!callback) {
|
|
796
793
|
var thisUpdater = this;
|
|
797
794
|
return new Promise(function (resolve, reject) {
|
|
@@ -934,8 +931,7 @@ _:patch
|
|
|
934
931
|
callback(undefined, false, 'Exception in update: ' + e + '\n' + Util.stackString(e));
|
|
935
932
|
}
|
|
936
933
|
}
|
|
937
|
-
updateDav(doc, ds, is, callbackFunction) {
|
|
938
|
-
let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
934
|
+
updateDav(doc, ds, is, callbackFunction, options = {}) {
|
|
939
935
|
let kb = this.store;
|
|
940
936
|
// The code below is derived from Kenny's UpdateCenter.js
|
|
941
937
|
var request = kb.any(doc, this.ns.link('request'));
|
|
@@ -992,8 +988,7 @@ _:patch
|
|
|
992
988
|
* @param callbackFunction
|
|
993
989
|
* @param options
|
|
994
990
|
*/
|
|
995
|
-
updateLocalFile(doc, ds, is, callbackFunction) {
|
|
996
|
-
let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
991
|
+
updateLocalFile(doc, ds, is, callbackFunction, options = {}) {
|
|
997
992
|
const kb = this.store;
|
|
998
993
|
// console.log('Writing back to local file\n')
|
|
999
994
|
|
package/lib/utils.js
CHANGED
|
@@ -89,8 +89,7 @@ function arrayToStatements(rdfFactory, subject, data) {
|
|
|
89
89
|
}, subject);
|
|
90
90
|
return statements;
|
|
91
91
|
}
|
|
92
|
-
function ArrayIndexOf(arr, item) {
|
|
93
|
-
let i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
92
|
+
function ArrayIndexOf(arr, item, i = 0) {
|
|
94
93
|
var length = arr.length;
|
|
95
94
|
if (i < 0) i = length + i;
|
|
96
95
|
for (; i < length; i++) {
|
package/lib/variable.js
CHANGED
|
@@ -23,8 +23,7 @@ class Variable extends _nodeInternal.default {
|
|
|
23
23
|
* Initializes this variable
|
|
24
24
|
* @param name The variable's name
|
|
25
25
|
*/
|
|
26
|
-
constructor() {
|
|
27
|
-
let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
26
|
+
constructor(name = '') {
|
|
28
27
|
super(name);
|
|
29
28
|
(0, _defineProperty2.default)(this, "termType", _types.VariableTermType);
|
|
30
29
|
/** The base string for a variable's name */
|
package/lib/xsd-internal.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare namespace _default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
let boolean: NamedNode;
|
|
3
|
+
let dateTime: NamedNode;
|
|
4
|
+
let decimal: NamedNode;
|
|
5
|
+
let double: NamedNode;
|
|
6
|
+
let integer: NamedNode;
|
|
7
|
+
let langString: NamedNode;
|
|
8
|
+
let string: NamedNode;
|
|
9
9
|
}
|
|
10
10
|
export default _default;
|
|
11
11
|
import NamedNode from './named-node';
|
package/lib/xsd.d.ts
CHANGED
|
@@ -9,11 +9,11 @@ export function createXSD(localFactory?: import("./factories/factory-types").Dat
|
|
|
9
9
|
};
|
|
10
10
|
export default defaultXSD;
|
|
11
11
|
declare namespace defaultXSD {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
let boolean: import("./named-node").default;
|
|
13
|
+
let dateTime: import("./named-node").default;
|
|
14
|
+
let decimal: import("./named-node").default;
|
|
15
|
+
let double: import("./named-node").default;
|
|
16
|
+
let integer: import("./named-node").default;
|
|
17
|
+
let langString: import("./named-node").default;
|
|
18
|
+
let string: import("./named-node").default;
|
|
19
19
|
}
|
package/lib/xsd.js
CHANGED
|
@@ -7,8 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.createXSD = createXSD;
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _canonicalDataFactory = _interopRequireDefault(require("./factories/canonical-data-factory"));
|
|
10
|
-
function createXSD() {
|
|
11
|
-
let localFactory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _canonicalDataFactory.default;
|
|
10
|
+
function createXSD(localFactory = _canonicalDataFactory.default) {
|
|
12
11
|
return {
|
|
13
12
|
boolean: localFactory.namedNode("http://www.w3.org/2001/XMLSchema#boolean"),
|
|
14
13
|
dateTime: localFactory.namedNode("http://www.w3.org/2001/XMLSchema#dateTime"),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rdflib",
|
|
3
3
|
"description": "an RDF library for node.js. Suitable for client and server side.",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.2-075b5109",
|
|
5
5
|
"private": false,
|
|
6
6
|
"browserslist": [
|
|
7
7
|
"> 0.5%"
|
|
@@ -44,49 +44,51 @@
|
|
|
44
44
|
"homepage": "http://github.com/linkeddata/rdflib.js",
|
|
45
45
|
"bugs": "http://github.com/linkeddata/rdflib.js/issues",
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@babel/runtime": "^7.
|
|
47
|
+
"@babel/runtime": "^7.28.4",
|
|
48
48
|
"@frogcat/ttl2jsonld": "^0.0.10",
|
|
49
49
|
"@rdfjs/types": "^2.0.1",
|
|
50
|
-
"@xmldom/xmldom": "^0.8.
|
|
51
|
-
"cross-fetch": "^
|
|
52
|
-
"jsonld": "^
|
|
53
|
-
"n3": "^1.
|
|
50
|
+
"@xmldom/xmldom": "^0.8.11",
|
|
51
|
+
"cross-fetch": "^4.1.0",
|
|
52
|
+
"jsonld": "^9.0.0",
|
|
53
|
+
"n3": "^1.26.0",
|
|
54
54
|
"solid-namespace": "^0.5.4"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@babel/cli": "^7.
|
|
58
|
-
"@babel/core": "^7.
|
|
57
|
+
"@babel/cli": "^7.28.3",
|
|
58
|
+
"@babel/core": "^7.28.5",
|
|
59
59
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
60
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
61
|
-
"@babel/preset-env": "^7.
|
|
62
|
-
"@babel/preset-typescript": "^7.
|
|
63
|
-
"@babel/register": "^7.
|
|
64
|
-
"@types/chai": "^
|
|
60
|
+
"@babel/plugin-transform-runtime": "^7.28.5",
|
|
61
|
+
"@babel/preset-env": "^7.28.5",
|
|
62
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
63
|
+
"@babel/register": "^7.28.3",
|
|
64
|
+
"@types/chai": "^5.2.3",
|
|
65
65
|
"@types/dirty-chai": "^2.0.5",
|
|
66
|
-
"@types/express": "^
|
|
66
|
+
"@types/express": "^5.0.6",
|
|
67
67
|
"@types/jsonld": "^1.5.15",
|
|
68
68
|
"@types/mocha": "^10.0.10",
|
|
69
|
-
"@types/
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
69
|
+
"@types/node": "^25.0.1",
|
|
70
|
+
"@types/sinon-chai": "^4.0.0",
|
|
71
|
+
"babel-loader": "^10.0.0",
|
|
72
|
+
"chai": "^6.2.1",
|
|
73
|
+
"colors": "^1.4.0",
|
|
74
|
+
"diff": "^8.0.2",
|
|
75
|
+
"eslint": "^9.39.2",
|
|
76
|
+
"globals": "^16.5.0",
|
|
77
|
+
"locate-path": "^8.0.0",
|
|
78
|
+
"mocha": "^11.7.5",
|
|
79
|
+
"nock": "^14.0.10",
|
|
79
80
|
"node-fetch": "^3.3.2",
|
|
80
|
-
"node-polyfill-webpack-plugin": "^
|
|
81
|
-
"
|
|
82
|
-
"sinon
|
|
83
|
-
"
|
|
81
|
+
"node-polyfill-webpack-plugin": "^4.1.0",
|
|
82
|
+
"rimraf": "^6.1.2",
|
|
83
|
+
"sinon": "^21.0.0",
|
|
84
|
+
"sinon-chai": "^4.0.1",
|
|
85
|
+
"source-map-loader": "^5.0.0",
|
|
84
86
|
"ts-node": "^10.9.2",
|
|
85
|
-
"typedoc": "^0.
|
|
86
|
-
"typescript": "^5.
|
|
87
|
-
"webpack": "^5.
|
|
88
|
-
"webpack-cli": "^
|
|
89
|
-
"webpack-dev-server": "^
|
|
87
|
+
"typedoc": "^0.28.15",
|
|
88
|
+
"typescript": "^5.9.3",
|
|
89
|
+
"webpack": "^5.103.0",
|
|
90
|
+
"webpack-cli": "^6.0.1",
|
|
91
|
+
"webpack-dev-server": "^5.2.2"
|
|
90
92
|
},
|
|
91
93
|
"scripts": {
|
|
92
94
|
"build": "babel src --extensions \".ts,.js\" -d lib",
|
|
@@ -95,14 +97,16 @@
|
|
|
95
97
|
"build:types": "tsc --emitDeclarationOnly -d --moduleResolution node --declarationDir lib",
|
|
96
98
|
"build:all": "npm run build && npm run build:types && npm run build:browser && npm run build:esm",
|
|
97
99
|
"doc": "typedoc --out ./doc ./src/index.ts --excludePrivate --excludeInternal --tsconfig ./tsconfig.json",
|
|
100
|
+
"lint": "eslint src tests",
|
|
101
|
+
"lint:fix": "eslint src tests --fix",
|
|
98
102
|
"ignore:prepublishOnly": "npm ci && npm run build:all && npm run doc && npm run test",
|
|
99
103
|
"postversion": "git push --follow-tags",
|
|
100
104
|
"start": "webpack serve --port 4800",
|
|
101
105
|
"test": "npm run test:unit && npm run test:serialize && npm run test:types",
|
|
102
106
|
"test:clean": "rimraf tests/serialize/,*",
|
|
103
107
|
"test:serialize": "npm run build && npm run test:serialize:all && npm run test:clean",
|
|
104
|
-
"test:serialize:all": "npm run test:serialize:1 && npm run test:serialize:2 && npm run test:serialize:3 && npm run test:serialize:4 && npm run test:serialize:5 && npm run test:serialize:6 && npm run test:serialize:7 && npm run test:serialize:8 && npm run test:serialize:10 && npm run test:serialize:11 && npm run test:serialize:12 && npm run test:serialize:13 && npm run test:serialize:14 && npm run test:serialize:15",
|
|
105
|
-
"test:serialize:1": "cd ./tests/serialize && node ./data.js -in=t1.ttl -format=application/rdf+xml -out=,t1.xml &&
|
|
108
|
+
"test:serialize:all": "npm run test:serialize:1 && npm run test:serialize:2 && npm run test:serialize:3 && npm run test:serialize:4 && npm run test:serialize:5 && npm run test:serialize:6 && npm run test:serialize:7 && npm run test:serialize:8 && npm run test:serialize:10 && npm run test:serialize:11 && npm run test:serialize:12 && npm run test:serialize:13 && npm run test:serialize:14 && npm run test:serialize:15 && npm run test:serialize:16 && npm run test:serialize:17 && npm run test:serialize:18",
|
|
109
|
+
"test:serialize:1": "cd ./tests/serialize && node ./data.js -in=t1.ttl -format=application/rdf+xml -out=,t1.xml && node diff ,t1.xml t1-ref.xml",
|
|
106
110
|
"test:serialize:2": "cd ./tests/serialize && node ./data.js -in=t2.ttl -format=application/rdf+xml -out=,t2.xml && node diff ,t2.xml t2-ref.xml",
|
|
107
111
|
"test:serialize:3": "cd ./tests/serialize && node ./data.js -in=t3.ttl -format=application/rdf+xml -out=,t3.xml && node diff ,t3.xml t3-ref.xml",
|
|
108
112
|
"test:serialize:4": "cd ./tests/serialize && node ./data.js -in=t3.ttl -out=,t4.ttl && node diff ,t4.ttl t4-ref.ttl",
|
|
@@ -117,7 +121,8 @@
|
|
|
117
121
|
"test:serialize:14": "cd ./tests/serialize && node ./data.js -in=t14.html -format=text/turtle -out=,t14.ttl && node diff ,t14.ttl t14-ref.ttl",
|
|
118
122
|
"test:serialize:15": "cd ./tests/serialize && node ./data.js -in=t15.html -format=text/turtle -out=,t15.ttl && node diff ,t15.ttl t15-ref.ttl",
|
|
119
123
|
"test:serialize:16": "cd ./tests/serialize && node ./data.js -in=t1.ttl -format=application/ld+json -out=,t1.jsonld && node diff ,t1.jsonld t16-ref.jsonld",
|
|
120
|
-
"test:serialize:17": "cd ./tests/serialize && node ./data.js -in=t17.ttl -format=application/rdf+xml
|
|
124
|
+
"test:serialize:17": "cd ./tests/serialize && node ./data.js -in=t17.ttl -format=application/rdf+xml -out=,t17.xml && node diff ,t17.xml t17-ref.xml",
|
|
125
|
+
"test:serialize:18": "cd ./tests/serialize && node ./data.js -in=t18.ttl -format=application/rdf+xml -out=,t18.xml && node diff ,t18.xml t18-ref.xml",
|
|
121
126
|
"test:types": "tsc --noEmit --target es2019 --moduleResolution node tests/types/*.ts",
|
|
122
127
|
"test:unit": "mocha --growl --require ./tests/babel-register.js tests/unit/**-test.*",
|
|
123
128
|
"test:unit:egp": "mocha --require ./tests/babel-register.js tests/unit/fetcher-egp-test.js",
|
package/src/fetcher.ts
CHANGED
|
@@ -756,13 +756,22 @@ export default class Fetcher implements CallbackifyInterface {
|
|
|
756
756
|
this.timeout = options.timeout || 30000
|
|
757
757
|
|
|
758
758
|
// solidFetcher is deprecated
|
|
759
|
-
|
|
759
|
+
let fetchFunc = options.fetch
|
|
760
760
|
|| (typeof global !== 'undefined' && (global.solidFetcher || global.solidFetch))
|
|
761
761
|
|| (typeof window !== 'undefined' && (window.solidFetcher || window.solidFetch))
|
|
762
762
|
|| crossFetch
|
|
763
|
-
if (!
|
|
763
|
+
if (!fetchFunc) {
|
|
764
764
|
throw new Error('No _fetch function available for Fetcher')
|
|
765
765
|
}
|
|
766
|
+
// Bind fetch to its context to avoid "Illegal invocation" errors
|
|
767
|
+
// Check if it's the native browser fetch or global fetch that needs binding
|
|
768
|
+
if (typeof window !== 'undefined' && fetchFunc === window.fetch) {
|
|
769
|
+
this._fetch = fetchFunc.bind(window)
|
|
770
|
+
} else if (typeof global !== 'undefined' && fetchFunc === global.fetch) {
|
|
771
|
+
this._fetch = fetchFunc.bind(global)
|
|
772
|
+
} else {
|
|
773
|
+
this._fetch = fetchFunc
|
|
774
|
+
}
|
|
766
775
|
// This is the name of the graph we store all the HTTP metadata in
|
|
767
776
|
this.appNode = this.store.sym('chrome://TheCurrentSession')
|
|
768
777
|
// this.appNode = this.store.rdfFactory.blankNode() // Needs to have a URI in tests
|
package/src/jsonldparser.js
CHANGED
|
@@ -78,10 +78,10 @@ export default async function jsonldParser(str, kb, base) {
|
|
|
78
78
|
function nodeType(kb, obj) {
|
|
79
79
|
if (obj['@id'].startsWith('_:')) {
|
|
80
80
|
// This object is a Blank Node. Pass the id without the `_:` prefix
|
|
81
|
-
return kb.rdfFactory.blankNode(obj['@id'].substring(2))
|
|
81
|
+
return kb.rdfFactory.blankNode(obj['@id'].substring(2))
|
|
82
82
|
} else {
|
|
83
83
|
// This object is a Named Node
|
|
84
|
-
return kb.rdfFactory.namedNode(obj['@id'])
|
|
84
|
+
return kb.rdfFactory.namedNode(obj['@id'])
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|