@pod-os/core 0.6.1-2196a40.0 → 0.6.1-4ea2c6e.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.
Files changed (3) hide show
  1. package/dist/index.js +1630 -228
  2. package/lib/index.js +1630 -228
  3. package/package.json +9 -9
package/lib/index.js CHANGED
@@ -25,6 +25,10 @@ var PodOS = (() => {
25
25
  return to;
26
26
  };
27
27
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
28
+ // If the importer is in node compatibility mode or this is not an ESM
29
+ // file that has been converted to a CommonJS file using a Babel-
30
+ // compatible transform (i.e. "__esModule" has not been set), then set
31
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
32
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
33
  mod
30
34
  ));
@@ -1011,6 +1015,9 @@ var PodOS = (() => {
1011
1015
  var init_errors = __esm({
1012
1016
  "../node_modules/jose/dist/browser/util/errors.js"() {
1013
1017
  JOSEError = class extends Error {
1018
+ static get code() {
1019
+ return "ERR_JOSE_GENERIC";
1020
+ }
1014
1021
  constructor(message2) {
1015
1022
  var _a;
1016
1023
  super(message2);
@@ -1018,31 +1025,28 @@ var PodOS = (() => {
1018
1025
  this.name = this.constructor.name;
1019
1026
  (_a = Error.captureStackTrace) === null || _a === void 0 ? void 0 : _a.call(Error, this, this.constructor);
1020
1027
  }
1021
- static get code() {
1022
- return "ERR_JOSE_GENERIC";
1023
- }
1024
1028
  };
1025
1029
  JWTClaimValidationFailed = class extends JOSEError {
1030
+ static get code() {
1031
+ return "ERR_JWT_CLAIM_VALIDATION_FAILED";
1032
+ }
1026
1033
  constructor(message2, claim = "unspecified", reason = "unspecified") {
1027
1034
  super(message2);
1028
1035
  this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
1029
1036
  this.claim = claim;
1030
1037
  this.reason = reason;
1031
1038
  }
1032
- static get code() {
1033
- return "ERR_JWT_CLAIM_VALIDATION_FAILED";
1034
- }
1035
1039
  };
1036
1040
  JWTExpired = class extends JOSEError {
1041
+ static get code() {
1042
+ return "ERR_JWT_EXPIRED";
1043
+ }
1037
1044
  constructor(message2, claim = "unspecified", reason = "unspecified") {
1038
1045
  super(message2);
1039
1046
  this.code = "ERR_JWT_EXPIRED";
1040
1047
  this.claim = claim;
1041
1048
  this.reason = reason;
1042
1049
  }
1043
- static get code() {
1044
- return "ERR_JWT_EXPIRED";
1045
- }
1046
1050
  };
1047
1051
  JOSEAlgNotAllowed = class extends JOSEError {
1048
1052
  constructor() {
@@ -8229,7 +8233,9 @@ ${newlined}
8229
8233
  }
8230
8234
  }
8231
8235
  return true;
8232
- }, w.prototype.clone = function Wt() {
8236
+ }, w.prototype.clone = /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
8237
+ */
8238
+ function Wt() {
8233
8239
  var t3 = F();
8234
8240
  return this.copyTo(t3), t3;
8235
8241
  }, w.prototype.intValue = function zt() {
@@ -8622,7 +8628,9 @@ ${newlined}
8622
8628
  default:
8623
8629
  return null;
8624
8630
  }
8625
- }, He.prototype.getByteLength = function() {
8631
+ }, /*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib
8632
+ */
8633
+ He.prototype.getByteLength = function() {
8626
8634
  return Math.floor((this.toBigInteger().bitLength() + 7) / 8);
8627
8635
  }, Ve.prototype.getEncoded = function(t3) {
8628
8636
  var e2 = function t4(e3, r4) {
@@ -14626,15 +14634,36 @@ ${newlined}
14626
14634
  "../node_modules/rdf-canonize/lib/IdentifierIssuer.js"(exports, module2) {
14627
14635
  "use strict";
14628
14636
  module2.exports = class IdentifierIssuer {
14637
+ /**
14638
+ * Creates a new IdentifierIssuer. A IdentifierIssuer issues unique
14639
+ * identifiers, keeping track of any previously issued identifiers.
14640
+ *
14641
+ * @param prefix the prefix to use ('<prefix><counter>').
14642
+ * @param existing an existing Map to use.
14643
+ * @param counter the counter to use.
14644
+ */
14629
14645
  constructor(prefix, existing = /* @__PURE__ */ new Map(), counter = 0) {
14630
14646
  this.prefix = prefix;
14631
14647
  this._existing = existing;
14632
14648
  this.counter = counter;
14633
14649
  }
14650
+ /**
14651
+ * Copies this IdentifierIssuer.
14652
+ *
14653
+ * @return a copy of this IdentifierIssuer.
14654
+ */
14634
14655
  clone() {
14635
14656
  const { prefix, _existing, counter } = this;
14636
14657
  return new IdentifierIssuer(prefix, new Map(_existing), counter);
14637
14658
  }
14659
+ /**
14660
+ * Gets the new identifier for the given old identifier, where if no old
14661
+ * identifier is given a new identifier will be generated.
14662
+ *
14663
+ * @param [old] the old identifier to get the new identifier for.
14664
+ *
14665
+ * @return the new identifier.
14666
+ */
14638
14667
  getId(old) {
14639
14668
  const existing = old && this._existing.get(old);
14640
14669
  if (existing) {
@@ -14647,9 +14676,24 @@ ${newlined}
14647
14676
  }
14648
14677
  return identifier;
14649
14678
  }
14679
+ /**
14680
+ * Returns true if the given old identifer has already been assigned a new
14681
+ * identifier.
14682
+ *
14683
+ * @param old the old identifier to check.
14684
+ *
14685
+ * @return true if the old identifier has been assigned a new identifier,
14686
+ * false if not.
14687
+ */
14650
14688
  hasId(old) {
14651
14689
  return this._existing.has(old);
14652
14690
  }
14691
+ /**
14692
+ * Returns all of the IDs that have been issued new IDs in the order in
14693
+ * which they were issued new IDs.
14694
+ *
14695
+ * @return the list of old IDs that has been issued new IDs in order.
14696
+ */
14653
14697
  getOldIds() {
14654
14698
  return [...this._existing.keys()];
14655
14699
  }
@@ -14812,6 +14856,11 @@ ${newlined}
14812
14856
  require_setImmediate();
14813
14857
  var crypto2 = self.crypto || self.msCrypto;
14814
14858
  module2.exports = class MessageDigest {
14859
+ /**
14860
+ * Creates a new MessageDigest.
14861
+ *
14862
+ * @param algorithm the algorithm to use.
14863
+ */
14815
14864
  constructor(algorithm) {
14816
14865
  if (!(crypto2 && crypto2.subtle)) {
14817
14866
  throw new Error("crypto.subtle not found.");
@@ -14848,6 +14897,12 @@ ${newlined}
14848
14897
  "../node_modules/rdf-canonize/lib/Permuter.js"(exports, module2) {
14849
14898
  "use strict";
14850
14899
  module2.exports = class Permuter {
14900
+ /**
14901
+ * A Permuter iterates over all possible permutations of the given array
14902
+ * of elements.
14903
+ *
14904
+ * @param list the array of elements to iterate over.
14905
+ */
14851
14906
  constructor(list) {
14852
14907
  this.current = list.sort();
14853
14908
  this.done = false;
@@ -14856,9 +14911,20 @@ ${newlined}
14856
14911
  this.dir.set(list[i], true);
14857
14912
  }
14858
14913
  }
14914
+ /**
14915
+ * Returns true if there is another permutation.
14916
+ *
14917
+ * @return true if there is another permutation, false if not.
14918
+ */
14859
14919
  hasNext() {
14860
14920
  return !this.done;
14861
14921
  }
14922
+ /**
14923
+ * Gets the next permutation. Call hasNext() to ensure there is another one
14924
+ * first.
14925
+ *
14926
+ * @return the next permutation.
14927
+ */
14862
14928
  next() {
14863
14929
  const { current, dir: dir2 } = this;
14864
14930
  const rval = current.slice();
@@ -14927,6 +14993,13 @@ ${newlined}
14927
14993
  );
14928
14994
  })();
14929
14995
  module2.exports = class NQuads {
14996
+ /**
14997
+ * Parses RDF in the form of N-Quads.
14998
+ *
14999
+ * @param input the N-Quads input to parse.
15000
+ *
15001
+ * @return an RDF dataset (an array of quads per http://rdf.js.org/).
15002
+ */
14930
15003
  static parse(input) {
14931
15004
  const dataset = [];
14932
15005
  const graphs = {};
@@ -15006,6 +15079,13 @@ ${newlined}
15006
15079
  }
15007
15080
  return dataset;
15008
15081
  }
15082
+ /**
15083
+ * Converts an RDF dataset to N-Quads.
15084
+ *
15085
+ * @param dataset (array of quads) the RDF dataset to convert.
15086
+ *
15087
+ * @return the N-Quads string.
15088
+ */
15009
15089
  static serialize(dataset) {
15010
15090
  if (!Array.isArray(dataset)) {
15011
15091
  dataset = NQuads.legacyDatasetToQuads(dataset);
@@ -15016,6 +15096,16 @@ ${newlined}
15016
15096
  }
15017
15097
  return quads.sort().join("");
15018
15098
  }
15099
+ /**
15100
+ * Converts RDF quad components to an N-Quad string (a single quad).
15101
+ *
15102
+ * @param {Object} s - N-Quad subject component.
15103
+ * @param {Object} p - N-Quad predicate component.
15104
+ * @param {Object} o - N-Quad object component.
15105
+ * @param {Object} g - N-Quad graph component.
15106
+ *
15107
+ * @return {string} the N-Quad.
15108
+ */
15019
15109
  static serializeQuadComponents(s, p, o, g) {
15020
15110
  let nquad = "";
15021
15111
  if (s.termType === TYPE_NAMED_NODE) {
@@ -15046,6 +15136,13 @@ ${newlined}
15046
15136
  nquad += " .\n";
15047
15137
  return nquad;
15048
15138
  }
15139
+ /**
15140
+ * Converts an RDF quad to an N-Quad string (a single quad).
15141
+ *
15142
+ * @param quad the RDF quad convert.
15143
+ *
15144
+ * @return the N-Quad string.
15145
+ */
15049
15146
  static serializeQuad(quad5) {
15050
15147
  return NQuads.serializeQuadComponents(
15051
15148
  quad5.subject,
@@ -15054,6 +15151,14 @@ ${newlined}
15054
15151
  quad5.graph
15055
15152
  );
15056
15153
  }
15154
+ /**
15155
+ * Converts a legacy-formatted dataset to an array of quads dataset per
15156
+ * http://rdf.js.org/.
15157
+ *
15158
+ * @param dataset the legacy dataset to convert.
15159
+ *
15160
+ * @return the array of quads dataset.
15161
+ */
15057
15162
  static legacyDatasetToQuads(dataset) {
15058
15163
  const quads = [];
15059
15164
  const termTypeMap = {
@@ -15188,6 +15293,7 @@ ${newlined}
15188
15293
  this.quads = null;
15189
15294
  this.deepIterations = null;
15190
15295
  }
15296
+ // 4.4) Normalization Algorithm
15191
15297
  async main(dataset) {
15192
15298
  this.deepIterations = /* @__PURE__ */ new Map();
15193
15299
  this.quads = dataset;
@@ -15248,6 +15354,7 @@ ${newlined}
15248
15354
  normalized.sort();
15249
15355
  return normalized.join("");
15250
15356
  }
15357
+ // 4.6) Hash First Degree Quads
15251
15358
  async hashFirstDegreeQuads(id3) {
15252
15359
  const nquads = [];
15253
15360
  const info2 = this.blankNodeInfo.get(id3);
@@ -15284,6 +15391,7 @@ ${newlined}
15284
15391
  info2.hash = await md.digest();
15285
15392
  return info2.hash;
15286
15393
  }
15394
+ // 4.7) Hash Related Blank Node
15287
15395
  async hashRelatedBlankNode(related, quad5, issuer, position) {
15288
15396
  let id3;
15289
15397
  if (this.canonicalIssuer.hasId(related)) {
@@ -15301,6 +15409,7 @@ ${newlined}
15301
15409
  md.update(id3);
15302
15410
  return md.digest();
15303
15411
  }
15412
+ // 4.8) Hash N-Degree Quads
15304
15413
  async hashNDegreeQuads(id3, issuer) {
15305
15414
  const deepIterations = this.deepIterations.get(id3) || 0;
15306
15415
  if (deepIterations > this.maxDeepIterations) {
@@ -15367,6 +15476,7 @@ ${newlined}
15367
15476
  }
15368
15477
  return { hash: await md.digest(), issuer };
15369
15478
  }
15479
+ // helper for modifying component during Hash First Degree Quads
15370
15480
  modifyFirstDegreeComponent(id3, component) {
15371
15481
  if (component.termType !== "BlankNode") {
15372
15482
  return component;
@@ -15376,9 +15486,11 @@ ${newlined}
15376
15486
  value: component.value === id3 ? "_:a" : "_:z"
15377
15487
  };
15378
15488
  }
15489
+ // helper for getting a related predicate
15379
15490
  getRelatedPredicate(quad5) {
15380
15491
  return `<${quad5.predicate.value}>`;
15381
15492
  }
15493
+ // helper for creating hash to related blank nodes map
15382
15494
  async createHashToRelated(id3, issuer) {
15383
15495
  const hashToRelated = /* @__PURE__ */ new Map();
15384
15496
  const quads = this.blankNodeInfo.get(id3).quads;
@@ -15455,6 +15567,7 @@ ${newlined}
15455
15567
  hashToRelated.set(hash, [related]);
15456
15568
  }
15457
15569
  }
15570
+ // canonical ids for 7.1
15458
15571
  _componentWithCanonicalId(component) {
15459
15572
  if (component.termType === "BlankNode" && !component.value.startsWith(this.canonicalIssuer.prefix)) {
15460
15573
  return {
@@ -15486,6 +15599,7 @@ ${newlined}
15486
15599
  this.name = "URGNA2012";
15487
15600
  this.createMessageDigest = () => new MessageDigest("sha1");
15488
15601
  }
15602
+ // helper for modifying component during Hash First Degree Quads
15489
15603
  modifyFirstDegreeComponent(id3, component, key) {
15490
15604
  if (component.termType !== "BlankNode") {
15491
15605
  return component;
@@ -15501,9 +15615,11 @@ ${newlined}
15501
15615
  value: component.value === id3 ? "_:a" : "_:z"
15502
15616
  };
15503
15617
  }
15618
+ // helper for getting a related predicate
15504
15619
  getRelatedPredicate(quad5) {
15505
15620
  return quad5.predicate.value;
15506
15621
  }
15622
+ // helper for creating hash to related blank nodes map
15507
15623
  async createHashToRelated(id3, issuer) {
15508
15624
  const hashToRelated = /* @__PURE__ */ new Map();
15509
15625
  const quads = this.blankNodeInfo.get(id3).quads;
@@ -15563,6 +15679,7 @@ ${newlined}
15563
15679
  this.quads = null;
15564
15680
  this.deepIterations = null;
15565
15681
  }
15682
+ // 4.4) Normalization Algorithm
15566
15683
  main(dataset) {
15567
15684
  this.deepIterations = /* @__PURE__ */ new Map();
15568
15685
  this.quads = dataset;
@@ -15619,6 +15736,7 @@ ${newlined}
15619
15736
  normalized.sort();
15620
15737
  return normalized.join("");
15621
15738
  }
15739
+ // 4.6) Hash First Degree Quads
15622
15740
  hashFirstDegreeQuads(id3) {
15623
15741
  const nquads = [];
15624
15742
  const info2 = this.blankNodeInfo.get(id3);
@@ -15655,6 +15773,7 @@ ${newlined}
15655
15773
  info2.hash = md.digest();
15656
15774
  return info2.hash;
15657
15775
  }
15776
+ // 4.7) Hash Related Blank Node
15658
15777
  hashRelatedBlankNode(related, quad5, issuer, position) {
15659
15778
  let id3;
15660
15779
  if (this.canonicalIssuer.hasId(related)) {
@@ -15672,6 +15791,7 @@ ${newlined}
15672
15791
  md.update(id3);
15673
15792
  return md.digest();
15674
15793
  }
15794
+ // 4.8) Hash N-Degree Quads
15675
15795
  hashNDegreeQuads(id3, issuer) {
15676
15796
  const deepIterations = this.deepIterations.get(id3) || 0;
15677
15797
  if (deepIterations > this.maxDeepIterations) {
@@ -15734,6 +15854,7 @@ ${newlined}
15734
15854
  }
15735
15855
  return { hash: md.digest(), issuer };
15736
15856
  }
15857
+ // helper for modifying component during Hash First Degree Quads
15737
15858
  modifyFirstDegreeComponent(id3, component) {
15738
15859
  if (component.termType !== "BlankNode") {
15739
15860
  return component;
@@ -15743,9 +15864,11 @@ ${newlined}
15743
15864
  value: component.value === id3 ? "_:a" : "_:z"
15744
15865
  };
15745
15866
  }
15867
+ // helper for getting a related predicate
15746
15868
  getRelatedPredicate(quad5) {
15747
15869
  return `<${quad5.predicate.value}>`;
15748
15870
  }
15871
+ // helper for creating hash to related blank nodes map
15749
15872
  createHashToRelated(id3, issuer) {
15750
15873
  const hashToRelated = /* @__PURE__ */ new Map();
15751
15874
  const quads = this.blankNodeInfo.get(id3).quads;
@@ -15811,6 +15934,7 @@ ${newlined}
15811
15934
  hashToRelated.set(hash, [related]);
15812
15935
  }
15813
15936
  }
15937
+ // canonical ids for 7.1
15814
15938
  _componentWithCanonicalId({ component }) {
15815
15939
  if (component.termType === "BlankNode" && !component.value.startsWith(this.canonicalIssuer.prefix)) {
15816
15940
  return {
@@ -15839,6 +15963,7 @@ ${newlined}
15839
15963
  this.name = "URGNA2012";
15840
15964
  this.createMessageDigest = () => new MessageDigest("sha1");
15841
15965
  }
15966
+ // helper for modifying component during Hash First Degree Quads
15842
15967
  modifyFirstDegreeComponent(id3, component, key) {
15843
15968
  if (component.termType !== "BlankNode") {
15844
15969
  return component;
@@ -15854,9 +15979,11 @@ ${newlined}
15854
15979
  value: component.value === id3 ? "_:a" : "_:z"
15855
15980
  };
15856
15981
  }
15982
+ // helper for getting a related predicate
15857
15983
  getRelatedPredicate(quad5) {
15858
15984
  return quad5.predicate.value;
15859
15985
  }
15986
+ // helper for creating hash to related blank nodes map
15860
15987
  createHashToRelated(id3, issuer) {
15861
15988
  const hashToRelated = /* @__PURE__ */ new Map();
15862
15989
  const quads = this.blankNodeInfo.get(id3).quads;
@@ -16022,8 +16149,14 @@ ${newlined}
16022
16149
  return false;
16023
16150
  };
16024
16151
  api.isSubjectReference = (v) => types2.isObject(v) && Object.keys(v).length === 1 && "@id" in v;
16025
- api.isValue = (v) => types2.isObject(v) && "@value" in v;
16026
- api.isList = (v) => types2.isObject(v) && "@list" in v;
16152
+ api.isValue = (v) => // Note: A value is a @value if all of these hold true:
16153
+ // 1. It is an Object.
16154
+ // 2. It has the @value property.
16155
+ types2.isObject(v) && "@value" in v;
16156
+ api.isList = (v) => // Note: A value is a @list if all of these hold true:
16157
+ // 1. It is an Object.
16158
+ // 2. It has the @list property.
16159
+ types2.isObject(v) && "@list" in v;
16027
16160
  api.isGraph = (v) => {
16028
16161
  return types2.isObject(v) && "@graph" in v && Object.keys(v).filter((key) => key !== "@id" && key !== "@index").length === 1;
16029
16162
  };
@@ -16047,6 +16180,13 @@ ${newlined}
16047
16180
  "../node_modules/jsonld/lib/JsonLdError.js"(exports, module2) {
16048
16181
  "use strict";
16049
16182
  module2.exports = class JsonLdError extends Error {
16183
+ /**
16184
+ * Creates a JSON-LD Error.
16185
+ *
16186
+ * @param msg the error message.
16187
+ * @param type the error type.
16188
+ * @param details the error details.
16189
+ */
16050
16190
  constructor(message2 = "An unspecified JSON-LD error occurred.", name = "jsonld.Error", details = {}) {
16051
16191
  super(message2);
16052
16192
  this.name = name;
@@ -16316,6 +16456,7 @@ ${newlined}
16316
16456
  var RDF2 = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
16317
16457
  var XSD2 = "http://www.w3.org/2001/XMLSchema#";
16318
16458
  module2.exports = {
16459
+ // TODO: Deprecated and will be removed later. Use LINK_HEADER_CONTEXT.
16319
16460
  LINK_HEADER_REL: "http://www.w3.org/ns/json-ld#context",
16320
16461
  LINK_HEADER_CONTEXT: "http://www.w3.org/ns/json-ld#context",
16321
16462
  RDF: RDF2,
@@ -16343,6 +16484,9 @@ ${newlined}
16343
16484
  "../node_modules/jsonld/lib/RequestQueue.js"(exports, module2) {
16344
16485
  "use strict";
16345
16486
  module2.exports = class RequestQueue {
16487
+ /**
16488
+ * Creates a simple queue for requesting documents.
16489
+ */
16346
16490
  constructor() {
16347
16491
  this._requests = {};
16348
16492
  }
@@ -16378,6 +16522,7 @@ ${newlined}
16378
16522
  module2.exports = api;
16379
16523
  api.parsers = {
16380
16524
  simple: {
16525
+ // RFC 3986 basic parts
16381
16526
  keys: [
16382
16527
  "href",
16383
16528
  "scheme",
@@ -16386,6 +16531,7 @@ ${newlined}
16386
16531
  "query",
16387
16532
  "fragment"
16388
16533
  ],
16534
+ /* eslint-disable-next-line max-len */
16389
16535
  regex: /^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/
16390
16536
  },
16391
16537
  full: {
@@ -16405,6 +16551,7 @@ ${newlined}
16405
16551
  "query",
16406
16552
  "fragment"
16407
16553
  ],
16554
+ /* eslint-disable-next-line max-len */
16408
16555
  regex: /^(([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/
16409
16556
  }
16410
16557
  };
@@ -16693,9 +16840,9 @@ ${newlined}
16693
16840
  }
16694
16841
  });
16695
16842
 
16696
- // ../node_modules/yallist/iterator.js
16843
+ // ../node_modules/jsonld/node_modules/yallist/iterator.js
16697
16844
  var require_iterator = __commonJS({
16698
- "../node_modules/yallist/iterator.js"(exports, module2) {
16845
+ "../node_modules/jsonld/node_modules/yallist/iterator.js"(exports, module2) {
16699
16846
  "use strict";
16700
16847
  module2.exports = function(Yallist) {
16701
16848
  Yallist.prototype[Symbol.iterator] = function* () {
@@ -16707,9 +16854,9 @@ ${newlined}
16707
16854
  }
16708
16855
  });
16709
16856
 
16710
- // ../node_modules/yallist/yallist.js
16857
+ // ../node_modules/jsonld/node_modules/yallist/yallist.js
16711
16858
  var require_yallist = __commonJS({
16712
- "../node_modules/yallist/yallist.js"(exports, module2) {
16859
+ "../node_modules/jsonld/node_modules/yallist/yallist.js"(exports, module2) {
16713
16860
  "use strict";
16714
16861
  module2.exports = Yallist;
16715
16862
  Yallist.Node = Node3;
@@ -17076,9 +17223,9 @@ ${newlined}
17076
17223
  }
17077
17224
  });
17078
17225
 
17079
- // ../node_modules/lru-cache/index.js
17226
+ // ../node_modules/jsonld/node_modules/lru-cache/index.js
17080
17227
  var require_lru_cache = __commonJS({
17081
- "../node_modules/lru-cache/index.js"(exports, module2) {
17228
+ "../node_modules/jsonld/node_modules/lru-cache/index.js"(exports, module2) {
17082
17229
  "use strict";
17083
17230
  var Yallist = require_yallist();
17084
17231
  var MAX = Symbol("max");
@@ -17112,6 +17259,7 @@ ${newlined}
17112
17259
  this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
17113
17260
  this.reset();
17114
17261
  }
17262
+ // resize the cache when the max changes.
17115
17263
  set max(mL) {
17116
17264
  if (typeof mL !== "number" || mL < 0)
17117
17265
  throw new TypeError("max must be a non-negative number");
@@ -17136,6 +17284,7 @@ ${newlined}
17136
17284
  get maxAge() {
17137
17285
  return this[MAX_AGE];
17138
17286
  }
17287
+ // resize the cache when the lengthCalculator changes.
17139
17288
  set lengthCalculator(lC) {
17140
17289
  if (typeof lC !== "function")
17141
17290
  lC = naiveLength;
@@ -17351,6 +17500,11 @@ ${newlined}
17351
17500
  var LRU = require_lru_cache();
17352
17501
  var MAX_ACTIVE_CONTEXTS = 10;
17353
17502
  module2.exports = class ResolvedContext {
17503
+ /**
17504
+ * Creates a ResolvedContext.
17505
+ *
17506
+ * @param document the context document.
17507
+ */
17354
17508
  constructor({ document: document3 }) {
17355
17509
  this.document = document3;
17356
17510
  this.cache = new LRU({ max: MAX_ACTIVE_CONTEXTS });
@@ -17382,6 +17536,11 @@ ${newlined}
17382
17536
  var ResolvedContext = require_ResolvedContext();
17383
17537
  var MAX_CONTEXT_URLS = 10;
17384
17538
  module2.exports = class ContextResolver {
17539
+ /**
17540
+ * Creates a ContextResolver.
17541
+ *
17542
+ * @param sharedCache a shared LRU cache with `get` and `set` APIs.
17543
+ */
17385
17544
  constructor({ sharedCache }) {
17386
17545
  this.perOpCache = /* @__PURE__ */ new Map();
17387
17546
  this.sharedCache = sharedCache;
@@ -19352,6 +19511,7 @@ ${newlined}
19352
19511
  });
19353
19512
  } else if (container.includes("@type") && _isObject(value)) {
19354
19513
  expandedValue = await _expandIndexMap({
19514
+ // since container is `@type`, revert type scoped context when expanding
19355
19515
  activeCtx: termCtx.revertToPreviousContext(),
19356
19516
  options,
19357
19517
  activeProperty: key,
@@ -19895,12 +20055,18 @@ ${newlined}
19895
20055
  var types2 = require_types();
19896
20056
  var util = require_util();
19897
20057
  var {
20058
+ // RDF,
19898
20059
  RDF_LIST,
19899
20060
  RDF_FIRST,
19900
20061
  RDF_REST,
19901
20062
  RDF_NIL,
19902
20063
  RDF_TYPE,
20064
+ // RDF_PLAIN_LITERAL,
20065
+ // RDF_XML_LITERAL,
19903
20066
  RDF_JSON_LITERAL,
20067
+ // RDF_OBJECT,
20068
+ // RDF_LANGSTRING,
20069
+ // XSD,
19904
20070
  XSD_BOOLEAN,
19905
20071
  XSD_DOUBLE,
19906
20072
  XSD_INTEGER,
@@ -20121,12 +20287,18 @@ ${newlined}
20121
20287
  var types2 = require_types();
20122
20288
  var util = require_util();
20123
20289
  var {
20290
+ // RDF,
20291
+ // RDF_LIST,
20124
20292
  RDF_FIRST,
20125
20293
  RDF_REST,
20126
20294
  RDF_NIL,
20127
20295
  RDF_TYPE,
20296
+ // RDF_PLAIN_LITERAL,
20297
+ // RDF_XML_LITERAL,
20128
20298
  RDF_JSON_LITERAL,
20299
+ // RDF_OBJECT,
20129
20300
  RDF_LANGSTRING,
20301
+ // XSD,
20130
20302
  XSD_BOOLEAN,
20131
20303
  XSD_DOUBLE,
20132
20304
  XSD_INTEGER,
@@ -22553,10 +22725,9 @@ ${newlined}
22553
22725
  return iterable;
22554
22726
  if (!isNaN(iterable.length)) {
22555
22727
  var i = -1, next = function next2() {
22556
- for (; ++i < iterable.length; ) {
22728
+ for (; ++i < iterable.length; )
22557
22729
  if (hasOwn.call(iterable, i))
22558
22730
  return next2.value = iterable[i], next2.done = false, next2;
22559
- }
22560
22731
  return next2.value = void 0, next2.done = true, next2;
22561
22732
  };
22562
22733
  return next.next = next;
@@ -22601,9 +22772,8 @@ ${newlined}
22601
22772
  return "[object Generator]";
22602
22773
  }), exports2.keys = function(val) {
22603
22774
  var object = Object(val), keys = [];
22604
- for (var key in object) {
22775
+ for (var key in object)
22605
22776
  keys.push(key);
22606
- }
22607
22777
  return keys.reverse(), function next() {
22608
22778
  for (; keys.length; ) {
22609
22779
  var key2 = keys.pop();
@@ -22616,9 +22786,8 @@ ${newlined}
22616
22786
  constructor: Context,
22617
22787
  reset: function reset(skipTempReset) {
22618
22788
  if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = false, this.delegate = null, this.method = "next", this.arg = void 0, this.tryEntries.forEach(resetTryEntry), !skipTempReset)
22619
- for (var name in this) {
22789
+ for (var name in this)
22620
22790
  "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = void 0);
22621
- }
22622
22791
  },
22623
22792
  stop: function stop() {
22624
22793
  this.done = true;
@@ -22763,22 +22932,97 @@ ${newlined}
22763
22932
  return target;
22764
22933
  }
22765
22934
  var MIME_TYPE = freeze({
22935
+ /**
22936
+ * `text/html`, the only mime type that triggers treating an XML document as HTML.
22937
+ *
22938
+ * @see DOMParser.SupportedType.isHTML
22939
+ * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
22940
+ * @see https://en.wikipedia.org/wiki/HTML Wikipedia
22941
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
22942
+ * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec
22943
+ */
22766
22944
  HTML: "text/html",
22945
+ /**
22946
+ * Helper method to check a mime type if it indicates an HTML document
22947
+ *
22948
+ * @param {string} [value]
22949
+ * @returns {boolean}
22950
+ *
22951
+ * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
22952
+ * @see https://en.wikipedia.org/wiki/HTML Wikipedia
22953
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
22954
+ * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring */
22767
22955
  isHTML: function(value) {
22768
22956
  return value === MIME_TYPE.HTML;
22769
22957
  },
22958
+ /**
22959
+ * `application/xml`, the standard mime type for XML documents.
22960
+ *
22961
+ * @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration
22962
+ * @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303
22963
+ * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
22964
+ */
22770
22965
  XML_APPLICATION: "application/xml",
22966
+ /**
22967
+ * `text/html`, an alias for `application/xml`.
22968
+ *
22969
+ * @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303
22970
+ * @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration
22971
+ * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
22972
+ */
22771
22973
  XML_TEXT: "text/xml",
22974
+ /**
22975
+ * `application/xhtml+xml`, indicates an XML document that has the default HTML namespace,
22976
+ * but is parsed as an XML document.
22977
+ *
22978
+ * @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration
22979
+ * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec
22980
+ * @see https://en.wikipedia.org/wiki/XHTML Wikipedia
22981
+ */
22772
22982
  XML_XHTML_APPLICATION: "application/xhtml+xml",
22983
+ /**
22984
+ * `image/svg+xml`,
22985
+ *
22986
+ * @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration
22987
+ * @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1
22988
+ * @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia
22989
+ */
22773
22990
  XML_SVG_IMAGE: "image/svg+xml"
22774
22991
  });
22775
22992
  var NAMESPACE = freeze({
22993
+ /**
22994
+ * The XHTML namespace.
22995
+ *
22996
+ * @see http://www.w3.org/1999/xhtml
22997
+ */
22776
22998
  HTML: "http://www.w3.org/1999/xhtml",
22999
+ /**
23000
+ * Checks if `uri` equals `NAMESPACE.HTML`.
23001
+ *
23002
+ * @param {string} [uri]
23003
+ *
23004
+ * @see NAMESPACE.HTML
23005
+ */
22777
23006
  isHTML: function(uri) {
22778
23007
  return uri === NAMESPACE.HTML;
22779
23008
  },
23009
+ /**
23010
+ * The SVG namespace.
23011
+ *
23012
+ * @see http://www.w3.org/2000/svg
23013
+ */
22780
23014
  SVG: "http://www.w3.org/2000/svg",
23015
+ /**
23016
+ * The `xml:` namespace.
23017
+ *
23018
+ * @see http://www.w3.org/XML/1998/namespace
23019
+ */
22781
23020
  XML: "http://www.w3.org/XML/1998/namespace",
23021
+ /**
23022
+ * The `xmlns:` namespace
23023
+ *
23024
+ * @see https://www.w3.org/2000/xmlns/
23025
+ */
22782
23026
  XMLNS: "http://www.w3.org/2000/xmlns/"
22783
23027
  });
22784
23028
  exports.assign = assign;
@@ -22894,7 +23138,19 @@ ${newlined}
22894
23138
  function NodeList() {
22895
23139
  }
22896
23140
  NodeList.prototype = {
23141
+ /**
23142
+ * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.
23143
+ * @standard level1
23144
+ */
22897
23145
  length: 0,
23146
+ /**
23147
+ * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.
23148
+ * @standard level1
23149
+ * @param index unsigned long
23150
+ * Index into the collection.
23151
+ * @return Node
23152
+ * The node at the indexth position in the NodeList, or null if that is not a valid index.
23153
+ */
22898
23154
  item: function(index2) {
22899
23155
  return this[index2] || null;
22900
23156
  },
@@ -22904,9 +23160,19 @@ ${newlined}
22904
23160
  }
22905
23161
  return buf.join("");
22906
23162
  },
23163
+ /**
23164
+ * @private
23165
+ * @param {function (Node):boolean} predicate
23166
+ * @returns {Node[]}
23167
+ */
22907
23168
  filter: function(predicate) {
22908
23169
  return Array.prototype.filter.call(this, predicate);
22909
23170
  },
23171
+ /**
23172
+ * @private
23173
+ * @param {Node} item
23174
+ * @returns {number}
23175
+ */
22910
23176
  indexOf: function(item) {
22911
23177
  return Array.prototype.indexOf.call(this, item);
22912
23178
  }
@@ -22995,6 +23261,7 @@ ${newlined}
22995
23261
  _addNamedNode(this._ownerElement, this, attr, oldAttr);
22996
23262
  return oldAttr;
22997
23263
  },
23264
+ /* returns Node */
22998
23265
  setNamedItemNS: function(attr) {
22999
23266
  var el = attr.ownerElement, oldAttr;
23000
23267
  if (el && el != this._ownerElement) {
@@ -23004,11 +23271,14 @@ ${newlined}
23004
23271
  _addNamedNode(this._ownerElement, this, attr, oldAttr);
23005
23272
  return oldAttr;
23006
23273
  },
23274
+ /* returns Node */
23007
23275
  removeNamedItem: function(key) {
23008
23276
  var attr = this.getNamedItem(key);
23009
23277
  _removeNamedNode(this._ownerElement, this, attr);
23010
23278
  return attr;
23011
23279
  },
23280
+ // raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR
23281
+ //for level2
23012
23282
  removeNamedItemNS: function(namespaceURI, localName) {
23013
23283
  var attr = this.getNamedItemNS(namespaceURI, localName);
23014
23284
  _removeNamedNode(this._ownerElement, this, attr);
@@ -23028,9 +23298,46 @@ ${newlined}
23028
23298
  function DOMImplementation() {
23029
23299
  }
23030
23300
  DOMImplementation.prototype = {
23301
+ /**
23302
+ * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given feature is supported.
23303
+ * The different implementations fairly diverged in what kind of features were reported.
23304
+ * The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use.
23305
+ *
23306
+ * @deprecated It is deprecated and modern browsers return true in all cases.
23307
+ *
23308
+ * @param {string} feature
23309
+ * @param {string} [version]
23310
+ * @returns {boolean} always true
23311
+ *
23312
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature MDN
23313
+ * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-5CED94D7 DOM Level 1 Core
23314
+ * @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature DOM Living Standard
23315
+ */
23031
23316
  hasFeature: function(feature, version) {
23032
23317
  return true;
23033
23318
  },
23319
+ /**
23320
+ * Creates an XML Document object of the specified type with its document element.
23321
+ *
23322
+ * __It behaves slightly different from the description in the living standard__:
23323
+ * - There is no interface/class `XMLDocument`, it returns a `Document` instance.
23324
+ * - `contentType`, `encoding`, `mode`, `origin`, `url` fields are currently not declared.
23325
+ * - this implementation is not validating names or qualified names
23326
+ * (when parsing XML strings, the SAX parser takes care of that)
23327
+ *
23328
+ * @param {string|null} namespaceURI
23329
+ * @param {string} qualifiedName
23330
+ * @param {DocumentType=null} doctype
23331
+ * @returns {Document}
23332
+ *
23333
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN
23334
+ * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM Level 2 Core (initial)
23335
+ * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Level 2 Core
23336
+ *
23337
+ * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
23338
+ * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
23339
+ * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
23340
+ */
23034
23341
  createDocument: function(namespaceURI, qualifiedName, doctype) {
23035
23342
  var doc = new Document();
23036
23343
  doc.implementation = this;
@@ -23045,6 +23352,27 @@ ${newlined}
23045
23352
  }
23046
23353
  return doc;
23047
23354
  },
23355
+ /**
23356
+ * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.
23357
+ *
23358
+ * __This behavior is slightly different from the in the specs__:
23359
+ * - this implementation is not validating names or qualified names
23360
+ * (when parsing XML strings, the SAX parser takes care of that)
23361
+ *
23362
+ * @param {string} qualifiedName
23363
+ * @param {string} [publicId]
23364
+ * @param {string} [systemId]
23365
+ * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation
23366
+ * or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`
23367
+ *
23368
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType MDN
23369
+ * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM Level 2 Core
23370
+ * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living Standard
23371
+ *
23372
+ * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
23373
+ * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
23374
+ * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
23375
+ */
23048
23376
  createDocumentType: function(qualifiedName, publicId, systemId) {
23049
23377
  var node = new DocumentType();
23050
23378
  node.name = qualifiedName;
@@ -23069,6 +23397,7 @@ ${newlined}
23069
23397
  namespaceURI: null,
23070
23398
  prefix: null,
23071
23399
  localName: null,
23400
+ // Modified in DOM Level 2:
23072
23401
  insertBefore: function(newChild, refChild) {
23073
23402
  return _insertBefore(this, newChild, refChild);
23074
23403
  },
@@ -23090,6 +23419,7 @@ ${newlined}
23090
23419
  cloneNode: function(deep) {
23091
23420
  return cloneNode(this.ownerDocument || this, this, deep);
23092
23421
  },
23422
+ // Modified in DOM Level 2:
23093
23423
  normalize: function() {
23094
23424
  var child = this.firstChild;
23095
23425
  while (child) {
@@ -23103,12 +23433,28 @@ ${newlined}
23103
23433
  }
23104
23434
  }
23105
23435
  },
23436
+ // Introduced in DOM Level 2:
23106
23437
  isSupported: function(feature, version) {
23107
23438
  return this.ownerDocument.implementation.hasFeature(feature, version);
23108
23439
  },
23440
+ // Introduced in DOM Level 2:
23109
23441
  hasAttributes: function() {
23110
23442
  return this.attributes.length > 0;
23111
23443
  },
23444
+ /**
23445
+ * Look up the prefix associated to the given namespace URI, starting from this node.
23446
+ * **The default namespace declarations are ignored by this method.**
23447
+ * See Namespace Prefix Lookup for details on the algorithm used by this method.
23448
+ *
23449
+ * _Note: The implementation seems to be incomplete when compared to the algorithm described in the specs._
23450
+ *
23451
+ * @param {string | null} namespaceURI
23452
+ * @returns {string | null}
23453
+ * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespacePrefix
23454
+ * @see https://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespacePrefixAlgo
23455
+ * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix
23456
+ * @see https://github.com/xmldom/xmldom/issues/322
23457
+ */
23112
23458
  lookupPrefix: function(namespaceURI) {
23113
23459
  var el = this;
23114
23460
  while (el) {
@@ -23124,6 +23470,7 @@ ${newlined}
23124
23470
  }
23125
23471
  return null;
23126
23472
  },
23473
+ // Introduced in DOM Level 3:
23127
23474
  lookupNamespaceURI: function(prefix) {
23128
23475
  var el = this;
23129
23476
  while (el) {
@@ -23137,6 +23484,7 @@ ${newlined}
23137
23484
  }
23138
23485
  return null;
23139
23486
  },
23487
+ // Introduced in DOM Level 3:
23140
23488
  isDefaultNamespace: function(namespaceURI) {
23141
23489
  var prefix = this.lookupPrefix(namespaceURI);
23142
23490
  return prefix == null;
@@ -23254,7 +23602,8 @@ ${newlined}
23254
23602
  if (child && child.parentNode !== parent2) {
23255
23603
  throw new DOMException(NOT_FOUND_ERR, "child not in parent");
23256
23604
  }
23257
- if (!hasInsertableNodeType(node) || isDocTypeNode(node) && parent2.nodeType !== Node3.DOCUMENT_NODE) {
23605
+ if (// 4. If `node` is not a DocumentFragment, DocumentType, Element, or CharacterData node, then throw a "HierarchyRequestError" DOMException.
23606
+ !hasInsertableNodeType(node) || isDocTypeNode(node) && parent2.nodeType !== Node3.DOCUMENT_NODE) {
23258
23607
  throw new DOMException(
23259
23608
  HIERARCHY_REQUEST_ERR,
23260
23609
  "Unexpected node type " + node.nodeType + " for parent node type " + parent2.nodeType
@@ -23379,8 +23728,15 @@ ${newlined}
23379
23728
  return newChild;
23380
23729
  }
23381
23730
  Document.prototype = {
23731
+ //implementation : null,
23382
23732
  nodeName: "#document",
23383
23733
  nodeType: DOCUMENT_NODE,
23734
+ /**
23735
+ * The DocumentType node of the document.
23736
+ *
23737
+ * @readonly
23738
+ * @type DocumentType
23739
+ */
23384
23740
  doctype: null,
23385
23741
  documentElement: null,
23386
23742
  _inc: 1,
@@ -23417,9 +23773,11 @@ ${newlined}
23417
23773
  this.documentElement = newChild;
23418
23774
  }
23419
23775
  },
23776
+ // Introduced in DOM Level 2:
23420
23777
  importNode: function(importedNode, deep) {
23421
23778
  return importNode(this, importedNode, deep);
23422
23779
  },
23780
+ // Introduced in DOM Level 2:
23423
23781
  getElementById: function(id3) {
23424
23782
  var rtv = null;
23425
23783
  _visitNode(this.documentElement, function(node) {
@@ -23432,6 +23790,23 @@ ${newlined}
23432
23790
  });
23433
23791
  return rtv;
23434
23792
  },
23793
+ /**
23794
+ * The `getElementsByClassName` method of `Document` interface returns an array-like object
23795
+ * of all child elements which have **all** of the given class name(s).
23796
+ *
23797
+ * Returns an empty list if `classeNames` is an empty string or only contains HTML white space characters.
23798
+ *
23799
+ *
23800
+ * Warning: This is a live LiveNodeList.
23801
+ * Changes in the DOM will reflect in the array as the changes occur.
23802
+ * If an element selected by this array no longer qualifies for the selector,
23803
+ * it will automatically be removed. Be aware of this for iteration purposes.
23804
+ *
23805
+ * @param {string} classNames is a string representing the class name(s) to match; multiple class names are separated by (ASCII-)whitespace
23806
+ *
23807
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName
23808
+ * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname
23809
+ */
23435
23810
  getElementsByClassName: function(classNames) {
23436
23811
  var classNamesSet = toOrderedSet(classNames);
23437
23812
  return new LiveNodeList(this, function(base) {
@@ -23456,6 +23831,7 @@ ${newlined}
23456
23831
  return ls;
23457
23832
  });
23458
23833
  },
23834
+ //document factory method:
23459
23835
  createElement: function(tagName) {
23460
23836
  var node = new Element();
23461
23837
  node.ownerDocument = this;
@@ -23513,6 +23889,7 @@ ${newlined}
23513
23889
  node.nodeName = name;
23514
23890
  return node;
23515
23891
  },
23892
+ // Introduced in DOM Level 2:
23516
23893
  createElementNS: function(namespaceURI, qualifiedName) {
23517
23894
  var node = new Element();
23518
23895
  var pl = qualifiedName.split(":");
@@ -23531,6 +23908,7 @@ ${newlined}
23531
23908
  attrs._ownerElement = node;
23532
23909
  return node;
23533
23910
  },
23911
+ // Introduced in DOM Level 2:
23534
23912
  createAttributeNS: function(namespaceURI, qualifiedName) {
23535
23913
  var node = new Attr();
23536
23914
  var pl = qualifiedName.split(":");
@@ -23573,6 +23951,7 @@ ${newlined}
23573
23951
  var attr = this.getAttributeNode(name);
23574
23952
  attr && this.removeAttributeNode(attr);
23575
23953
  },
23954
+ //four real opeartion method
23576
23955
  appendChild: function(newChild) {
23577
23956
  if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) {
23578
23957
  return this.insertBefore(newChild, null);
@@ -23589,6 +23968,7 @@ ${newlined}
23589
23968
  removeAttributeNode: function(oldAttr) {
23590
23969
  return this.attributes.removeNamedItem(oldAttr.nodeName);
23591
23970
  },
23971
+ //get real attribute name,and remove it by removeAttributeNode
23592
23972
  removeAttributeNS: function(namespaceURI, localName) {
23593
23973
  var old = this.getAttributeNodeNS(namespaceURI, localName);
23594
23974
  old && this.removeAttributeNode(old);
@@ -23742,6 +24122,7 @@ ${newlined}
23742
24122
  if (prefix == null) {
23743
24123
  var visibleNamespaces = [
23744
24124
  { namespace: uri, prefix: null }
24125
+ //{namespace:uri,prefix:''}
23745
24126
  ];
23746
24127
  }
23747
24128
  }
@@ -24501,6 +24882,10 @@ ${newlined}
24501
24882
  }
24502
24883
  el.addValue(
24503
24884
  qname,
24885
+ // @see https://www.w3.org/TR/xml/#AVNormalize
24886
+ // since the xmldom sax parser does not "interpret" DTD the following is not implemented:
24887
+ // - recursive replacement of (DTD) entity references
24888
+ // - trimming and collapsing multiple spaces into a single one for attributes that are not of type CDATA
24504
24889
  value2.replace(/[\t\n\r]/g, " ").replace(/&#?\w+;/g, entityReplacer),
24505
24890
  startIndex
24506
24891
  );
@@ -24848,6 +25233,16 @@ ${newlined}
24848
25233
  getValue: function(i) {
24849
25234
  return this[i].value;
24850
25235
  }
25236
+ // ,getIndex:function(uri, localName)){
25237
+ // if(localName){
25238
+ //
25239
+ // }else{
25240
+ // var qName = uri
25241
+ // }
25242
+ // },
25243
+ // getValue:function(){return this.getValue(this.getIndex.apply(this,arguments))},
25244
+ // getType:function(uri,localName){}
25245
+ // getType:function(i){},
24851
25246
  };
24852
25247
  function split(source, start) {
24853
25248
  var match;
@@ -25013,6 +25408,7 @@ ${newlined}
25013
25408
  locator.lineNumber = 0;
25014
25409
  }
25015
25410
  },
25411
+ //LexicalHandler
25016
25412
  comment: function(chars, start, length) {
25017
25413
  chars = _toString.apply(this, arguments);
25018
25414
  var comm = this.doc.createComment(chars);
@@ -25034,6 +25430,10 @@ ${newlined}
25034
25430
  this.doc.doctype = dt;
25035
25431
  }
25036
25432
  },
25433
+ /**
25434
+ * @see org.xml.sax.ErrorHandler
25435
+ * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html
25436
+ */
25037
25437
  warning: function(error2) {
25038
25438
  console.warn("[xmldom warning] " + error2, _locator(this.locator));
25039
25439
  },
@@ -25106,6 +25506,7 @@ ${newlined}
25106
25506
  http: "http://www.w3.org/2007/ont/http#",
25107
25507
  httph: "http://www.w3.org/2007/ont/httph#",
25108
25508
  icalTZ: "http://www.w3.org/2002/12/cal/icaltzd#",
25509
+ // Beware: not cal:
25109
25510
  ldp: "http://www.w3.org/ns/ldp#",
25110
25511
  link: "http://www.w3.org/2007/ont/link#",
25111
25512
  log: "http://www.w3.org/2000/10/swap/log#",
@@ -25123,6 +25524,7 @@ ${newlined}
25123
25524
  rss: "http://purl.org/rss/1.0/",
25124
25525
  sched: "http://www.w3.org/ns/pim/schedule#",
25125
25526
  schema: "http://schema.org/",
25527
+ // @@ beware confusion with documents no 303
25126
25528
  sioc: "http://rdfs.org/sioc/ns#",
25127
25529
  solid: "http://www.w3.org/ns/solid/terms#",
25128
25530
  space: "http://www.w3.org/ns/pim/space#",
@@ -25176,6 +25578,8 @@ ${newlined}
25176
25578
  }
25177
25579
  async handleIncomingRedirect() {
25178
25580
  return this.session.handleIncomingRedirect({
25581
+ // session restore disabled, due to
25582
+ // https://github.com/inrupt/solid-client-authn-js/issues/1647
25179
25583
  restorePreviousSession: false
25180
25584
  });
25181
25585
  }
@@ -25407,6 +25811,11 @@ ${newlined}
25407
25811
  console.log("@@@ node substitute" + this);
25408
25812
  return this;
25409
25813
  }
25814
+ /**
25815
+ * Compares this node with another
25816
+ * @see {equals} to check if two nodes are equal
25817
+ * @param other - The other node
25818
+ */
25410
25819
  }, {
25411
25820
  key: "compareTerm",
25412
25821
  value: function compareTerm(other) {
@@ -25424,6 +25833,10 @@ ${newlined}
25424
25833
  }
25425
25834
  return 0;
25426
25835
  }
25836
+ /**
25837
+ * Compares whether the two nodes are equal
25838
+ * @param other The other node
25839
+ */
25427
25840
  }, {
25428
25841
  key: "equals",
25429
25842
  value: function equals2(other) {
@@ -25432,31 +25845,51 @@ ${newlined}
25432
25845
  }
25433
25846
  return this.termType === other.termType && this.value === other.value;
25434
25847
  }
25848
+ /**
25849
+ * Creates a hash for this node
25850
+ * @deprecated use {rdfFactory.id} instead if possible
25851
+ */
25435
25852
  }, {
25436
25853
  key: "hashString",
25437
25854
  value: function hashString() {
25438
25855
  return this.toCanonical();
25439
25856
  }
25857
+ /**
25858
+ * Compares whether this node is the same as the other one
25859
+ * @param other - Another node
25860
+ */
25440
25861
  }, {
25441
25862
  key: "sameTerm",
25442
25863
  value: function sameTerm(other) {
25443
25864
  return this.equals(other);
25444
25865
  }
25866
+ /**
25867
+ * Creates a canonical string representation of this node
25868
+ */
25445
25869
  }, {
25446
25870
  key: "toCanonical",
25447
25871
  value: function toCanonical() {
25448
25872
  return this.toNT();
25449
25873
  }
25874
+ /**
25875
+ * Creates a n-triples string representation of this node
25876
+ */
25450
25877
  }, {
25451
25878
  key: "toNT",
25452
25879
  value: function toNT() {
25453
25880
  return this.toString();
25454
25881
  }
25882
+ /**
25883
+ * Creates a n-quads string representation of this node
25884
+ */
25455
25885
  }, {
25456
25886
  key: "toNQ",
25457
25887
  value: function toNQ2() {
25458
25888
  return this.toNT();
25459
25889
  }
25890
+ /**
25891
+ * Creates a string representation of this node
25892
+ */
25460
25893
  }, {
25461
25894
  key: "toString",
25462
25895
  value: function toString() {
@@ -25558,6 +25991,10 @@ ${newlined}
25558
25991
  }
25559
25992
  return 0;
25560
25993
  }
25994
+ /**
25995
+ * Gets a copy of this blank node in the specified formula
25996
+ * @param formula The formula
25997
+ */
25561
25998
  }, {
25562
25999
  key: "copy",
25563
26000
  value: function copy(formula2) {
@@ -25577,20 +26014,25 @@ ${newlined}
25577
26014
  }
25578
26015
  }], [{
25579
26016
  key: "getId",
25580
- value: function getId(id3) {
25581
- if (id3) {
25582
- if (typeof id3 !== "string") {
25583
- console.log("Bad blank id:", id3);
25584
- throw new Error("Bad id argument to new blank node: " + id3);
25585
- }
25586
- if (id3.includes("#")) {
25587
- var fragments = id3.split("#");
25588
- return fragments[fragments.length - 1];
26017
+ value: (
26018
+ /**
26019
+ * The next unique identifier for blank nodes
26020
+ */
26021
+ function getId(id3) {
26022
+ if (id3) {
26023
+ if (typeof id3 !== "string") {
26024
+ console.log("Bad blank id:", id3);
26025
+ throw new Error("Bad id argument to new blank node: " + id3);
26026
+ }
26027
+ if (id3.includes("#")) {
26028
+ var fragments = id3.split("#");
26029
+ return fragments[fragments.length - 1];
26030
+ }
26031
+ return id3;
25589
26032
  }
25590
- return id3;
26033
+ return "n" + BlankNode3.nextId++;
25591
26034
  }
25592
- return "n" + BlankNode3.nextId++;
25593
- }
26035
+ )
25594
26036
  }]);
25595
26037
  return BlankNode3;
25596
26038
  }(Node2);
@@ -25706,6 +26148,10 @@ ${newlined}
25706
26148
  return null;
25707
26149
  return new NamedNode3(str.slice(0, p + 1));
25708
26150
  }
26151
+ /**
26152
+ * Returns an NN for the whole web site, ending in slash.
26153
+ * Contrast with the "origin" which does NOT have a trailing slash
26154
+ */
25709
26155
  }, {
25710
26156
  key: "site",
25711
26157
  value: function site() {
@@ -25720,6 +26166,10 @@ ${newlined}
25720
26166
  return new NamedNode3(str.slice(0, q + 1));
25721
26167
  }
25722
26168
  }
26169
+ /**
26170
+ * Creates the fetchable named node for the document.
26171
+ * Removes everything from the # anchor tag.
26172
+ */
25723
26173
  }, {
25724
26174
  key: "doc",
25725
26175
  value: function doc() {
@@ -25729,16 +26179,21 @@ ${newlined}
25729
26179
  return new NamedNode3(this.value.split("#")[0]);
25730
26180
  }
25731
26181
  }
26182
+ /**
26183
+ * Returns the URI including <brackets>
26184
+ */
25732
26185
  }, {
25733
26186
  key: "toString",
25734
26187
  value: function toString() {
25735
26188
  return "<" + this.value + ">";
25736
26189
  }
26190
+ /** The local identifier with the document */
25737
26191
  }, {
25738
26192
  key: "id",
25739
26193
  value: function id3() {
25740
26194
  return this.value.split("#")[1];
25741
26195
  }
26196
+ /** Alias for value, favored by Tim */
25742
26197
  }, {
25743
26198
  key: "uri",
25744
26199
  get: function get() {
@@ -25747,6 +26202,10 @@ ${newlined}
25747
26202
  set: function set(uri) {
25748
26203
  this.value = uri;
25749
26204
  }
26205
+ /**
26206
+ * Creates a named node from the specified input value
26207
+ * @param value - An input value
26208
+ */
25750
26209
  }], [{
25751
26210
  key: "fromValue",
25752
26211
  value: function fromValue2(value) {
@@ -25829,6 +26288,10 @@ ${newlined}
25829
26288
  value: function copy() {
25830
26289
  return new Literal3(this.value, this.lang, this.datatype);
25831
26290
  }
26291
+ /**
26292
+ * Gets whether two literals are the same
26293
+ * @param other The other statement
26294
+ */
25832
26295
  }, {
25833
26296
  key: "equals",
25834
26297
  value: function equals2(other) {
@@ -25837,6 +26300,10 @@ ${newlined}
25837
26300
  }
25838
26301
  return this.termType === other.termType && this.value === other.value && this.language === other.language && (!this.datatype && !other.datatype || this.datatype && this.datatype.equals(other.datatype));
25839
26302
  }
26303
+ /**
26304
+ * The language for the literal
26305
+ * @deprecated use {language} instead
26306
+ */
25840
26307
  }, {
25841
26308
  key: "lang",
25842
26309
  get: function get() {
@@ -25850,11 +26317,16 @@ ${newlined}
25850
26317
  value: function toNT() {
25851
26318
  return Literal3.toNT(this);
25852
26319
  }
26320
+ /** Serializes a literal to an N-Triples string */
25853
26321
  }, {
25854
26322
  key: "toString",
25855
26323
  value: function toString() {
25856
26324
  return "" + this.value;
25857
26325
  }
26326
+ /**
26327
+ * Builds a literal node from a boolean value
26328
+ * @param value - The value
26329
+ */
25858
26330
  }], [{
25859
26331
  key: "toNT",
25860
26332
  value: function toNT(literal4) {
@@ -25882,6 +26354,10 @@ ${newlined}
25882
26354
  var strValue = value ? "1" : "0";
25883
26355
  return new Literal3(strValue, null, xsd_internal_default.boolean);
25884
26356
  }
26357
+ /**
26358
+ * Builds a literal node from a date value
26359
+ * @param value The value
26360
+ */
25885
26361
  }, {
25886
26362
  key: "fromDate",
25887
26363
  value: function fromDate(value) {
@@ -25894,6 +26370,10 @@ ${newlined}
25894
26370
  var date = "" + value.getUTCFullYear() + "-" + d2(value.getUTCMonth() + 1) + "-" + d2(value.getUTCDate()) + "T" + d2(value.getUTCHours()) + ":" + d2(value.getUTCMinutes()) + ":" + d2(value.getUTCSeconds()) + "Z";
25895
26371
  return new Literal3(date, null, xsd_internal_default.dateTime);
25896
26372
  }
26373
+ /**
26374
+ * Builds a literal node from a number value
26375
+ * @param value - The value
26376
+ */
25897
26377
  }, {
25898
26378
  key: "fromNumber",
25899
26379
  value: function fromNumber(value) {
@@ -25909,6 +26389,10 @@ ${newlined}
25909
26389
  }
25910
26390
  return new Literal3(strValue, null, datatype);
25911
26391
  }
26392
+ /**
26393
+ * Builds a literal node from an input value
26394
+ * @param value - The input value
26395
+ */
25912
26396
  }, {
25913
26397
  key: "fromValue",
25914
26398
  value: function fromValue2(value) {
@@ -26002,22 +26486,36 @@ ${newlined}
26002
26486
  set: function set(value) {
26003
26487
  this.value = value;
26004
26488
  }
26489
+ /**
26490
+ * Appends an element to this collection
26491
+ * @param element - The new element
26492
+ */
26005
26493
  }, {
26006
26494
  key: "append",
26007
26495
  value: function append(element) {
26008
26496
  return this.elements.push(element);
26009
26497
  }
26498
+ /**
26499
+ * Closes this collection
26500
+ */
26010
26501
  }, {
26011
26502
  key: "close",
26012
26503
  value: function close() {
26013
26504
  this.closed = true;
26014
26505
  return this.closed;
26015
26506
  }
26507
+ /**
26508
+ * Removes the first element from the collection (and return it)
26509
+ */
26016
26510
  }, {
26017
26511
  key: "shift",
26018
26512
  value: function shift() {
26019
26513
  return this.elements.shift();
26020
26514
  }
26515
+ /**
26516
+ * Creates a new Collection with the substituting bindings applied
26517
+ * @param bindings - The bindings to substitute
26518
+ */
26021
26519
  }, {
26022
26520
  key: "substitute",
26023
26521
  value: function substitute(bindings) {
@@ -26033,9 +26531,19 @@ ${newlined}
26033
26531
  }
26034
26532
  }, {
26035
26533
  key: "toString",
26036
- value: function toString() {
26037
- return "(" + this.elements.join(" ") + ")";
26038
- }
26534
+ value: (
26535
+ /**
26536
+ * Serializes the collection to a string.
26537
+ * Surrounded by (parentheses) and separated by spaces.
26538
+ */
26539
+ function toString() {
26540
+ return "(" + this.elements.join(" ") + ")";
26541
+ }
26542
+ )
26543
+ /**
26544
+ * Prepends the specified element to the collection's front
26545
+ * @param element - The element to prepend
26546
+ */
26039
26547
  }, {
26040
26548
  key: "unshift",
26041
26549
  value: function unshift(element) {
@@ -27840,6 +28348,7 @@ ${newlined}
27840
28348
  until,
27841
28349
  waterfall: waterfall$1,
27842
28350
  whilst: whilst$1,
28351
+ // aliases
27843
28352
  all: every$1,
27844
28353
  allLimit: everyLimit$1,
27845
28354
  allSeries: everySeries$1,
@@ -27983,6 +28492,8 @@ ${newlined}
27983
28492
  this._comments = !!options.comments;
27984
28493
  this._literalClosingPos = 0;
27985
28494
  }
28495
+ // ## Private methods
28496
+ // ### `_tokenizeToEnd` tokenizes as for as possible, emitting tokens through the callback
27986
28497
  _tokenizeToEnd(callback, inputFinished) {
27987
28498
  let input = this._input;
27988
28499
  let currentLineLength = input.length;
@@ -28201,6 +28712,7 @@ ${newlined}
28201
28712
  callback(self2._syntaxError(/^\S*/.exec(input)[0]));
28202
28713
  }
28203
28714
  }
28715
+ // ### `_unescape` replaces N3 escape codes by their corresponding characters
28204
28716
  _unescape(item) {
28205
28717
  let invalid = false;
28206
28718
  const replaced = item.replace(escapeSequence, (sequence, unicode4, unicode8, escapedChar) => {
@@ -28217,6 +28729,7 @@ ${newlined}
28217
28729
  });
28218
28730
  return invalid ? null : replaced;
28219
28731
  }
28732
+ // ### `_parseLiteral` parses a literal into an unescaped value
28220
28733
  _parseLiteral(input) {
28221
28734
  if (input.length >= 3) {
28222
28735
  const opening = input.match(/^(?:"""|"|'''|'|)/)[0];
@@ -28241,6 +28754,7 @@ ${newlined}
28241
28754
  }
28242
28755
  return { value: "", matchLength: 0 };
28243
28756
  }
28757
+ // ### `_syntaxError` creates a syntax error for the given issue
28244
28758
  _syntaxError(issue) {
28245
28759
  this._input = null;
28246
28760
  const err = new Error(`Unexpected "${issue}" on line ${this._line}.`);
@@ -28251,9 +28765,13 @@ ${newlined}
28251
28765
  };
28252
28766
  return err;
28253
28767
  }
28768
+ // ### Strips off any starting UTF BOM mark.
28254
28769
  _readStartingBom(input) {
28255
28770
  return input.startsWith("\uFEFF") ? input.substr(1) : input;
28256
28771
  }
28772
+ // ## Public methods
28773
+ // ### `tokenize` starts the transformation of an N3 document into an array of tokens.
28774
+ // The input can be a string or a stream.
28257
28775
  tokenize(input, callback) {
28258
28776
  this._line = 1;
28259
28777
  if (typeof input === "string") {
@@ -28321,17 +28839,22 @@ ${newlined}
28321
28839
  constructor(id3) {
28322
28840
  this.id = id3;
28323
28841
  }
28842
+ // ### The value of this term
28324
28843
  get value() {
28325
28844
  return this.id;
28326
28845
  }
28846
+ // ### Returns whether this object represents the same term as the other
28327
28847
  equals(other) {
28328
28848
  if (other instanceof Term)
28329
28849
  return this.id === other.id;
28330
28850
  return !!other && this.termType === other.termType && this.value === other.value;
28331
28851
  }
28852
+ // ### Implement hashCode for Immutable.js, since we implement `equals`
28853
+ // https://immutable-js.com/docs/v4.0.0/ValueObject/#hashCode()
28332
28854
  hashCode() {
28333
28855
  return 0;
28334
28856
  }
28857
+ // ### Returns a plain object representation of this term
28335
28858
  toJSON() {
28336
28859
  return {
28337
28860
  termType: this.termType,
@@ -28340,30 +28863,37 @@ ${newlined}
28340
28863
  }
28341
28864
  };
28342
28865
  var NamedNode2 = class extends Term {
28866
+ // ### The term type of this term
28343
28867
  get termType() {
28344
28868
  return "NamedNode";
28345
28869
  }
28346
28870
  };
28347
28871
  var Literal2 = class extends Term {
28872
+ // ### The term type of this term
28348
28873
  get termType() {
28349
28874
  return "Literal";
28350
28875
  }
28876
+ // ### The text value of this literal
28351
28877
  get value() {
28352
28878
  return this.id.substring(1, this.id.lastIndexOf('"'));
28353
28879
  }
28880
+ // ### The language of this literal
28354
28881
  get language() {
28355
28882
  const id3 = this.id;
28356
28883
  let atPos = id3.lastIndexOf('"') + 1;
28357
28884
  return atPos < id3.length && id3[atPos++] === "@" ? id3.substr(atPos).toLowerCase() : "";
28358
28885
  }
28886
+ // ### The datatype IRI of this literal
28359
28887
  get datatype() {
28360
28888
  return new NamedNode2(this.datatypeString);
28361
28889
  }
28890
+ // ### The datatype string of this literal
28362
28891
  get datatypeString() {
28363
28892
  const id3 = this.id, dtPos = id3.lastIndexOf('"') + 1;
28364
28893
  const char = dtPos < id3.length ? id3[dtPos] : "";
28365
28894
  return char === "^" ? id3.substr(dtPos + 2) : char !== "@" ? xsd2.string : rdf.langString;
28366
28895
  }
28896
+ // ### Returns whether this object represents the same term as the other
28367
28897
  equals(other) {
28368
28898
  if (other instanceof Literal2)
28369
28899
  return this.id === other.id;
@@ -28382,9 +28912,11 @@ ${newlined}
28382
28912
  constructor(name) {
28383
28913
  super(`_:${name}`);
28384
28914
  }
28915
+ // ### The term type of this term
28385
28916
  get termType() {
28386
28917
  return "BlankNode";
28387
28918
  }
28919
+ // ### The name of this blank node
28388
28920
  get value() {
28389
28921
  return this.id.substr(2);
28390
28922
  }
@@ -28393,9 +28925,11 @@ ${newlined}
28393
28925
  constructor(name) {
28394
28926
  super(`?${name}`);
28395
28927
  }
28928
+ // ### The term type of this term
28396
28929
  get termType() {
28397
28930
  return "Variable";
28398
28931
  }
28932
+ // ### The name of this variable
28399
28933
  get value() {
28400
28934
  return this.id.substr(1);
28401
28935
  }
@@ -28405,9 +28939,11 @@ ${newlined}
28405
28939
  super("");
28406
28940
  return DEFAULTGRAPH || this;
28407
28941
  }
28942
+ // ### The term type of this term
28408
28943
  get termType() {
28409
28944
  return "DefaultGraph";
28410
28945
  }
28946
+ // ### Returns whether this object represents the same term as the other
28411
28947
  equals(other) {
28412
28948
  return this === other || !!other && this.termType === other.termType;
28413
28949
  }
@@ -28421,6 +28957,7 @@ ${newlined}
28421
28957
  this._object = object;
28422
28958
  this._graph = graph3 || DEFAULTGRAPH;
28423
28959
  }
28960
+ // ### The term type of this term
28424
28961
  get termType() {
28425
28962
  return "Quad";
28426
28963
  }
@@ -28436,6 +28973,7 @@ ${newlined}
28436
28973
  get graph() {
28437
28974
  return this._graph;
28438
28975
  }
28976
+ // ### Returns a plain object representation of this quad
28439
28977
  toJSON() {
28440
28978
  return {
28441
28979
  termType: this.termType,
@@ -28445,6 +28983,7 @@ ${newlined}
28445
28983
  graph: this._graph.toJSON()
28446
28984
  };
28447
28985
  }
28986
+ // ### Returns whether this object represents the same quad as the other
28448
28987
  equals(other) {
28449
28988
  return !!other && this._subject.equals(other.subject) && this._predicate.equals(other.predicate) && this._object.equals(other.object) && this._graph.equals(other.graph);
28450
28989
  }
@@ -28506,9 +29045,13 @@ ${newlined}
28506
29045
  this._lexer = options.lexer || new N3Lexer({ lineMode: isLineMode, n3: isN3 });
28507
29046
  this._explicitQuantifiers = !!options.explicitQuantifiers;
28508
29047
  }
29048
+ // ## Static class methods
29049
+ // ### `_resetBlankNodePrefix` restarts blank node prefix identification
28509
29050
  static _resetBlankNodePrefix() {
28510
29051
  blankNodePrefix = 0;
28511
29052
  }
29053
+ // ## Private methods
29054
+ // ### `_setBase` sets the base IRI to resolve relative IRIs
28512
29055
  _setBase(baseIRI) {
28513
29056
  if (!baseIRI) {
28514
29057
  this._base = "";
@@ -28524,6 +29067,8 @@ ${newlined}
28524
29067
  this._baseScheme = baseIRI[1];
28525
29068
  }
28526
29069
  }
29070
+ // ### `_saveContext` stores the current parsing context
29071
+ // when entering a new scope (list, blank node, formula)
28527
29072
  _saveContext(type, graph3, subject, predicate, object) {
28528
29073
  const n3Mode = this._n3Mode;
28529
29074
  this._contextStack.push({
@@ -28542,6 +29087,8 @@ ${newlined}
28542
29087
  this._quantified = Object.create(this._quantified);
28543
29088
  }
28544
29089
  }
29090
+ // ### `_restoreContext` restores the parent context
29091
+ // when leaving a scope (list, blank node, formula)
28545
29092
  _restoreContext(type, token) {
28546
29093
  const context = this._contextStack.pop();
28547
29094
  if (!context || context.type !== type)
@@ -28556,6 +29103,7 @@ ${newlined}
28556
29103
  this._quantified = context.quantified;
28557
29104
  }
28558
29105
  }
29106
+ // ### `_readInTopContext` reads a token when in the top context
28559
29107
  _readInTopContext(token) {
28560
29108
  switch (token.type) {
28561
29109
  case "eof":
@@ -28584,6 +29132,7 @@ ${newlined}
28584
29132
  return this._readSubject(token);
28585
29133
  }
28586
29134
  }
29135
+ // ### `_readEntity` reads an IRI, prefixed name, blank node, or variable
28587
29136
  _readEntity(token, quantifier) {
28588
29137
  let value;
28589
29138
  switch (token.type) {
@@ -28614,6 +29163,7 @@ ${newlined}
28614
29163
  value = this._quantified[value.id];
28615
29164
  return value;
28616
29165
  }
29166
+ // ### `_readSubject` reads a quad's subject
28617
29167
  _readSubject(token) {
28618
29168
  this._predicate = null;
28619
29169
  switch (token.type) {
@@ -28680,6 +29230,7 @@ ${newlined}
28680
29230
  }
28681
29231
  return this._readPredicateOrNamedGraph;
28682
29232
  }
29233
+ // ### `_readPredicate` reads a quad's predicate
28683
29234
  _readPredicate(token) {
28684
29235
  const type = token.type;
28685
29236
  switch (type) {
@@ -28717,6 +29268,7 @@ ${newlined}
28717
29268
  }
28718
29269
  return this._readObject;
28719
29270
  }
29271
+ // ### `_readObject` reads a quad's object
28720
29272
  _readObject(token) {
28721
29273
  switch (token.type) {
28722
29274
  case "literal":
@@ -28764,15 +29316,18 @@ ${newlined}
28764
29316
  }
28765
29317
  return this._getContextEndReader();
28766
29318
  }
29319
+ // ### `_readPredicateOrNamedGraph` reads a quad's predicate, or a named graph
28767
29320
  _readPredicateOrNamedGraph(token) {
28768
29321
  return token.type === "{" ? this._readGraph(token) : this._readPredicate(token);
28769
29322
  }
29323
+ // ### `_readGraph` reads a graph
28770
29324
  _readGraph(token) {
28771
29325
  if (token.type !== "{")
28772
29326
  return this._error(`Expected graph but got ${token.type}`, token);
28773
29327
  this._graph = this._subject, this._subject = null;
28774
29328
  return this._readSubject;
28775
29329
  }
29330
+ // ### `_readBlankNodeHead` reads the head of a blank node
28776
29331
  _readBlankNodeHead(token) {
28777
29332
  if (token.type === "]") {
28778
29333
  this._subject = null;
@@ -28782,6 +29337,7 @@ ${newlined}
28782
29337
  return this._readPredicate(token);
28783
29338
  }
28784
29339
  }
29340
+ // ### `_readBlankNodeTail` reads the end of a blank node
28785
29341
  _readBlankNodeTail(token) {
28786
29342
  if (token.type !== "]")
28787
29343
  return this._readBlankNodePunctuation(token);
@@ -28796,6 +29352,7 @@ ${newlined}
28796
29352
  else
28797
29353
  return empty ? this._readPredicateOrNamedGraph : this._readPredicateAfterBlank;
28798
29354
  }
29355
+ // ### `_readPredicateAfterBlank` reads a predicate after an anonymous blank node
28799
29356
  _readPredicateAfterBlank(token) {
28800
29357
  switch (token.type) {
28801
29358
  case ".":
@@ -28806,6 +29363,7 @@ ${newlined}
28806
29363
  return this._readPredicate(token);
28807
29364
  }
28808
29365
  }
29366
+ // ### `_readListItem` reads items from a list
28809
29367
  _readListItem(token) {
28810
29368
  let item = null, list = null, next = this._readListItem;
28811
29369
  const previousList = this._subject, stack = this._contextStack, parent2 = stack[stack.length - 1];
@@ -28889,12 +29447,15 @@ ${newlined}
28889
29447
  }
28890
29448
  return next;
28891
29449
  }
29450
+ // ### `_readDataTypeOrLang` reads an _optional_ datatype or language
28892
29451
  _readDataTypeOrLang(token) {
28893
29452
  return this._completeObjectLiteral(token, false);
28894
29453
  }
29454
+ // ### `_readListItemDataTypeOrLang` reads an _optional_ datatype or language in a list
28895
29455
  _readListItemDataTypeOrLang(token) {
28896
29456
  return this._completeObjectLiteral(token, true);
28897
29457
  }
29458
+ // ### `_completeLiteral` completes a literal with an optional datatype or language
28898
29459
  _completeLiteral(token) {
28899
29460
  let literal4 = this._literal(this._literalValue);
28900
29461
  switch (token.type) {
@@ -28913,10 +29474,12 @@ ${newlined}
28913
29474
  }
28914
29475
  return { token, literal: literal4 };
28915
29476
  }
29477
+ // Completes a literal in subject position
28916
29478
  _completeSubjectLiteral(token) {
28917
29479
  this._subject = this._completeLiteral(token).literal;
28918
29480
  return this._readPredicateOrNamedGraph;
28919
29481
  }
29482
+ // Completes a literal in object position
28920
29483
  _completeObjectLiteral(token, listItem) {
28921
29484
  const completed = this._completeLiteral(token);
28922
29485
  if (!completed)
@@ -28931,6 +29494,7 @@ ${newlined}
28931
29494
  return this._readCallback(completed.token);
28932
29495
  }
28933
29496
  }
29497
+ // ### `_readFormulaTail` reads the end of a formula
28934
29498
  _readFormulaTail(token) {
28935
29499
  if (token.type !== "}")
28936
29500
  return this._readPunctuation(token);
@@ -28939,6 +29503,7 @@ ${newlined}
28939
29503
  this._restoreContext("formula", token);
28940
29504
  return this._object === null ? this._readPredicate : this._getContextEndReader();
28941
29505
  }
29506
+ // ### `_readPunctuation` reads punctuation between quads or quad parts
28942
29507
  _readPunctuation(token) {
28943
29508
  let next, graph3 = this._graph;
28944
29509
  const subject = this._subject, inversePredicate = this._inversePredicate;
@@ -28977,6 +29542,7 @@ ${newlined}
28977
29542
  }
28978
29543
  return next;
28979
29544
  }
29545
+ // ### `_readBlankNodePunctuation` reads punctuation in a blank node
28980
29546
  _readBlankNodePunctuation(token) {
28981
29547
  let next;
28982
29548
  switch (token.type) {
@@ -28992,17 +29558,20 @@ ${newlined}
28992
29558
  this._emit(this._subject, this._predicate, this._object, this._graph);
28993
29559
  return next;
28994
29560
  }
29561
+ // ### `_readQuadPunctuation` reads punctuation after a quad
28995
29562
  _readQuadPunctuation(token) {
28996
29563
  if (token.type !== ".")
28997
29564
  return this._error("Expected dot to follow quad", token);
28998
29565
  return this._readInTopContext;
28999
29566
  }
29567
+ // ### `_readPrefix` reads the prefix of a prefix declaration
29000
29568
  _readPrefix(token) {
29001
29569
  if (token.type !== "prefix")
29002
29570
  return this._error("Expected prefix to follow @prefix", token);
29003
29571
  this._prefix = token.value;
29004
29572
  return this._readPrefixIRI;
29005
29573
  }
29574
+ // ### `_readPrefixIRI` reads the IRI of a prefix declaration
29006
29575
  _readPrefixIRI(token) {
29007
29576
  if (token.type !== "IRI")
29008
29577
  return this._error(`Expected IRI to follow prefix "${this._prefix}:"`, token);
@@ -29011,6 +29580,7 @@ ${newlined}
29011
29580
  this._prefixCallback(this._prefix, prefixNode);
29012
29581
  return this._readDeclarationPunctuation;
29013
29582
  }
29583
+ // ### `_readBaseIRI` reads the IRI of a base declaration
29014
29584
  _readBaseIRI(token) {
29015
29585
  const iri = token.type === "IRI" && this._resolveIRI(token.value);
29016
29586
  if (!iri)
@@ -29018,6 +29588,7 @@ ${newlined}
29018
29588
  this._setBase(iri);
29019
29589
  return this._readDeclarationPunctuation;
29020
29590
  }
29591
+ // ### `_readNamedGraphLabel` reads the label of a named graph
29021
29592
  _readNamedGraphLabel(token) {
29022
29593
  switch (token.type) {
29023
29594
  case "IRI":
@@ -29030,12 +29601,14 @@ ${newlined}
29030
29601
  return this._error("Invalid graph label", token);
29031
29602
  }
29032
29603
  }
29604
+ // ### `_readNamedGraphLabel` reads a blank node label of a named graph
29033
29605
  _readNamedGraphBlankLabel(token) {
29034
29606
  if (token.type !== "]")
29035
29607
  return this._error("Invalid graph label", token);
29036
29608
  this._subject = this._blankNode();
29037
29609
  return this._readGraph;
29038
29610
  }
29611
+ // ### `_readDeclarationPunctuation` reads the punctuation of a declaration
29039
29612
  _readDeclarationPunctuation(token) {
29040
29613
  if (this._sparqlStyle) {
29041
29614
  this._sparqlStyle = false;
@@ -29045,6 +29618,7 @@ ${newlined}
29045
29618
  return this._error("Expected declaration to end with a dot", token);
29046
29619
  return this._readInTopContext;
29047
29620
  }
29621
+ // Reads a list of quantified symbols from a @forSome or @forAll statement
29048
29622
  _readQuantifierList(token) {
29049
29623
  let entity;
29050
29624
  switch (token.type) {
@@ -29076,6 +29650,7 @@ ${newlined}
29076
29650
  }
29077
29651
  return this._readQuantifierPunctuation;
29078
29652
  }
29653
+ // Reads punctuation from a @forSome or @forAll statement
29079
29654
  _readQuantifierPunctuation(token) {
29080
29655
  if (token.type === ",")
29081
29656
  return this._readQuantifierList;
@@ -29088,10 +29663,12 @@ ${newlined}
29088
29663
  return this._readCallback(token);
29089
29664
  }
29090
29665
  }
29666
+ // ### `_getPathReader` reads a potential path and then resumes with the given function
29091
29667
  _getPathReader(afterPath) {
29092
29668
  this._afterPath = afterPath;
29093
29669
  return this._readPath;
29094
29670
  }
29671
+ // ### `_readPath` reads a potential path
29095
29672
  _readPath(token) {
29096
29673
  switch (token.type) {
29097
29674
  case "!":
@@ -29108,6 +29685,7 @@ ${newlined}
29108
29685
  return this._afterPath(token);
29109
29686
  }
29110
29687
  }
29688
+ // ### `_readForwardPath` reads a '!' path
29111
29689
  _readForwardPath(token) {
29112
29690
  let subject, predicate;
29113
29691
  const object = this._blankNode();
@@ -29120,6 +29698,7 @@ ${newlined}
29120
29698
  this._emit(subject, predicate, object, this._graph);
29121
29699
  return this._readPath;
29122
29700
  }
29701
+ // ### `_readBackwardPath` reads a '^' path
29123
29702
  _readBackwardPath(token) {
29124
29703
  const subject = this._blankNode();
29125
29704
  let predicate, object;
@@ -29132,6 +29711,7 @@ ${newlined}
29132
29711
  this._emit(subject, predicate, object, this._graph);
29133
29712
  return this._readPath;
29134
29713
  }
29714
+ // ### `_readRDFStarTailOrGraph` reads the graph of a nested RDF* quad or the end of a nested RDF* triple
29135
29715
  _readRDFStarTailOrGraph(token) {
29136
29716
  if (token.type !== ">>") {
29137
29717
  if (this._supportsQuads && this._graph === null && (this._graph = this._readEntity(token)) !== void 0)
@@ -29140,6 +29720,7 @@ ${newlined}
29140
29720
  }
29141
29721
  return this._readRDFStarTail(token);
29142
29722
  }
29723
+ // ### `_readRDFStarTail` reads the end of a nested RDF* triple
29143
29724
  _readRDFStarTail(token) {
29144
29725
  if (token.type !== ">>")
29145
29726
  return this._error(`Expected >> but got ${token.type}`, token);
@@ -29158,6 +29739,7 @@ ${newlined}
29158
29739
  return this._getContextEndReader();
29159
29740
  }
29160
29741
  }
29742
+ // ### `_getContextEndReader` gets the next reader function at the end of a context
29161
29743
  _getContextEndReader() {
29162
29744
  const contextStack = this._contextStack;
29163
29745
  if (!contextStack.length)
@@ -29173,9 +29755,11 @@ ${newlined}
29173
29755
  return this._readRDFStarTailOrGraph;
29174
29756
  }
29175
29757
  }
29758
+ // ### `_emit` sends a quad through the callback
29176
29759
  _emit(subject, predicate, object, graph3) {
29177
29760
  this._callback(null, this._quad(subject, predicate, object, graph3 || this.DEFAULTGRAPH));
29178
29761
  }
29762
+ // ### `_error` emits an error message through the callback
29179
29763
  _error(message2, token) {
29180
29764
  const err = new Error(`${message2} on line ${token.line}.`);
29181
29765
  err.context = {
@@ -29186,9 +29770,12 @@ ${newlined}
29186
29770
  this._callback(err);
29187
29771
  this._callback = noop;
29188
29772
  }
29773
+ // ### `_resolveIRI` resolves an IRI against the base path
29189
29774
  _resolveIRI(iri) {
29190
29775
  return /^[a-z][a-z0-9+.-]*:/i.test(iri) ? iri : this._resolveRelativeIRI(iri);
29191
29776
  }
29777
+ // ### `_resolveRelativeIRI` resolves an IRI against the base path,
29778
+ // assuming that a base path has been set and that the IRI is indeed relative
29192
29779
  _resolveRelativeIRI(iri) {
29193
29780
  if (!iri.length)
29194
29781
  return this._base;
@@ -29203,6 +29790,7 @@ ${newlined}
29203
29790
  return /^[^/:]*:/.test(iri) ? null : this._removeDotSegments(this._basePath + iri);
29204
29791
  }
29205
29792
  }
29793
+ // ### `_removeDotSegments` resolves './' and '../' path segments in an IRI as per RFC3986
29206
29794
  _removeDotSegments(iri) {
29207
29795
  if (!/(^|\/)\.\.?($|[/#?])/.test(iri))
29208
29796
  return iri;
@@ -29250,6 +29838,8 @@ ${newlined}
29250
29838
  }
29251
29839
  return result + iri.substring(segmentStart);
29252
29840
  }
29841
+ // ## Public methods
29842
+ // ### `parse` parses the N3 input and emits each parsed quad through the callback
29253
29843
  parse(input, quadCallback, prefixCallback) {
29254
29844
  this._readCallback = this._readInTopContext;
29255
29845
  this._sparqlStyle = false;
@@ -29319,6 +29909,8 @@ ${newlined}
29319
29909
  "\f": "\\f"
29320
29910
  };
29321
29911
  var SerializedTerm = class extends Term {
29912
+ // Pretty-printed nodes are not equal to any other node
29913
+ // (e.g., [] does not equal [])
29322
29914
  equals() {
29323
29915
  return false;
29324
29916
  }
@@ -29361,12 +29953,16 @@ ${newlined}
29361
29953
  this._writeQuad = this._writeQuadLine;
29362
29954
  }
29363
29955
  }
29956
+ // ## Private methods
29957
+ // ### Whether the current graph is the default graph
29364
29958
  get _inDefaultGraph() {
29365
29959
  return DEFAULTGRAPH2.equals(this._graph);
29366
29960
  }
29961
+ // ### `_write` writes the argument to the output stream
29367
29962
  _write(string, callback) {
29368
29963
  this._outputStream.write(string, "utf8", callback);
29369
29964
  }
29965
+ // ### `_writeQuad` writes the quad to the output stream
29370
29966
  _writeQuad(subject, predicate, object, graph3, done) {
29371
29967
  try {
29372
29968
  if (!graph3.equals(this._graph)) {
@@ -29387,22 +29983,27 @@ ${newlined}
29387
29983
  done && done(error2);
29388
29984
  }
29389
29985
  }
29986
+ // ### `_writeQuadLine` writes the quad to the output stream as a single line
29390
29987
  _writeQuadLine(subject, predicate, object, graph3, done) {
29391
29988
  delete this._prefixMatch;
29392
29989
  this._write(this.quadToString(subject, predicate, object, graph3), done);
29393
29990
  }
29991
+ // ### `quadToString` serializes a quad as a string
29394
29992
  quadToString(subject, predicate, object, graph3) {
29395
29993
  return `${this._encodeSubject(subject)} ${this._encodeIriOrBlank(predicate)} ${this._encodeObject(object)}${graph3 && graph3.value ? ` ${this._encodeIriOrBlank(graph3)} .
29396
29994
  ` : " .\n"}`;
29397
29995
  }
29996
+ // ### `quadsToString` serializes an array of quads as a string
29398
29997
  quadsToString(quads) {
29399
29998
  return quads.map((t) => {
29400
29999
  return this.quadToString(t.subject, t.predicate, t.object, t.graph);
29401
30000
  }).join("");
29402
30001
  }
30002
+ // ### `_encodeSubject` represents a subject
29403
30003
  _encodeSubject(entity) {
29404
30004
  return entity.termType === "Quad" ? this._encodeQuad(entity) : this._encodeIriOrBlank(entity);
29405
30005
  }
30006
+ // ### `_encodeIriOrBlank` represents an IRI or blank node
29406
30007
  _encodeIriOrBlank(entity) {
29407
30008
  if (entity.termType !== "NamedNode") {
29408
30009
  if (this._lists && entity.value in this._lists)
@@ -29417,6 +30018,7 @@ ${newlined}
29417
30018
  const prefixMatch = this._prefixRegex.exec(iri);
29418
30019
  return !prefixMatch ? `<${iri}>` : !prefixMatch[1] ? iri : this._prefixIRIs[prefixMatch[1]] + prefixMatch[2];
29419
30020
  }
30021
+ // ### `_encodeLiteral` represents a literal
29420
30022
  _encodeLiteral(literal4) {
29421
30023
  let value = literal4.value;
29422
30024
  if (escape2.test(value))
@@ -29450,9 +30052,11 @@ ${newlined}
29450
30052
  }
29451
30053
  return `"${value}"^^${this._encodeIriOrBlank(literal4.datatype)}`;
29452
30054
  }
30055
+ // ### `_encodePredicate` represents a predicate
29453
30056
  _encodePredicate(predicate) {
29454
30057
  return predicate.value === rdf2.type ? "a" : this._encodeIriOrBlank(predicate);
29455
30058
  }
30059
+ // ### `_encodeObject` represents an object
29456
30060
  _encodeObject(object) {
29457
30061
  switch (object.termType) {
29458
30062
  case "Quad":
@@ -29463,12 +30067,15 @@ ${newlined}
29463
30067
  return this._encodeIriOrBlank(object);
29464
30068
  }
29465
30069
  }
30070
+ // ### `_encodeQuad` encodes an RDF* quad
29466
30071
  _encodeQuad({ subject, predicate, object, graph: graph3 }) {
29467
30072
  return `<<${this._encodeSubject(subject)} ${this._encodePredicate(predicate)} ${this._encodeObject(object)}${isDefaultGraph(graph3) ? "" : ` ${this._encodeIriOrBlank(graph3)}`}>>`;
29468
30073
  }
30074
+ // ### `_blockedWrite` replaces `_write` after the writer has been closed
29469
30075
  _blockedWrite() {
29470
30076
  throw new Error("Cannot write because the writer has been closed.");
29471
30077
  }
30078
+ // ### `addQuad` adds the quad to the output stream
29472
30079
  addQuad(subject, predicate, object, graph3, done) {
29473
30080
  if (object === void 0)
29474
30081
  this._writeQuad(subject.subject, subject.predicate, subject.object, subject.graph, predicate);
@@ -29477,15 +30084,18 @@ ${newlined}
29477
30084
  else
29478
30085
  this._writeQuad(subject, predicate, object, graph3 || DEFAULTGRAPH2, done);
29479
30086
  }
30087
+ // ### `addQuads` adds the quads to the output stream
29480
30088
  addQuads(quads) {
29481
30089
  for (let i = 0; i < quads.length; i++)
29482
30090
  this.addQuad(quads[i]);
29483
30091
  }
30092
+ // ### `addPrefix` adds the prefix to the output stream
29484
30093
  addPrefix(prefix, iri, done) {
29485
30094
  const prefixes = {};
29486
30095
  prefixes[prefix] = iri;
29487
30096
  this.addPrefixes(prefixes, done);
29488
30097
  }
30098
+ // ### `addPrefixes` adds the prefixes to the output stream
29489
30099
  addPrefixes(prefixes, done) {
29490
30100
  if (!this._prefixIRIs)
29491
30101
  return done && done();
@@ -29514,6 +30124,7 @@ ${newlined}
29514
30124
  }
29515
30125
  this._write(hasPrefixes ? "\n" : "", done);
29516
30126
  }
30127
+ // ### `blank` creates a blank node with the given content
29517
30128
  blank(predicate, object) {
29518
30129
  let children = predicate, child, length;
29519
30130
  if (predicate === void 0)
@@ -29544,12 +30155,14 @@ ${newlined}
29544
30155
  ]`);
29545
30156
  }
29546
30157
  }
30158
+ // ### `list` creates a list node with the given content
29547
30159
  list(elements) {
29548
30160
  const length = elements && elements.length || 0, contents = new Array(length);
29549
30161
  for (let i = 0; i < length; i++)
29550
30162
  contents[i] = this._encodeObject(elements[i]);
29551
30163
  return new SerializedTerm(`(${contents.join(" ")})`);
29552
30164
  }
30165
+ // ### `end` signals the end of the output stream
29553
30166
  end(done) {
29554
30167
  if (this._subject !== null) {
29555
30168
  this._write(this._inDefaultGraph ? ".\n" : "\n}\n");
@@ -29738,11 +30351,19 @@ ${newlined}
29738
30351
  set: function set(g) {
29739
30352
  this.graph = g;
29740
30353
  }
30354
+ /**
30355
+ * Checks whether two statements are the same
30356
+ * @param other - The other statement
30357
+ */
29741
30358
  }, {
29742
30359
  key: "equals",
29743
30360
  value: function equals2(other) {
29744
30361
  return other.subject.equals(this.subject) && other.predicate.equals(this.predicate) && other.object.equals(this.object) && other.graph.equals(this.graph);
29745
30362
  }
30363
+ /**
30364
+ * Creates a statement with the bindings substituted
30365
+ * @param bindings The bindings
30366
+ */
29746
30367
  }, {
29747
30368
  key: "substitute",
29748
30369
  value: function substitute(bindings) {
@@ -29750,6 +30371,7 @@ ${newlined}
29750
30371
  console.log("@@@ statement substitute:" + y);
29751
30372
  return y;
29752
30373
  }
30374
+ /** Creates a canonical string representation of this statement. */
29753
30375
  }, {
29754
30376
  key: "toCanonical",
29755
30377
  value: function toCanonical() {
@@ -29759,16 +30381,19 @@ ${newlined}
29759
30381
  }
29760
30382
  return terms.join(" ") + " .";
29761
30383
  }
30384
+ /** Creates a n-triples string representation of this statement */
29762
30385
  }, {
29763
30386
  key: "toNT",
29764
30387
  value: function toNT() {
29765
30388
  return [this.subject.toNT(), this.predicate.toNT(), this.object.toNT()].join(" ") + " .";
29766
30389
  }
30390
+ /** Creates a n-quads string representation of this statement */
29767
30391
  }, {
29768
30392
  key: "toNQ",
29769
30393
  value: function toNQ2() {
29770
30394
  return [this.subject.toNT(), this.predicate.toNT(), this.object.toNT(), isDefaultGraph2(this.graph) ? "" : this.graph.toNT()].join(" ") + " .";
29771
30395
  }
30396
+ /** Creates a string representation of this statement */
29772
30397
  }, {
29773
30398
  key: "toString",
29774
30399
  value: function toString() {
@@ -30046,12 +30671,19 @@ ${newlined}
30046
30671
  var _defaultGraph = new DefaultGraph2();
30047
30672
  var CanonicalDataFactory = {
30048
30673
  supports: (_supports = {}, _defineProperty(_supports, Feature.collections, false), _defineProperty(_supports, Feature.defaultGraphType, false), _defineProperty(_supports, Feature.equalsMethod, true), _defineProperty(_supports, Feature.identity, false), _defineProperty(_supports, Feature.id, true), _defineProperty(_supports, Feature.reversibleId, false), _defineProperty(_supports, Feature.variableType, true), _supports),
30674
+ /**
30675
+ * Creates a new blank node
30676
+ * @param value - The blank node's identifier
30677
+ */
30049
30678
  blankNode: function blankNode2(value) {
30050
30679
  return new BlankNode(value);
30051
30680
  },
30052
30681
  defaultGraph: function defaultGraph3() {
30053
30682
  return _defaultGraph;
30054
30683
  },
30684
+ /**
30685
+ * Compares to (rdf) objects for equality.
30686
+ */
30055
30687
  equals: function equals(a, b) {
30056
30688
  if (a === b || !a || !b) {
30057
30689
  return true;
@@ -30067,6 +30699,14 @@ ${newlined}
30067
30699
  }
30068
30700
  return false;
30069
30701
  },
30702
+ /**
30703
+ * Generates a uniquely identifiably *idempotent* string for the given {term}.
30704
+ *
30705
+ * Equivalent to [[Term.hashString]]
30706
+ *
30707
+ * @example Use this to associate data with a term in an object
30708
+ * { obj[id(term)] = "myData" }
30709
+ */
30070
30710
  id: function id(term2) {
30071
30711
  if (!term2) {
30072
30712
  return "undefined";
@@ -30090,6 +30730,11 @@ ${newlined}
30090
30730
  isQuad: function isQuad2(obj) {
30091
30731
  return obj instanceof Statement;
30092
30732
  },
30733
+ /**
30734
+ * Creates a new literal node. Does some JS literal parsing for ease of use.
30735
+ * @param value - The lexical value
30736
+ * @param languageOrDatatype - Either the language or the datatype
30737
+ */
30093
30738
  literal: function literal2(value, languageOrDatatype) {
30094
30739
  if (typeof value !== "string" && !languageOrDatatype) {
30095
30740
  return Literal.fromValue(value);
@@ -30105,18 +30750,37 @@ ${newlined}
30105
30750
  return new Literal(strValue, null, languageOrDatatype);
30106
30751
  }
30107
30752
  },
30753
+ /**
30754
+ * Creates a new named node
30755
+ * @param value - The new named node
30756
+ */
30108
30757
  namedNode: function namedNode2(value) {
30109
30758
  return new NamedNode(value);
30110
30759
  },
30760
+ /**
30761
+ * Creates a new statement
30762
+ * @param subject - The subject
30763
+ * @param predicate - The predicate
30764
+ * @param object - The object
30765
+ * @param graph - The containing graph
30766
+ */
30111
30767
  quad: function quad3(subject, predicate, object, graph3) {
30112
30768
  return new Statement(subject, predicate, object, graph3 || _defaultGraph);
30113
30769
  },
30770
+ /**
30771
+ * Creates a new statement
30772
+ * @param subject - The subject
30773
+ * @param predicate - The predicate
30774
+ * @param object - The object
30775
+ * @param graph - The containing graph
30776
+ */
30114
30777
  triple: function triple(subject, predicate, object, graph3) {
30115
30778
  return this.quad(subject, predicate, object, graph3);
30116
30779
  },
30117
30780
  quadToNQ: function quadToNQ(q) {
30118
30781
  return "".concat(this.termToNQ(q.subject), " ").concat(this.termToNQ(q.predicate), " ").concat(this.termToNQ(q.object), " ").concat(this.termToNQ(q.graph), " .");
30119
30782
  },
30783
+ /** Stringify a {term} to n-quads serialization. */
30120
30784
  termToNQ: function termToNQ(term2) {
30121
30785
  var _this = this;
30122
30786
  switch (term2.termType) {
@@ -30139,12 +30803,17 @@ ${newlined}
30139
30803
  throw new Error("Can't serialize nonstandard term type (was '".concat(term2.termType, "')"));
30140
30804
  }
30141
30805
  },
30806
+ /** Convert an rdf object (term or quad) to n-quads serialization. */
30142
30807
  toNQ: function toNQ(term2) {
30143
30808
  if (this.isQuad(term2)) {
30144
30809
  return this.quadToNQ(term2);
30145
30810
  }
30146
30811
  return this.termToNQ(term2);
30147
30812
  },
30813
+ /**
30814
+ * Creates a new variable
30815
+ * @param name - The name for the variable
30816
+ */
30148
30817
  variable: function variable2(name) {
30149
30818
  return new Variable2(name);
30150
30819
  }
@@ -30446,6 +31115,12 @@ ${newlined}
30446
31115
  }
30447
31116
  return this.store.fromNT(s);
30448
31117
  }
31118
+ /**
31119
+ * Defines a set of [prefix, namespace] pairs to be used by this Serializer instance.
31120
+ * Overrides previous prefixes if any
31121
+ * @param namespaces
31122
+ * @return {Serializer}
31123
+ */
30449
31124
  }, {
30450
31125
  key: "setNamespaces",
30451
31126
  value: function setNamespaces(namespaces) {
@@ -30454,6 +31129,11 @@ ${newlined}
30454
31129
  }
30455
31130
  return this;
30456
31131
  }
31132
+ /**
31133
+ * Defines a namespace prefix, overriding any existing prefix for that URI
31134
+ * @param prefix
31135
+ * @param uri
31136
+ */
30457
31137
  }, {
30458
31138
  key: "setPrefix",
30459
31139
  value: function setPrefix(prefix, uri) {
@@ -30470,6 +31150,11 @@ ${newlined}
30470
31150
  this.prefixes[uri] = prefix;
30471
31151
  this.namespaces[prefix] = uri;
30472
31152
  }
31153
+ /* Accumulate Namespaces
31154
+ **
31155
+ ** These are only hints. If two overlap, only one gets used
31156
+ ** There is therefore no guarantee in general.
31157
+ */
30473
31158
  }, {
30474
31159
  key: "suggestPrefix",
30475
31160
  value: function suggestPrefix(prefix, uri) {
@@ -30484,6 +31169,7 @@ ${newlined}
30484
31169
  this.prefixes[uri] = prefix;
30485
31170
  this.namespaces[prefix] = uri;
30486
31171
  }
31172
+ // Takes a namespace -> prefix map
30487
31173
  }, {
30488
31174
  key: "suggestNamespaces",
30489
31175
  value: function suggestNamespaces(namespaces) {
@@ -30507,6 +31193,7 @@ ${newlined}
30507
31193
  }
30508
31194
  }
30509
31195
  }
31196
+ // Make up an unused prefix for a random namespace
30510
31197
  }, {
30511
31198
  key: "makeUpPrefix",
30512
31199
  value: function makeUpPrefix(uri) {
@@ -30609,6 +31296,7 @@ ${newlined}
30609
31296
  "incoming": incoming
30610
31297
  };
30611
31298
  }
31299
+ // //////////////////////////////////////////////////////
30612
31300
  }, {
30613
31301
  key: "toN3",
30614
31302
  value: function toN3(f) {
@@ -30747,7 +31435,8 @@ ${newlined}
30747
31435
  continue;
30748
31436
  }
30749
31437
  }
30750
- if (lastLength < indent * level + 4 || lastLength + branch.length + 1 < width && ";.".indexOf(str[str.length - 2]) < 0) {
31438
+ if (lastLength < indent * level + 4 || // if new line not necessary
31439
+ lastLength + branch.length + 1 < width && ";.".indexOf(str[str.length - 2]) < 0) {
30751
31440
  str = str.slice(0, -1) + " " + branch + "\n";
30752
31441
  lastLength += branch.length + 1;
30753
31442
  } else {
@@ -30855,6 +31544,8 @@ ${newlined}
30855
31544
  var tree = statementListToTree(sts);
30856
31545
  return prefixDirectives() + treeToString(tree);
30857
31546
  }
31547
+ // //////////////////////////////////////////// Atomic Terms
31548
+ // Deal with term level things and nesting with no bnode structure
30858
31549
  }, {
30859
31550
  key: "atomicTermToN3",
30860
31551
  value: function atomicTermToN3(expr, stats) {
@@ -30902,6 +31593,7 @@ ${newlined}
30902
31593
  throw new Error("Internal: atomicTermToN3 cannot handle " + expr + " of termType: " + expr.termType);
30903
31594
  }
30904
31595
  }
31596
+ // stringToN3: String escaping for N3
30905
31597
  }, {
30906
31598
  key: "stringToN3",
30907
31599
  value: function stringToN3(str, flags) {
@@ -30911,7 +31603,10 @@ ${newlined}
30911
31603
  var i, j, k;
30912
31604
  var delim;
30913
31605
  var forbidden;
30914
- if (str.length > 20 && str.slice(-1) !== '"' && flags.indexOf("n") < 0 && (str.indexOf("\n") > 0 || str.indexOf('"') > 0)) {
31606
+ if (str.length > 20 && // Long enough to make sense
31607
+ str.slice(-1) !== '"' && // corner case'
31608
+ flags.indexOf("n") < 0 && // Force single line
31609
+ (str.indexOf("\n") > 0 || str.indexOf('"') > 0)) {
30915
31610
  delim = '"""';
30916
31611
  forbidden = this.forbidden3;
30917
31612
  } else {
@@ -30944,6 +31639,7 @@ ${newlined}
30944
31639
  }
30945
31640
  return delim + res + str.slice(i) + delim;
30946
31641
  }
31642
+ // A single symbol, either in <> or namespace notation
30947
31643
  }, {
30948
31644
  key: "symbolToN3",
30949
31645
  value: function symbolToN3(x) {
@@ -30952,7 +31648,8 @@ ${newlined}
30952
31648
  if (j < 0 && this.flags.indexOf("/") < 0) {
30953
31649
  j = uri.lastIndexOf("/");
30954
31650
  }
30955
- if (j >= 0 && this.flags.indexOf("p") < 0 && (uri.indexOf("http") === 0 || uri.indexOf("ws") === 0 || uri.indexOf("file") === 0)) {
31651
+ if (j >= 0 && this.flags.indexOf("p") < 0 && // Can split at namespace but only if http[s]: URI or file: or ws[s] (why not others?)
31652
+ (uri.indexOf("http") === 0 || uri.indexOf("ws") === 0 || uri.indexOf("file") === 0)) {
30956
31653
  var canSplit = true;
30957
31654
  for (var k = j + 1; k < uri.length; k++) {
30958
31655
  if (this._notNameChars.indexOf(uri[k]) >= 0) {
@@ -30980,6 +31677,9 @@ ${newlined}
30980
31677
  }
30981
31678
  return this.explicitURI(uri);
30982
31679
  }
31680
+ // /////////////////////////// Quad store serialization
31681
+ // @para. write - a function taking a single string to be output
31682
+ //
30983
31683
  }, {
30984
31684
  key: "writeStore",
30985
31685
  value: function writeStore(write) {
@@ -31008,6 +31708,7 @@ ${newlined}
31008
31708
  });
31009
31709
  write(this.statementsToN3(metadata));
31010
31710
  }
31711
+ // ////////////////////////////////////////////// XML serialization
31011
31712
  }, {
31012
31713
  key: "statementsToXML",
31013
31714
  value: function statementsToXML(sts) {
@@ -31246,6 +31947,7 @@ ${newlined}
31246
31947
  var tree2 = [str, tree, "</rdf:RDF>"];
31247
31948
  return XMLtreeToString(tree2, -1);
31248
31949
  }
31950
+ // End @@ body
31249
31951
  }]);
31250
31952
  return Serializer2;
31251
31953
  }();
@@ -31510,16 +32212,27 @@ ${newlined}
31510
32212
  }
31511
32213
  return this.statements.push(this.rdfFactory.quad(subject, predicate, object, graph3));
31512
32214
  }
32215
+ /** Add a statment object
32216
+ * @param {Statement} statement - An existing constructed statement to add
32217
+ */
31513
32218
  }, {
31514
32219
  key: "addStatement",
31515
32220
  value: function addStatement(statement) {
31516
32221
  return this.add(statement);
31517
32222
  }
32223
+ /**
32224
+ * Shortcut for adding blankNodes
32225
+ * @param [id]
32226
+ */
31518
32227
  }, {
31519
32228
  key: "bnode",
31520
32229
  value: function bnode(id3) {
31521
32230
  return this.rdfFactory.blankNode(id3);
31522
32231
  }
32232
+ /**
32233
+ * Adds all the statements to this formula
32234
+ * @param statements - A collection of statements
32235
+ */
31523
32236
  }, {
31524
32237
  key: "addAll",
31525
32238
  value: function addAll(statements) {
@@ -31528,6 +32241,18 @@ ${newlined}
31528
32241
  _this3.add(quad5.subject, quad5.predicate, quad5.object, quad5.graph);
31529
32242
  });
31530
32243
  }
32244
+ /** Follow link from one node, using one wildcard, looking for one
32245
+ *
32246
+ * For example, any(me, knows, null, profile) - a person I know accoring to my profile .
32247
+ * any(me, knows, null, null) - a person I know accoring to anything in store .
32248
+ * any(null, knows, me, null) - a person who know me accoring to anything in store .
32249
+ *
32250
+ * @param s - A node to search for as subject, or if null, a wildcard
32251
+ * @param p - A node to search for as predicate, or if null, a wildcard
32252
+ * @param o - A node to search for as object, or if null, a wildcard
32253
+ * @param g - A node to search for as graph, or if null, a wildcard
32254
+ * @returns A node which match the wildcard position, or null
32255
+ */
31531
32256
  }, {
31532
32257
  key: "any",
31533
32258
  value: function any(s, p, o, g) {
@@ -31543,18 +32268,35 @@ ${newlined}
31543
32268
  }
31544
32269
  return null;
31545
32270
  }
32271
+ /**
32272
+ * Gets the value of a node that matches the specified pattern
32273
+ * @param s The subject
32274
+ * @param p The predicate
32275
+ * @param o The object
32276
+ * @param g The graph that contains the statement
32277
+ */
31546
32278
  }, {
31547
32279
  key: "anyValue",
31548
32280
  value: function anyValue(s, p, o, g) {
31549
32281
  var y = this.any(s, p, o, g);
31550
32282
  return y ? y.value : void 0;
31551
32283
  }
32284
+ /**
32285
+ * Gets the first JavaScript object equivalent to a node based on the specified pattern
32286
+ * @param s The subject
32287
+ * @param p The predicate
32288
+ * @param o The object
32289
+ * @param g The graph that contains the statement
32290
+ */
31552
32291
  }, {
31553
32292
  key: "anyJS",
31554
32293
  value: function anyJS(s, p, o, g) {
31555
32294
  var y = this.any(s, p, o, g);
31556
32295
  return y ? Node2.toJS(y) : void 0;
31557
32296
  }
32297
+ /**
32298
+ * Gets the first statement that matches the specified pattern
32299
+ */
31558
32300
  }, {
31559
32301
  key: "anyStatementMatching",
31560
32302
  value: function anyStatementMatching(s, p, o, g) {
@@ -31564,11 +32306,27 @@ ${newlined}
31564
32306
  }
31565
32307
  return x[0];
31566
32308
  }
32309
+ /**
32310
+ * Returns a unique index-safe identifier for the given term.
32311
+ *
32312
+ * Falls back to the rdflib hashString implementation if the given factory doesn't support id.
32313
+ */
31567
32314
  }, {
31568
32315
  key: "id",
31569
32316
  value: function id3(term2) {
31570
32317
  return this.rdfFactory.id(term2);
31571
32318
  }
32319
+ /**
32320
+ * Search the Store
32321
+ * This is really a teaching method as to do this properly you would use IndexedFormula
32322
+ *
32323
+ * @param s - A node to search for as subject, or if null, a wildcard
32324
+ * @param p - A node to search for as predicate, or if null, a wildcard
32325
+ * @param o - A node to search for as object, or if null, a wildcard
32326
+ * @param g - A node to search for as graph, or if null, a wildcard
32327
+ * @param justOne - flag - stop when found one rather than get all of them?
32328
+ * @returns {Array<Node>} - An array of nodes which match the wildcard position
32329
+ */
31572
32330
  }, {
31573
32331
  key: "statementsMatching",
31574
32332
  value: function statementsMatching(s, p, o, g, justOne) {
@@ -31580,6 +32338,13 @@ ${newlined}
31580
32338
  }
31581
32339
  return sts;
31582
32340
  }
32341
+ /**
32342
+ * Finds the types in the list which have no *stored* subtypes
32343
+ * These are a set of classes which provide by themselves complete
32344
+ * information -- the other classes are redundant for those who
32345
+ * know the class DAG.
32346
+ * @param types A map of the types
32347
+ */
31583
32348
  }, {
31584
32349
  key: "bottomTypeURIs",
31585
32350
  value: function bottomTypeURIs(types2) {
@@ -31613,11 +32378,24 @@ ${newlined}
31613
32378
  }
31614
32379
  return bots;
31615
32380
  }
32381
+ /** Creates a new collection */
31616
32382
  }, {
31617
32383
  key: "collection",
31618
32384
  value: function collection2() {
31619
32385
  return new Collection();
31620
32386
  }
32387
+ /** Follow links from one node, using one wildcard.
32388
+ *
32389
+ * For example, each(me, knows, null, profile) - people I know accoring to my profile .
32390
+ * each(me, knows, null, null) - people I know accoring to anything in store .
32391
+ * each(null, knows, me, null) - people who know me accoring to anything in store .
32392
+ *
32393
+ * @param s - A node to search for as subject, or if null, a wildcard
32394
+ * @param p - A node to search for as predicate, or if null, a wildcard
32395
+ * @param o - A node to search for as object, or if null, a wildcard
32396
+ * @param g - A node to search for as graph, or if null, a wildcard
32397
+ * @returns {Array<Node>} - An array of nodes which match the wildcard position
32398
+ */
31621
32399
  }, {
31622
32400
  key: "each",
31623
32401
  value: function each2(s, p, o, g) {
@@ -31642,6 +32420,10 @@ ${newlined}
31642
32420
  }
31643
32421
  return results;
31644
32422
  }
32423
+ /**
32424
+ * Test whether this formula is equals to {other}
32425
+ * @param other - The other formula
32426
+ */
31645
32427
  }, {
31646
32428
  key: "equals",
31647
32429
  value: function equals2(other) {
@@ -31650,6 +32432,15 @@ ${newlined}
31650
32432
  }
31651
32433
  return this.hashString() === other.hashString();
31652
32434
  }
32435
+ /**
32436
+ * For thisClass or any subclass, anything which has it is its type
32437
+ * or is the object of something which has the type as its range, or subject
32438
+ * of something which has the type as its domain
32439
+ * We don't bother doing subproperty (yet?)as it doesn't seeem to be used
32440
+ * much.
32441
+ * Get all the Classes of which we can RDFS-infer the subject is a member
32442
+ * @return a hash of URIs
32443
+ */
31653
32444
  }, {
31654
32445
  key: "findMembersNT",
31655
32446
  value: function findMembersNT(thisClass) {
@@ -31700,11 +32491,27 @@ ${newlined}
31700
32491
  }
31701
32492
  return members;
31702
32493
  }
32494
+ /**
32495
+ * For thisClass or any subclass, anything which has it is its type
32496
+ * or is the object of something which has the type as its range, or subject
32497
+ * of something which has the type as its domain
32498
+ * We don't bother doing subproperty (yet?)as it doesn't seeem to be used
32499
+ * much.
32500
+ * Get all the Classes of which we can RDFS-infer the subject is a member
32501
+ * @param subject - A named node
32502
+ */
31703
32503
  }, {
31704
32504
  key: "findMemberURIs",
31705
32505
  value: function findMemberURIs(subject) {
31706
32506
  return this.NTtoURI(this.findMembersNT(subject));
31707
32507
  }
32508
+ /**
32509
+ * Get all the Classes of which we can RDFS-infer the subject is a superclass
32510
+ * Returns a hash table where key is NT of type and value is statement why we
32511
+ * think so.
32512
+ * Does NOT return terms, returns URI strings.
32513
+ * We use NT representations in this version because they handle blank nodes.
32514
+ */
31708
32515
  }, {
31709
32516
  key: "findSubClassesNT",
31710
32517
  value: function findSubClassesNT(subject) {
@@ -31712,6 +32519,14 @@ ${newlined}
31712
32519
  types2[subject.toNT()] = true;
31713
32520
  return this.transitiveClosure(types2, this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"), true);
31714
32521
  }
32522
+ /**
32523
+ * Get all the Classes of which we can RDFS-infer the subject is a subclass
32524
+ * @param {RDFlibNamedNode} subject - The thing whose classes are to be found
32525
+ * @returns a hash table where key is NT of type and value is statement why we
32526
+ * think so.
32527
+ * Does NOT return terms, returns URI strings.
32528
+ * We use NT representations in this version because they handle blank nodes.
32529
+ */
31715
32530
  }, {
31716
32531
  key: "findSuperClassesNT",
31717
32532
  value: function findSuperClassesNT(subject) {
@@ -31719,6 +32534,15 @@ ${newlined}
31719
32534
  types2[subject.toNT()] = true;
31720
32535
  return this.transitiveClosure(types2, this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"), false);
31721
32536
  }
32537
+ /**
32538
+ * Get all the Classes of which we can RDFS-infer the subject is a member
32539
+ * todo: This will loop is there is a class subclass loop (Sublass loops are
32540
+ * not illegal)
32541
+ * @param {RDFlibNamedNode} subject - The thing whose classes are to be found
32542
+ * @returns a hash table where key is NT of type and value is statement why we think so.
32543
+ * Does NOT return terms, returns URI strings.
32544
+ * We use NT representations in this version because they handle blank nodes.
32545
+ */
31722
32546
  }, {
31723
32547
  key: "findTypesNT",
31724
32548
  value: function findTypesNT(subject) {
@@ -31757,11 +32581,27 @@ ${newlined}
31757
32581
  }
31758
32582
  return this.transitiveClosure(types2, this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"), false);
31759
32583
  }
32584
+ /**
32585
+ * Get all the Classes of which we can RDFS-infer the subject is a member
32586
+ * todo: This will loop is there is a class subclass loop (Sublass loops are
32587
+ * not illegal)
32588
+ * Returns a hash table where key is NT of type and value is statement why we
32589
+ * think so.
32590
+ * Does NOT return terms, returns URI strings.
32591
+ * We use NT representations in this version because they handle blank nodes.
32592
+ * @param subject - A subject node
32593
+ */
31760
32594
  }, {
31761
32595
  key: "findTypeURIs",
31762
32596
  value: function findTypeURIs(subject) {
31763
32597
  return this.NTtoURI(this.findTypesNT(subject));
31764
32598
  }
32599
+ /** Trace statements which connect directly, or through bnodes
32600
+ *
32601
+ * @param subject - The node to start looking for statments
32602
+ * @param doc - The document to be searched, or null to search all documents
32603
+ * @returns an array of statements, duplicate statements are suppresssed.
32604
+ */
31765
32605
  }, {
31766
32606
  key: "connectedStatements",
31767
32607
  value: function connectedStatements(subject, doc, excludePredicateURIs) {
@@ -31799,11 +32639,22 @@ ${newlined}
31799
32639
  }
31800
32640
  return result;
31801
32641
  }
32642
+ /**
32643
+ * Creates a new empty formula
32644
+ *
32645
+ * @param _features - Not applicable, but necessary for typing to pass
32646
+ */
31802
32647
  }, {
31803
32648
  key: "formula",
31804
32649
  value: function formula2(_features) {
31805
32650
  return new Formula2();
31806
32651
  }
32652
+ /**
32653
+ * Transforms an NTriples string format into a Node.
32654
+ * The blank node bit should not be used on program-external values; designed
32655
+ * for internal work such as storing a blank node id in an HTML attribute.
32656
+ * This will only parse the strings generated by the various toNT() methods.
32657
+ */
31807
32658
  }, {
31808
32659
  key: "fromNT",
31809
32660
  value: function fromNT(str) {
@@ -31836,6 +32687,7 @@ ${newlined}
31836
32687
  }
31837
32688
  throw new Error("Can't convert from NT: " + str);
31838
32689
  }
32690
+ /** Returns true if this formula holds the specified statement(s) */
31839
32691
  }, {
31840
32692
  key: "holds",
31841
32693
  value: function holds(s, p, o, g) {
@@ -31860,11 +32712,20 @@ ${newlined}
31860
32712
  var st3 = this.anyStatementMatching(s, p, o, g);
31861
32713
  return st3 != null;
31862
32714
  }
32715
+ /**
32716
+ * Returns true if this formula holds the specified {statement}
32717
+ */
31863
32718
  }, {
31864
32719
  key: "holdsStatement",
31865
32720
  value: function holdsStatement(statement) {
31866
32721
  return this.holds(statement.subject, statement.predicate, statement.object, statement.graph);
31867
32722
  }
32723
+ /**
32724
+ * Used by the n3parser to generate list elements
32725
+ * @param values - The values of the collection
32726
+ * @param context - The store
32727
+ * @return {BlankNode|Collection} - The term for the statement
32728
+ */
31868
32729
  }, {
31869
32730
  key: "list",
31870
32731
  value: function list(values, context) {
@@ -31881,6 +32742,12 @@ ${newlined}
31881
32742
  return node;
31882
32743
  }
31883
32744
  }
32745
+ /**
32746
+ * Transform a collection of NTriple URIs into their URI strings
32747
+ * @param t - Some iterable collection of NTriple URI strings
32748
+ * @return A collection of the URIs as strings
32749
+ * todo: explain why it is important to go through NT
32750
+ */
31884
32751
  }, {
31885
32752
  key: "NTtoURI",
31886
32753
  value: function NTtoURI(t) {
@@ -31896,11 +32763,22 @@ ${newlined}
31896
32763
  }
31897
32764
  return uris;
31898
32765
  }
32766
+ /**
32767
+ * Serializes this formula
32768
+ * @param base - The base string
32769
+ * @param contentType - The content type of the syntax to use
32770
+ * @param provenance - The provenance URI
32771
+ * @param options - options to pass to the serializer, as defined in serialize method
32772
+ */
31899
32773
  }, {
31900
32774
  key: "serialize",
31901
32775
  value: function serialize2(base, contentType, provenance, options) {
31902
32776
  return serialize(provenance, this, base, contentType, void 0, options);
31903
32777
  }
32778
+ /**
32779
+ * Creates a new formula with the substituting bindings applied
32780
+ * @param bindings - The bindings to substitute
32781
+ */
31904
32782
  }, {
31905
32783
  key: "substitute",
31906
32784
  value: function substitute(bindings) {
@@ -31921,6 +32799,13 @@ ${newlined}
31921
32799
  }
31922
32800
  return this.rdfFactory.namedNode(uri);
31923
32801
  }
32802
+ /**
32803
+ * Gets the node matching the specified pattern. Throws when no match could be made.
32804
+ * @param s - The subject
32805
+ * @param p - The predicate
32806
+ * @param o - The object
32807
+ * @param g - The graph that contains the statement
32808
+ */
31924
32809
  }, {
31925
32810
  key: "the",
31926
32811
  value: function the(s, p, o, g) {
@@ -31930,6 +32815,14 @@ ${newlined}
31930
32815
  }
31931
32816
  return x;
31932
32817
  }
32818
+ /**
32819
+ * RDFS Inference
32820
+ * These are hand-written implementations of a backward-chaining reasoner
32821
+ * over the RDFS axioms.
32822
+ * @param seeds - A hash of NTs of classes to start with
32823
+ * @param predicate - The property to trace though
32824
+ * @param inverse - Trace inverse direction
32825
+ */
31933
32826
  }, {
31934
32827
  key: "transitiveClosure",
31935
32828
  value: function transitiveClosure(seeds, predicate, inverse) {
@@ -31964,6 +32857,12 @@ ${newlined}
31964
32857
  delete agenda[t];
31965
32858
  }
31966
32859
  }
32860
+ /**
32861
+ * Finds the types in the list which have no *stored* supertypes
32862
+ * We exclude the universal class, owl:Things and rdf:Resource, as it is
32863
+ * information-free.
32864
+ * @param types - The types
32865
+ */
31967
32866
  }, {
31968
32867
  key: "topTypeURIs",
31969
32868
  value: function topTypeURIs(types2) {
@@ -32001,16 +32900,30 @@ ${newlined}
32001
32900
  }
32002
32901
  return tops;
32003
32902
  }
32903
+ /**
32904
+ * Serializes this formula to a string
32905
+ */
32004
32906
  }, {
32005
32907
  key: "toString",
32006
32908
  value: function toString() {
32007
32909
  return "{" + this.statements.join("\n") + "}";
32008
32910
  }
32911
+ /**
32912
+ * Gets a new variable
32913
+ * @param name - The variable's name
32914
+ */
32009
32915
  }, {
32010
32916
  key: "variable",
32011
32917
  value: function variable4(name) {
32012
32918
  return new Variable2(name);
32013
32919
  }
32920
+ /**
32921
+ * Gets the number of statements in this formula that matches the specified pattern
32922
+ * @param s - The subject
32923
+ * @param p - The predicate
32924
+ * @param o - The object
32925
+ * @param g - The graph that contains the statement
32926
+ */
32014
32927
  }, {
32015
32928
  key: "whether",
32016
32929
  value: function whether(s, p, o, g) {
@@ -32316,6 +33229,7 @@ ${newlined}
32316
33229
  bindingsSoFar,
32317
33230
  level,
32318
33231
  fetcher4,
33232
+ // match not match2 to look up any others necessary.
32319
33233
  localCallback,
32320
33234
  branch
32321
33235
  );
@@ -32603,7 +33517,13 @@ ${newlined}
32603
33517
  _this.whyIndex = [];
32604
33518
  _this.index = [_this.subjectIndex, _this.predicateIndex, _this.objectIndex, _this.whyIndex];
32605
33519
  _this.namespaces = {};
32606
- _this.features = features || [];
33520
+ _this.features = features || [
33521
+ // By default, devs do not expect these features.
33522
+ // See https://github.com/linkeddata/rdflib.js/issues/458
33523
+ // 'sameAs',
33524
+ // 'InverseFunctionalProperty',
33525
+ // 'FunctionalProperty',
33526
+ ];
32607
33527
  _this.rdfArrayRemove = opts.rdfArrayRemove || RDFArrayRemove;
32608
33528
  if (opts.dataCallback) {
32609
33529
  _this.dataCallbacks = [opts.dataCallback];
@@ -32613,14 +33533,24 @@ ${newlined}
32613
33533
  }
32614
33534
  _createClass(IndexedFormula5, [{
32615
33535
  key: "substitute",
32616
- value: function substitute(bindings) {
32617
- var statementsCopy = this.statements.map(function(ea) {
32618
- return ea.substitute(bindings);
32619
- });
32620
- var y = new IndexedFormula5();
32621
- y.add(statementsCopy);
32622
- return y;
32623
- }
33536
+ value: (
33537
+ /**
33538
+ * Gets this graph with the bindings substituted
33539
+ * @param bindings The bindings
33540
+ */
33541
+ function substitute(bindings) {
33542
+ var statementsCopy = this.statements.map(function(ea) {
33543
+ return ea.substitute(bindings);
33544
+ });
33545
+ var y = new IndexedFormula5();
33546
+ y.add(statementsCopy);
33547
+ return y;
33548
+ }
33549
+ )
33550
+ /**
33551
+ * Add a callback which will be triggered after a statement has been added to the store.
33552
+ * @param cb
33553
+ */
32624
33554
  }, {
32625
33555
  key: "addDataCallback",
32626
33556
  value: function addDataCallback(cb) {
@@ -32629,6 +33559,13 @@ ${newlined}
32629
33559
  }
32630
33560
  this.dataCallbacks.push(cb);
32631
33561
  }
33562
+ /**
33563
+ * Apply a set of statements to be deleted and to be inserted
33564
+ *
33565
+ * @param patch - The set of statements to be deleted and to be inserted
33566
+ * @param target - The name of the document to patch
33567
+ * @param patchCallback - Callback to be called when patching is complete
33568
+ */
32632
33569
  }, {
32633
33570
  key: "applyPatch",
32634
33571
  value: function applyPatch(patch, target, patchCallback) {
@@ -32694,6 +33631,11 @@ ${newlined}
32694
33631
  doPatch(patchCallback);
32695
33632
  }
32696
33633
  }
33634
+ /**
33635
+ * N3 allows for declaring blank nodes, this function enables that support
33636
+ *
33637
+ * @param x The blank node to be declared, supported in N3
33638
+ */
32697
33639
  }, {
32698
33640
  key: "declareExistential",
32699
33641
  value: function declareExistential(x) {
@@ -32702,6 +33644,9 @@ ${newlined}
32702
33644
  this._existentialVariables.push(x);
32703
33645
  return x;
32704
33646
  }
33647
+ /**
33648
+ * @param features
33649
+ */
32705
33650
  }, {
32706
33651
  key: "initPropertyActions",
32707
33652
  value: function initPropertyActions(features) {
@@ -32723,12 +33668,23 @@ ${newlined}
32723
33668
  }];
32724
33669
  }
32725
33670
  }
33671
+ /** @deprecated Use {add} instead */
32726
33672
  }, {
32727
33673
  key: "addStatement",
32728
33674
  value: function addStatement(st3) {
32729
33675
  this.add(st3.subject, st3.predicate, st3.object, st3.graph);
32730
33676
  return this.statements.length;
32731
33677
  }
33678
+ /**
33679
+ * Adds a triple (quad) to the store.
33680
+ *
33681
+ * @param subj - The thing about which the fact a relationship is asserted.
33682
+ * Also accepts a statement or an array of Statements.
33683
+ * @param pred - The relationship which is asserted
33684
+ * @param obj - The object of the relationship, e.g. another thing or a value. If passed a string, this will become a literal.
33685
+ * @param why - The document in which the triple (S,P,O) was or will be stored on the web
33686
+ * @returns The statement added to the store, or the store
33687
+ */
32732
33688
  }, {
32733
33689
  key: "add",
32734
33690
  value: function add(subj, pred, obj, why) {
@@ -32808,6 +33764,10 @@ ${newlined}
32808
33764
  }
32809
33765
  return st3;
32810
33766
  }
33767
+ /**
33768
+ * Returns the symbol with canonical URI as smushed
33769
+ * @param term - An RDF node
33770
+ */
32811
33771
  }, {
32812
33772
  key: "canon",
32813
33773
  value: function canon(term2) {
@@ -32839,6 +33799,9 @@ ${newlined}
32839
33799
  throw new Error("Term Type not recognized for canonization: ".concat(term2.termType));
32840
33800
  }
32841
33801
  }
33802
+ /**
33803
+ * Checks this formula for consistency
33804
+ */
32842
33805
  }, {
32843
33806
  key: "check",
32844
33807
  value: function check2() {
@@ -32852,6 +33815,11 @@ ${newlined}
32852
33815
  }
32853
33816
  }
32854
33817
  }
33818
+ /**
33819
+ * Checks a list of statements for consistency
33820
+ * @param sts - The list of statements to check
33821
+ * @param from - An index with the array ['subject', 'predicate', 'object', 'why']
33822
+ */
32855
33823
  }, {
32856
33824
  key: "checkStatementList",
32857
33825
  value: function checkStatementList(sts, from) {
@@ -32885,6 +33853,9 @@ ${newlined}
32885
33853
  }
32886
33854
  }
32887
33855
  }
33856
+ /**
33857
+ * Closes this formula (and return it)
33858
+ */
32888
33859
  }, {
32889
33860
  key: "close",
32890
33861
  value: function close() {
@@ -32910,6 +33881,13 @@ ${newlined}
32910
33881
  }
32911
33882
  return 0;
32912
33883
  }
33884
+ /**
33885
+ * replaces @template with @target and add appropriate triples
33886
+ * removes no triples by default and is a one-direction replication
33887
+ * @param template node to copy
33888
+ * @param target node to copy to
33889
+ * @param flags Whether or not to do a two-directional copy and/or delete triples
33890
+ */
32913
33891
  }, {
32914
33892
  key: "copyTo",
32915
33893
  value: function copyTo(template, target, flags) {
@@ -32935,6 +33913,12 @@ ${newlined}
32935
33913
  }
32936
33914
  }
32937
33915
  }
