rdflib 2.2.34 → 2.2.35-2bb9ed0b
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 +3 -0
- package/dist/515.rdflib.min.js.map +1 -0
- package/dist/789.rdflib.min.js +1 -0
- package/dist/rdflib.min.js +1 -1
- package/dist/rdflib.min.js.LICENSE.txt +0 -2
- package/dist/rdflib.min.js.map +1 -1
- package/esm/blank-node.js +57 -85
- package/esm/class-order.js +1 -1
- package/esm/collection.js +70 -106
- package/esm/default-graph.js +13 -33
- package/esm/empty.js +8 -26
- package/esm/factories/canonical-data-factory.js +33 -30
- package/esm/factories/extended-term-factory.js +18 -14
- package/esm/factories/factory-types.js +1 -1
- package/esm/factories/rdflib-data-factory.js +9 -11
- package/esm/fetcher.js +1364 -1668
- package/esm/formula.js +631 -739
- package/esm/index.js +31 -51
- package/esm/jsonldparser.js +19 -26
- package/esm/jsonparser.js +1 -1
- package/esm/lists.js +41 -86
- package/esm/literal.js +120 -157
- package/esm/log.js +7 -7
- package/esm/n3parser.js +1008 -1090
- package/esm/named-node.js +69 -99
- package/esm/namespace.js +2 -4
- package/esm/node-internal.js +73 -97
- package/esm/node.js +1 -2
- package/esm/parse.js +3 -3
- package/esm/patch-parser.js +1 -2
- package/esm/query.js +15 -30
- package/esm/rdfaparser.js +775 -846
- package/esm/rdfxmlparser.js +348 -365
- package/esm/serialize.js +2 -3
- package/esm/serializer.js +834 -889
- package/esm/sparql-to-query.js +0 -2
- package/esm/statement.js +52 -72
- package/esm/store.js +852 -963
- package/esm/types.js +26 -21
- package/esm/update-manager.js +963 -1104
- package/esm/updates-via.js +104 -134
- package/esm/uri.js +3 -3
- package/esm/utils/default-graph-uri.js +2 -2
- package/esm/utils/terms.js +4 -5
- package/esm/utils-js.js +5 -6
- package/esm/utils.js +7 -6
- package/esm/variable.js +32 -58
- package/esm/xsd.js +2 -2
- package/lib/blank-node.js +56 -83
- package/lib/class-order.js +2 -3
- package/lib/collection.js +69 -104
- package/lib/default-graph.js +13 -32
- package/lib/empty.js +8 -25
- package/lib/factories/canonical-data-factory.js +36 -34
- package/lib/factories/extended-term-factory.js +19 -16
- package/lib/factories/factory-types.js +2 -3
- package/lib/factories/rdflib-data-factory.js +10 -13
- package/lib/fetcher.js +1394 -1693
- package/lib/formula.js +631 -738
- package/lib/index.js +66 -89
- package/lib/jsonldparser.js +21 -32
- package/lib/jsonparser.js +3 -4
- package/lib/lists.js +47 -87
- package/lib/literal.js +120 -156
- package/lib/log.js +8 -9
- package/lib/n3parser.js +1011 -1096
- package/lib/named-node.js +69 -98
- package/lib/namespace.js +2 -4
- package/lib/node-internal.js +72 -95
- package/lib/node.js +2 -4
- package/lib/parse.js +5 -6
- package/lib/patch-parser.js +1 -2
- package/lib/query.js +19 -32
- package/lib/rdfaparser.js +777 -849
- package/lib/rdfxmlparser.js +350 -366
- package/lib/serialize.js +2 -3
- package/lib/serializer.js +838 -892
- package/lib/sparql-to-query.js +0 -2
- package/lib/statement.js +54 -74
- package/lib/store.js +873 -978
- package/lib/types.js +22 -43
- package/lib/update-manager.js +972 -1111
- package/lib/updates-via.js +105 -134
- package/lib/uri.js +3 -3
- package/lib/utils/default-graph-uri.js +2 -4
- package/lib/utils/terms.js +4 -6
- package/lib/utils-js.js +11 -13
- package/lib/utils.js +6 -7
- package/lib/variable.js +34 -60
- package/lib/xsd-internal.js +2 -3
- package/lib/xsd.js +3 -4
- package/package.json +31 -31
- package/src/n3parser.js +1 -1
- package/src/rdfxmlparser.js +2 -1
- package/src/serializer.js +1 -1
- package/.babelrc +0 -20
- package/dist/670.rdflib.min.js +0 -1
- package/dist/730.rdflib.min.js +0 -3
- package/dist/730.rdflib.min.js.map +0 -1
- /package/dist/{730.rdflib.min.js.LICENSE.txt → 515.rdflib.min.js.LICENSE.txt} +0 -0
package/lib/updates-via.js
CHANGED
|
@@ -5,15 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.UpdatesVia = exports.UpdatesSocket = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
8
|
var _rdflibDataFactory = _interopRequireDefault(require("./factories/rdflib-data-factory"));
|
|
11
9
|
/*
|
|
12
10
|
* Updates-Via
|
|
13
11
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
|
|
13
|
+
class UpdatesSocket {
|
|
14
|
+
constructor(parent, via) {
|
|
17
15
|
this.parent = parent;
|
|
18
16
|
this.via = via;
|
|
19
17
|
this.connected = false;
|
|
@@ -30,150 +28,123 @@ var UpdatesSocket = /*#__PURE__*/function () {
|
|
|
30
28
|
this.onError(error);
|
|
31
29
|
}
|
|
32
30
|
}
|
|
33
|
-
(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
ref =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
elt = ref[j];
|
|
50
|
-
results.push(elt.split('='));
|
|
51
|
-
}
|
|
52
|
-
return results;
|
|
53
|
-
}();
|
|
54
|
-
for (i in ref) {
|
|
55
|
-
elt = ref[i];
|
|
56
|
-
ref1 = [decodeURIComponent(elt[0]), decodeURIComponent(elt[1])];
|
|
57
|
-
k = ref1[0];
|
|
58
|
-
v = ref1[1];
|
|
59
|
-
if (r[k] == null) {
|
|
60
|
-
r[k] = [];
|
|
61
|
-
}
|
|
62
|
-
r[k].push(v);
|
|
31
|
+
_decode(q) {
|
|
32
|
+
var elt;
|
|
33
|
+
var i;
|
|
34
|
+
var k;
|
|
35
|
+
var r;
|
|
36
|
+
var ref;
|
|
37
|
+
var ref1;
|
|
38
|
+
var v;
|
|
39
|
+
r = {};
|
|
40
|
+
ref = function () {
|
|
41
|
+
var j, len, ref, results;
|
|
42
|
+
ref = q.split('&');
|
|
43
|
+
results = [];
|
|
44
|
+
for (j = 0, len = ref.length; j < len; j++) {
|
|
45
|
+
elt = ref[j];
|
|
46
|
+
results.push(elt.split('='));
|
|
63
47
|
}
|
|
64
|
-
return
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}, {
|
|
74
|
-
key: "_subscribe",
|
|
75
|
-
value: function _subscribe(uri) {
|
|
76
|
-
this._send('sub', uri, '');
|
|
77
|
-
this.subscribed[uri] = true;
|
|
78
|
-
return this.subscribed[uri];
|
|
79
|
-
}
|
|
80
|
-
}, {
|
|
81
|
-
key: "onClose",
|
|
82
|
-
value: function onClose(e) {
|
|
83
|
-
var uri;
|
|
84
|
-
this.connected = false;
|
|
85
|
-
for (uri in this.subscribed) {
|
|
86
|
-
this.pending[uri] = true;
|
|
48
|
+
return results;
|
|
49
|
+
}();
|
|
50
|
+
for (i in ref) {
|
|
51
|
+
elt = ref[i];
|
|
52
|
+
ref1 = [decodeURIComponent(elt[0]), decodeURIComponent(elt[1])];
|
|
53
|
+
k = ref1[0];
|
|
54
|
+
v = ref1[1];
|
|
55
|
+
if (r[k] == null) {
|
|
56
|
+
r[k] = [];
|
|
87
57
|
}
|
|
88
|
-
|
|
89
|
-
return this.subscribed;
|
|
58
|
+
r[k].push(v);
|
|
90
59
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
60
|
+
return r;
|
|
61
|
+
}
|
|
62
|
+
_send(method, uri, data) {
|
|
63
|
+
var base, message;
|
|
64
|
+
message = [method, uri, data].join(' ');
|
|
65
|
+
return typeof (base = this.socket).send === 'function' ? base.send(message) : void 0;
|
|
66
|
+
}
|
|
67
|
+
_subscribe(uri) {
|
|
68
|
+
this._send('sub', uri, '');
|
|
69
|
+
this.subscribed[uri] = true;
|
|
70
|
+
return this.subscribed[uri];
|
|
71
|
+
}
|
|
72
|
+
onClose(e) {
|
|
73
|
+
var uri;
|
|
74
|
+
this.connected = false;
|
|
75
|
+
for (uri in this.subscribed) {
|
|
76
|
+
this.pending[uri] = true;
|
|
95
77
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
78
|
+
this.subscribed = {};
|
|
79
|
+
return this.subscribed;
|
|
80
|
+
}
|
|
81
|
+
onError(e) {
|
|
82
|
+
throw new Error('onError' + e);
|
|
83
|
+
}
|
|
84
|
+
onMessage(e) {
|
|
85
|
+
var base, message;
|
|
86
|
+
message = e.data.split(' ');
|
|
87
|
+
if (message[0] === 'ping') {
|
|
88
|
+
return typeof (base = this.socket).send === 'function' ? base.send('pong ' + message.slice(1).join(' ')) : void 0;
|
|
89
|
+
} else if (message[0] === 'pub') {
|
|
90
|
+
return this.parent.onUpdate(message[1], this._decode(message[2]));
|
|
106
91
|
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
results.push(this._subscribe(uri));
|
|
116
|
-
}
|
|
117
|
-
return results;
|
|
92
|
+
}
|
|
93
|
+
onOpen(e) {
|
|
94
|
+
var results, uri;
|
|
95
|
+
this.connected = true;
|
|
96
|
+
results = [];
|
|
97
|
+
for (uri in this.pending) {
|
|
98
|
+
delete this.pending[uri];
|
|
99
|
+
results.push(this._subscribe(uri));
|
|
118
100
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
101
|
+
return results;
|
|
102
|
+
}
|
|
103
|
+
subscribe(uri) {
|
|
104
|
+
if (this.connected) {
|
|
105
|
+
return this._subscribe(uri);
|
|
106
|
+
} else {
|
|
107
|
+
this.pending[uri] = true;
|
|
108
|
+
return this.pending[uri];
|
|
128
109
|
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
}();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
132
112
|
exports.UpdatesSocket = UpdatesSocket;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
(0, _classCallCheck2.default)(this, UpdatesVia);
|
|
113
|
+
class UpdatesVia {
|
|
114
|
+
constructor(fetcher) {
|
|
136
115
|
this.fetcher = fetcher;
|
|
137
116
|
this.graph = {};
|
|
138
117
|
this.via = {};
|
|
139
118
|
this.fetcher.addCallback('headers', this.onHeaders);
|
|
140
119
|
}
|
|
141
|
-
(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
var etag, uri, via;
|
|
145
|
-
if (d.headers == null) {
|
|
146
|
-
return true;
|
|
147
|
-
}
|
|
148
|
-
if (typeof WebSocket === 'undefined' || WebSocket === null) {
|
|
149
|
-
return true;
|
|
150
|
-
}
|
|
151
|
-
etag = d.headers['etag'];
|
|
152
|
-
via = d.headers['updates-via'];
|
|
153
|
-
uri = d.uri;
|
|
154
|
-
if (etag && via) {
|
|
155
|
-
this.graph[uri] = {
|
|
156
|
-
etag: etag,
|
|
157
|
-
via: via
|
|
158
|
-
};
|
|
159
|
-
this.register(via, uri);
|
|
160
|
-
}
|
|
120
|
+
onHeaders(d) {
|
|
121
|
+
var etag, uri, via;
|
|
122
|
+
if (d.headers == null) {
|
|
161
123
|
return true;
|
|
162
124
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
value: function onUpdate(uri, d) {
|
|
166
|
-
return this.fetcher.refresh(_rdflibDataFactory.default.namedNode(uri));
|
|
125
|
+
if (typeof WebSocket === 'undefined' || WebSocket === null) {
|
|
126
|
+
return true;
|
|
167
127
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
128
|
+
etag = d.headers['etag'];
|
|
129
|
+
via = d.headers['updates-via'];
|
|
130
|
+
uri = d.uri;
|
|
131
|
+
if (etag && via) {
|
|
132
|
+
this.graph[uri] = {
|
|
133
|
+
etag: etag,
|
|
134
|
+
via: via
|
|
135
|
+
};
|
|
136
|
+
this.register(via, uri);
|
|
175
137
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
onUpdate(uri, d) {
|
|
141
|
+
return this.fetcher.refresh(_rdflibDataFactory.default.namedNode(uri));
|
|
142
|
+
}
|
|
143
|
+
register(via, uri) {
|
|
144
|
+
if (this.via[via] == null) {
|
|
145
|
+
this.via[via] = new UpdatesSocket(this, via);
|
|
146
|
+
}
|
|
147
|
+
return this.via[via].subscribe(uri);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
179
150
|
exports.UpdatesVia = UpdatesVia;
|
package/lib/uri.js
CHANGED
|
@@ -135,7 +135,7 @@ function join(given, base) {
|
|
|
135
135
|
* @param uri The URI
|
|
136
136
|
*/
|
|
137
137
|
function protocol(uri) {
|
|
138
|
-
|
|
138
|
+
const i = uri.indexOf(':');
|
|
139
139
|
if (i < 0) {
|
|
140
140
|
return null;
|
|
141
141
|
} else {
|
|
@@ -158,8 +158,8 @@ function refTo(base, uri) {
|
|
|
158
158
|
return '';
|
|
159
159
|
}
|
|
160
160
|
for (i = o = 0, len = uri.length; o < len; i = ++o) {
|
|
161
|
-
|
|
162
|
-
if (
|
|
161
|
+
const c = uri[i];
|
|
162
|
+
if (c !== base[i]) {
|
|
163
163
|
break;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
@@ -8,7 +8,5 @@ exports.defaultGraphURI = exports.defaultGraphNode = void 0;
|
|
|
8
8
|
var _namedNode = _interopRequireDefault(require("../named-node"));
|
|
9
9
|
// Prevents circular dependencies between data-factory-internal and statement
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
exports.
|
|
13
|
-
var defaultGraphNode = new _namedNode.default(defaultGraphURI);
|
|
14
|
-
exports.defaultGraphNode = defaultGraphNode;
|
|
11
|
+
const defaultGraphURI = exports.defaultGraphURI = 'chrome:theSession';
|
|
12
|
+
const defaultGraphNode = exports.defaultGraphNode = new _namedNode.default(defaultGraphURI);
|
package/lib/utils/terms.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -20,16 +19,15 @@ exports.isStore = isStore;
|
|
|
20
19
|
exports.isSubject = isSubject;
|
|
21
20
|
exports.isTerm = isTerm;
|
|
22
21
|
exports.isVariable = isVariable;
|
|
23
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
24
22
|
var _types = require("../types");
|
|
25
23
|
/** TypeGuard for RDFLib Statements */
|
|
26
24
|
function isStatement(obj) {
|
|
27
|
-
return
|
|
25
|
+
return typeof obj === 'object' && obj !== null && 'subject' in obj;
|
|
28
26
|
}
|
|
29
27
|
|
|
30
28
|
/** TypeGuard for RDFlib Stores */
|
|
31
29
|
function isStore(obj) {
|
|
32
|
-
return
|
|
30
|
+
return typeof obj === 'object' && obj !== null && 'statements' in obj;
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
/** TypeGuard for RDFLib Collections */
|
|
@@ -60,7 +58,7 @@ function isVariable(obj) {
|
|
|
60
58
|
|
|
61
59
|
/** TypeGuard for RDF/JS spec Terms */
|
|
62
60
|
function isTerm(obj) {
|
|
63
|
-
return
|
|
61
|
+
return typeof obj === 'object' && obj !== null && 'termType' in obj;
|
|
64
62
|
}
|
|
65
63
|
|
|
66
64
|
/** TypeGuard for RDF/JS spec Literals */
|
|
@@ -70,7 +68,7 @@ function isLiteral(value) {
|
|
|
70
68
|
|
|
71
69
|
/** TypeGuard for RDF/JS spec Quads */
|
|
72
70
|
function isQuad(obj) {
|
|
73
|
-
return
|
|
71
|
+
return typeof obj === "object" && obj !== null && 'subject' in obj && 'predicate' in obj && 'object' in obj;
|
|
74
72
|
}
|
|
75
73
|
|
|
76
74
|
/** TypeGuard for RDF/JS spec NamedNodes */
|
package/lib/utils-js.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -16,7 +15,7 @@ exports.heavyCompareSPO = heavyCompareSPO;
|
|
|
16
15
|
exports.linkRelationProperty = linkRelationProperty;
|
|
17
16
|
Object.defineProperty(exports, "log", {
|
|
18
17
|
enumerable: true,
|
|
19
|
-
get: function
|
|
18
|
+
get: function () {
|
|
20
19
|
return _log.default;
|
|
21
20
|
}
|
|
22
21
|
});
|
|
@@ -27,22 +26,22 @@ exports.stackString = stackString;
|
|
|
27
26
|
exports.string = void 0;
|
|
28
27
|
exports.string_startswith = string_startswith;
|
|
29
28
|
exports.uri = void 0;
|
|
30
|
-
var
|
|
31
|
-
|
|
29
|
+
var _uri = _interopRequireWildcard(require("./uri"));
|
|
30
|
+
var uri = _uri;
|
|
31
|
+
exports.uri = _uri;
|
|
32
32
|
var _log = _interopRequireDefault(require("./log"));
|
|
33
33
|
var _namedNode = _interopRequireDefault(require("./named-node"));
|
|
34
34
|
var _xmldom = require("@xmldom/xmldom");
|
|
35
|
-
function _getRequireWildcardCache(
|
|
36
|
-
function _interopRequireWildcard(
|
|
35
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
36
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
37
37
|
/**
|
|
38
38
|
* Utility functions for $rdf
|
|
39
39
|
* @module util
|
|
40
40
|
*/
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
const string = exports.string = {
|
|
43
43
|
template: stringTemplate
|
|
44
44
|
};
|
|
45
|
-
exports.string = string;
|
|
46
45
|
function mediaTypeClass(mediaType) {
|
|
47
46
|
mediaType = mediaType.split(';')[0].trim(); // remove media type parameters
|
|
48
47
|
return new _namedNode.default('http://www.w3.org/ns/iana/media-types/' + mediaType + '#Resource');
|
|
@@ -89,7 +88,7 @@ function callbackify(obj, callbacks) {
|
|
|
89
88
|
var replaceCallbacks = [];
|
|
90
89
|
var len = obj.callbacks[hook].length;
|
|
91
90
|
var x;
|
|
92
|
-
|
|
91
|
+
let callback;
|
|
93
92
|
|
|
94
93
|
// log.info('!@$ Firing '+hook+' call back with length'+len)
|
|
95
94
|
for (x = len - 1; x >= 0; x--) {
|
|
@@ -215,10 +214,10 @@ function dtstamp() {
|
|
|
215
214
|
* Compares statements (heavy comparison for repeatable canonical ordering)
|
|
216
215
|
*/
|
|
217
216
|
function heavyCompare(x, y, g, uriMap) {
|
|
218
|
-
var nonBlank = function
|
|
217
|
+
var nonBlank = function (x) {
|
|
219
218
|
return x.termType === 'BlankNode' ? null : x;
|
|
220
219
|
};
|
|
221
|
-
var signature = function
|
|
220
|
+
var signature = function (x) {
|
|
222
221
|
var lis = g.statementsMatching(x).map(function (st) {
|
|
223
222
|
return '' + nonBlank(st.subject) + ' ' + nonBlank(st.predicate) + ' ' + nonBlank(st.object);
|
|
224
223
|
}).concat(g.statementsMatching(undefined, undefined, x).map(function (st) {
|
|
@@ -227,7 +226,7 @@ function heavyCompare(x, y, g, uriMap) {
|
|
|
227
226
|
lis.sort();
|
|
228
227
|
return lis.join('\n');
|
|
229
228
|
};
|
|
230
|
-
|
|
229
|
+
const comparison = Object.prototype.hasOwnProperty.call(g, "compareTerms") ? g.compareTerms(x, y) : x.compareTerm(y);
|
|
231
230
|
if (x.termType === 'BlankNode' && y.termType === 'BlankNode') {
|
|
232
231
|
if (comparison === 0) return 0; // Same
|
|
233
232
|
if (signature(x) > signature(y)) return +1;
|
|
@@ -272,7 +271,6 @@ function parseXML(str, options) {
|
|
|
272
271
|
dparser = new _xmldom.DOMParser(); // Doc says this works
|
|
273
272
|
}
|
|
274
273
|
}
|
|
275
|
-
|
|
276
274
|
return dparser.parseFromString(str, 'application/xml');
|
|
277
275
|
}
|
|
278
276
|
|
package/lib/utils.js
CHANGED
|
@@ -60,9 +60,8 @@ function AJAR_handleNewTerm(kb, p, requestedBy) {
|
|
|
60
60
|
referringTerm: requestedBy
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var rdf = {
|
|
63
|
+
const appliedFactoryMethods = exports.appliedFactoryMethods = ['blankNode', 'defaultGraph', 'literal', 'namedNode', 'quad', 'variable', 'supports'];
|
|
64
|
+
const rdf = {
|
|
66
65
|
first: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first',
|
|
67
66
|
rest: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest',
|
|
68
67
|
nil: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'
|
|
@@ -76,10 +75,10 @@ var rdf = {
|
|
|
76
75
|
* @return The {data} as a set of statements.
|
|
77
76
|
*/
|
|
78
77
|
function arrayToStatements(rdfFactory, subject, data) {
|
|
79
|
-
|
|
80
|
-
data.reduce(
|
|
78
|
+
const statements = [];
|
|
79
|
+
data.reduce((id, _listObj, i, listData) => {
|
|
81
80
|
statements.push(rdfFactory.quad(id, rdfFactory.namedNode(rdf.first), listData[i]));
|
|
82
|
-
|
|
81
|
+
let nextNode;
|
|
83
82
|
if (i < listData.length - 1) {
|
|
84
83
|
nextNode = rdfFactory.blankNode();
|
|
85
84
|
statements.push(rdfFactory.quad(id, rdfFactory.namedNode(rdf.rest), nextNode));
|
|
@@ -91,7 +90,7 @@ function arrayToStatements(rdfFactory, subject, data) {
|
|
|
91
90
|
return statements;
|
|
92
91
|
}
|
|
93
92
|
function ArrayIndexOf(arr, item) {
|
|
94
|
-
|
|
93
|
+
let i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
95
94
|
var length = arr.length;
|
|
96
95
|
if (i < 0) i = length + i;
|
|
97
96
|
for (; i < length; i++) {
|
package/lib/variable.js
CHANGED
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
9
|
var _classOrder = _interopRequireDefault(require("./class-order"));
|
|
17
10
|
var _nodeInternal = _interopRequireDefault(require("./node-internal"));
|
|
18
11
|
var _types = require("./types");
|
|
19
12
|
var Uri = _interopRequireWildcard(require("./uri"));
|
|
20
|
-
function _getRequireWildcardCache(
|
|
21
|
-
function _interopRequireWildcard(
|
|
22
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
23
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
15
|
/**
|
|
25
16
|
* Variables are placeholders used in patterns to be matched.
|
|
26
17
|
* In cwm they are symbols which are the formula's list of quantified variables.
|
|
@@ -28,62 +19,45 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
28
19
|
* a common special base URI for variables. Their names are uris,
|
|
29
20
|
* but the ? notation has an implicit base uri of 'varid:'
|
|
30
21
|
*/
|
|
31
|
-
|
|
32
|
-
(0, _inherits2.default)(Variable, _Node);
|
|
33
|
-
var _super = _createSuper(Variable);
|
|
22
|
+
class Variable extends _nodeInternal.default {
|
|
34
23
|
/**
|
|
35
24
|
* Initializes this variable
|
|
36
25
|
* @param name The variable's name
|
|
37
26
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
(0,
|
|
42
|
-
_this = _super.call(this, name);
|
|
43
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "termType", _types.VariableTermType);
|
|
27
|
+
constructor() {
|
|
28
|
+
let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
29
|
+
super(name);
|
|
30
|
+
(0, _defineProperty2.default)(this, "termType", _types.VariableTermType);
|
|
44
31
|
/** The base string for a variable's name */
|
|
45
|
-
(0, _defineProperty2.default)(
|
|
46
|
-
(0, _defineProperty2.default)(
|
|
47
|
-
(0, _defineProperty2.default)(
|
|
32
|
+
(0, _defineProperty2.default)(this, "base", 'varid:');
|
|
33
|
+
(0, _defineProperty2.default)(this, "classOrder", _classOrder.default.Variable);
|
|
34
|
+
(0, _defineProperty2.default)(this, "isVar", 1);
|
|
48
35
|
/** The unique identifier of this variable */
|
|
49
|
-
(0, _defineProperty2.default)(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return _this;
|
|
36
|
+
(0, _defineProperty2.default)(this, "uri", void 0);
|
|
37
|
+
this.base = 'varid:';
|
|
38
|
+
this.uri = Uri.join(name, this.base);
|
|
53
39
|
}
|
|
54
|
-
(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (!other) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
return this.termType === other.termType && this.value === other.value;
|
|
40
|
+
equals(other) {
|
|
41
|
+
if (!other) {
|
|
42
|
+
return false;
|
|
61
43
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return
|
|
77
|
-
}
|
|
78
|
-
}], [{
|
|
79
|
-
key: "toString",
|
|
80
|
-
value: function toString(variable) {
|
|
81
|
-
if (variable.uri.slice(0, variable.base.length) === variable.base) {
|
|
82
|
-
return "?".concat(variable.uri.slice(variable.base.length));
|
|
83
|
-
}
|
|
84
|
-
return "?".concat(variable.uri);
|
|
44
|
+
return this.termType === other.termType && this.value === other.value;
|
|
45
|
+
}
|
|
46
|
+
hashString() {
|
|
47
|
+
return this.toString();
|
|
48
|
+
}
|
|
49
|
+
substitute(bindings) {
|
|
50
|
+
var ref;
|
|
51
|
+
return (ref = bindings[this.toNT()]) != null ? ref : this;
|
|
52
|
+
}
|
|
53
|
+
toString() {
|
|
54
|
+
return Variable.toString(this);
|
|
55
|
+
}
|
|
56
|
+
static toString(variable) {
|
|
57
|
+
if (variable.uri.slice(0, variable.base.length) === variable.base) {
|
|
58
|
+
return `?${variable.uri.slice(variable.base.length)}`;
|
|
85
59
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
60
|
+
return `?${variable.uri}`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
89
63
|
exports.default = Variable;
|
package/lib/xsd-internal.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _namedNode = _interopRequireDefault(require("./named-node"));
|
|
9
|
-
var _default = {
|
|
9
|
+
var _default = exports.default = {
|
|
10
10
|
boolean: new _namedNode.default('http://www.w3.org/2001/XMLSchema#boolean'),
|
|
11
11
|
dateTime: new _namedNode.default('http://www.w3.org/2001/XMLSchema#dateTime'),
|
|
12
12
|
decimal: new _namedNode.default('http://www.w3.org/2001/XMLSchema#decimal'),
|
|
@@ -14,5 +14,4 @@ var _default = {
|
|
|
14
14
|
integer: new _namedNode.default('http://www.w3.org/2001/XMLSchema#integer'),
|
|
15
15
|
langString: new _namedNode.default('http://www.w3.org/1999/02/22-rdf-syntax-ns#langString'),
|
|
16
16
|
string: new _namedNode.default('http://www.w3.org/2001/XMLSchema#string')
|
|
17
|
-
};
|
|
18
|
-
exports.default = _default;
|
|
17
|
+
};
|
package/lib/xsd.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.createXSD = createXSD;
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _canonicalDataFactory = _interopRequireDefault(require("./factories/canonical-data-factory"));
|
|
10
10
|
function createXSD() {
|
|
11
|
-
|
|
11
|
+
let localFactory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _canonicalDataFactory.default;
|
|
12
12
|
return {
|
|
13
13
|
boolean: localFactory.namedNode("http://www.w3.org/2001/XMLSchema#boolean"),
|
|
14
14
|
dateTime: localFactory.namedNode("http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
@@ -19,6 +19,5 @@ function createXSD() {
|
|
|
19
19
|
string: localFactory.namedNode("http://www.w3.org/2001/XMLSchema#string")
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
var _default = defaultXSD;
|
|
24
|
-
exports.default = _default;
|
|
22
|
+
const defaultXSD = createXSD(_canonicalDataFactory.default);
|
|
23
|
+
var _default = exports.default = defaultXSD;
|