@pod-os/core 0.25.0-rc.4b3fb8a.0 → 0.25.0-rc.9c6fff0.0
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/{chunk-S4UXBIES.js → chunk-SCBWPWX6.js} +8817 -8795
- package/dist/{dist-O5YU2L4C.js → dist-PQRMDIKY.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/{jsonld-X74JI4TL.js → jsonld-V2RB47OZ.js} +464 -539
- package/lib/index.js +9085 -9140
- package/package.json +8 -8
|
@@ -11,9 +11,9 @@ var require_IdentifierIssuer = __commonJS({
|
|
|
11
11
|
* Creates a new IdentifierIssuer. A IdentifierIssuer issues unique
|
|
12
12
|
* identifiers, keeping track of any previously issued identifiers.
|
|
13
13
|
*
|
|
14
|
-
* @param prefix
|
|
15
|
-
* @param existing
|
|
16
|
-
* @param counter
|
|
14
|
+
* @param {string} prefix - The prefix to use ('<prefix><counter>').
|
|
15
|
+
* @param {Map} [existing] - An existing Map to use.
|
|
16
|
+
* @param {number} [counter] - The counter to use.
|
|
17
17
|
*/
|
|
18
18
|
constructor(prefix, existing = /* @__PURE__ */ new Map(), counter = 0) {
|
|
19
19
|
this.prefix = prefix;
|
|
@@ -23,7 +23,7 @@ var require_IdentifierIssuer = __commonJS({
|
|
|
23
23
|
/**
|
|
24
24
|
* Copies this IdentifierIssuer.
|
|
25
25
|
*
|
|
26
|
-
* @
|
|
26
|
+
* @returns {object} - A copy of this IdentifierIssuer.
|
|
27
27
|
*/
|
|
28
28
|
clone() {
|
|
29
29
|
const { prefix, _existing, counter } = this;
|
|
@@ -33,9 +33,9 @@ var require_IdentifierIssuer = __commonJS({
|
|
|
33
33
|
* Gets the new identifier for the given old identifier, where if no old
|
|
34
34
|
* identifier is given a new identifier will be generated.
|
|
35
35
|
*
|
|
36
|
-
* @param [old]
|
|
36
|
+
* @param {string} [old] - The old identifier to get the new identifier for.
|
|
37
37
|
*
|
|
38
|
-
* @
|
|
38
|
+
* @returns {string} - The new identifier.
|
|
39
39
|
*/
|
|
40
40
|
getId(old) {
|
|
41
41
|
const existing = old && this._existing.get(old);
|
|
@@ -53,10 +53,10 @@ var require_IdentifierIssuer = __commonJS({
|
|
|
53
53
|
* Returns true if the given old identifer has already been assigned a new
|
|
54
54
|
* identifier.
|
|
55
55
|
*
|
|
56
|
-
* @param old
|
|
56
|
+
* @param {string} old - The old identifier to check.
|
|
57
57
|
*
|
|
58
|
-
* @
|
|
59
|
-
* false if not.
|
|
58
|
+
* @returns {boolean} - True if the old identifier has been assigned a new
|
|
59
|
+
* identifier, false if not.
|
|
60
60
|
*/
|
|
61
61
|
hasId(old) {
|
|
62
62
|
return this._existing.has(old);
|
|
@@ -65,7 +65,8 @@ var require_IdentifierIssuer = __commonJS({
|
|
|
65
65
|
* Returns all of the IDs that have been issued new IDs in the order in
|
|
66
66
|
* which they were issued new IDs.
|
|
67
67
|
*
|
|
68
|
-
* @
|
|
68
|
+
* @returns {Array} - The list of old IDs that has been issued new IDs in
|
|
69
|
+
* order.
|
|
69
70
|
*/
|
|
70
71
|
getOldIds() {
|
|
71
72
|
return [...this._existing.keys()];
|
|
@@ -222,29 +223,58 @@ var require_setImmediate = __commonJS({
|
|
|
222
223
|
}
|
|
223
224
|
});
|
|
224
225
|
|
|
225
|
-
// ../node_modules/rdf-canonize/lib/
|
|
226
|
-
var
|
|
227
|
-
"../node_modules/rdf-canonize/lib/
|
|
226
|
+
// ../node_modules/rdf-canonize/lib/platform-browser.js
|
|
227
|
+
var require_platform_browser = __commonJS({
|
|
228
|
+
"../node_modules/rdf-canonize/lib/platform-browser.js"(exports) {
|
|
228
229
|
"use strict";
|
|
229
230
|
require_setImmediate();
|
|
230
|
-
|
|
231
|
+
exports.setImmediate = setImmediate;
|
|
232
|
+
exports.crypto = globalThis.crypto;
|
|
233
|
+
var byteToHex = [];
|
|
234
|
+
for (let n = 0; n <= 255; ++n) {
|
|
235
|
+
byteToHex.push(n.toString(16).padStart(2, "0"));
|
|
236
|
+
}
|
|
237
|
+
exports.bufferToHex = function bufferToHex(buffer) {
|
|
238
|
+
let hex = "";
|
|
239
|
+
const bytes = new Uint8Array(buffer);
|
|
240
|
+
for (let i = 0; i < bytes.length; ++i) {
|
|
241
|
+
hex += byteToHex[bytes[i]];
|
|
242
|
+
}
|
|
243
|
+
return hex;
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
// ../node_modules/rdf-canonize/lib/MessageDigest-webcrypto.js
|
|
249
|
+
var require_MessageDigest_webcrypto = __commonJS({
|
|
250
|
+
"../node_modules/rdf-canonize/lib/MessageDigest-webcrypto.js"(exports, module) {
|
|
251
|
+
"use strict";
|
|
252
|
+
var { bufferToHex, crypto } = require_platform_browser();
|
|
253
|
+
var algorithmMap = /* @__PURE__ */ new Map([
|
|
254
|
+
["sha256", "SHA-256"],
|
|
255
|
+
["SHA256", "SHA-256"],
|
|
256
|
+
["SHA-256", "SHA-256"],
|
|
257
|
+
["sha384", "SHA-384"],
|
|
258
|
+
["SHA384", "SHA-384"],
|
|
259
|
+
["SHA-384", "SHA-384"],
|
|
260
|
+
["sha512", "SHA-512"],
|
|
261
|
+
["SHA512", "SHA-512"],
|
|
262
|
+
["SHA-512", "SHA-512"]
|
|
263
|
+
]);
|
|
231
264
|
module.exports = class MessageDigest {
|
|
232
265
|
/**
|
|
233
|
-
* Creates a new MessageDigest.
|
|
266
|
+
* Creates a new WebCrypto API MessageDigest.
|
|
234
267
|
*
|
|
235
|
-
* @param algorithm
|
|
268
|
+
* @param {string} algorithm - The algorithm to use.
|
|
236
269
|
*/
|
|
237
270
|
constructor(algorithm) {
|
|
238
271
|
if (!(crypto && crypto.subtle)) {
|
|
239
272
|
throw new Error("crypto.subtle not found.");
|
|
240
273
|
}
|
|
241
|
-
if (algorithm
|
|
242
|
-
this.algorithm = { name: "SHA-256" };
|
|
243
|
-
} else if (algorithm === "sha1") {
|
|
244
|
-
this.algorithm = { name: "SHA-1" };
|
|
245
|
-
} else {
|
|
274
|
+
if (!algorithmMap.has(algorithm)) {
|
|
246
275
|
throw new Error(`Unsupported algorithm "${algorithm}".`);
|
|
247
276
|
}
|
|
277
|
+
this.algorithm = algorithmMap.get(algorithm);
|
|
248
278
|
this._content = "";
|
|
249
279
|
}
|
|
250
280
|
update(msg) {
|
|
@@ -252,14 +282,8 @@ var require_MessageDigest_browser = __commonJS({
|
|
|
252
282
|
}
|
|
253
283
|
async digest() {
|
|
254
284
|
const data = new TextEncoder().encode(this._content);
|
|
255
|
-
const buffer =
|
|
256
|
-
|
|
257
|
-
);
|
|
258
|
-
let hex = "";
|
|
259
|
-
for (let i = 0; i < buffer.length; ++i) {
|
|
260
|
-
hex += buffer[i].toString(16).padStart(2, "0");
|
|
261
|
-
}
|
|
262
|
-
return hex;
|
|
285
|
+
const buffer = await crypto.subtle.digest(this.algorithm, data);
|
|
286
|
+
return bufferToHex(buffer);
|
|
263
287
|
}
|
|
264
288
|
};
|
|
265
289
|
}
|
|
@@ -274,7 +298,7 @@ var require_Permuter = __commonJS({
|
|
|
274
298
|
* A Permuter iterates over all possible permutations of the given array
|
|
275
299
|
* of elements.
|
|
276
300
|
*
|
|
277
|
-
* @param list
|
|
301
|
+
* @param {Array} list - The array of elements to iterate over.
|
|
278
302
|
*/
|
|
279
303
|
constructor(list) {
|
|
280
304
|
this.current = list.sort();
|
|
@@ -287,7 +311,7 @@ var require_Permuter = __commonJS({
|
|
|
287
311
|
/**
|
|
288
312
|
* Returns true if there is another permutation.
|
|
289
313
|
*
|
|
290
|
-
* @
|
|
314
|
+
* @returns {boolean} - True if there is another permutation, false if not.
|
|
291
315
|
*/
|
|
292
316
|
hasNext() {
|
|
293
317
|
return !this.done;
|
|
@@ -296,7 +320,7 @@ var require_Permuter = __commonJS({
|
|
|
296
320
|
* Gets the next permutation. Call hasNext() to ensure there is another one
|
|
297
321
|
* first.
|
|
298
322
|
*
|
|
299
|
-
* @
|
|
323
|
+
* @returns {any} - The next permutation.
|
|
300
324
|
*/
|
|
301
325
|
next() {
|
|
302
326
|
const { current, dir } = this;
|
|
@@ -343,22 +367,24 @@ var require_NQuads = __commonJS({
|
|
|
343
367
|
var TYPE_DEFAULT_GRAPH = "DefaultGraph";
|
|
344
368
|
var REGEX = {};
|
|
345
369
|
(() => {
|
|
346
|
-
const iri = "(?:<([^:]+:[^>]*)>)";
|
|
347
370
|
const PN_CHARS_BASE = "A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD";
|
|
348
371
|
const PN_CHARS_U = PN_CHARS_BASE + "_";
|
|
349
372
|
const PN_CHARS = PN_CHARS_U + "0-9-\xB7\u0300-\u036F\u203F-\u2040";
|
|
350
|
-
const BLANK_NODE_LABEL = "
|
|
373
|
+
const BLANK_NODE_LABEL = "_:((?:[" + PN_CHARS_U + "0-9])(?:(?:[" + PN_CHARS + ".])*(?:[" + PN_CHARS + "]))?)";
|
|
374
|
+
const UCHAR4 = "\\\\u[0-9A-Fa-f]{4}";
|
|
375
|
+
const UCHAR8 = "\\\\U[0-9A-Fa-f]{8}";
|
|
376
|
+
const IRI = '(?:<((?:[^\0- <>"{}|^`\\\\]|' + UCHAR4 + "|" + UCHAR8 + ")*)>)";
|
|
351
377
|
const bnode = BLANK_NODE_LABEL;
|
|
352
378
|
const plain = '"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"';
|
|
353
|
-
const datatype = "(?:\\^\\^" +
|
|
379
|
+
const datatype = "(?:\\^\\^" + IRI + ")";
|
|
354
380
|
const language = "(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*))";
|
|
355
381
|
const literal = "(?:" + plain + "(?:" + datatype + "|" + language + ")?)";
|
|
356
382
|
const ws = "[ \\t]+";
|
|
357
383
|
const wso = "[ \\t]*";
|
|
358
|
-
const subject = "(?:" +
|
|
359
|
-
const property =
|
|
360
|
-
const object = "(?:" +
|
|
361
|
-
const graphName = "(?:\\.|(?:(?:" +
|
|
384
|
+
const subject = "(?:" + IRI + "|" + bnode + ")" + ws;
|
|
385
|
+
const property = IRI + ws;
|
|
386
|
+
const object = "(?:" + IRI + "|" + bnode + "|" + literal + ")" + wso;
|
|
387
|
+
const graphName = "(?:\\.|(?:(?:" + IRI + "|" + bnode + ")" + wso + "\\.))";
|
|
362
388
|
REGEX.eoln = /(?:\r\n)|(?:\n)|(?:\r)/g;
|
|
363
389
|
REGEX.empty = new RegExp("^" + wso + "$");
|
|
364
390
|
REGEX.quad = new RegExp(
|
|
@@ -369,9 +395,10 @@ var require_NQuads = __commonJS({
|
|
|
369
395
|
/**
|
|
370
396
|
* Parses RDF in the form of N-Quads.
|
|
371
397
|
*
|
|
372
|
-
* @param input
|
|
398
|
+
* @param {string} input - The N-Quads input to parse.
|
|
373
399
|
*
|
|
374
|
-
* @
|
|
400
|
+
* @returns {Array} - An RDF dataset (an array of quads per
|
|
401
|
+
* https://rdf.js.org/).
|
|
375
402
|
*/
|
|
376
403
|
static parse(input) {
|
|
377
404
|
const dataset = [];
|
|
@@ -389,15 +416,30 @@ var require_NQuads = __commonJS({
|
|
|
389
416
|
}
|
|
390
417
|
const quad = { subject: null, predicate: null, object: null, graph: null };
|
|
391
418
|
if (match[1] !== void 0) {
|
|
392
|
-
quad.subject = {
|
|
419
|
+
quad.subject = {
|
|
420
|
+
termType: TYPE_NAMED_NODE,
|
|
421
|
+
value: _iriUnescape(match[1])
|
|
422
|
+
};
|
|
393
423
|
} else {
|
|
394
|
-
quad.subject = {
|
|
424
|
+
quad.subject = {
|
|
425
|
+
termType: TYPE_BLANK_NODE,
|
|
426
|
+
value: match[2]
|
|
427
|
+
};
|
|
395
428
|
}
|
|
396
|
-
quad.predicate = {
|
|
429
|
+
quad.predicate = {
|
|
430
|
+
termType: TYPE_NAMED_NODE,
|
|
431
|
+
value: _iriUnescape(match[3])
|
|
432
|
+
};
|
|
397
433
|
if (match[4] !== void 0) {
|
|
398
|
-
quad.object = {
|
|
434
|
+
quad.object = {
|
|
435
|
+
termType: TYPE_NAMED_NODE,
|
|
436
|
+
value: _iriUnescape(match[4])
|
|
437
|
+
};
|
|
399
438
|
} else if (match[5] !== void 0) {
|
|
400
|
-
quad.object = {
|
|
439
|
+
quad.object = {
|
|
440
|
+
termType: TYPE_BLANK_NODE,
|
|
441
|
+
value: match[5]
|
|
442
|
+
};
|
|
401
443
|
} else {
|
|
402
444
|
quad.object = {
|
|
403
445
|
termType: TYPE_LITERAL,
|
|
@@ -407,19 +449,19 @@ var require_NQuads = __commonJS({
|
|
|
407
449
|
}
|
|
408
450
|
};
|
|
409
451
|
if (match[7] !== void 0) {
|
|
410
|
-
quad.object.datatype.value = match[7];
|
|
452
|
+
quad.object.datatype.value = _iriUnescape(match[7]);
|
|
411
453
|
} else if (match[8] !== void 0) {
|
|
412
454
|
quad.object.datatype.value = RDF_LANGSTRING;
|
|
413
455
|
quad.object.language = match[8];
|
|
414
456
|
} else {
|
|
415
457
|
quad.object.datatype.value = XSD_STRING;
|
|
416
458
|
}
|
|
417
|
-
quad.object.value =
|
|
459
|
+
quad.object.value = _stringLiteralUnescape(match[6]);
|
|
418
460
|
}
|
|
419
461
|
if (match[9] !== void 0) {
|
|
420
462
|
quad.graph = {
|
|
421
463
|
termType: TYPE_NAMED_NODE,
|
|
422
|
-
value: match[9]
|
|
464
|
+
value: _iriUnescape(match[9])
|
|
423
465
|
};
|
|
424
466
|
} else if (match[10] !== void 0) {
|
|
425
467
|
quad.graph = {
|
|
@@ -455,14 +497,11 @@ var require_NQuads = __commonJS({
|
|
|
455
497
|
/**
|
|
456
498
|
* Converts an RDF dataset to N-Quads.
|
|
457
499
|
*
|
|
458
|
-
* @param dataset
|
|
500
|
+
* @param {Array} dataset - The Array of quads RDF dataset to convert.
|
|
459
501
|
*
|
|
460
|
-
* @
|
|
502
|
+
* @returns {string} - The N-Quads string.
|
|
461
503
|
*/
|
|
462
504
|
static serialize(dataset) {
|
|
463
|
-
if (!Array.isArray(dataset)) {
|
|
464
|
-
dataset = NQuads.legacyDatasetToQuads(dataset);
|
|
465
|
-
}
|
|
466
505
|
const quads = [];
|
|
467
506
|
for (const quad of dataset) {
|
|
468
507
|
quads.push(NQuads.serializeQuad(quad));
|
|
@@ -472,39 +511,43 @@ var require_NQuads = __commonJS({
|
|
|
472
511
|
/**
|
|
473
512
|
* Converts RDF quad components to an N-Quad string (a single quad).
|
|
474
513
|
*
|
|
475
|
-
* @param {
|
|
476
|
-
* @param {
|
|
477
|
-
* @param {
|
|
478
|
-
* @param {
|
|
514
|
+
* @param {object} s - N-Quad subject component.
|
|
515
|
+
* @param {object} p - N-Quad predicate component.
|
|
516
|
+
* @param {object} o - N-Quad object component.
|
|
517
|
+
* @param {object} g - N-Quad graph component.
|
|
479
518
|
*
|
|
480
|
-
* @
|
|
519
|
+
* @returns {string} - The N-Quad.
|
|
481
520
|
*/
|
|
482
521
|
static serializeQuadComponents(s, p, o, g) {
|
|
483
522
|
let nquad = "";
|
|
484
523
|
if (s.termType === TYPE_NAMED_NODE) {
|
|
485
|
-
nquad += `<${s.value}>`;
|
|
524
|
+
nquad += `<${_iriEscape(s.value)}>`;
|
|
525
|
+
} else {
|
|
526
|
+
nquad += `_:${s.value}`;
|
|
527
|
+
}
|
|
528
|
+
if (p.termType === TYPE_NAMED_NODE) {
|
|
529
|
+
nquad += ` <${_iriEscape(p.value)}> `;
|
|
486
530
|
} else {
|
|
487
|
-
nquad +=
|
|
531
|
+
nquad += ` _:${p.value} `;
|
|
488
532
|
}
|
|
489
|
-
nquad += ` <${p.value}> `;
|
|
490
533
|
if (o.termType === TYPE_NAMED_NODE) {
|
|
491
|
-
nquad += `<${o.value}>`;
|
|
534
|
+
nquad += `<${_iriEscape(o.value)}>`;
|
|
492
535
|
} else if (o.termType === TYPE_BLANK_NODE) {
|
|
493
|
-
nquad += o.value
|
|
536
|
+
nquad += `_:${o.value}`;
|
|
494
537
|
} else {
|
|
495
|
-
nquad += `"${
|
|
538
|
+
nquad += `"${_stringLiteralEscape(o.value)}"`;
|
|
496
539
|
if (o.datatype.value === RDF_LANGSTRING) {
|
|
497
540
|
if (o.language) {
|
|
498
541
|
nquad += `@${o.language}`;
|
|
499
542
|
}
|
|
500
543
|
} else if (o.datatype.value !== XSD_STRING) {
|
|
501
|
-
nquad += `^^<${o.datatype.value}>`;
|
|
544
|
+
nquad += `^^<${_iriEscape(o.datatype.value)}>`;
|
|
502
545
|
}
|
|
503
546
|
}
|
|
504
547
|
if (g.termType === TYPE_NAMED_NODE) {
|
|
505
|
-
nquad += ` <${g.value}>`;
|
|
548
|
+
nquad += ` <${_iriEscape(g.value)}>`;
|
|
506
549
|
} else if (g.termType === TYPE_BLANK_NODE) {
|
|
507
|
-
nquad += `
|
|
550
|
+
nquad += ` _:${g.value}`;
|
|
508
551
|
}
|
|
509
552
|
nquad += " .\n";
|
|
510
553
|
return nquad;
|
|
@@ -512,9 +555,9 @@ var require_NQuads = __commonJS({
|
|
|
512
555
|
/**
|
|
513
556
|
* Converts an RDF quad to an N-Quad string (a single quad).
|
|
514
557
|
*
|
|
515
|
-
* @param quad
|
|
558
|
+
* @param {object} quad - The RDF quad convert.
|
|
516
559
|
*
|
|
517
|
-
* @
|
|
560
|
+
* @returns {string} - The N-Quad string.
|
|
518
561
|
*/
|
|
519
562
|
static serializeQuad(quad) {
|
|
520
563
|
return NQuads.serializeQuadComponents(
|
|
@@ -524,65 +567,6 @@ var require_NQuads = __commonJS({
|
|
|
524
567
|
quad.graph
|
|
525
568
|
);
|
|
526
569
|
}
|
|
527
|
-
/**
|
|
528
|
-
* Converts a legacy-formatted dataset to an array of quads dataset per
|
|
529
|
-
* http://rdf.js.org/.
|
|
530
|
-
*
|
|
531
|
-
* @param dataset the legacy dataset to convert.
|
|
532
|
-
*
|
|
533
|
-
* @return the array of quads dataset.
|
|
534
|
-
*/
|
|
535
|
-
static legacyDatasetToQuads(dataset) {
|
|
536
|
-
const quads = [];
|
|
537
|
-
const termTypeMap = {
|
|
538
|
-
"blank node": TYPE_BLANK_NODE,
|
|
539
|
-
IRI: TYPE_NAMED_NODE,
|
|
540
|
-
literal: TYPE_LITERAL
|
|
541
|
-
};
|
|
542
|
-
for (const graphName in dataset) {
|
|
543
|
-
const triples = dataset[graphName];
|
|
544
|
-
triples.forEach((triple) => {
|
|
545
|
-
const quad = {};
|
|
546
|
-
for (const componentName in triple) {
|
|
547
|
-
const oldComponent = triple[componentName];
|
|
548
|
-
const newComponent = {
|
|
549
|
-
termType: termTypeMap[oldComponent.type],
|
|
550
|
-
value: oldComponent.value
|
|
551
|
-
};
|
|
552
|
-
if (newComponent.termType === TYPE_LITERAL) {
|
|
553
|
-
newComponent.datatype = {
|
|
554
|
-
termType: TYPE_NAMED_NODE
|
|
555
|
-
};
|
|
556
|
-
if ("datatype" in oldComponent) {
|
|
557
|
-
newComponent.datatype.value = oldComponent.datatype;
|
|
558
|
-
}
|
|
559
|
-
if ("language" in oldComponent) {
|
|
560
|
-
if (!("datatype" in oldComponent)) {
|
|
561
|
-
newComponent.datatype.value = RDF_LANGSTRING;
|
|
562
|
-
}
|
|
563
|
-
newComponent.language = oldComponent.language;
|
|
564
|
-
} else if (!("datatype" in oldComponent)) {
|
|
565
|
-
newComponent.datatype.value = XSD_STRING;
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
quad[componentName] = newComponent;
|
|
569
|
-
}
|
|
570
|
-
if (graphName === "@default") {
|
|
571
|
-
quad.graph = {
|
|
572
|
-
termType: TYPE_DEFAULT_GRAPH,
|
|
573
|
-
value: ""
|
|
574
|
-
};
|
|
575
|
-
} else {
|
|
576
|
-
quad.graph = {
|
|
577
|
-
termType: graphName.startsWith("_:") ? TYPE_BLANK_NODE : TYPE_NAMED_NODE,
|
|
578
|
-
value: graphName
|
|
579
|
-
};
|
|
580
|
-
}
|
|
581
|
-
quads.push(quad);
|
|
582
|
-
});
|
|
583
|
-
}
|
|
584
|
-
return quads;
|
|
585
|
-
}
|
|
586
570
|
};
|
|
587
571
|
function _compareTriples(t1, t2) {
|
|
588
572
|
if (!(t1.subject.termType === t2.subject.termType && t1.object.termType === t2.object.termType)) {
|
|
@@ -596,36 +580,47 @@ var require_NQuads = __commonJS({
|
|
|
596
580
|
}
|
|
597
581
|
return t1.object.datatype.termType === t2.object.datatype.termType && t1.object.language === t2.object.language && t1.object.datatype.value === t2.object.datatype.value;
|
|
598
582
|
}
|
|
599
|
-
var
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
583
|
+
var _stringLiteralEscapeRegex = /[\u0000-\u001F\u007F"\\]/g;
|
|
584
|
+
var _stringLiteralEscapeMap = [];
|
|
585
|
+
for (let n = 0; n <= 127; ++n) {
|
|
586
|
+
if (_stringLiteralEscapeRegex.test(String.fromCharCode(n))) {
|
|
587
|
+
_stringLiteralEscapeMap[n] = "\\u" + n.toString(16).toUpperCase().padStart(4, "0");
|
|
588
|
+
_stringLiteralEscapeRegex.lastIndex = 0;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
_stringLiteralEscapeMap["\b".codePointAt(0)] = "\\b";
|
|
592
|
+
_stringLiteralEscapeMap[" ".codePointAt(0)] = "\\t";
|
|
593
|
+
_stringLiteralEscapeMap["\n".codePointAt(0)] = "\\n";
|
|
594
|
+
_stringLiteralEscapeMap["\f".codePointAt(0)] = "\\f";
|
|
595
|
+
_stringLiteralEscapeMap["\r".codePointAt(0)] = "\\r";
|
|
596
|
+
_stringLiteralEscapeMap['"'.codePointAt(0)] = '\\"';
|
|
597
|
+
_stringLiteralEscapeMap["\\".codePointAt(0)] = "\\\\";
|
|
598
|
+
function _stringLiteralEscape(s) {
|
|
599
|
+
if (!_stringLiteralEscapeRegex.test(s)) {
|
|
600
|
+
return s;
|
|
601
|
+
}
|
|
602
|
+
return s.replace(_stringLiteralEscapeRegex, function(match) {
|
|
603
|
+
return _stringLiteralEscapeMap[match.codePointAt(0)];
|
|
612
604
|
});
|
|
613
605
|
}
|
|
614
|
-
var
|
|
615
|
-
function
|
|
616
|
-
|
|
606
|
+
var _stringLiteralUnescapeRegex = /(?:\\([btnfr"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;
|
|
607
|
+
function _stringLiteralUnescape(s) {
|
|
608
|
+
if (!_stringLiteralUnescapeRegex.test(s)) {
|
|
609
|
+
return s;
|
|
610
|
+
}
|
|
611
|
+
return s.replace(_stringLiteralUnescapeRegex, function(match, code, u, U) {
|
|
617
612
|
if (code) {
|
|
618
613
|
switch (code) {
|
|
619
|
-
case "t":
|
|
620
|
-
return " ";
|
|
621
614
|
case "b":
|
|
622
615
|
return "\b";
|
|
616
|
+
case "t":
|
|
617
|
+
return " ";
|
|
623
618
|
case "n":
|
|
624
619
|
return "\n";
|
|
625
|
-
case "r":
|
|
626
|
-
return "\r";
|
|
627
620
|
case "f":
|
|
628
621
|
return "\f";
|
|
622
|
+
case "r":
|
|
623
|
+
return "\r";
|
|
629
624
|
case '"':
|
|
630
625
|
return '"';
|
|
631
626
|
case "'":
|
|
@@ -638,38 +633,73 @@ var require_NQuads = __commonJS({
|
|
|
638
633
|
return String.fromCharCode(parseInt(u, 16));
|
|
639
634
|
}
|
|
640
635
|
if (U) {
|
|
641
|
-
|
|
636
|
+
return String.fromCodePoint(parseInt(U, 16));
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
var _iriEscapeRegex = /[\u0000-\u0020<>"{}|^`\\]/g;
|
|
641
|
+
var _iriEscapeRegexMap = [];
|
|
642
|
+
for (let n = 0; n <= 127; ++n) {
|
|
643
|
+
if (_iriEscapeRegex.test(String.fromCharCode(n))) {
|
|
644
|
+
_iriEscapeRegexMap[n] = "\\u" + n.toString(16).toUpperCase().padStart(4, "0");
|
|
645
|
+
_iriEscapeRegex.lastIndex = 0;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
function _iriEscape(s) {
|
|
649
|
+
if (!_iriEscapeRegex.test(s)) {
|
|
650
|
+
return s;
|
|
651
|
+
}
|
|
652
|
+
return s.replace(_iriEscapeRegex, function(match) {
|
|
653
|
+
return _iriEscapeRegexMap[match.codePointAt(0)];
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
var _iriUnescapeRegex = /(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;
|
|
657
|
+
function _iriUnescape(s) {
|
|
658
|
+
if (!_iriUnescapeRegex.test(s)) {
|
|
659
|
+
return s;
|
|
660
|
+
}
|
|
661
|
+
return s.replace(_iriUnescapeRegex, function(match, u, U) {
|
|
662
|
+
if (u) {
|
|
663
|
+
return String.fromCharCode(parseInt(u, 16));
|
|
664
|
+
}
|
|
665
|
+
if (U) {
|
|
666
|
+
return String.fromCodePoint(parseInt(U, 16));
|
|
642
667
|
}
|
|
643
668
|
});
|
|
644
669
|
}
|
|
645
670
|
}
|
|
646
671
|
});
|
|
647
672
|
|
|
648
|
-
// ../node_modules/rdf-canonize/lib/
|
|
649
|
-
var
|
|
650
|
-
"../node_modules/rdf-canonize/lib/
|
|
673
|
+
// ../node_modules/rdf-canonize/lib/RDFC10.js
|
|
674
|
+
var require_RDFC10 = __commonJS({
|
|
675
|
+
"../node_modules/rdf-canonize/lib/RDFC10.js"(exports, module) {
|
|
651
676
|
"use strict";
|
|
652
677
|
var IdentifierIssuer = require_IdentifierIssuer();
|
|
653
|
-
var MessageDigest =
|
|
678
|
+
var MessageDigest = require_MessageDigest_webcrypto();
|
|
654
679
|
var Permuter = require_Permuter();
|
|
655
680
|
var NQuads = require_NQuads();
|
|
656
|
-
|
|
681
|
+
var { setImmediate: setImmediate2 } = require_platform_browser();
|
|
682
|
+
module.exports = class RDFC10 {
|
|
657
683
|
constructor({
|
|
658
|
-
createMessageDigest =
|
|
684
|
+
createMessageDigest = null,
|
|
685
|
+
messageDigestAlgorithm = "sha256",
|
|
659
686
|
canonicalIdMap = /* @__PURE__ */ new Map(),
|
|
660
|
-
|
|
687
|
+
maxWorkFactor = 1,
|
|
688
|
+
maxDeepIterations = -1,
|
|
689
|
+
signal = null
|
|
661
690
|
} = {}) {
|
|
662
|
-
this.name = "
|
|
691
|
+
this.name = "RDFC-1.0";
|
|
663
692
|
this.blankNodeInfo = /* @__PURE__ */ new Map();
|
|
664
|
-
this.canonicalIssuer = new IdentifierIssuer("
|
|
665
|
-
this.createMessageDigest = createMessageDigest;
|
|
693
|
+
this.canonicalIssuer = new IdentifierIssuer("c14n", canonicalIdMap);
|
|
694
|
+
this.createMessageDigest = createMessageDigest || (() => new MessageDigest(messageDigestAlgorithm));
|
|
695
|
+
this.maxWorkFactor = maxWorkFactor;
|
|
666
696
|
this.maxDeepIterations = maxDeepIterations;
|
|
697
|
+
this.remainingDeepIterations = 0;
|
|
698
|
+
this.signal = signal;
|
|
667
699
|
this.quads = null;
|
|
668
|
-
this.deepIterations = null;
|
|
669
700
|
}
|
|
670
701
|
// 4.4) Normalization Algorithm
|
|
671
702
|
async main(dataset) {
|
|
672
|
-
this.deepIterations = /* @__PURE__ */ new Map();
|
|
673
703
|
this.quads = dataset;
|
|
674
704
|
for (const quad of dataset) {
|
|
675
705
|
this._addBlankNodeQuadInfo({ quad, component: quad.subject });
|
|
@@ -696,13 +726,27 @@ var require_URDNA2015 = __commonJS({
|
|
|
696
726
|
const id = idList[0];
|
|
697
727
|
this.canonicalIssuer.getId(id);
|
|
698
728
|
}
|
|
729
|
+
if (this.maxDeepIterations < 0) {
|
|
730
|
+
if (this.maxWorkFactor === 0) {
|
|
731
|
+
this.maxDeepIterations = 0;
|
|
732
|
+
} else if (this.maxWorkFactor === Infinity) {
|
|
733
|
+
this.maxDeepIterations = Infinity;
|
|
734
|
+
} else {
|
|
735
|
+
const nonUniqueCount = nonUnique.reduce((count, v) => count + v.length, 0);
|
|
736
|
+
this.maxDeepIterations = nonUniqueCount ** this.maxWorkFactor;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
if (this.maxDeepIterations > Number.MAX_SAFE_INTEGER) {
|
|
740
|
+
this.maxDeepIterations = Infinity;
|
|
741
|
+
}
|
|
742
|
+
this.remainingDeepIterations = this.maxDeepIterations;
|
|
699
743
|
for (const idList of nonUnique) {
|
|
700
744
|
const hashPathList = [];
|
|
701
745
|
for (const id of idList) {
|
|
702
746
|
if (this.canonicalIssuer.hasId(id)) {
|
|
703
747
|
continue;
|
|
704
748
|
}
|
|
705
|
-
const issuer = new IdentifierIssuer("
|
|
749
|
+
const issuer = new IdentifierIssuer("b");
|
|
706
750
|
issuer.getId(id);
|
|
707
751
|
const result = await this.hashNDegreeQuads(id, issuer);
|
|
708
752
|
hashPathList.push(result);
|
|
@@ -734,28 +778,12 @@ var require_URDNA2015 = __commonJS({
|
|
|
734
778
|
const info = this.blankNodeInfo.get(id);
|
|
735
779
|
const quads = info.quads;
|
|
736
780
|
for (const quad of quads) {
|
|
737
|
-
|
|
738
|
-
subject
|
|
739
|
-
|
|
740
|
-
object
|
|
741
|
-
graph
|
|
742
|
-
|
|
743
|
-
copy.subject = this.modifyFirstDegreeComponent(
|
|
744
|
-
id,
|
|
745
|
-
quad.subject,
|
|
746
|
-
"subject"
|
|
747
|
-
);
|
|
748
|
-
copy.object = this.modifyFirstDegreeComponent(
|
|
749
|
-
id,
|
|
750
|
-
quad.object,
|
|
751
|
-
"object"
|
|
752
|
-
);
|
|
753
|
-
copy.graph = this.modifyFirstDegreeComponent(
|
|
754
|
-
id,
|
|
755
|
-
quad.graph,
|
|
756
|
-
"graph"
|
|
757
|
-
);
|
|
758
|
-
nquads.push(NQuads.serializeQuad(copy));
|
|
781
|
+
nquads.push(NQuads.serializeQuadComponents(
|
|
782
|
+
this.modifyFirstDegreeComponent(id, quad.subject, "subject"),
|
|
783
|
+
quad.predicate,
|
|
784
|
+
this.modifyFirstDegreeComponent(id, quad.object, "object"),
|
|
785
|
+
this.modifyFirstDegreeComponent(id, quad.graph, "graph")
|
|
786
|
+
));
|
|
759
787
|
}
|
|
760
788
|
nquads.sort();
|
|
761
789
|
const md = this.createMessageDigest();
|
|
@@ -767,31 +795,30 @@ var require_URDNA2015 = __commonJS({
|
|
|
767
795
|
}
|
|
768
796
|
// 4.7) Hash Related Blank Node
|
|
769
797
|
async hashRelatedBlankNode(related, quad, issuer, position) {
|
|
798
|
+
const md = this.createMessageDigest();
|
|
799
|
+
md.update(position);
|
|
800
|
+
if (position !== "g") {
|
|
801
|
+
md.update(this.getRelatedPredicate(quad));
|
|
802
|
+
}
|
|
770
803
|
let id;
|
|
771
804
|
if (this.canonicalIssuer.hasId(related)) {
|
|
772
|
-
id = this.canonicalIssuer.getId(related);
|
|
805
|
+
id = "_:" + this.canonicalIssuer.getId(related);
|
|
773
806
|
} else if (issuer.hasId(related)) {
|
|
774
|
-
id = issuer.getId(related);
|
|
807
|
+
id = "_:" + issuer.getId(related);
|
|
775
808
|
} else {
|
|
776
809
|
id = this.blankNodeInfo.get(related).hash;
|
|
777
810
|
}
|
|
778
|
-
const md = this.createMessageDigest();
|
|
779
|
-
md.update(position);
|
|
780
|
-
if (position !== "g") {
|
|
781
|
-
md.update(this.getRelatedPredicate(quad));
|
|
782
|
-
}
|
|
783
811
|
md.update(id);
|
|
784
812
|
return md.digest();
|
|
785
813
|
}
|
|
786
814
|
// 4.8) Hash N-Degree Quads
|
|
787
815
|
async hashNDegreeQuads(id, issuer) {
|
|
788
|
-
|
|
789
|
-
if (deepIterations > this.maxDeepIterations) {
|
|
816
|
+
if (this.remainingDeepIterations === 0) {
|
|
790
817
|
throw new Error(
|
|
791
|
-
`Maximum deep iterations (${this.maxDeepIterations})
|
|
818
|
+
`Maximum deep iterations exceeded (${this.maxDeepIterations}).`
|
|
792
819
|
);
|
|
793
820
|
}
|
|
794
|
-
this.
|
|
821
|
+
this.remainingDeepIterations--;
|
|
795
822
|
const md = this.createMessageDigest();
|
|
796
823
|
const hashToRelated = await this.createHashToRelated(id, issuer);
|
|
797
824
|
const hashes = [...hashToRelated.keys()].sort();
|
|
@@ -804,6 +831,9 @@ var require_URDNA2015 = __commonJS({
|
|
|
804
831
|
while (permuter.hasNext()) {
|
|
805
832
|
const permutation = permuter.next();
|
|
806
833
|
if (++i % 3 === 0) {
|
|
834
|
+
if (this.signal && this.signal.aborted) {
|
|
835
|
+
throw new Error(`Abort signal received: "${this.signal.reason}".`);
|
|
836
|
+
}
|
|
807
837
|
await this._yield();
|
|
808
838
|
}
|
|
809
839
|
let issuerCopy = issuer.clone();
|
|
@@ -812,12 +842,12 @@ var require_URDNA2015 = __commonJS({
|
|
|
812
842
|
let nextPermutation = false;
|
|
813
843
|
for (const related of permutation) {
|
|
814
844
|
if (this.canonicalIssuer.hasId(related)) {
|
|
815
|
-
path += this.canonicalIssuer.getId(related);
|
|
845
|
+
path += "_:" + this.canonicalIssuer.getId(related);
|
|
816
846
|
} else {
|
|
817
847
|
if (!issuerCopy.hasId(related)) {
|
|
818
848
|
recursionList.push(related);
|
|
819
849
|
}
|
|
820
|
-
path += issuerCopy.getId(related);
|
|
850
|
+
path += "_:" + issuerCopy.getId(related);
|
|
821
851
|
}
|
|
822
852
|
if (chosenPath.length !== 0 && path > chosenPath) {
|
|
823
853
|
nextPermutation = true;
|
|
@@ -829,7 +859,7 @@ var require_URDNA2015 = __commonJS({
|
|
|
829
859
|
}
|
|
830
860
|
for (const related of recursionList) {
|
|
831
861
|
const result = await this.hashNDegreeQuads(related, issuerCopy);
|
|
832
|
-
path += issuerCopy.getId(related);
|
|
862
|
+
path += "_:" + issuerCopy.getId(related);
|
|
833
863
|
path += `<${result.hash}>`;
|
|
834
864
|
issuerCopy = result.issuer;
|
|
835
865
|
if (chosenPath.length !== 0 && path > chosenPath) {
|
|
@@ -857,7 +887,7 @@ var require_URDNA2015 = __commonJS({
|
|
|
857
887
|
}
|
|
858
888
|
return {
|
|
859
889
|
termType: "BlankNode",
|
|
860
|
-
value: component.value === id ? "
|
|
890
|
+
value: component.value === id ? "a" : "z"
|
|
861
891
|
};
|
|
862
892
|
}
|
|
863
893
|
// helper for getting a related predicate
|
|
@@ -952,7 +982,7 @@ var require_URDNA2015 = __commonJS({
|
|
|
952
982
|
return component;
|
|
953
983
|
}
|
|
954
984
|
async _yield() {
|
|
955
|
-
return new Promise((resolve) =>
|
|
985
|
+
return new Promise((resolve) => setImmediate2(resolve));
|
|
956
986
|
}
|
|
957
987
|
};
|
|
958
988
|
function _stringHashCompare(a, b) {
|
|
@@ -961,102 +991,38 @@ var require_URDNA2015 = __commonJS({
|
|
|
961
991
|
}
|
|
962
992
|
});
|
|
963
993
|
|
|
964
|
-
// ../node_modules/rdf-canonize/lib/
|
|
965
|
-
var
|
|
966
|
-
"../node_modules/rdf-canonize/lib/
|
|
967
|
-
"use strict";
|
|
968
|
-
var MessageDigest = require_MessageDigest_browser();
|
|
969
|
-
var URDNA2015 = require_URDNA2015();
|
|
970
|
-
module.exports = class URDNA2012 extends URDNA2015 {
|
|
971
|
-
constructor() {
|
|
972
|
-
super();
|
|
973
|
-
this.name = "URGNA2012";
|
|
974
|
-
this.createMessageDigest = () => new MessageDigest("sha1");
|
|
975
|
-
}
|
|
976
|
-
// helper for modifying component during Hash First Degree Quads
|
|
977
|
-
modifyFirstDegreeComponent(id, component, key) {
|
|
978
|
-
if (component.termType !== "BlankNode") {
|
|
979
|
-
return component;
|
|
980
|
-
}
|
|
981
|
-
if (key === "graph") {
|
|
982
|
-
return {
|
|
983
|
-
termType: "BlankNode",
|
|
984
|
-
value: "_:g"
|
|
985
|
-
};
|
|
986
|
-
}
|
|
987
|
-
return {
|
|
988
|
-
termType: "BlankNode",
|
|
989
|
-
value: component.value === id ? "_:a" : "_:z"
|
|
990
|
-
};
|
|
991
|
-
}
|
|
992
|
-
// helper for getting a related predicate
|
|
993
|
-
getRelatedPredicate(quad) {
|
|
994
|
-
return quad.predicate.value;
|
|
995
|
-
}
|
|
996
|
-
// helper for creating hash to related blank nodes map
|
|
997
|
-
async createHashToRelated(id, issuer) {
|
|
998
|
-
const hashToRelated = /* @__PURE__ */ new Map();
|
|
999
|
-
const quads = this.blankNodeInfo.get(id).quads;
|
|
1000
|
-
let i = 0;
|
|
1001
|
-
for (const quad of quads) {
|
|
1002
|
-
let position;
|
|
1003
|
-
let related;
|
|
1004
|
-
if (quad.subject.termType === "BlankNode" && quad.subject.value !== id) {
|
|
1005
|
-
related = quad.subject.value;
|
|
1006
|
-
position = "p";
|
|
1007
|
-
} else if (quad.object.termType === "BlankNode" && quad.object.value !== id) {
|
|
1008
|
-
related = quad.object.value;
|
|
1009
|
-
position = "r";
|
|
1010
|
-
} else {
|
|
1011
|
-
continue;
|
|
1012
|
-
}
|
|
1013
|
-
if (++i % 100 === 0) {
|
|
1014
|
-
await this._yield();
|
|
1015
|
-
}
|
|
1016
|
-
const hash = await this.hashRelatedBlankNode(
|
|
1017
|
-
related,
|
|
1018
|
-
quad,
|
|
1019
|
-
issuer,
|
|
1020
|
-
position
|
|
1021
|
-
);
|
|
1022
|
-
const entries = hashToRelated.get(hash);
|
|
1023
|
-
if (entries) {
|
|
1024
|
-
entries.push(related);
|
|
1025
|
-
} else {
|
|
1026
|
-
hashToRelated.set(hash, [related]);
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
return hashToRelated;
|
|
1030
|
-
}
|
|
1031
|
-
};
|
|
1032
|
-
}
|
|
1033
|
-
});
|
|
1034
|
-
|
|
1035
|
-
// ../node_modules/rdf-canonize/lib/URDNA2015Sync.js
|
|
1036
|
-
var require_URDNA2015Sync = __commonJS({
|
|
1037
|
-
"../node_modules/rdf-canonize/lib/URDNA2015Sync.js"(exports, module) {
|
|
994
|
+
// ../node_modules/rdf-canonize/lib/RDFC10Sync.js
|
|
995
|
+
var require_RDFC10Sync = __commonJS({
|
|
996
|
+
"../node_modules/rdf-canonize/lib/RDFC10Sync.js"(exports, module) {
|
|
1038
997
|
"use strict";
|
|
1039
998
|
var IdentifierIssuer = require_IdentifierIssuer();
|
|
1040
|
-
var MessageDigest =
|
|
999
|
+
var MessageDigest = require_MessageDigest_webcrypto();
|
|
1041
1000
|
var Permuter = require_Permuter();
|
|
1042
1001
|
var NQuads = require_NQuads();
|
|
1043
|
-
module.exports = class
|
|
1002
|
+
module.exports = class RDFC10Sync {
|
|
1044
1003
|
constructor({
|
|
1045
|
-
createMessageDigest =
|
|
1004
|
+
createMessageDigest = null,
|
|
1005
|
+
messageDigestAlgorithm = "sha256",
|
|
1046
1006
|
canonicalIdMap = /* @__PURE__ */ new Map(),
|
|
1047
|
-
|
|
1007
|
+
maxWorkFactor = 1,
|
|
1008
|
+
maxDeepIterations = -1,
|
|
1009
|
+
timeout = 0
|
|
1048
1010
|
} = {}) {
|
|
1049
|
-
this.name = "
|
|
1011
|
+
this.name = "RDFC-1.0";
|
|
1050
1012
|
this.blankNodeInfo = /* @__PURE__ */ new Map();
|
|
1051
|
-
this.canonicalIssuer = new IdentifierIssuer("
|
|
1052
|
-
this.createMessageDigest = createMessageDigest;
|
|
1013
|
+
this.canonicalIssuer = new IdentifierIssuer("c14n", canonicalIdMap);
|
|
1014
|
+
this.createMessageDigest = createMessageDigest || (() => new MessageDigest(messageDigestAlgorithm));
|
|
1015
|
+
this.maxWorkFactor = maxWorkFactor;
|
|
1053
1016
|
this.maxDeepIterations = maxDeepIterations;
|
|
1017
|
+
this.remainingDeepIterations = 0;
|
|
1018
|
+
this.timeout = timeout;
|
|
1019
|
+
if (timeout > 0) {
|
|
1020
|
+
this.startTime = Date.now();
|
|
1021
|
+
}
|
|
1054
1022
|
this.quads = null;
|
|
1055
|
-
this.deepIterations = null;
|
|
1056
1023
|
}
|
|
1057
1024
|
// 4.4) Normalization Algorithm
|
|
1058
1025
|
main(dataset) {
|
|
1059
|
-
this.deepIterations = /* @__PURE__ */ new Map();
|
|
1060
1026
|
this.quads = dataset;
|
|
1061
1027
|
for (const quad of dataset) {
|
|
1062
1028
|
this._addBlankNodeQuadInfo({ quad, component: quad.subject });
|
|
@@ -1079,13 +1045,27 @@ var require_URDNA2015Sync = __commonJS({
|
|
|
1079
1045
|
const id = idList[0];
|
|
1080
1046
|
this.canonicalIssuer.getId(id);
|
|
1081
1047
|
}
|
|
1048
|
+
if (this.maxDeepIterations < 0) {
|
|
1049
|
+
if (this.maxWorkFactor === 0) {
|
|
1050
|
+
this.maxDeepIterations = 0;
|
|
1051
|
+
} else if (this.maxWorkFactor === Infinity) {
|
|
1052
|
+
this.maxDeepIterations = Infinity;
|
|
1053
|
+
} else {
|
|
1054
|
+
const nonUniqueCount = nonUnique.reduce((count, v) => count + v.length, 0);
|
|
1055
|
+
this.maxDeepIterations = nonUniqueCount ** this.maxWorkFactor;
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
if (this.maxDeepIterations > Number.MAX_SAFE_INTEGER) {
|
|
1059
|
+
this.maxDeepIterations = Infinity;
|
|
1060
|
+
}
|
|
1061
|
+
this.remainingDeepIterations = this.maxDeepIterations;
|
|
1082
1062
|
for (const idList of nonUnique) {
|
|
1083
1063
|
const hashPathList = [];
|
|
1084
1064
|
for (const id of idList) {
|
|
1085
1065
|
if (this.canonicalIssuer.hasId(id)) {
|
|
1086
1066
|
continue;
|
|
1087
1067
|
}
|
|
1088
|
-
const issuer = new IdentifierIssuer("
|
|
1068
|
+
const issuer = new IdentifierIssuer("b");
|
|
1089
1069
|
issuer.getId(id);
|
|
1090
1070
|
const result = this.hashNDegreeQuads(id, issuer);
|
|
1091
1071
|
hashPathList.push(result);
|
|
@@ -1101,10 +1081,10 @@ var require_URDNA2015Sync = __commonJS({
|
|
|
1101
1081
|
const normalized = [];
|
|
1102
1082
|
for (const quad of this.quads) {
|
|
1103
1083
|
const nQuad = NQuads.serializeQuadComponents(
|
|
1104
|
-
this._componentWithCanonicalId(
|
|
1084
|
+
this._componentWithCanonicalId(quad.subject),
|
|
1105
1085
|
quad.predicate,
|
|
1106
|
-
this._componentWithCanonicalId(
|
|
1107
|
-
this._componentWithCanonicalId(
|
|
1086
|
+
this._componentWithCanonicalId(quad.object),
|
|
1087
|
+
this._componentWithCanonicalId(quad.graph)
|
|
1108
1088
|
);
|
|
1109
1089
|
normalized.push(nQuad);
|
|
1110
1090
|
}
|
|
@@ -1117,28 +1097,12 @@ var require_URDNA2015Sync = __commonJS({
|
|
|
1117
1097
|
const info = this.blankNodeInfo.get(id);
|
|
1118
1098
|
const quads = info.quads;
|
|
1119
1099
|
for (const quad of quads) {
|
|
1120
|
-
|
|
1121
|
-
subject
|
|
1122
|
-
|
|
1123
|
-
object
|
|
1124
|
-
graph
|
|
1125
|
-
|
|
1126
|
-
copy.subject = this.modifyFirstDegreeComponent(
|
|
1127
|
-
id,
|
|
1128
|
-
quad.subject,
|
|
1129
|
-
"subject"
|
|
1130
|
-
);
|
|
1131
|
-
copy.object = this.modifyFirstDegreeComponent(
|
|
1132
|
-
id,
|
|
1133
|
-
quad.object,
|
|
1134
|
-
"object"
|
|
1135
|
-
);
|
|
1136
|
-
copy.graph = this.modifyFirstDegreeComponent(
|
|
1137
|
-
id,
|
|
1138
|
-
quad.graph,
|
|
1139
|
-
"graph"
|
|
1140
|
-
);
|
|
1141
|
-
nquads.push(NQuads.serializeQuad(copy));
|
|
1100
|
+
nquads.push(NQuads.serializeQuadComponents(
|
|
1101
|
+
this.modifyFirstDegreeComponent(id, quad.subject, "subject"),
|
|
1102
|
+
quad.predicate,
|
|
1103
|
+
this.modifyFirstDegreeComponent(id, quad.object, "object"),
|
|
1104
|
+
this.modifyFirstDegreeComponent(id, quad.graph, "graph")
|
|
1105
|
+
));
|
|
1142
1106
|
}
|
|
1143
1107
|
nquads.sort();
|
|
1144
1108
|
const md = this.createMessageDigest();
|
|
@@ -1150,31 +1114,30 @@ var require_URDNA2015Sync = __commonJS({
|
|
|
1150
1114
|
}
|
|
1151
1115
|
// 4.7) Hash Related Blank Node
|
|
1152
1116
|
hashRelatedBlankNode(related, quad, issuer, position) {
|
|
1117
|
+
const md = this.createMessageDigest();
|
|
1118
|
+
md.update(position);
|
|
1119
|
+
if (position !== "g") {
|
|
1120
|
+
md.update(this.getRelatedPredicate(quad));
|
|
1121
|
+
}
|
|
1153
1122
|
let id;
|
|
1154
1123
|
if (this.canonicalIssuer.hasId(related)) {
|
|
1155
|
-
id = this.canonicalIssuer.getId(related);
|
|
1124
|
+
id = "_:" + this.canonicalIssuer.getId(related);
|
|
1156
1125
|
} else if (issuer.hasId(related)) {
|
|
1157
|
-
id = issuer.getId(related);
|
|
1126
|
+
id = "_:" + issuer.getId(related);
|
|
1158
1127
|
} else {
|
|
1159
1128
|
id = this.blankNodeInfo.get(related).hash;
|
|
1160
1129
|
}
|
|
1161
|
-
const md = this.createMessageDigest();
|
|
1162
|
-
md.update(position);
|
|
1163
|
-
if (position !== "g") {
|
|
1164
|
-
md.update(this.getRelatedPredicate(quad));
|
|
1165
|
-
}
|
|
1166
1130
|
md.update(id);
|
|
1167
1131
|
return md.digest();
|
|
1168
1132
|
}
|
|
1169
1133
|
// 4.8) Hash N-Degree Quads
|
|
1170
1134
|
hashNDegreeQuads(id, issuer) {
|
|
1171
|
-
|
|
1172
|
-
if (deepIterations > this.maxDeepIterations) {
|
|
1135
|
+
if (this.remainingDeepIterations === 0) {
|
|
1173
1136
|
throw new Error(
|
|
1174
|
-
`Maximum deep iterations (${this.maxDeepIterations})
|
|
1137
|
+
`Maximum deep iterations exceeded (${this.maxDeepIterations}).`
|
|
1175
1138
|
);
|
|
1176
1139
|
}
|
|
1177
|
-
this.
|
|
1140
|
+
this.remainingDeepIterations--;
|
|
1178
1141
|
const md = this.createMessageDigest();
|
|
1179
1142
|
const hashToRelated = this.createHashToRelated(id, issuer);
|
|
1180
1143
|
const hashes = [...hashToRelated.keys()].sort();
|
|
@@ -1183,20 +1146,26 @@ var require_URDNA2015Sync = __commonJS({
|
|
|
1183
1146
|
let chosenPath = "";
|
|
1184
1147
|
let chosenIssuer;
|
|
1185
1148
|
const permuter = new Permuter(hashToRelated.get(hash));
|
|
1149
|
+
let i = 0;
|
|
1186
1150
|
while (permuter.hasNext()) {
|
|
1187
1151
|
const permutation = permuter.next();
|
|
1152
|
+
if (++i % 3 === 0) {
|
|
1153
|
+
if (this.timeout > 0 && Date.now() - this.startTime > this.timeout) {
|
|
1154
|
+
throw new Error("Canonize timeout.");
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1188
1157
|
let issuerCopy = issuer.clone();
|
|
1189
1158
|
let path = "";
|
|
1190
1159
|
const recursionList = [];
|
|
1191
1160
|
let nextPermutation = false;
|
|
1192
1161
|
for (const related of permutation) {
|
|
1193
1162
|
if (this.canonicalIssuer.hasId(related)) {
|
|
1194
|
-
path += this.canonicalIssuer.getId(related);
|
|
1163
|
+
path += "_:" + this.canonicalIssuer.getId(related);
|
|
1195
1164
|
} else {
|
|
1196
1165
|
if (!issuerCopy.hasId(related)) {
|
|
1197
1166
|
recursionList.push(related);
|
|
1198
1167
|
}
|
|
1199
|
-
path += issuerCopy.getId(related);
|
|
1168
|
+
path += "_:" + issuerCopy.getId(related);
|
|
1200
1169
|
}
|
|
1201
1170
|
if (chosenPath.length !== 0 && path > chosenPath) {
|
|
1202
1171
|
nextPermutation = true;
|
|
@@ -1208,7 +1177,7 @@ var require_URDNA2015Sync = __commonJS({
|
|
|
1208
1177
|
}
|
|
1209
1178
|
for (const related of recursionList) {
|
|
1210
1179
|
const result = this.hashNDegreeQuads(related, issuerCopy);
|
|
1211
|
-
path += issuerCopy.getId(related);
|
|
1180
|
+
path += "_:" + issuerCopy.getId(related);
|
|
1212
1181
|
path += `<${result.hash}>`;
|
|
1213
1182
|
issuerCopy = result.issuer;
|
|
1214
1183
|
if (chosenPath.length !== 0 && path > chosenPath) {
|
|
@@ -1236,7 +1205,7 @@ var require_URDNA2015Sync = __commonJS({
|
|
|
1236
1205
|
}
|
|
1237
1206
|
return {
|
|
1238
1207
|
termType: "BlankNode",
|
|
1239
|
-
value: component.value === id ? "
|
|
1208
|
+
value: component.value === id ? "a" : "z"
|
|
1240
1209
|
};
|
|
1241
1210
|
}
|
|
1242
1211
|
// helper for getting a related predicate
|
|
@@ -1301,7 +1270,12 @@ var require_URDNA2015Sync = __commonJS({
|
|
|
1301
1270
|
return;
|
|
1302
1271
|
}
|
|
1303
1272
|
const related = component.value;
|
|
1304
|
-
const hash = this.hashRelatedBlankNode(
|
|
1273
|
+
const hash = this.hashRelatedBlankNode(
|
|
1274
|
+
related,
|
|
1275
|
+
quad,
|
|
1276
|
+
issuer,
|
|
1277
|
+
position
|
|
1278
|
+
);
|
|
1305
1279
|
const entries = hashToRelated.get(hash);
|
|
1306
1280
|
if (entries) {
|
|
1307
1281
|
entries.push(related);
|
|
@@ -1310,7 +1284,7 @@ var require_URDNA2015Sync = __commonJS({
|
|
|
1310
1284
|
}
|
|
1311
1285
|
}
|
|
1312
1286
|
// canonical ids for 7.1
|
|
1313
|
-
_componentWithCanonicalId(
|
|
1287
|
+
_componentWithCanonicalId(component) {
|
|
1314
1288
|
if (component.termType === "BlankNode" && !component.value.startsWith(this.canonicalIssuer.prefix)) {
|
|
1315
1289
|
return {
|
|
1316
1290
|
termType: "BlankNode",
|
|
@@ -1326,159 +1300,72 @@ var require_URDNA2015Sync = __commonJS({
|
|
|
1326
1300
|
}
|
|
1327
1301
|
});
|
|
1328
1302
|
|
|
1329
|
-
// ../node_modules/rdf-canonize/lib/URGNA2012Sync.js
|
|
1330
|
-
var require_URGNA2012Sync = __commonJS({
|
|
1331
|
-
"../node_modules/rdf-canonize/lib/URGNA2012Sync.js"(exports, module) {
|
|
1332
|
-
"use strict";
|
|
1333
|
-
var MessageDigest = require_MessageDigest_browser();
|
|
1334
|
-
var URDNA2015Sync = require_URDNA2015Sync();
|
|
1335
|
-
module.exports = class URDNA2012Sync extends URDNA2015Sync {
|
|
1336
|
-
constructor() {
|
|
1337
|
-
super();
|
|
1338
|
-
this.name = "URGNA2012";
|
|
1339
|
-
this.createMessageDigest = () => new MessageDigest("sha1");
|
|
1340
|
-
}
|
|
1341
|
-
// helper for modifying component during Hash First Degree Quads
|
|
1342
|
-
modifyFirstDegreeComponent(id, component, key) {
|
|
1343
|
-
if (component.termType !== "BlankNode") {
|
|
1344
|
-
return component;
|
|
1345
|
-
}
|
|
1346
|
-
if (key === "graph") {
|
|
1347
|
-
return {
|
|
1348
|
-
termType: "BlankNode",
|
|
1349
|
-
value: "_:g"
|
|
1350
|
-
};
|
|
1351
|
-
}
|
|
1352
|
-
return {
|
|
1353
|
-
termType: "BlankNode",
|
|
1354
|
-
value: component.value === id ? "_:a" : "_:z"
|
|
1355
|
-
};
|
|
1356
|
-
}
|
|
1357
|
-
// helper for getting a related predicate
|
|
1358
|
-
getRelatedPredicate(quad) {
|
|
1359
|
-
return quad.predicate.value;
|
|
1360
|
-
}
|
|
1361
|
-
// helper for creating hash to related blank nodes map
|
|
1362
|
-
createHashToRelated(id, issuer) {
|
|
1363
|
-
const hashToRelated = /* @__PURE__ */ new Map();
|
|
1364
|
-
const quads = this.blankNodeInfo.get(id).quads;
|
|
1365
|
-
for (const quad of quads) {
|
|
1366
|
-
let position;
|
|
1367
|
-
let related;
|
|
1368
|
-
if (quad.subject.termType === "BlankNode" && quad.subject.value !== id) {
|
|
1369
|
-
related = quad.subject.value;
|
|
1370
|
-
position = "p";
|
|
1371
|
-
} else if (quad.object.termType === "BlankNode" && quad.object.value !== id) {
|
|
1372
|
-
related = quad.object.value;
|
|
1373
|
-
position = "r";
|
|
1374
|
-
} else {
|
|
1375
|
-
continue;
|
|
1376
|
-
}
|
|
1377
|
-
const hash = this.hashRelatedBlankNode(related, quad, issuer, position);
|
|
1378
|
-
const entries = hashToRelated.get(hash);
|
|
1379
|
-
if (entries) {
|
|
1380
|
-
entries.push(related);
|
|
1381
|
-
} else {
|
|
1382
|
-
hashToRelated.set(hash, [related]);
|
|
1383
|
-
}
|
|
1384
|
-
}
|
|
1385
|
-
return hashToRelated;
|
|
1386
|
-
}
|
|
1387
|
-
};
|
|
1388
|
-
}
|
|
1389
|
-
});
|
|
1390
|
-
|
|
1391
|
-
// (disabled):rdf-canonize-native
|
|
1392
|
-
var require_rdf_canonize_native = __commonJS({
|
|
1393
|
-
"(disabled):rdf-canonize-native"() {
|
|
1394
|
-
}
|
|
1395
|
-
});
|
|
1396
|
-
|
|
1397
1303
|
// ../node_modules/rdf-canonize/lib/index.js
|
|
1398
1304
|
var require_lib = __commonJS({
|
|
1399
1305
|
"../node_modules/rdf-canonize/lib/index.js"(exports) {
|
|
1400
1306
|
"use strict";
|
|
1401
|
-
var
|
|
1402
|
-
var
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1307
|
+
var RDFC10 = require_RDFC10();
|
|
1308
|
+
var RDFC10Sync = require_RDFC10Sync();
|
|
1309
|
+
function _inputToDataset(input, options) {
|
|
1310
|
+
if (options.inputFormat) {
|
|
1311
|
+
if (options.inputFormat === "application/n-quads") {
|
|
1312
|
+
if (typeof input !== "string") {
|
|
1313
|
+
throw new Error("N-Quads input must be a string.");
|
|
1314
|
+
}
|
|
1315
|
+
return exports.NQuads.parse(input);
|
|
1316
|
+
}
|
|
1317
|
+
throw new Error(
|
|
1318
|
+
`Unknown canonicalization input format: "${options.inputFormat}".`
|
|
1319
|
+
);
|
|
1413
1320
|
}
|
|
1414
1321
|
return input;
|
|
1415
1322
|
}
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
if (api) {
|
|
1420
|
-
rdfCanonizeNative = api;
|
|
1421
|
-
}
|
|
1422
|
-
return rdfCanonizeNative;
|
|
1423
|
-
};
|
|
1424
|
-
exports.canonize = async function(input, options) {
|
|
1425
|
-
const dataset = _inputToDataset(input, options);
|
|
1426
|
-
if (options.useNative) {
|
|
1427
|
-
if (!rdfCanonizeNative) {
|
|
1428
|
-
throw new Error("rdf-canonize-native not available");
|
|
1429
|
-
}
|
|
1430
|
-
if (options.createMessageDigest) {
|
|
1323
|
+
function _checkOutputFormat(options) {
|
|
1324
|
+
if (options.format) {
|
|
1325
|
+
if (options.format !== "application/n-quads") {
|
|
1431
1326
|
throw new Error(
|
|
1432
|
-
|
|
1327
|
+
`Unknown canonicalization output format: "${options.format}".`
|
|
1433
1328
|
);
|
|
1434
1329
|
}
|
|
1435
|
-
return new Promise((resolve, reject) => rdfCanonizeNative.canonize(dataset, options, (err, canonical) => err ? reject(err) : resolve(canonical)));
|
|
1436
|
-
}
|
|
1437
|
-
if (options.algorithm === "URDNA2015") {
|
|
1438
|
-
return new URDNA2015(options).main(dataset);
|
|
1439
1330
|
}
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
);
|
|
1445
|
-
}
|
|
1446
|
-
return new URGNA2012(options).main(dataset);
|
|
1331
|
+
}
|
|
1332
|
+
function _traceURDNA2015() {
|
|
1333
|
+
if (!!globalThis.RDF_CANONIZE_TRACE_URDNA2015) {
|
|
1334
|
+
console.trace("[rdf-canonize] URDNA2015 is deprecated, use RDFC-1.0");
|
|
1447
1335
|
}
|
|
1336
|
+
}
|
|
1337
|
+
exports.NQuads = require_NQuads();
|
|
1338
|
+
exports.IdentifierIssuer = require_IdentifierIssuer();
|
|
1339
|
+
exports.canonize = async function(input, options = {}) {
|
|
1340
|
+
const dataset = _inputToDataset(input, options);
|
|
1341
|
+
_checkOutputFormat(options);
|
|
1448
1342
|
if (!("algorithm" in options)) {
|
|
1449
1343
|
throw new Error("No RDF Dataset Canonicalization algorithm specified.");
|
|
1450
1344
|
}
|
|
1345
|
+
if (options.algorithm === "RDFC-1.0") {
|
|
1346
|
+
return new RDFC10(options).main(dataset);
|
|
1347
|
+
}
|
|
1348
|
+
if (options.algorithm === "URDNA2015" && !options.rejectURDNA2015) {
|
|
1349
|
+
_traceURDNA2015();
|
|
1350
|
+
return new RDFC10(options).main(dataset);
|
|
1351
|
+
}
|
|
1451
1352
|
throw new Error(
|
|
1452
1353
|
"Invalid RDF Dataset Canonicalization algorithm: " + options.algorithm
|
|
1453
1354
|
);
|
|
1454
1355
|
};
|
|
1455
|
-
exports._canonizeSync = function(input, options) {
|
|
1356
|
+
exports._canonizeSync = function(input, options = {}) {
|
|
1456
1357
|
const dataset = _inputToDataset(input, options);
|
|
1457
|
-
|
|
1458
|
-
if (!rdfCanonizeNative) {
|
|
1459
|
-
throw new Error("rdf-canonize-native not available");
|
|
1460
|
-
}
|
|
1461
|
-
if (options.createMessageDigest) {
|
|
1462
|
-
throw new Error(
|
|
1463
|
-
'"createMessageDigest" cannot be used with "useNative".'
|
|
1464
|
-
);
|
|
1465
|
-
}
|
|
1466
|
-
return rdfCanonizeNative.canonizeSync(dataset, options);
|
|
1467
|
-
}
|
|
1468
|
-
if (options.algorithm === "URDNA2015") {
|
|
1469
|
-
return new URDNA2015Sync(options).main(dataset);
|
|
1470
|
-
}
|
|
1471
|
-
if (options.algorithm === "URGNA2012") {
|
|
1472
|
-
if (options.createMessageDigest) {
|
|
1473
|
-
throw new Error(
|
|
1474
|
-
'"createMessageDigest" cannot be used with "URGNA2012".'
|
|
1475
|
-
);
|
|
1476
|
-
}
|
|
1477
|
-
return new URGNA2012Sync(options).main(dataset);
|
|
1478
|
-
}
|
|
1358
|
+
_checkOutputFormat(options);
|
|
1479
1359
|
if (!("algorithm" in options)) {
|
|
1480
1360
|
throw new Error("No RDF Dataset Canonicalization algorithm specified.");
|
|
1481
1361
|
}
|
|
1362
|
+
if (options.algorithm === "RDFC-1.0") {
|
|
1363
|
+
return new RDFC10Sync(options).main(dataset);
|
|
1364
|
+
}
|
|
1365
|
+
if (options.algorithm === "URDNA2015" && !options.rejectURDNA2015) {
|
|
1366
|
+
_traceURDNA2015();
|
|
1367
|
+
return new RDFC10Sync(options).main(dataset);
|
|
1368
|
+
}
|
|
1482
1369
|
throw new Error(
|
|
1483
1370
|
"Invalid RDF Dataset Canonicalization algorithm: " + options.algorithm
|
|
1484
1371
|
);
|
|
@@ -2206,7 +2093,7 @@ var require_xhr = __commonJS({
|
|
|
2206
2093
|
});
|
|
2207
2094
|
|
|
2208
2095
|
// ../node_modules/jsonld/lib/platform-browser.js
|
|
2209
|
-
var
|
|
2096
|
+
var require_platform_browser2 = __commonJS({
|
|
2210
2097
|
"../node_modules/jsonld/lib/platform-browser.js"(exports, module) {
|
|
2211
2098
|
"use strict";
|
|
2212
2099
|
var xhrLoader = require_xhr();
|
|
@@ -2619,16 +2506,16 @@ var require_lru_cache = __commonJS({
|
|
|
2619
2506
|
"../node_modules/jsonld/node_modules/lru-cache/index.js"(exports, module) {
|
|
2620
2507
|
"use strict";
|
|
2621
2508
|
var Yallist = require_yallist();
|
|
2622
|
-
var MAX = Symbol("max");
|
|
2623
|
-
var LENGTH = Symbol("length");
|
|
2624
|
-
var LENGTH_CALCULATOR = Symbol("lengthCalculator");
|
|
2625
|
-
var ALLOW_STALE = Symbol("allowStale");
|
|
2626
|
-
var MAX_AGE = Symbol("maxAge");
|
|
2627
|
-
var DISPOSE = Symbol("dispose");
|
|
2628
|
-
var NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet");
|
|
2629
|
-
var LRU_LIST = Symbol("lruList");
|
|
2630
|
-
var CACHE = Symbol("cache");
|
|
2631
|
-
var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
|
|
2509
|
+
var MAX = /* @__PURE__ */ Symbol("max");
|
|
2510
|
+
var LENGTH = /* @__PURE__ */ Symbol("length");
|
|
2511
|
+
var LENGTH_CALCULATOR = /* @__PURE__ */ Symbol("lengthCalculator");
|
|
2512
|
+
var ALLOW_STALE = /* @__PURE__ */ Symbol("allowStale");
|
|
2513
|
+
var MAX_AGE = /* @__PURE__ */ Symbol("maxAge");
|
|
2514
|
+
var DISPOSE = /* @__PURE__ */ Symbol("dispose");
|
|
2515
|
+
var NO_DISPOSE_ON_SET = /* @__PURE__ */ Symbol("noDisposeOnSet");
|
|
2516
|
+
var LRU_LIST = /* @__PURE__ */ Symbol("lruList");
|
|
2517
|
+
var CACHE = /* @__PURE__ */ Symbol("cache");
|
|
2518
|
+
var UPDATE_AGE_ON_GET = /* @__PURE__ */ Symbol("updateAgeOnGet");
|
|
2632
2519
|
var naiveLength = () => 1;
|
|
2633
2520
|
var LRUCache = class {
|
|
2634
2521
|
constructor(options) {
|
|
@@ -5830,26 +5717,27 @@ var require_fromRdf = __commonJS({
|
|
|
5830
5717
|
defaultGraph[name] = { "@id": name };
|
|
5831
5718
|
}
|
|
5832
5719
|
const nodeMap = graphMap[name];
|
|
5833
|
-
const s = quad.subject
|
|
5720
|
+
const s = _nodeId(quad.subject);
|
|
5834
5721
|
const p = quad.predicate.value;
|
|
5835
5722
|
const o = quad.object;
|
|
5836
5723
|
if (!(s in nodeMap)) {
|
|
5837
5724
|
nodeMap[s] = { "@id": s };
|
|
5838
5725
|
}
|
|
5839
5726
|
const node = nodeMap[s];
|
|
5840
|
-
const
|
|
5841
|
-
|
|
5842
|
-
|
|
5727
|
+
const objectNodeId = _nodeId(o);
|
|
5728
|
+
const objectIsNode = !!objectNodeId;
|
|
5729
|
+
if (objectIsNode && !(objectNodeId in nodeMap)) {
|
|
5730
|
+
nodeMap[objectNodeId] = { "@id": objectNodeId };
|
|
5843
5731
|
}
|
|
5844
5732
|
if (p === RDF_TYPE && !useRdfType && objectIsNode) {
|
|
5845
|
-
_addValue(node, "@type",
|
|
5733
|
+
_addValue(node, "@type", objectNodeId, { propertyIsArray: true });
|
|
5846
5734
|
continue;
|
|
5847
5735
|
}
|
|
5848
5736
|
const value = _RDFToObject(o, useNativeTypes, rdfDirection, options);
|
|
5849
5737
|
_addValue(node, p, value, { propertyIsArray: true });
|
|
5850
5738
|
if (objectIsNode) {
|
|
5851
|
-
if (
|
|
5852
|
-
const object = nodeMap[
|
|
5739
|
+
if (objectNodeId === RDF_NIL) {
|
|
5740
|
+
const object = nodeMap[objectNodeId];
|
|
5853
5741
|
if (!("usages" in object)) {
|
|
5854
5742
|
object.usages = [];
|
|
5855
5743
|
}
|
|
@@ -5858,10 +5746,10 @@ var require_fromRdf = __commonJS({
|
|
|
5858
5746
|
property: p,
|
|
5859
5747
|
value
|
|
5860
5748
|
});
|
|
5861
|
-
} else if (
|
|
5862
|
-
referencedOnce[
|
|
5749
|
+
} else if (objectNodeId in referencedOnce) {
|
|
5750
|
+
referencedOnce[objectNodeId] = false;
|
|
5863
5751
|
} else {
|
|
5864
|
-
referencedOnce[
|
|
5752
|
+
referencedOnce[objectNodeId] = {
|
|
5865
5753
|
node,
|
|
5866
5754
|
property: p,
|
|
5867
5755
|
value
|
|
@@ -5927,8 +5815,9 @@ var require_fromRdf = __commonJS({
|
|
|
5927
5815
|
return result;
|
|
5928
5816
|
};
|
|
5929
5817
|
function _RDFToObject(o, useNativeTypes, rdfDirection, options) {
|
|
5930
|
-
|
|
5931
|
-
|
|
5818
|
+
const nodeId = _nodeId(o);
|
|
5819
|
+
if (nodeId) {
|
|
5820
|
+
return { "@id": nodeId };
|
|
5932
5821
|
}
|
|
5933
5822
|
const rval = { "@value": o.value };
|
|
5934
5823
|
if (o.language) {
|
|
@@ -5968,22 +5857,29 @@ var require_fromRdf = __commonJS({
|
|
|
5968
5857
|
}
|
|
5969
5858
|
if (useNativeTypes) {
|
|
5970
5859
|
if (type === XSD_BOOLEAN) {
|
|
5971
|
-
if (rval["@value"] === "true") {
|
|
5860
|
+
if (rval["@value"] === "true" || rval["@value"] === "1") {
|
|
5972
5861
|
rval["@value"] = true;
|
|
5973
|
-
} else if (rval["@value"] === "false") {
|
|
5862
|
+
} else if (rval["@value"] === "false" || rval["@value"] === "0") {
|
|
5974
5863
|
rval["@value"] = false;
|
|
5864
|
+
} else {
|
|
5865
|
+
rval["@type"] = type;
|
|
5975
5866
|
}
|
|
5976
|
-
} else if (
|
|
5977
|
-
if (
|
|
5867
|
+
} else if (type === XSD_INTEGER) {
|
|
5868
|
+
if (types.isNumeric(rval["@value"])) {
|
|
5978
5869
|
const i = parseInt(rval["@value"], 10);
|
|
5979
5870
|
if (i.toFixed(0) === rval["@value"]) {
|
|
5980
5871
|
rval["@value"] = i;
|
|
5981
5872
|
}
|
|
5982
|
-
} else
|
|
5873
|
+
} else {
|
|
5874
|
+
rval["@type"] = type;
|
|
5875
|
+
}
|
|
5876
|
+
} else if (type === XSD_DOUBLE) {
|
|
5877
|
+
if (types.isNumeric(rval["@value"])) {
|
|
5983
5878
|
rval["@value"] = parseFloat(rval["@value"]);
|
|
5879
|
+
} else {
|
|
5880
|
+
rval["@type"] = type;
|
|
5984
5881
|
}
|
|
5985
|
-
}
|
|
5986
|
-
if (![XSD_BOOLEAN, XSD_INTEGER, XSD_DOUBLE, XSD_STRING].includes(type)) {
|
|
5882
|
+
} else {
|
|
5987
5883
|
rval["@type"] = type;
|
|
5988
5884
|
}
|
|
5989
5885
|
} else if (rdfDirection === "i18n-datatype" && type.startsWith("https://www.w3.org/ns/i18n#")) {
|
|
@@ -6014,31 +5910,50 @@ var require_fromRdf = __commonJS({
|
|
|
6014
5910
|
}
|
|
6015
5911
|
return rval;
|
|
6016
5912
|
}
|
|
5913
|
+
function _nodeId(term) {
|
|
5914
|
+
if (term.termType === "NamedNode") {
|
|
5915
|
+
return term.value;
|
|
5916
|
+
} else if (term.termType === "BlankNode") {
|
|
5917
|
+
return "_:" + term.value;
|
|
5918
|
+
}
|
|
5919
|
+
return null;
|
|
5920
|
+
}
|
|
6017
5921
|
}
|
|
6018
5922
|
});
|
|
6019
5923
|
|
|
6020
|
-
// ../node_modules/
|
|
5924
|
+
// ../node_modules/canonicalize/lib/canonicalize.js
|
|
6021
5925
|
var require_canonicalize = __commonJS({
|
|
6022
|
-
"../node_modules/
|
|
5926
|
+
"../node_modules/canonicalize/lib/canonicalize.js"(exports, module) {
|
|
6023
5927
|
"use strict";
|
|
6024
5928
|
module.exports = function serialize(object) {
|
|
6025
|
-
if (
|
|
5929
|
+
if (typeof object === "number" && isNaN(object)) {
|
|
5930
|
+
throw new Error("NaN is not allowed");
|
|
5931
|
+
}
|
|
5932
|
+
if (typeof object === "number" && !isFinite(object)) {
|
|
5933
|
+
throw new Error("Infinity is not allowed");
|
|
5934
|
+
}
|
|
5935
|
+
if (object === null || typeof object !== "object") {
|
|
6026
5936
|
return JSON.stringify(object);
|
|
6027
5937
|
}
|
|
5938
|
+
if (object.toJSON instanceof Function) {
|
|
5939
|
+
return serialize(object.toJSON());
|
|
5940
|
+
}
|
|
6028
5941
|
if (Array.isArray(object)) {
|
|
6029
|
-
|
|
5942
|
+
const values2 = object.reduce((t, cv, ci) => {
|
|
6030
5943
|
const comma = ci === 0 ? "" : ",";
|
|
6031
5944
|
const value = cv === void 0 || typeof cv === "symbol" ? null : cv;
|
|
6032
|
-
return t
|
|
6033
|
-
}, "")
|
|
5945
|
+
return `${t}${comma}${serialize(value)}`;
|
|
5946
|
+
}, "");
|
|
5947
|
+
return `[${values2}]`;
|
|
6034
5948
|
}
|
|
6035
|
-
|
|
5949
|
+
const values = Object.keys(object).sort().reduce((t, cv) => {
|
|
6036
5950
|
if (object[cv] === void 0 || typeof object[cv] === "symbol") {
|
|
6037
5951
|
return t;
|
|
6038
5952
|
}
|
|
6039
5953
|
const comma = t.length === 0 ? "" : ",";
|
|
6040
|
-
return t
|
|
6041
|
-
}, "")
|
|
5954
|
+
return `${t}${comma}${serialize(cv)}:${serialize(object[cv])}`;
|
|
5955
|
+
}, "");
|
|
5956
|
+
return `{${values}}`;
|
|
6042
5957
|
};
|
|
6043
5958
|
}
|
|
6044
5959
|
});
|
|
@@ -6091,12 +6006,7 @@ var require_toRdf = __commonJS({
|
|
|
6091
6006
|
if (graphName === "@default") {
|
|
6092
6007
|
graphTerm = { termType: "DefaultGraph", value: "" };
|
|
6093
6008
|
} else if (_isAbsoluteIri(graphName)) {
|
|
6094
|
-
|
|
6095
|
-
graphTerm = { termType: "BlankNode" };
|
|
6096
|
-
} else {
|
|
6097
|
-
graphTerm = { termType: "NamedNode" };
|
|
6098
|
-
}
|
|
6099
|
-
graphTerm.value = graphName;
|
|
6009
|
+
graphTerm = _makeTerm(graphName);
|
|
6100
6010
|
} else {
|
|
6101
6011
|
if (options.eventHandler) {
|
|
6102
6012
|
_handleEvent({
|
|
@@ -6131,10 +6041,7 @@ var require_toRdf = __commonJS({
|
|
|
6131
6041
|
continue;
|
|
6132
6042
|
}
|
|
6133
6043
|
for (const item of items) {
|
|
6134
|
-
const subject =
|
|
6135
|
-
termType: id.startsWith("_:") ? "BlankNode" : "NamedNode",
|
|
6136
|
-
value: id
|
|
6137
|
-
};
|
|
6044
|
+
const subject = _makeTerm(id);
|
|
6138
6045
|
if (!_isAbsoluteIri(id)) {
|
|
6139
6046
|
if (options.eventHandler) {
|
|
6140
6047
|
_handleEvent({
|
|
@@ -6152,10 +6059,7 @@ var require_toRdf = __commonJS({
|
|
|
6152
6059
|
}
|
|
6153
6060
|
continue;
|
|
6154
6061
|
}
|
|
6155
|
-
const predicate =
|
|
6156
|
-
termType: property.startsWith("_:") ? "BlankNode" : "NamedNode",
|
|
6157
|
-
value: property
|
|
6158
|
-
};
|
|
6062
|
+
const predicate = _makeTerm(property);
|
|
6159
6063
|
if (!_isAbsoluteIri(property)) {
|
|
6160
6064
|
if (options.eventHandler) {
|
|
6161
6065
|
_handleEvent({
|
|
@@ -6216,7 +6120,10 @@ var require_toRdf = __commonJS({
|
|
|
6216
6120
|
const rest = { termType: "NamedNode", value: RDF_REST };
|
|
6217
6121
|
const nil = { termType: "NamedNode", value: RDF_NIL };
|
|
6218
6122
|
const last = list.pop();
|
|
6219
|
-
const result = last ? {
|
|
6123
|
+
const result = last ? {
|
|
6124
|
+
termType: "BlankNode",
|
|
6125
|
+
value: issuer.getId().slice(2)
|
|
6126
|
+
} : nil;
|
|
6220
6127
|
let subject = result;
|
|
6221
6128
|
for (const item of list) {
|
|
6222
6129
|
const object = _objectToRDF(
|
|
@@ -6227,7 +6134,7 @@ var require_toRdf = __commonJS({
|
|
|
6227
6134
|
rdfDirection,
|
|
6228
6135
|
options
|
|
6229
6136
|
);
|
|
6230
|
-
const next = { termType: "BlankNode", value: issuer.getId() };
|
|
6137
|
+
const next = { termType: "BlankNode", value: issuer.getId().slice(2) };
|
|
6231
6138
|
dataset.push({
|
|
6232
6139
|
subject,
|
|
6233
6140
|
predicate: first,
|
|
@@ -6267,12 +6174,14 @@ var require_toRdf = __commonJS({
|
|
|
6267
6174
|
return result;
|
|
6268
6175
|
}
|
|
6269
6176
|
function _objectToRDF(item, issuer, dataset, graphTerm, rdfDirection, options) {
|
|
6270
|
-
|
|
6177
|
+
let object;
|
|
6271
6178
|
if (graphTypes.isValue(item)) {
|
|
6272
|
-
object
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6179
|
+
object = {
|
|
6180
|
+
termType: "Literal",
|
|
6181
|
+
value: void 0,
|
|
6182
|
+
datatype: {
|
|
6183
|
+
termType: "NamedNode"
|
|
6184
|
+
}
|
|
6276
6185
|
};
|
|
6277
6186
|
let value = item["@value"];
|
|
6278
6187
|
const datatype = item["@type"] || null;
|
|
@@ -6358,12 +6267,13 @@ var require_toRdf = __commonJS({
|
|
|
6358
6267
|
rdfDirection,
|
|
6359
6268
|
options
|
|
6360
6269
|
);
|
|
6361
|
-
object
|
|
6362
|
-
|
|
6270
|
+
object = {
|
|
6271
|
+
termType: _list.termType,
|
|
6272
|
+
value: _list.value
|
|
6273
|
+
};
|
|
6363
6274
|
} else {
|
|
6364
6275
|
const id = types.isObject(item) ? item["@id"] : item;
|
|
6365
|
-
object
|
|
6366
|
-
object.value = id;
|
|
6276
|
+
object = _makeTerm(id);
|
|
6367
6277
|
}
|
|
6368
6278
|
if (object.termType === "NamedNode" && !_isAbsoluteIri(object.value)) {
|
|
6369
6279
|
if (options.eventHandler) {
|
|
@@ -6384,6 +6294,18 @@ var require_toRdf = __commonJS({
|
|
|
6384
6294
|
}
|
|
6385
6295
|
return object;
|
|
6386
6296
|
}
|
|
6297
|
+
function _makeTerm(id) {
|
|
6298
|
+
if (id.startsWith("_:")) {
|
|
6299
|
+
return {
|
|
6300
|
+
termType: "BlankNode",
|
|
6301
|
+
value: id.slice(2)
|
|
6302
|
+
};
|
|
6303
|
+
}
|
|
6304
|
+
return {
|
|
6305
|
+
termType: "NamedNode",
|
|
6306
|
+
value: id
|
|
6307
|
+
};
|
|
6308
|
+
}
|
|
6387
6309
|
}
|
|
6388
6310
|
});
|
|
6389
6311
|
|
|
@@ -7869,7 +7791,7 @@ var require_JsonLdProcessor = __commonJS({
|
|
|
7869
7791
|
var require_jsonld = __commonJS({
|
|
7870
7792
|
"../node_modules/jsonld/lib/jsonld.js"(exports, module) {
|
|
7871
7793
|
var canonize = require_rdf_canonize();
|
|
7872
|
-
var platform =
|
|
7794
|
+
var platform = require_platform_browser2();
|
|
7873
7795
|
var util = require_util();
|
|
7874
7796
|
var ContextResolver = require_ContextResolver();
|
|
7875
7797
|
var IdentifierIssuer = util.IdentifierIssuer;
|
|
@@ -8169,29 +8091,31 @@ var require_jsonld = __commonJS({
|
|
|
8169
8091
|
throw new TypeError("Could not canonize, too few arguments.");
|
|
8170
8092
|
}
|
|
8171
8093
|
options = _setDefaults(options, {
|
|
8172
|
-
base: _isString(input) ? input : null,
|
|
8173
|
-
algorithm: "URDNA2015",
|
|
8174
8094
|
skipExpansion: false,
|
|
8175
8095
|
safe: true,
|
|
8176
8096
|
contextResolver: new ContextResolver(
|
|
8177
8097
|
{ sharedCache: _resolvedContextCache }
|
|
8178
8098
|
)
|
|
8179
8099
|
});
|
|
8100
|
+
const canonizeOptions = Object.assign({}, {
|
|
8101
|
+
algorithm: "RDFC-1.0"
|
|
8102
|
+
}, options.canonizeOptions || null);
|
|
8180
8103
|
if ("inputFormat" in options) {
|
|
8181
|
-
if (options.inputFormat !== "application/n-quads"
|
|
8104
|
+
if (options.inputFormat !== "application/n-quads") {
|
|
8182
8105
|
throw new JsonLdError(
|
|
8183
8106
|
"Unknown canonicalization input format.",
|
|
8184
8107
|
"jsonld.CanonizeError"
|
|
8185
8108
|
);
|
|
8186
8109
|
}
|
|
8187
8110
|
const parsedInput = NQuads.parse(input);
|
|
8188
|
-
return canonize.canonize(parsedInput,
|
|
8111
|
+
return canonize.canonize(parsedInput, canonizeOptions);
|
|
8189
8112
|
}
|
|
8190
8113
|
const opts = { ...options };
|
|
8191
8114
|
delete opts.format;
|
|
8115
|
+
delete opts.canonizeOptions;
|
|
8192
8116
|
opts.produceGeneralizedRdf = false;
|
|
8193
8117
|
const dataset = await jsonld.toRDF(input, opts);
|
|
8194
|
-
return canonize.canonize(dataset,
|
|
8118
|
+
return canonize.canonize(dataset, canonizeOptions);
|
|
8195
8119
|
};
|
|
8196
8120
|
jsonld.fromRDF = async function(dataset, options) {
|
|
8197
8121
|
if (arguments.length < 1) {
|
|
@@ -8222,7 +8146,6 @@ var require_jsonld = __commonJS({
|
|
|
8222
8146
|
throw new TypeError("Could not convert to RDF, too few arguments.");
|
|
8223
8147
|
}
|
|
8224
8148
|
options = _setDefaults(options, {
|
|
8225
|
-
base: _isString(input) ? input : "",
|
|
8226
8149
|
skipExpansion: false,
|
|
8227
8150
|
contextResolver: new ContextResolver(
|
|
8228
8151
|
{ sharedCache: _resolvedContextCache }
|
|
@@ -8236,7 +8159,7 @@ var require_jsonld = __commonJS({
|
|
|
8236
8159
|
}
|
|
8237
8160
|
const dataset = _toRDF(expanded, options);
|
|
8238
8161
|
if (options.format) {
|
|
8239
|
-
if (options.format === "application/n-quads"
|
|
8162
|
+
if (options.format === "application/n-quads") {
|
|
8240
8163
|
return NQuads.serialize(dataset);
|
|
8241
8164
|
}
|
|
8242
8165
|
throw new JsonLdError(
|
|
@@ -8406,7 +8329,6 @@ var require_jsonld = __commonJS({
|
|
|
8406
8329
|
delete _rdfParsers[contentType];
|
|
8407
8330
|
};
|
|
8408
8331
|
jsonld.registerRDFParser("application/n-quads", NQuads.parse);
|
|
8409
|
-
jsonld.registerRDFParser("application/nquads", NQuads.parse);
|
|
8410
8332
|
jsonld.url = require_url();
|
|
8411
8333
|
jsonld.logEventHandler = _logEventHandler;
|
|
8412
8334
|
jsonld.logWarningEventHandler = _logWarningEventHandler;
|
|
@@ -8459,19 +8381,22 @@ var require_jsonld = __commonJS({
|
|
|
8459
8381
|
export default require_jsonld();
|
|
8460
8382
|
/*! Bundled license information:
|
|
8461
8383
|
|
|
8462
|
-
rdf-canonize/lib/
|
|
8463
|
-
rdf-canonize/lib/Permuter.js:
|
|
8464
|
-
rdf-canonize/lib/NQuads.js:
|
|
8465
|
-
rdf-canonize/lib/URDNA2015.js:
|
|
8466
|
-
rdf-canonize/lib/URGNA2012.js:
|
|
8467
|
-
rdf-canonize/lib/URDNA2015Sync.js:
|
|
8384
|
+
rdf-canonize/lib/platform-browser.js:
|
|
8468
8385
|
(*!
|
|
8469
|
-
* Copyright (c)
|
|
8386
|
+
* Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
|
|
8387
|
+
*)
|
|
8388
|
+
|
|
8389
|
+
rdf-canonize/lib/MessageDigest-webcrypto.js:
|
|
8390
|
+
rdf-canonize/lib/RDFC10.js:
|
|
8391
|
+
rdf-canonize/lib/RDFC10Sync.js:
|
|
8392
|
+
(*!
|
|
8393
|
+
* Copyright (c) 2016-2023 Digital Bazaar, Inc. All rights reserved.
|
|
8470
8394
|
*)
|
|
8471
8395
|
|
|
8472
|
-
rdf-canonize/lib/
|
|
8396
|
+
rdf-canonize/lib/Permuter.js:
|
|
8397
|
+
rdf-canonize/lib/NQuads.js:
|
|
8473
8398
|
(*!
|
|
8474
|
-
* Copyright (c) 2016-
|
|
8399
|
+
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
8475
8400
|
*)
|
|
8476
8401
|
|
|
8477
8402
|
jsonld/lib/context.js:
|