33916
+ /**
33917
+ * Simplify graph in store when we realize two identifiers are equivalent
33918
+ * We replace the bigger with the smaller.
33919
+ * @param u1in The first node
33920
+ * @param u2in The second node
33921
+ */
32938
33922
  }, {
32939
33923
  key: "equate",
32940
33924
  value: function equate(u1in, u2in) {
@@ -32950,27 +33934,59 @@ ${newlined}
32950
33934
  return this.replaceWith(u1, u2);
32951
33935
  }
32952
33936
  }
33937
+ /**
33938
+ * Creates a new empty indexed formula
33939
+ * Only applicable for IndexedFormula, but TypeScript won't allow a subclass to override a property
33940
+ * @param features The list of features
33941
+ */
32953
33942
  }, {
32954
33943
  key: "formula",
32955
33944
  value: function formula2(features) {
32956
33945
  return new IndexedFormula5(features);
32957
33946
  }
33947
+ /**
33948
+ * Returns the number of statements contained in this IndexedFormula.
33949
+ * (Getter proxy to this.statements).
33950
+ * Usage:
33951
+ * ```
33952
+ * var kb = rdf.graph()
33953
+ * kb.length // -> 0
33954
+ * ```
33955
+ * @returns {Number}
33956
+ */
32958
33957
  }, {
32959
33958
  key: "length",
32960
33959
  get: function get() {
32961
33960
  return this.statements.length;
32962
33961
  }
33962
+ /**
33963
+ * Returns any quads matching the given arguments.
33964
+ * Standard RDFJS spec method for Source objects, implemented as an
33965
+ * alias to `statementsMatching()`
33966
+ * @param subject The subject
33967
+ * @param predicate The predicate
33968
+ * @param object The object
33969
+ * @param graph The graph that contains the statement
33970
+ */
32963
33971
  }, {
32964
33972
  key: "match",
32965
33973
  value: function match(subject, predicate, object, graph3) {
32966
33974
  return this.statementsMatching(node_default.fromValue(subject), node_default.fromValue(predicate), node_default.fromValue(object), node_default.fromValue(graph3));
32967
33975
  }
33976
+ /**
33977
+ * Find out whether a given URI is used as symbol in the formula
33978
+ * @param uri The URI to look for
33979
+ */
32968
33980
  }, {
32969
33981
  key: "mentionsURI",
32970
33982
  value: function mentionsURI(uri) {
32971
33983
  var hash = "<" + uri + ">";
32972
33984
  return !!this.subjectIndex[hash] || !!this.objectIndex[hash] || !!this.predicateIndex[hash];
32973
33985
  }
33986
+ /**
33987
+ * Existentials are BNodes - something exists without naming
33988
+ * @param uri An URI
33989
+ */
32974
33990
  }, {
32975
33991
  key: "newExistential",
32976
33992
  value: function newExistential(uri) {
@@ -32979,6 +33995,11 @@ ${newlined}
32979
33995
  var x = this.sym(uri);
32980
33996
  return this.declareExistential(x);
32981
33997
  }
33998
+ /**
33999
+ * Adds a new property action
34000
+ * @param pred the predicate that the function should be triggered on
34001
+ * @param action the function that should trigger
34002
+ */
32982
34003
  }, {
32983
34004
  key: "newPropertyAction",
32984
34005
  value: function newPropertyAction(pred, action) {
@@ -32994,6 +34015,11 @@ ${newlined}
32994
34015
  }
32995
34016
  return done;
32996
34017
  }
