rdflib 2.2.22-2f49e8ef → 2.2.22-53d65d90
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/rdflib.min.js +1 -1
- package/dist/rdflib.min.js.LICENSE.txt +4 -0
- package/dist/rdflib.min.js.map +1 -1
- package/esm/blank-node.js +90 -61
- package/esm/class-order.js +1 -1
- package/esm/collection.js +106 -70
- package/esm/default-graph.js +33 -13
- package/esm/empty.js +26 -8
- package/esm/factories/canonical-data-factory.js +30 -33
- package/esm/factories/extended-term-factory.js +14 -18
- package/esm/factories/factory-types.js +1 -1
- package/esm/factories/rdflib-data-factory.js +11 -9
- package/esm/fetcher.js +1644 -1355
- package/esm/formula.js +740 -632
- package/esm/index.js +52 -33
- package/esm/jsonldparser.js +35 -19
- package/esm/jsonparser.js +1 -1
- package/esm/lists.js +86 -38
- package/esm/literal.js +157 -120
- package/esm/log.js +7 -7
- package/esm/n3parser.js +1085 -1008
- package/esm/named-node.js +99 -69
- package/esm/namespace.js +4 -2
- package/esm/node-internal.js +98 -74
- package/esm/node.js +1 -1
- package/esm/parse.js +3 -3
- package/esm/patch-parser.js +1 -1
- package/esm/query.js +16 -15
- package/esm/rdfaparser.js +846 -781
- package/esm/rdfxmlparser.js +365 -348
- package/esm/serialize.js +4 -11
- package/esm/serializer.js +886 -821
- package/esm/statement.js +72 -52
- package/esm/store.js +924 -822
- package/esm/types.js +21 -21
- package/esm/update-manager.js +983 -882
- package/esm/updates-via.js +134 -104
- package/esm/uri.js +3 -3
- package/esm/utils/default-graph-uri.js +2 -2
- package/esm/utils/terms.js +5 -4
- package/esm/utils-js.js +5 -5
- package/esm/utils.js +6 -6
- package/esm/variable.js +58 -32
- package/esm/xsd.js +2 -2
- package/lib/blank-node.js +88 -60
- package/lib/class-order.js +1 -1
- package/lib/collection.js +104 -69
- package/lib/default-graph.js +32 -13
- package/lib/empty.js +25 -8
- package/lib/factories/canonical-data-factory.js +32 -35
- package/lib/factories/extended-term-factory.js +14 -18
- package/lib/factories/factory-types.js +1 -1
- package/lib/factories/rdflib-data-factory.js +11 -9
- package/lib/fetcher.js +1646 -1385
- package/lib/formula.d.ts +1 -1
- package/lib/formula.js +739 -632
- package/lib/index.d.ts +1 -2
- package/lib/index.js +88 -70
- package/lib/jsonldparser.js +35 -19
- package/lib/jsonparser.js +1 -1
- package/lib/lists.js +86 -54
- package/lib/literal.js +156 -120
- package/lib/log.js +7 -7
- package/lib/n3parser.js +1089 -1010
- package/lib/named-node.js +98 -69
- package/lib/namespace.js +4 -2
- package/lib/node-internal.js +96 -73
- package/lib/node.js +1 -1
- package/lib/parse.js +6 -5
- package/lib/patch-parser.js +1 -1
- package/lib/query.js +18 -19
- package/lib/rdfaparser.js +848 -783
- package/lib/rdfxmlparser.js +366 -350
- package/lib/serialize.d.ts +1 -1
- package/lib/serialize.js +4 -13
- package/lib/serializer.d.ts +1 -0
- package/lib/serializer.js +890 -825
- package/lib/statement.js +74 -54
- package/lib/store.d.ts +1 -1
- package/lib/store.js +926 -844
- package/lib/types.js +21 -21
- package/lib/update-manager.d.ts +1 -1
- package/lib/update-manager.js +959 -865
- package/lib/updates-via.js +134 -105
- package/lib/uri.js +3 -3
- package/lib/utils/default-graph-uri.js +2 -2
- package/lib/utils/terms.js +6 -4
- package/lib/utils-js.js +9 -8
- package/lib/utils.js +6 -6
- package/lib/variable.js +60 -34
- package/lib/xsd.js +2 -2
- package/package.json +9 -8
- package/src/index.ts +0 -2
- package/src/jsonldparser.js +13 -4
- package/src/serialize.ts +4 -11
- package/src/serializer.js +24 -0
- package/src/update-manager.ts +8 -2
- package/esm/convert.js +0 -60
- package/lib/convert.d.ts +0 -2
- package/lib/convert.js +0 -71
- package/src/convert.js +0 -70
package/esm/updates-via.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
1
3
|
/*
|
|
2
4
|
* Updates-Via
|
|
3
5
|
*/
|
|
4
6
|
import DataFactory from './factories/rdflib-data-factory';
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
+
export var UpdatesSocket = /*#__PURE__*/function () {
|
|
8
|
+
function UpdatesSocket(parent, via) {
|
|
9
|
+
_classCallCheck(this, UpdatesSocket);
|
|
7
10
|
this.parent = parent;
|
|
8
11
|
this.via = via;
|
|
9
12
|
this.connected = false;
|
|
@@ -20,121 +23,148 @@ export class UpdatesSocket {
|
|
|
20
23
|
this.onError(error);
|
|
21
24
|
}
|
|
22
25
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
ref =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
_createClass(UpdatesSocket, [{
|
|
27
|
+
key: "_decode",
|
|
28
|
+
value: function _decode(q) {
|
|
29
|
+
var elt;
|
|
30
|
+
var i;
|
|
31
|
+
var k;
|
|
32
|
+
var r;
|
|
33
|
+
var ref;
|
|
34
|
+
var ref1;
|
|
35
|
+
var v;
|
|
36
|
+
r = {};
|
|
37
|
+
ref = function () {
|
|
38
|
+
var j, len, ref, results;
|
|
39
|
+
ref = q.split('&');
|
|
40
|
+
results = [];
|
|
41
|
+
for (j = 0, len = ref.length; j < len; j++) {
|
|
42
|
+
elt = ref[j];
|
|
43
|
+
results.push(elt.split('='));
|
|
44
|
+
}
|
|
45
|
+
return results;
|
|
46
|
+
}();
|
|
47
|
+
for (i in ref) {
|
|
48
|
+
elt = ref[i];
|
|
49
|
+
ref1 = [decodeURIComponent(elt[0]), decodeURIComponent(elt[1])];
|
|
50
|
+
k = ref1[0];
|
|
51
|
+
v = ref1[1];
|
|
52
|
+
if (r[k] == null) {
|
|
53
|
+
r[k] = [];
|
|
54
|
+
}
|
|
55
|
+
r[k].push(v);
|
|
39
56
|
}
|
|
40
|
-
return
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
return r;
|
|
58
|
+
}
|
|
59
|
+
}, {
|
|
60
|
+
key: "_send",
|
|
61
|
+
value: function _send(method, uri, data) {
|
|
62
|
+
var base, message;
|
|
63
|
+
message = [method, uri, data].join(' ');
|
|
64
|
+
return typeof (base = this.socket).send === 'function' ? base.send(message) : void 0;
|
|
65
|
+
}
|
|
66
|
+
}, {
|
|
67
|
+
key: "_subscribe",
|
|
68
|
+
value: function _subscribe(uri) {
|
|
69
|
+
this._send('sub', uri, '');
|
|
70
|
+
this.subscribed[uri] = true;
|
|
71
|
+
return this.subscribed[uri];
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
key: "onClose",
|
|
75
|
+
value: function onClose(e) {
|
|
76
|
+
var uri;
|
|
77
|
+
this.connected = false;
|
|
78
|
+
for (uri in this.subscribed) {
|
|
79
|
+
this.pending[uri] = true;
|
|
49
80
|
}
|
|
50
|
-
|
|
81
|
+
this.subscribed = {};
|
|
82
|
+
return this.subscribed;
|
|
51
83
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
message = [method, uri, data].join(' ');
|
|
57
|
-
return typeof (base = this.socket).send === 'function' ? base.send(message) : void 0;
|
|
58
|
-
}
|
|
59
|
-
_subscribe(uri) {
|
|
60
|
-
this._send('sub', uri, '');
|
|
61
|
-
this.subscribed[uri] = true;
|
|
62
|
-
return this.subscribed[uri];
|
|
63
|
-
}
|
|
64
|
-
onClose(e) {
|
|
65
|
-
var uri;
|
|
66
|
-
this.connected = false;
|
|
67
|
-
for (uri in this.subscribed) {
|
|
68
|
-
this.pending[uri] = true;
|
|
84
|
+
}, {
|
|
85
|
+
key: "onError",
|
|
86
|
+
value: function onError(e) {
|
|
87
|
+
throw new Error('onError' + e);
|
|
69
88
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return typeof (base = this.socket).send === 'function' ? base.send('pong ' + message.slice(1).join(' ')) : void 0;
|
|
81
|
-
} else if (message[0] === 'pub') {
|
|
82
|
-
return this.parent.onUpdate(message[1], this._decode(message[2]));
|
|
89
|
+
}, {
|
|
90
|
+
key: "onMessage",
|
|
91
|
+
value: function onMessage(e) {
|
|
92
|
+
var base, message;
|
|
93
|
+
message = e.data.split(' ');
|
|
94
|
+
if (message[0] === 'ping') {
|
|
95
|
+
return typeof (base = this.socket).send === 'function' ? base.send('pong ' + message.slice(1).join(' ')) : void 0;
|
|
96
|
+
} else if (message[0] === 'pub') {
|
|
97
|
+
return this.parent.onUpdate(message[1], this._decode(message[2]));
|
|
98
|
+
}
|
|
83
99
|
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
100
|
+
}, {
|
|
101
|
+
key: "onOpen",
|
|
102
|
+
value: function onOpen(e) {
|
|
103
|
+
var results, uri;
|
|
104
|
+
this.connected = true;
|
|
105
|
+
results = [];
|
|
106
|
+
for (uri in this.pending) {
|
|
107
|
+
delete this.pending[uri];
|
|
108
|
+
results.push(this._subscribe(uri));
|
|
109
|
+
}
|
|
110
|
+
return results;
|
|
92
111
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
112
|
+
}, {
|
|
113
|
+
key: "subscribe",
|
|
114
|
+
value: function subscribe(uri) {
|
|
115
|
+
if (this.connected) {
|
|
116
|
+
return this._subscribe(uri);
|
|
117
|
+
} else {
|
|
118
|
+
this.pending[uri] = true;
|
|
119
|
+
return this.pending[uri];
|
|
120
|
+
}
|
|
101
121
|
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
122
|
+
}]);
|
|
123
|
+
return UpdatesSocket;
|
|
124
|
+
}();
|
|
125
|
+
export var UpdatesVia = /*#__PURE__*/function () {
|
|
126
|
+
function UpdatesVia(fetcher) {
|
|
127
|
+
_classCallCheck(this, UpdatesVia);
|
|
106
128
|
this.fetcher = fetcher;
|
|
107
129
|
this.graph = {};
|
|
108
130
|
this.via = {};
|
|
109
131
|
this.fetcher.addCallback('headers', this.onHeaders);
|
|
110
132
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
133
|
+
_createClass(UpdatesVia, [{
|
|
134
|
+
key: "onHeaders",
|
|
135
|
+
value: function onHeaders(d) {
|
|
136
|
+
var etag, uri, via;
|
|
137
|
+
if (d.headers == null) {
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
if (typeof WebSocket === 'undefined' || WebSocket === null) {
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
etag = d.headers['etag'];
|
|
144
|
+
via = d.headers['updates-via'];
|
|
145
|
+
uri = d.uri;
|
|
146
|
+
if (etag && via) {
|
|
147
|
+
this.graph[uri] = {
|
|
148
|
+
etag: etag,
|
|
149
|
+
via: via
|
|
150
|
+
};
|
|
151
|
+
this.register(via, uri);
|
|
152
|
+
}
|
|
117
153
|
return true;
|
|
118
154
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
uri
|
|
122
|
-
|
|
123
|
-
this.graph[uri] = {
|
|
124
|
-
etag: etag,
|
|
125
|
-
via: via
|
|
126
|
-
};
|
|
127
|
-
this.register(via, uri);
|
|
155
|
+
}, {
|
|
156
|
+
key: "onUpdate",
|
|
157
|
+
value: function onUpdate(uri, d) {
|
|
158
|
+
return this.fetcher.refresh(DataFactory.namedNode(uri));
|
|
128
159
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
this.via[via] = new UpdatesSocket(this, via);
|
|
160
|
+
}, {
|
|
161
|
+
key: "register",
|
|
162
|
+
value: function register(via, uri) {
|
|
163
|
+
if (this.via[via] == null) {
|
|
164
|
+
this.via[via] = new UpdatesSocket(this, via);
|
|
165
|
+
}
|
|
166
|
+
return this.via[via].subscribe(uri);
|
|
137
167
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
168
|
+
}]);
|
|
169
|
+
return UpdatesVia;
|
|
170
|
+
}();
|
package/esm/uri.js
CHANGED
|
@@ -124,7 +124,7 @@ export function join(given, base) {
|
|
|
124
124
|
* @param uri The URI
|
|
125
125
|
*/
|
|
126
126
|
export function protocol(uri) {
|
|
127
|
-
|
|
127
|
+
var i = uri.indexOf(':');
|
|
128
128
|
if (i < 0) {
|
|
129
129
|
return null;
|
|
130
130
|
} else {
|
|
@@ -147,8 +147,8 @@ export function refTo(base, uri) {
|
|
|
147
147
|
return '';
|
|
148
148
|
}
|
|
149
149
|
for (i = o = 0, len = uri.length; o < len; i = ++o) {
|
|
150
|
-
|
|
151
|
-
if (
|
|
150
|
+
var _c = uri[i];
|
|
151
|
+
if (_c !== base[i]) {
|
|
152
152
|
break;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Prevents circular dependencies between data-factory-internal and statement
|
|
2
2
|
|
|
3
3
|
import NamedNode from '../named-node';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export var defaultGraphURI = 'chrome:theSession';
|
|
5
|
+
export var defaultGraphNode = new NamedNode(defaultGraphURI);
|
package/esm/utils/terms.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
1
2
|
import { CollectionTermType, NamedNodeTermType, VariableTermType, BlankNodeTermType, LiteralTermType, GraphTermType, DefaultGraphTermType } from '../types';
|
|
2
3
|
/** TypeGuard for RDFLib Statements */
|
|
3
4
|
export function isStatement(obj) {
|
|
4
|
-
return
|
|
5
|
+
return _typeof(obj) === 'object' && obj !== null && 'subject' in obj;
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
/** TypeGuard for RDFlib Stores */
|
|
8
9
|
export function isStore(obj) {
|
|
9
|
-
return
|
|
10
|
+
return _typeof(obj) === 'object' && obj !== null && 'statements' in obj;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
/** TypeGuard for RDFLib Collections */
|
|
@@ -37,7 +38,7 @@ export function isVariable(obj) {
|
|
|
37
38
|
|
|
38
39
|
/** TypeGuard for RDF/JS spec Terms */
|
|
39
40
|
export function isTerm(obj) {
|
|
40
|
-
return
|
|
41
|
+
return _typeof(obj) === 'object' && obj !== null && 'termType' in obj;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
/** TypeGuard for RDF/JS spec Literals */
|
|
@@ -47,7 +48,7 @@ export function isLiteral(value) {
|
|
|
47
48
|
|
|
48
49
|
/** TypeGuard for RDF/JS spec Quads */
|
|
49
50
|
export function isQuad(obj) {
|
|
50
|
-
return
|
|
51
|
+
return _typeof(obj) === "object" && obj !== null && 'subject' in obj && 'predicate' in obj && 'object' in obj;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
/** TypeGuard for RDF/JS spec NamedNodes */
|
package/esm/utils-js.js
CHANGED
|
@@ -6,7 +6,7 @@ import { docpart } from './uri';
|
|
|
6
6
|
import log from './log';
|
|
7
7
|
import * as uri from './uri';
|
|
8
8
|
import NamedNode from './named-node';
|
|
9
|
-
|
|
9
|
+
var string = {
|
|
10
10
|
template: stringTemplate
|
|
11
11
|
};
|
|
12
12
|
export { log, uri, string };
|
|
@@ -56,7 +56,7 @@ export function callbackify(obj, callbacks) {
|
|
|
56
56
|
var replaceCallbacks = [];
|
|
57
57
|
var len = obj.callbacks[hook].length;
|
|
58
58
|
var x;
|
|
59
|
-
|
|
59
|
+
var callback;
|
|
60
60
|
|
|
61
61
|
// log.info('!@$ Firing '+hook+' call back with length'+len)
|
|
62
62
|
for (x = len - 1; x >= 0; x--) {
|
|
@@ -182,10 +182,10 @@ export function dtstamp() {
|
|
|
182
182
|
* Compares statements (heavy comparison for repeatable canonical ordering)
|
|
183
183
|
*/
|
|
184
184
|
export function heavyCompare(x, y, g, uriMap) {
|
|
185
|
-
var nonBlank = function (x) {
|
|
185
|
+
var nonBlank = function nonBlank(x) {
|
|
186
186
|
return x.termType === 'BlankNode' ? null : x;
|
|
187
187
|
};
|
|
188
|
-
var signature = function (x) {
|
|
188
|
+
var signature = function signature(x) {
|
|
189
189
|
var lis = g.statementsMatching(x).map(function (st) {
|
|
190
190
|
return '' + nonBlank(st.subject) + ' ' + nonBlank(st.predicate) + ' ' + nonBlank(st.object);
|
|
191
191
|
}).concat(g.statementsMatching(undefined, undefined, x).map(function (st) {
|
|
@@ -194,7 +194,7 @@ export function heavyCompare(x, y, g, uriMap) {
|
|
|
194
194
|
lis.sort();
|
|
195
195
|
return lis.join('\n');
|
|
196
196
|
};
|
|
197
|
-
|
|
197
|
+
var comparison = Object.prototype.hasOwnProperty.call(g, "compareTerms") ? g.compareTerms(x, y) : x.compareTerm(y);
|
|
198
198
|
if (x.termType === 'BlankNode' && y.termType === 'BlankNode') {
|
|
199
199
|
if (comparison === 0) return 0; // Same
|
|
200
200
|
if (signature(x) > signature(y)) return +1;
|
package/esm/utils.js
CHANGED
|
@@ -50,8 +50,8 @@ export function AJAR_handleNewTerm(kb, p, requestedBy) {
|
|
|
50
50
|
referringTerm: requestedBy
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
export
|
|
54
|
-
|
|
53
|
+
export var appliedFactoryMethods = ['blankNode', 'defaultGraph', 'literal', 'namedNode', 'quad', 'variable', 'supports'];
|
|
54
|
+
var rdf = {
|
|
55
55
|
first: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first',
|
|
56
56
|
rest: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest',
|
|
57
57
|
nil: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'
|
|
@@ -65,10 +65,10 @@ const rdf = {
|
|
|
65
65
|
* @return The {data} as a set of statements.
|
|
66
66
|
*/
|
|
67
67
|
export function arrayToStatements(rdfFactory, subject, data) {
|
|
68
|
-
|
|
69
|
-
data.reduce((id, _listObj, i, listData)
|
|
68
|
+
var statements = [];
|
|
69
|
+
data.reduce(function (id, _listObj, i, listData) {
|
|
70
70
|
statements.push(rdfFactory.quad(id, rdfFactory.namedNode(rdf.first), listData[i]));
|
|
71
|
-
|
|
71
|
+
var nextNode;
|
|
72
72
|
if (i < listData.length - 1) {
|
|
73
73
|
nextNode = rdfFactory.blankNode();
|
|
74
74
|
statements.push(rdfFactory.quad(id, rdfFactory.namedNode(rdf.rest), nextNode));
|
|
@@ -80,7 +80,7 @@ export function arrayToStatements(rdfFactory, subject, data) {
|
|
|
80
80
|
return statements;
|
|
81
81
|
}
|
|
82
82
|
export function ArrayIndexOf(arr, item) {
|
|
83
|
-
|
|
83
|
+
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
84
84
|
var length = arr.length;
|
|
85
85
|
if (i < 0) i = length + i;
|
|
86
86
|
for (; i < length; i++) {
|
package/esm/variable.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
1
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
+
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; } }
|
|
2
10
|
import ClassOrder from './class-order';
|
|
3
11
|
import Node from './node-internal';
|
|
4
12
|
import { VariableTermType } from './types';
|
|
@@ -10,7 +18,9 @@ import * as Uri from './uri';
|
|
|
10
18
|
* a common special base URI for variables. Their names are uris,
|
|
11
19
|
* but the ? notation has an implicit base uri of 'varid:'
|
|
12
20
|
*/
|
|
13
|
-
|
|
21
|
+
var Variable = /*#__PURE__*/function (_Node) {
|
|
22
|
+
_inherits(Variable, _Node);
|
|
23
|
+
var _super = _createSuper(Variable);
|
|
14
24
|
/** The base string for a variable's name */
|
|
15
25
|
|
|
16
26
|
/** The unique identifier of this variable */
|
|
@@ -19,37 +29,53 @@ export default class Variable extends Node {
|
|
|
19
29
|
* Initializes this variable
|
|
20
30
|
* @param name The variable's name
|
|
21
31
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
_defineProperty(
|
|
28
|
-
_defineProperty(
|
|
29
|
-
_defineProperty(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
function Variable() {
|
|
33
|
+
var _this;
|
|
34
|
+
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
35
|
+
_classCallCheck(this, Variable);
|
|
36
|
+
_this = _super.call(this, name);
|
|
37
|
+
_defineProperty(_assertThisInitialized(_this), "termType", VariableTermType);
|
|
38
|
+
_defineProperty(_assertThisInitialized(_this), "base", 'varid:');
|
|
39
|
+
_defineProperty(_assertThisInitialized(_this), "classOrder", ClassOrder.Variable);
|
|
40
|
+
_defineProperty(_assertThisInitialized(_this), "isVar", 1);
|
|
41
|
+
_defineProperty(_assertThisInitialized(_this), "uri", void 0);
|
|
42
|
+
_this.base = 'varid:';
|
|
43
|
+
_this.uri = Uri.join(name, _this.base);
|
|
44
|
+
return _this;
|
|
32
45
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
46
|
+
_createClass(Variable, [{
|
|
47
|
+
key: "equals",
|
|
48
|
+
value: function equals(other) {
|
|
49
|
+
if (!other) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return this.termType === other.termType && this.value === other.value;
|
|
36
53
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
substitute(bindings) {
|
|
43
|
-
var ref;
|
|
44
|
-
return (ref = bindings[this.toNT()]) != null ? ref : this;
|
|
45
|
-
}
|
|
46
|
-
toString() {
|
|
47
|
-
return Variable.toString(this);
|
|
48
|
-
}
|
|
49
|
-
static toString(variable) {
|
|
50
|
-
if (variable.uri.slice(0, variable.base.length) === variable.base) {
|
|
51
|
-
return `?${variable.uri.slice(variable.base.length)}`;
|
|
54
|
+
}, {
|
|
55
|
+
key: "hashString",
|
|
56
|
+
value: function hashString() {
|
|
57
|
+
return this.toString();
|
|
52
58
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
}, {
|
|
60
|
+
key: "substitute",
|
|
61
|
+
value: function substitute(bindings) {
|
|
62
|
+
var ref;
|
|
63
|
+
return (ref = bindings[this.toNT()]) != null ? ref : this;
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
key: "toString",
|
|
67
|
+
value: function toString() {
|
|
68
|
+
return Variable.toString(this);
|
|
69
|
+
}
|
|
70
|
+
}], [{
|
|
71
|
+
key: "toString",
|
|
72
|
+
value: function toString(variable) {
|
|
73
|
+
if (variable.uri.slice(0, variable.base.length) === variable.base) {
|
|
74
|
+
return "?".concat(variable.uri.slice(variable.base.length));
|
|
75
|
+
}
|
|
76
|
+
return "?".concat(variable.uri);
|
|
77
|
+
}
|
|
78
|
+
}]);
|
|
79
|
+
return Variable;
|
|
80
|
+
}(Node);
|
|
81
|
+
export { Variable as default };
|
package/esm/xsd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import CanonicalDataFactory from "./factories/canonical-data-factory";
|
|
2
2
|
export function createXSD() {
|
|
3
|
-
|
|
3
|
+
var localFactory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : CanonicalDataFactory;
|
|
4
4
|
return {
|
|
5
5
|
boolean: localFactory.namedNode("http://www.w3.org/2001/XMLSchema#boolean"),
|
|
6
6
|
dateTime: localFactory.namedNode("http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
@@ -11,5 +11,5 @@ export function createXSD() {
|
|
|
11
11
|
string: localFactory.namedNode("http://www.w3.org/2001/XMLSchema#string")
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
var defaultXSD = createXSD(CanonicalDataFactory);
|
|
15
15
|
export default defaultXSD;
|