34018
+ /**
34019
+ * Creates a new universal node
34020
+ * Universals are Variables
34021
+ * @param uri An URI
34022
+ */
32997
34023
  }, {
32998
34024
  key: "newUniversal",
32999
34025
  value: function newUniversal(uri) {
@@ -33003,11 +34029,17 @@ ${newlined}
33003
34029
  this._universalVariables.push(x);
33004
34030
  return x;
33005
34031
  }
34032
+ // convenience function used by N3 parser
33006
34033
  }, {
33007
34034
  key: "variable",
33008
34035
  value: function variable4(name) {
33009
34036
  return new Variable2(name);
33010
34037
  }
34038
+ /**
34039
+ * Find an unused id for a file being edited: return a symbol
34040
+ * (Note: Slow iff a lot of them -- could be O(log(k)) )
34041
+ * @param doc A document named node
34042
+ */
33011
34043
  }, {
33012
34044
  key: "nextSymbol",
33013
34045
  value: function nextSymbol(doc) {
@@ -33017,11 +34049,24 @@ ${newlined}
33017
34049
  return this.sym(uri);
33018
34050
  }
33019
34051
  }
34052
+ /**
34053
+ * Query this store asynchronously, return bindings in callback
34054
+ *
34055
+ * @param myQuery The query to be run
34056
+ * @param callback Function to call when bindings
34057
+ * @param Fetcher | null If you want the query to do link following
34058
+ * @param onDone OBSOLETE - do not use this // @@ Why not ?? Called when query complete
34059
+ */
33020
34060
  }, {
33021
34061
  key: "query",
33022
34062
  value: function query(myQuery, callback, fetcher3, onDone) {
33023
34063
  return indexedFormulaQuery.call(this, myQuery, callback, fetcher3, onDone);
33024
34064
  }
34065
+ /**
34066
+ * Query this store synchronously and return bindings
34067
+ *
34068
+ * @param myQuery The query to be run
34069
+ */
33025
34070
  }, {
33026
34071
  key: "querySync",
33027
34072
  value: function querySync(myQuery) {
@@ -33040,6 +34085,10 @@ ${newlined}
33040
34085
  }
33041
34086
  return results;
33042
34087
  }
34088
+ /**
34089
+ * Removes one or multiple statement(s) from this formula
34090
+ * @param st - A Statement or array of Statements to remove
34091
+ */
33043
34092
  }, {
33044
34093
  key: "remove",
33045
34094
  value: function remove(st3) {
@@ -33059,6 +34108,10 @@ ${newlined}
33059
34108
  this.removeStatement(sts[0]);
33060
34109
  return this;
33061
34110
  }
34111
+ /**
34112
+ * Removes all statements in a doc
34113
+ * @param doc - The document / graph
34114
+ */
33062
34115
  }, {
33063
34116
  key: "removeDocument",
33064
34117
  value: function removeDocument(doc) {
@@ -33068,6 +34121,14 @@ ${newlined}
33068
34121
  }
33069
34122
  return this;
33070
34123
  }
34124
+ /**
34125
+ * Remove all statements matching args (within limit) *
34126
+ * @param subj The subject
34127
+ * @param pred The predicate
34128
+ * @param obj The object
34129
+ * @param why The graph that contains the statement
34130
+ * @param limit The number of statements to remove
34131
+ */
33071
34132
  }, {
33072
34133
  key: "removeMany",
33073
34134
  value: function removeMany(subj, pred, obj, why, limit) {
@@ -33082,12 +34143,26 @@ ${newlined}
33082
34143
  this.remove(statements[i]);
33083
34144
  }
33084
34145
  }
34146
+ /**
34147
+ * Remove all matching statements
34148
+ * @param subject The subject
34149
+ * @param predicate The predicate
34150
+ * @param object The object
34151
+ * @param graph The graph that contains the statement
34152
+ */
33085
34153
  }, {
33086
34154
  key: "removeMatches",
33087
34155
  value: function removeMatches(subject, predicate, object, graph3) {
33088
34156
  this.removeMany(subject, predicate, object, graph3);
33089
34157
  return this;
33090
34158
  }
34159
+ /**
34160
+ * Remove a particular statement object from the store
34161
+ *
34162
+ * @param st - a statement which is already in the store and indexed.
34163
+ * Make sure you only use this for these.
34164
+ * Otherwise, you should use remove() above.
34165
+ */
33091
34166
  }, {
33092
34167
  key: "removeStatement",
33093
34168
  value: function removeStatement(st3) {
@@ -33103,6 +34178,10 @@ ${newlined}
33103
34178
  this.rdfArrayRemove(this.statements, st3);
33104
34179
  return this;
33105
34180
  }
34181
+ /**
34182
+ * Removes statements
34183
+ * @param sts The statements to remove
34184
+ */
33106
34185
  }, {
33107
34186
  key: "removeStatements",
33108
34187
  value: function removeStatements(sts) {
@@ -33111,6 +34190,9 @@ ${newlined}
33111
34190
  }
33112
34191
  return this;
33113
34192
  }
34193
+ /**
34194
+ * Replace big with small, obsoleted with obsoleting.
34195
+ */
33114
34196
  }, {
33115
34197
  key: "replaceWith",
33116
34198
  value: function replaceWith(big, small) {
@@ -33153,6 +34235,10 @@ ${newlined}
33153
34235
  moveIndex(this.propertyActions);
33154
34236
  return true;
33155
34237
  }
34238
+ /**
34239
+ * Return all equivalent URIs by which this is known
34240
+ * @param x A named node
34241
+ */
33156
34242
  }, {
33157
34243
  key: "allAliases",
33158
34244
  value: function allAliases(x) {
@@ -33160,6 +34246,11 @@ ${newlined}
33160
34246
  a.push(this.canon(x));
33161
34247
  return a;
33162
34248
  }
34249
+ /**
34250
+ * Compare by canonical URI as smushed
34251
+ * @param x A named node
34252
+ * @param y Another named node
34253
+ */
33163
34254
  }, {
33164
34255
  key: "sameThings",
33165
34256
  value: function sameThings(x, y) {
@@ -33189,6 +34280,16 @@ ${newlined}
33189
34280
  }
33190
34281
  this.namespaces[prefix] = nsuri;
33191
34282
  }
34283
+ /** Search the Store
34284
+ *
34285
+ * ALL CONVENIENCE LOOKUP FUNCTIONS RELY ON THIS!
34286
+ * @param subj - A node to search for as subject, or if null, a wildcard
34287
+ * @param pred - A node to search for as predicate, or if null, a wildcard
34288
+ * @param obj - A node to search for as object, or if null, a wildcard
34289
+ * @param why - A node to search for as graph, or if null, a wildcard
34290
+ * @param justOne - flag - stop when found one rather than get all of them?
34291
+ * @returns An array of nodes which match the wildcard position
34292
+ */
33192
34293
  }, {
33193
34294
  key: "statementsMatching",
33194
34295
  value: function statementsMatching(subj, pred, obj, why, justOne) {
@@ -33258,6 +34359,10 @@ ${newlined}
33258
34359
  }
33259
34360
  return results;
33260
34361
  }
34362
+ /**
34363
+ * A list of all the URIs by which this thing is known
34364
+ * @param term
34365
+ */
33261
34366
  }, {
33262
34367
  key: "uris",
33263
34368
  value: function uris(term2) {
@@ -33299,6 +34404,7 @@ ${newlined}
33299
34404
  return encodeURI(str);
33300
34405
  }
33301
34406
  var Utf8 = {
34407
+ // public method for url encoding
33302
34408
  encode: function encode3(string) {
33303
34409
  string = string.replace(/\r\n/g, "\n");
33304
34410
  var utftext = "";
@@ -33317,6 +34423,7 @@ ${newlined}
33317
34423
  }
33318
34424
  return utftext;
33319
34425
  },
34426
+ // public method for url decoding
33320
34427
  decode: function decode3(utftext) {
33321
34428
  var string = "";
33322
34429
  var i = 0;
@@ -34675,6 +35782,10 @@ ${newlined}
34675
35782
  }
34676
35783
  var ExtendedTermFactory = _objectSpread2(_objectSpread2({}, canonical_data_factory_default), {}, {
34677
35784
  supports: (_supports2 = {}, _defineProperty(_supports2, Feature.collections, true), _defineProperty(_supports2, Feature.defaultGraphType, false), _defineProperty(_supports2, Feature.equalsMethod, true), _defineProperty(_supports2, Feature.identity, false), _defineProperty(_supports2, Feature.id, true), _defineProperty(_supports2, Feature.reversibleId, false), _defineProperty(_supports2, Feature.variableType, true), _supports2),
35785
+ /**
35786
+ * Creates a new collection
35787
+ * @param elements - The initial element
35788
+ */
34678
35789
  collection: function collection(elements) {
34679
35790
  return new Collection(elements);
34680
35791
  },
@@ -35754,102 +36865,122 @@ ${newlined}
35754
36865
  }
35755
36866
  _createClass(RDFParser2, [{
35756
36867
  key: "frameFactory",
35757
- value: function frameFactory(parser, parent2, element) {
35758
- return {
35759
- "NODE": 1,
35760
- "ARC": 2,
35761
- "parent": parent2,
35762
- "parser": parser,
35763
- "store": parser.store,
35764
- "element": element,
35765
- "lastChild": 0,
35766
- "base": null,
35767
- "lang": null,
35768
- "node": null,
35769
- "nodeType": null,
35770
- "listIndex": 1,
35771
- "rdfid": null,
35772
- "datatype": null,
35773
- "collection": false,
35774
- "terminateFrame": function terminateFrame() {
35775
- if (this.collection) {
35776
- this.node.close();
35777
- }
35778
- },
35779
- "addSymbol": function addSymbol(type, uri) {
35780
- uri = join(uri, this.base);
35781
- this.node = this.store.sym(uri);
35782
- this.nodeType = type;
35783
- },
35784
- "loadTriple": function loadTriple() {
35785
- if (this.parent.parent.collection) {
35786
- this.parent.parent.node.append(this.node);
35787
- } else {
35788
- this.store.add(this.parent.parent.node, this.parent.node, this.node, this.parser.why);
35789
- }
35790
- if (this.parent.rdfid != null) {
35791
- var triple3 = this.store.sym(join("#" + this.parent.rdfid, this.base));
35792
- this.store.add(triple3, this.store.sym(RDFParser2.ns.RDF + "type"), this.store.sym(RDFParser2.ns.RDF + "Statement"), this.parser.why);
35793
- this.store.add(triple3, this.store.sym(RDFParser2.ns.RDF + "subject"), this.parent.parent.node, this.parser.why);
35794
- this.store.add(triple3, this.store.sym(RDFParser2.ns.RDF + "predicate"), this.parent.node, this.parser.why);
35795
- this.store.add(triple3, this.store.sym(RDFParser2.ns.RDF + "object"), this.node, this.parser.why);
35796
- }
35797
- },
35798
- "isTripleToLoad": function isTripleToLoad() {
35799
- return this.parent != null && this.parent.parent != null && this.nodeType === this.NODE && this.parent.nodeType === this.ARC && this.parent.parent.nodeType === this.NODE;
35800
- },
35801
- "addNode": function addNode(uri) {
35802
- this.addSymbol(this.NODE, uri);
35803
- if (this.isTripleToLoad()) {
35804
- this.loadTriple();
35805
- }
35806
- },
35807
- "addCollection": function addCollection() {
35808
- this.nodeType = this.NODE;
35809
- this.node = this.store.collection();
35810
- this.collection = true;
35811
- if (this.isTripleToLoad()) {
35812
- this.loadTriple();
35813
- }
35814
- },
35815
- "addCollectionArc": function addCollectionArc() {
35816
- this.nodeType = this.ARC;
35817
- },
35818
- "addBNode": function addBNode(id3) {
35819
- if (id3 != null) {
35820
- if (this.parser.bnodes[id3] != null) {
35821
- this.node = this.parser.bnodes[id3];
36868
+ value: (
36869
+ /**
36870
+ * Frame class for namespace and base URI lookups
36871
+ * Base lookups will always resolve because the parser knows
36872
+ * the default base.
36873
+ *
36874
+ * @private
36875
+ */
36876
+ function frameFactory(parser, parent2, element) {
36877
+ return {
36878
+ "NODE": 1,
36879
+ "ARC": 2,
36880
+ "parent": parent2,
36881
+ "parser": parser,
36882
+ "store": parser.store,
36883
+ "element": element,
36884
+ "lastChild": 0,
36885
+ "base": null,
36886
+ "lang": null,
36887
+ "node": null,
36888
+ "nodeType": null,
36889
+ "listIndex": 1,
36890
+ "rdfid": null,
36891
+ "datatype": null,
36892
+ "collection": false,
36893
+ /** Terminate the frame and notify the store that we're done */
36894
+ "terminateFrame": function terminateFrame() {
36895
+ if (this.collection) {
36896
+ this.node.close();
36897
+ }
36898
+ },
36899
+ /** Add a symbol of a certain type to the this frame */
36900
+ "addSymbol": function addSymbol(type, uri) {
36901
+ uri = join(uri, this.base);
36902
+ this.node = this.store.sym(uri);
36903
+ this.nodeType = type;
36904
+ },
36905
+ /** Load any constructed triples into the store */
36906
+ "loadTriple": function loadTriple() {
36907
+ if (this.parent.parent.collection) {
36908
+ this.parent.parent.node.append(this.node);
35822
36909
  } else {
35823
- this.node = this.parser.bnodes[id3] = this.store.bnode();
36910
+ this.store.add(this.parent.parent.node, this.parent.node, this.node, this.parser.why);
36911
+ }
36912
+ if (this.parent.rdfid != null) {
36913
+ var triple3 = this.store.sym(join("#" + this.parent.rdfid, this.base));
36914
+ this.store.add(triple3, this.store.sym(RDFParser2.ns.RDF + "type"), this.store.sym(RDFParser2.ns.RDF + "Statement"), this.parser.why);
36915
+ this.store.add(triple3, this.store.sym(RDFParser2.ns.RDF + "subject"), this.parent.parent.node, this.parser.why);
36916
+ this.store.add(triple3, this.store.sym(RDFParser2.ns.RDF + "predicate"), this.parent.node, this.parser.why);
36917
+ this.store.add(triple3, this.store.sym(RDFParser2.ns.RDF + "object"), this.node, this.parser.why);
36918
+ }
36919
+ },
36920
+ /** Check if it's OK to load a triple */
36921
+ "isTripleToLoad": function isTripleToLoad() {
36922
+ return this.parent != null && this.parent.parent != null && this.nodeType === this.NODE && this.parent.nodeType === this.ARC && this.parent.parent.nodeType === this.NODE;
36923
+ },
36924
+ /** Add a symbolic node to this frame */
36925
+ "addNode": function addNode(uri) {
36926
+ this.addSymbol(this.NODE, uri);
36927
+ if (this.isTripleToLoad()) {
36928
+ this.loadTriple();
36929
+ }
36930
+ },
36931
+ /** Add a collection node to this frame */
36932
+ "addCollection": function addCollection() {
36933
+ this.nodeType = this.NODE;
36934
+ this.node = this.store.collection();
36935
+ this.collection = true;
36936
+ if (this.isTripleToLoad()) {
36937
+ this.loadTriple();
36938
+ }
36939
+ },
36940
+ /** Add a collection arc to this frame */
36941
+ "addCollectionArc": function addCollectionArc() {
36942
+ this.nodeType = this.ARC;
36943
+ },
36944
+ /** Add a bnode to this frame */
36945
+ "addBNode": function addBNode(id3) {
36946
+ if (id3 != null) {
36947
+ if (this.parser.bnodes[id3] != null) {
36948
+ this.node = this.parser.bnodes[id3];
36949
+ } else {
36950
+ this.node = this.parser.bnodes[id3] = this.store.bnode();
36951
+ }
36952
+ } else {
36953
+ this.node = this.store.bnode();
36954
+ }
36955
+ this.nodeType = this.NODE;
36956
+ if (this.isTripleToLoad()) {
36957
+ this.loadTriple();
36958
+ }
36959
+ },
36960
+ /** Add an arc or property to this frame */
36961
+ "addArc": function addArc(uri) {
36962
+ if (uri === RDFParser2.ns.RDF + "li") {
36963
+ uri = RDFParser2.ns.RDF + "_" + this.parent.listIndex;
36964
+ this.parent.listIndex++;
36965
+ }
36966
+ this.addSymbol(this.ARC, uri);
36967
+ },
36968
+ /** Add a literal to this frame */
36969
+ "addLiteral": function addLiteral(value) {
36970
+ if (this.parent.datatype && this.parent.datatype !== RDFParser2.ns.RDF + "langString") {
36971
+ this.node = this.store.literal(value, this.store.sym(this.parent.datatype));
36972
+ } else {
36973
+ this.node = this.store.literal(value, this.lang);
36974
+ }
36975
+ this.nodeType = this.NODE;
36976
+ if (this.isTripleToLoad()) {
36977
+ this.loadTriple();
35824
36978
  }
35825
- } else {
35826
- this.node = this.store.bnode();
35827
- }
35828
- this.nodeType = this.NODE;
35829
- if (this.isTripleToLoad()) {
35830
- this.loadTriple();
35831
- }
35832
- },
35833
- "addArc": function addArc(uri) {
35834
- if (uri === RDFParser2.ns.RDF + "li") {
35835
- uri = RDFParser2.ns.RDF + "_" + this.parent.listIndex;
35836
- this.parent.listIndex++;
35837
- }
35838
- this.addSymbol(this.ARC, uri);
35839
- },
35840
- "addLiteral": function addLiteral(value) {
35841
- if (this.parent.datatype && this.parent.datatype !== RDFParser2.ns.RDF + "langString") {
35842
- this.node = this.store.literal(value, this.store.sym(this.parent.datatype));
35843
- } else {
35844
- this.node = this.store.literal(value, this.lang);
35845
- }
35846
- this.nodeType = this.NODE;
35847
- if (this.isTripleToLoad()) {
35848
- this.loadTriple();
35849
36979
  }
35850
- }
35851
- };
35852
- }
36980
+ };
36981
+ }
36982
+ )
36983
+ // from the OpenLayers source .. needed to get around IE problems.
35853
36984
  }, {
35854
36985
  key: "getAttributeNodeNS",
35855
36986
  value: function getAttributeNodeNS(node, uri, name) {
@@ -35872,6 +37003,12 @@ ${newlined}
35872
37003
  }
35873
37004
  return attributeNode;
35874
37005
  }
37006
+ /**
37007
+ * Build our initial scope frame and parse the DOM into triples
37008
+ * @param {HTMLDocument} document The DOM to parse
37009
+ * @param {String} base The base URL to use
37010
+ * @param {Object} why The context to which this resource belongs
37011
+ */
35875
37012
  }, {
35876
37013
  key: "parse",
35877
37014
  value: function parse3(document3, base, why) {
@@ -36059,12 +37196,20 @@ ${newlined}
36059
37196
  }
36060
37197
  }
36061
37198
  }
37199
+ /**
37200
+ * Cleans out state from a previous parse run
37201
+ * @private
37202
+ */
36062
37203
  }, {
36063
37204
  key: "cleanParser",
36064
37205
  value: function cleanParser() {
36065
37206
  this.bnodes = {};
36066
37207
  this.why = null;
36067
37208
  }
37209
+ /**
37210
+ * Builds scope frame
37211
+ * @private
37212
+ */
36068
37213
  }, {
36069
37214
  key: "buildFrame",
36070
37215
  value: function buildFrame(parent2, element) {
@@ -36250,7 +37395,10 @@ ${newlined}
36250
37395
  }
36251
37396
  }
36252
37397
  function executeErrorCallback(e) {
36253
- if (contentType !== JSONLDContentType || contentType !== NQuadsContentType || contentType !== NQuadsAltContentType) {
37398
+ if (// TODO: Always true, what is the right behavior
37399
+ contentType !== JSONLDContentType || // @ts-ignore always true?
37400
+ contentType !== NQuadsContentType || // @ts-ignore always true?
37401
+ contentType !== NQuadsAltContentType) {
36254
37402
  if (callback) {
36255
37403
  callback(e, kb);
36256
37404
  } else {
@@ -36332,6 +37480,7 @@ ${newlined}
36332
37480
  link: Namespace("http://www.w3.org/2007/ont/link#", factory),
36333
37481
  http: Namespace("http://www.w3.org/2007/ont/http#", factory),
36334
37482
  httph: Namespace("http://www.w3.org/2007/ont/httph#", factory),
37483
+ // headers
36335
37484
  rdf: Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#", factory),
36336
37485
  rdfs: Namespace("http://www.w3.org/2000/01/rdf-schema#", factory),
36337
37486
  dc: Namespace("http://purl.org/dc/elements/1.1/", factory),
@@ -36340,6 +37489,8 @@ ${newlined}
36340
37489
  };
36341
37490
  var ns2 = getNS();
36342
37491
  var Handler = /* @__PURE__ */ _createClass(
37492
+ // TODO: Document, type
37493
+ // TODO: Document, type
36343
37494
  function Handler2(response, dom) {
36344
37495
  _classCallCheck(this, Handler2);
36345
37496
  _defineProperty(this, "response", void 0);
@@ -36762,6 +37913,7 @@ ${newlined}
36762
37913
  "*/*": {
36763
37914
  "q": 0.1
36764
37915
  }
37916
+ // Must allow access to random content
36765
37917
  };
36766
37918
  callbackify(this, ["request", "fail", "refresh", "retract", "done"]);
36767
37919
  Object.keys(options.handlers || defaultHandlers).map(function(key) {
@@ -36770,22 +37922,69 @@ ${newlined}
36770
37922
  }
36771
37923
  _createClass(Fetcher3, [{
36772
37924
  key: "load",
36773
- value: function load(uri) {
36774
- var _this2 = this;
36775
- var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
36776
- options = Object.assign({}, options);
36777
- if (uri instanceof Array) {
36778
- return Promise.all(uri.map(function(x) {
36779
- return _this2.load(x, Object.assign({}, options));
36780
- }));
37925
+ value: (
37926
+ /**
37927
+ * Promise-based load function
37928
+ *
37929
+ * Loads a web resource or resources into the store.
37930
+ *
37931
+ * A resource may be given as NamedNode object, or as a plain URI.
37932
+ * an array of resources will be given, in which they will be fetched in parallel.
37933
+ * By default, the HTTP headers are recorded also, in the same store, in a separate graph.
37934
+ * This allows code like editable() for example to test things about the resource.
37935
+ *
37936
+ * @param uri {Array<RDFlibNamedNode>|Array<string>|RDFlibNamedNode|string}
37937
+ *
37938
+ * @param [options={}] {Object}
37939
+ *
37940
+ * @param [options.fetch] {Function}
37941
+ *
37942
+ * @param [options.referringTerm] {RDFlibNamedNode} Referring term, the resource which
37943
+ * referred to this (for tracking bad links)
37944
+ *
37945
+ * @param [options.contentType] {string} Provided content type (for writes)
37946
+ *
37947
+ * @param [options.forceContentType] {string} Override the incoming header to
37948
+ * force the data to be treated as this content-type (for reads)
37949
+ *
37950
+ * @param [options.force] {boolean} Load the data even if loaded before.
37951
+ * Also sets the `Cache-Control:` header to `no-cache`
37952
+ *
37953
+ * @param [options.baseURI=docuri] {Node|string} Original uri to preserve
37954
+ * through proxying etc (`xhr.original`).
37955
+ *
37956
+ * @param [options.proxyUsed] {boolean} Whether this request is a retry via
37957
+ * a proxy (generally done from an error handler)
37958
+ *
37959
+ * @param [options.withCredentials] {boolean} flag for XHR/CORS etc
37960
+ *
37961
+ * @param [options.clearPreviousData] {boolean} Before we parse new data,
37962
+ * clear old, but only on status 200 responses
37963
+ *
37964
+ * @param [options.noMeta] {boolean} Prevents the addition of various metadata
37965
+ * triples (about the fetch request) to the store
37966
+ *
37967
+ * @param [options.noRDFa] {boolean}
37968
+ *
37969
+ * @returns {Promise<Result>}
37970
+ */
37971
+ function load(uri) {
37972
+ var _this2 = this;
37973
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
37974
+ options = Object.assign({}, options);
37975
+ if (uri instanceof Array) {
37976
+ return Promise.all(uri.map(function(x) {
37977
+ return _this2.load(x, Object.assign({}, options));
37978
+ }));
37979
+ }
37980
+ var uriIn = uri;
37981
+ var docuri = termValue(uriIn);
37982
+ docuri = docuri.split("#")[0];
37983
+ options = this.initFetchOptions(docuri, options);
37984
+ var initialisedOptions = this.initFetchOptions(docuri, options);
37985
+ return this.pendingFetchPromise(docuri, initialisedOptions.baseURI, initialisedOptions);
36781
37986
  }
36782
- var uriIn = uri;
36783
- var docuri = termValue(uriIn);
36784
- docuri = docuri.split("#")[0];
36785
- options = this.initFetchOptions(docuri, options);
36786
- var initialisedOptions = this.initFetchOptions(docuri, options);
36787
- return this.pendingFetchPromise(docuri, initialisedOptions.baseURI, initialisedOptions);
36788
- }
37987
+ )
36789
37988
  }, {
36790
37989
  key: "pendingFetchPromise",
36791
37990
  value: function pendingFetchPromise(uri, originalUri, options) {
@@ -36806,6 +38005,9 @@ ${newlined}
36806
38005
  return x;
36807
38006
  });
36808
38007
  }
38008
+ /**
38009
+ * @param _options - DEPRECATED
38010
+ */
36809
38011
  }, {
36810
38012
  key: "cleanupFetchRequest",
36811
38013
  value: function cleanupFetchRequest(originalUri, _options, timeout2) {
@@ -36850,6 +38052,14 @@ ${newlined}
36850
38052
  options.actualProxyURI = actualProxyURI;
36851
38053
  return options;
36852
38054
  }
38055
+ /**
38056
+ * (The promise chain ends in either a `failFetch()` or a `doneFetch()`)
38057
+ *
38058
+ * @param docuri {string}
38059
+ * @param options {Object}
38060
+ *
38061
+ * @returns {Promise<Object>} fetch() result or an { error, status } object
38062
+ */
36853
38063
  }, {
36854
38064
  key: "fetchUri",
36855
38065
  value: function fetchUri(docuri, options) {
@@ -36864,6 +38074,7 @@ ${newlined}
36864
38074
  if (!options.force) {
36865
38075
  if (state === "fetched") {
36866
38076
  return Promise.resolve(
38077
+ // @ts-ignore This is not a valid response object
36867
38078
  this.doneFetch(options, {
36868
38079
  status: 200,
36869
38080
  ok: true,
@@ -36875,10 +38086,12 @@ ${newlined}
36875
38086
  var _message = "Previously failed: " + this.requested[docuri];
36876
38087
  var dummyResponse = {
36877
38088
  url: docuri,
38089
+ // This does not comply to Fetch spec, it can be a string value in rdflib
36878
38090
  status: this.requested[docuri],
36879
38091
  statusText: _message,
36880
38092
  responseText: _message,
36881
38093
  headers: new import_cross_fetch.Headers(),
38094
+ // Headers() ???
36882
38095
  ok: false,
36883
38096
  body: null,
36884
38097
  bodyUsed: false,
@@ -36902,9 +38115,11 @@ ${newlined}
36902
38115
  var dummyResponse2 = {
36903
38116
  url: actualProxyURI,
36904
38117
  status: 999,
38118
+ // @@ what number/string should fetch failures report?
36905
38119
  statusText: (error2.name || "network failure") + ": " + (error2.errno || error2.code || error2.type),
36906
38120
  responseText: error2.message,
36907
38121
  headers: new import_cross_fetch.Headers(),
38122
+ // Headers() ???
36908
38123
  ok: false,
36909
38124
  body: null,
36910
38125
  bodyUsed: false,
@@ -36915,6 +38130,33 @@ ${newlined}
36915
38130
  return _this5.handleError(dummyResponse2, docuri, options);
36916
38131
  });
36917
38132
  }
38133
+ /**
38134
+ * Asks for a doc to be loaded if necessary then calls back
38135
+ *
38136
+ * Calling methods:
38137
+ * nowOrWhenFetched (uri, userCallback)
38138
+ * nowOrWhenFetched (uri, options, userCallback)
38139
+ * nowOrWhenFetched (uri, referringTerm, userCallback, options) <-- old
38140
+ * nowOrWhenFetched (uri, referringTerm, userCallback) <-- old
38141
+ *
38142
+ * Options include:
38143
+ * referringTerm The document in which this link was found.
38144
+ * this is valuable when finding the source of bad URIs
38145
+ * force boolean. Never mind whether you have tried before,
38146
+ * load this from scratch.
38147
+ * forceContentType Override the incoming header to force the data to be
38148
+ * treated as this content-type.
38149
+ *
38150
+ * Callback function takes:
38151
+ *
38152
+ * ok True if the fetch worked, and got a 200 response.
38153
+ * False if any error happened
38154
+ *
38155
+ * errmessage Text error message if not OK.
38156
+ *
38157
+ * response The fetch Response object (was: XHR) if there was was one
38158
+ * includes response.status as the HTTP status if any.
38159
+ */
36918
38160
  }, {
36919
38161
  key: "nowOrWhenFetched",
36920
38162
  value: function nowOrWhenFetched(uriIn, p2, userCallback) {
@@ -36957,6 +38199,11 @@ ${newlined}
36957
38199
  userCallback(false, message2, err.response);
36958
38200
  });
36959
38201
  }
38202
+ /**
38203
+ * Records a status message (as a literal node) by appending it to the
38204
+ * request's metadata status collection.
38205
+ *
38206
+ */
36960
38207
  }, {
36961
38208
  key: "addStatus",
36962
38209
  value: function addStatus(req, statusMessage) {
@@ -36970,6 +38217,14 @@ ${newlined}
36970
38217
  log_default.warn("web.js: No list to add to: " + statusNode + "," + statusMessage);
36971
38218
  }
36972
38219
  }
38220
+ /**
38221
+ * Records errors in the system on failure:
38222
+ *
38223
+ * - Adds an entry to the request status collection
38224
+ * - Adds an error triple with the fail message to the metadata
38225
+ * - Fires the 'fail' callback
38226
+ * - Rejects with an error result object, which has a response object if any
38227
+ */
36973
38228
  }, {
36974
38229
  key: "failFetch",
36975
38230
  value: function failFetch(options, errorMessage, statusCode, response) {
@@ -36992,6 +38247,8 @@ ${newlined}
36992
38247
  err.response = response;
36993
38248
  return Promise.reject(err);
36994
38249
  }
38250
+ // in the why part of the quad distinguish between HTML and HTTP header
38251
+ // Reverse is set iif the link was rev= as opposed to rel=
36995
38252
  }, {
36996
38253
  key: "linkData",
36997
38254
  value: function linkData(originalUri, rel, uri, why, reverse) {
@@ -37051,6 +38308,11 @@ ${newlined}
37051
38308
  response.req = options.req;
37052
38309
  return response;
37053
38310
  }
38311
+ /**
38312
+ * Note two nodes are now smushed
38313
+ * If only one was flagged as looked up, then the new node is looked up again,
38314
+ * which will make sure all the URIs are dereferenced
38315
+ */
37054
38316
  }, {
37055
38317
  key: "nowKnownAs",
37056
38318
  value: function nowKnownAs(was, now) {
@@ -37064,6 +38326,9 @@ ${newlined}
37064
38326
  }
37065
38327
  }
37066
38328
  }
38329
+ /**
38330
+ * Writes back to the web what we have in the store for this uri
38331
+ */
37067
38332
  }, {
37068
38333
  key: "putBack",
37069
38334
  value: function putBack(uri) {
@@ -37098,6 +38363,7 @@ ${newlined}
37098
38363
  return this.webOperation("GET", here).then(function(result) {
37099
38364
  return _this7.webOperation(
37100
38365
  "PUT",
38366
+ // change to binary from text
37101
38367
  there,
37102
38368
  {
37103
38369
  data: result.responseText,
@@ -37117,6 +38383,11 @@ ${newlined}
37117
38383
  return response;
37118
38384
  });
37119
38385
  }
38386
+ /** Create an empty resource if it really does not exist
38387
+ * Be absolutely sure something does not exist before creating a new empty file
38388
+ * as otherwise existing could be deleted.
38389
+ * @param doc - The resource
38390
+ */
37120
38391
  }, {
37121
38392
  key: "createIfNotExists",
37122
38393
  value: function() {
@@ -37179,10 +38450,16 @@ ${newlined}
37179
38450
  }
37180
38451
  return createIfNotExists;
37181
38452
  }()
38453
+ /**
38454
+ * @param parentURI URI of parent container
38455
+ * @param folderName - Optional folder name (slug)
38456
+ * @param data - Optional folder metadata
38457
+ */
37182
38458
  }, {
37183
38459
  key: "createContainer",
37184
38460
  value: function createContainer(parentURI, folderName, data) {
37185
38461
  var headers = {
38462
+ // Force the right mime type for containers
37186
38463
  "content-type": TurtleContentType,
37187
38464
  "link": this.ns.ldp("BasicContainer") + '; rel="type"'
37188
38465
  };
@@ -37220,6 +38497,13 @@ ${newlined}
37220
38497
  delete fetcher3.nonexistent[uri];
37221
38498
  }
37222
38499
  }
38500
+ /**
38501
+ * A generic web operation, at the fetch() level.
38502
+ * does not involve the quad store.
38503
+ *
38504
+ * Returns promise of Response
38505
+ * If data is returned, copies it to response.responseText before returning
38506
+ */
37223
38507
  }, {
37224
38508
  key: "webOperation",
37225
38509
  value: function webOperation(method, uriIn) {
@@ -37268,6 +38552,15 @@ ${newlined}
37268
38552
  });
37269
38553
  });
37270
38554
  }
38555
+ /**
38556
+ * Looks up something.
38557
+ * Looks up all the URIs a things has.
38558
+ *
38559
+ * @param term - canonical term for the thing whose URI is
38560
+ * to be dereferenced
38561
+ * @param rterm - the resource which referred to this
38562
+ * (for tracking bad links)
38563
+ */
37271
38564
  }, {
37272
38565
  key: "lookUpThing",
37273
38566
  value: function lookUpThing(term2, rterm) {
@@ -37283,6 +38576,14 @@ ${newlined}
37283
38576
  referringTerm: rterm
37284
38577
  });
37285
38578
  }
38579
+ /**
38580
+ * Looks up response header.
38581
+ *
38582
+ * @returns {Array|undefined} a list of header values found in a stored HTTP
38583
+ * response, or [] if response was found but no header found,
38584
+ * or undefined if no response is available.
38585
+ * Looks for { [] link:requestedURI ?uri; link:response [ httph:header-name ?value ] }
38586
+ */
37286
38587
  }, {
37287
38588
  key: "getHeader",
37288
38589
  value: function getHeader(doc, header) {
@@ -37352,6 +38653,11 @@ ${newlined}
37352
38653
  }
37353
38654
  }
37354
38655
  }
38656
+ /* refresh Reload data from a given document
38657
+ **
38658
+ ** @param term - An RDF Named Node for the eodcument in question
38659
+ ** @param userCallback - A function userCallback(ok, message, response)
38660
+ */
37355
38661
  }, {
37356
38662
  key: "refresh",
37357
38663
  value: function refresh(term2, userCallback) {
@@ -37361,6 +38667,11 @@ ${newlined}
37361
38667
  clearPreviousData: true
37362
38668
  }, userCallback);
37363
38669
  }
38670
+ /* refreshIfExpired Conditional refresh if Expired
38671
+ **
38672
+ ** @param term - An RDF Named Node for the eodcument in question
38673
+ ** @param userCallback - A function userCallback(ok, message, response)
38674
+ */
37364
38675
  }, {
37365
38676
  key: "refreshIfExpired",
37366
38677
  value: function refreshIfExpired(term2, userCallback) {
@@ -37425,6 +38736,10 @@ ${newlined}
37425
38736
  this.addStatus(options.req, "Abort: Will retry with credentials SUPPRESSED to see if that helps");
37426
38737
  return this.load(docuri, newOptions);
37427
38738
  }
38739
+ /**
38740
+ * Tests whether a request is being made to a cross-site URI (for purposes
38741
+ * of retrying with a proxy)
38742
+ */
37428
38743
  }, {
37429
38744
  key: "isCrossSite",
37430
38745
  value: function isCrossSite(uri) {
@@ -37435,6 +38750,10 @@ ${newlined}
37435
38750
  var here = "" + document.location;
37436
38751
  return (hostpart2(here) && hostpart2(uri) && hostpart2(here)) !== hostpart2(uri);
37437
38752
  }
38753
+ /**
38754
+ * Called when there's a network error in fetch(), or a response
38755
+ * with status of 0.
38756
+ */
37438
38757
  }, {
37439
38758
  key: "handleError",
37440
38759
  value: function handleError(response, docuri, options) {
@@ -37459,6 +38778,7 @@ ${newlined}
37459
38778
  }
37460
38779
  return this.failFetch(options, message2, response.status || 998, response);
37461
38780
  }
38781
+ // deduce some things from the HTTP transaction
37462
38782
  }, {
37463
38783
  key: "addType",
37464
38784
  value: function addType(rdfType, req, kb, locURI) {
@@ -37491,6 +38811,9 @@ ${newlined}
37491
38811
  }
37492
38812
  }
37493
38813
  }
38814
+ /**
38815
+ * Handle fetch() response
38816
+ */
37494
38817
  }, {
37495
38818
  key: "handleResponse",
37496
38819
  value: function handleResponse(response, docuri, options) {
@@ -37602,6 +38925,9 @@ ${newlined}
37602
38925
  }
37603
38926
  return contentType;
37604
38927
  }
38928
+ /**
38929
+ * Sends a new request to the specified uri. (Extracted from `onerrorFactory()`)
38930
+ */
37605
38931
  }, {
37606
38932
  key: "redirectToProxy",
37607
38933
  value: function redirectToProxy(newURI, options) {
@@ -37661,6 +38987,9 @@ ${newlined}
37661
38987
  }
37662
38988
  return acceptstring;
37663
38989
  }
38990
+ // var updatesVia = new $rdf.UpdatesVia(this) // Subscribe to headers
38991
+ // @@@@@@@@ This is turned off because it causes a websocket to be set up for ANY fetch
38992
+ // whether we want to track it ot not. including ontologies loaed though the XSSproxy
37664
38993
  }], [{
37665
38994
  key: "crossSiteProxy",
37666
38995
  value: function crossSiteProxy(uri) {
@@ -37712,17 +39041,26 @@ ${newlined}
37712
39041
  return y;
37713
39042
  }
37714
39043
  }
37715
- if (Fetcher3.crossSiteProxyTemplate && typeof document !== "undefined" && document.location && ("" + document.location).slice(0, 6) === "https:" && uri.slice(0, 5) === "http:") {
39044
+ if (Fetcher3.crossSiteProxyTemplate && typeof document !== "undefined" && document.location && ("" + document.location).slice(0, 6) === "https:" && // origin is secure
39045
+ uri.slice(0, 5) === "http:") {
37716
39046
  return Fetcher3.crossSiteProxyTemplate.replace("{uri}", encodeURIComponent(uri));
37717
39047
  }
37718
39048
  return uri;
37719
39049
  }
39050
+ /**
39051
+ * Tests whether the uri's protocol is supported by the Fetcher.
39052
+ * @param uri
39053
+ */
37720
39054
  }, {
37721
39055
  key: "unsupportedProtocol",
37722
39056
  value: function unsupportedProtocol(uri) {
37723
39057
  var pcol = protocol(uri);
37724
39058
  return pcol === "tel" || pcol === "mailto" || pcol === "urn";
37725
39059
  }
39060
+ /** Decide on credentials using old XXHR api or new fetch() one
39061
+ * @param requestedURI
39062
+ * @param options
39063
+ */
37726
39064
  }, {
37727
39065
  key: "setCredentials",
37728
39066
  value: function setCredentials(requestedURI) {
@@ -37767,9 +39105,17 @@ ${newlined}
37767
39105
  return target;
37768
39106
  }
37769
39107
  var RDFlibDataFactory = _objectSpread3(_objectSpread3({}, extended_term_factory_default), {}, {
39108
+ /**
39109
+ * Creates a new fetcher
39110
+ * @param store - The store to use
39111
+ * @param options - The options
39112
+ */
37770
39113
  fetcher: function fetcher(store, options) {
37771
39114
  return new Fetcher(store, options);
37772
39115
  },
39116
+ /**
39117
+ * Creates a new graph (store)
39118
+ */
37773
39119
  graph: function graph() {
37774
39120
  var features = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : void 0;
37775
39121
  var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : void 0;
@@ -37777,9 +39123,22 @@ ${newlined}
37777
39123
  rdfFactory: extended_term_factory_default
37778
39124
  });
37779
39125
  },
39126
+ /**
39127
+ * Creates a new literal node
39128
+ * @param val The lexical value
39129
+ * @param lang The language
39130
+ * @param dt The datatype
39131
+ */
37780
39132
  lit: function lit(val, lang, dt) {
37781
39133
  return this.literal("" + val, lang || dt);
37782
39134
  },
39135
+ /**
39136
+ * Creates a new statement
39137
+ * @param subject The subject
39138
+ * @param predicate The predicate
39139
+ * @param object The object
39140
+ * @param graph The containing graph
39141
+ */
37783
39142
  st: function st(subject, predicate, object, graph3) {
37784
39143
  return this.quad(subject, predicate, object, graph3);
37785
39144
  }
@@ -38036,68 +39395,111 @@ ${newlined}
38036
39395
  };
38037
39396
  return __toCommonJS(src_exports);
38038
39397
  })();
38039
- /*!
38040
- * Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
38041
- */
38042
- /*!
38043
- * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
38044
- */
38045
- /*!
38046
- * The buffer module from node.js, for the browser.
38047
- *
38048
- * @author Feross Aboukhadijeh <http://feross.org>
38049
- * @license MIT
38050
- */
38051
- /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
38052
- */
38053
- /*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval
38054
- */
38055
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
38056
- /*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
38057
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
38058
- /**
38059
- * A JavaScript implementation of the JSON-LD API.
38060
- *
38061
- * @author Dave Longley
38062
- *
38063
- * @license BSD 3-Clause License
38064
- * Copyright (c) 2011-2019 Digital Bazaar, Inc.
38065
- * All rights reserved.
38066
- *
38067
- * Redistribution and use in source and binary forms, with or without
38068
- * modification, are permitted provided that the following conditions are met:
38069
- *
38070
- * Redistributions of source code must retain the above copyright notice,
38071
- * this list of conditions and the following disclaimer.
38072
- *
38073
- * Redistributions in binary form must reproduce the above copyright
38074
- * notice, this list of conditions and the following disclaimer in the
38075
- * documentation and/or other materials provided with the distribution.
38076
- *
38077
- * Neither the name of the Digital Bazaar, Inc. nor the names of its
38078
- * contributors may be used to endorse or promote products derived from
38079
- * this software without specific prior written permission.
38080
- *
38081
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
38082
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
38083
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
38084
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
38085
- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
38086
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
38087
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
38088
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38089
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
38090
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38091
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38092
- */
38093
- /**
38094
- * Removes the @preserve keywords from expanded result of framing.
38095
- *
38096
- * @param input the framed, framed output.
38097
- * @param options the framing options used.
38098
- *
38099
- * @return the resulting output.
38100
- */
38101
- // disallow aliasing @context and @preserve
38102
- // remove @preserve
38103
- // remove @preserve from results
39398
+ /*! Bundled license information:
39399
+
39400
+ @inrupt/oidc-client/lib/oidc-client.min.js:
39401
+ (*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
39402
+ *)
39403
+ (*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval
39404
+ *)
39405
+ (*!
39406
+ * The buffer module from node.js, for the browser.
39407
+ *
39408
+ * @author Feross Aboukhadijeh <http://feross.org>
39409
+ * @license MIT
39410
+ *)
39411
+ (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
39412
+
39413
+ rdf-canonize/lib/MessageDigest-browser.js:
39414
+ (*!
39415
+ * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
39416
+ *)
39417
+
39418
+ rdf-canonize/lib/Permuter.js:
39419
+ (*!
39420
+ * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
39421
+ *)
39422
+
39423
+ rdf-canonize/lib/NQuads.js:
39424
+ (*!
39425
+ * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
39426
+ *)
39427
+
39428
+ rdf-canonize/lib/URDNA2015.js:
39429
+ (*!
39430
+ * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
39431
+ *)
39432
+
39433
+ rdf-canonize/lib/URGNA2012.js:
39434
+ (*!
39435
+ * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
39436
+ *)
39437
+
39438
+ rdf-canonize/lib/URDNA2015Sync.js:
39439
+ (*!
39440
+ * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
39441
+ *)
39442
+
39443
+ rdf-canonize/lib/URGNA2012Sync.js:
39444
+ (*!
39445
+ * Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
39446
+ *)
39447
+
39448
+ jsonld/lib/context.js:
39449
+ (* disallow aliasing @context and @preserve *)
39450
+
39451
+ jsonld/lib/frame.js:
39452
+ (* remove @preserve from results *)
39453
+ (**
39454
+ * Removes the @preserve keywords from expanded result of framing.
39455
+ *
39456
+ * @param input the framed, framed output.
39457
+ * @param options the framing options used.
39458
+ *
39459
+ * @return the resulting output.
39460
+ *)
39461
+ (* remove @preserve *)
39462
+
39463
+ jsonld/lib/jsonld.js:
39464
+ (**
39465
+ * A JavaScript implementation of the JSON-LD API.
39466
+ *
39467
+ * @author Dave Longley
39468
+ *
39469
+ * @license BSD 3-Clause License
39470
+ * Copyright (c) 2011-2019 Digital Bazaar, Inc.
39471
+ * All rights reserved.
39472
+ *
39473
+ * Redistribution and use in source and binary forms, with or without
39474
+ * modification, are permitted provided that the following conditions are met:
39475
+ *
39476
+ * Redistributions of source code must retain the above copyright notice,
39477
+ * this list of conditions and the following disclaimer.
39478
+ *
39479
+ * Redistributions in binary form must reproduce the above copyright
39480
+ * notice, this list of conditions and the following disclaimer in the
39481
+ * documentation and/or other materials provided with the distribution.
39482
+ *
39483
+ * Neither the name of the Digital Bazaar, Inc. nor the names of its
39484
+ * contributors may be used to endorse or promote products derived from
39485
+ * this software without specific prior written permission.
39486
+ *
39487
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
39488
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
39489
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
39490
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39491
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
39492
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
39493
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
39494
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
39495
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39496
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
39497
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39498
+ *)
39499
+
39500
+ queue-microtask/index.js:
39501
+ (*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
39502
+
39503
+ @babel/runtime/helpers/regeneratorRuntime.js:
39504
+ (*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE *)
39505
+ */