@pod-os/core 0.29.0 → 0.30.0-rc.4453840.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -30832,10 +30832,10 @@ var PodOS = (() => {
30832
30832
  return kb.rdfFactory.quad(id4, predicate4, object8, kb.rdfFactory.namedNode(base2));
30833
30833
  }
30834
30834
 
30835
- // ../node_modules/n3/src/N3Lexer.js
30835
+ // node_modules/n3/src/N3Lexer.js
30836
30836
  var import_buffer = __toESM(require_buffer());
30837
30837
 
30838
- // ../node_modules/n3/src/IRIs.js
30838
+ // node_modules/n3/src/IRIs.js
30839
30839
  var RDF2 = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
30840
30840
  var XSD = "http://www.w3.org/2001/XMLSchema#";
30841
30841
  var SWAP = "http://www.w3.org/2000/10/swap/";
@@ -30852,7 +30852,9 @@ var PodOS = (() => {
30852
30852
  nil: `${RDF2}nil`,
30853
30853
  first: `${RDF2}first`,
30854
30854
  rest: `${RDF2}rest`,
30855
- langString: `${RDF2}langString`
30855
+ langString: `${RDF2}langString`,
30856
+ dirLangString: `${RDF2}dirLangString`,
30857
+ reifies: `${RDF2}reifies`
30856
30858
  },
30857
30859
  owl: {
30858
30860
  sameAs: "http://www.w3.org/2002/07/owl#sameAs"
@@ -30867,7 +30869,7 @@ var PodOS = (() => {
30867
30869
  }
30868
30870
  };
30869
30871
 
30870
- // ../node_modules/n3/src/N3Lexer.js
30872
+ // node_modules/n3/src/N3Lexer.js
30871
30873
  var { xsd } = IRIs_default;
30872
30874
  var escapeSequence = /\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g;
30873
30875
  var escapeReplacements = {
@@ -30905,6 +30907,7 @@ var PodOS = (() => {
30905
30907
  _unescapedIri: true,
30906
30908
  _simpleQuotedString: true,
30907
30909
  _langcode: true,
30910
+ _dircode: true,
30908
30911
  _blank: true,
30909
30912
  _newline: true,
30910
30913
  _comment: true,
@@ -30918,15 +30921,16 @@ var PodOS = (() => {
30918
30921
  this._unescapedIri = /^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/;
30919
30922
  this._simpleQuotedString = /^"([^"\\\r\n]*)"(?=[^"])/;
30920
30923
  this._simpleApostropheString = /^'([^'\\\r\n]*)'(?=[^'])/;
30921
- this._langcode = /^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i;
30924
+ this._langcode = /^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9])/i;
30925
+ this._dircode = /^--(ltr)|(rtl)/;
30922
30926
  this._prefix = /^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/;
30923
30927
  this._prefixed = /^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/;
30924
30928
  this._variable = /^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/;
30925
30929
  this._blank = /^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/;
30926
30930
  this._number = /^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/;
30927
30931
  this._boolean = /^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/;
30928
- this._keyword = /^@[a-z]+(?=[\s#<:])/i;
30929
- this._sparqlKeyword = /^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i;
30932
+ this._atKeyword = /^@[a-z]+(?=[\s#<:])/i;
30933
+ this._keyword = /^(?:PREFIX|BASE|VERSION|GRAPH)(?=[\s#<])/i;
30930
30934
  this._shortPredicates = /^a(?=[\s#()\[\]\{\}"'<>])/;
30931
30935
  this._newline = /^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/;
30932
30936
  this._comment = /#([^\n\r]*)/;
@@ -31000,7 +31004,9 @@ var PodOS = (() => {
31000
31004
  if (value7 === null || illegalIriChars.test(value7))
31001
31005
  return reportSyntaxError(this);
31002
31006
  type5 = "IRI";
31003
- } else if (input2.length > 1 && input2[1] === "<")
31007
+ } else if (input2.length > 2 && input2[1] === "<" && input2[2] === "(")
31008
+ type5 = "<<(", matchLength = 3;
31009
+ else if (!this._lineMode && input2.length > (inputFinished ? 1 : 2) && input2[1] === "<")
31004
31010
  type5 = "<<", matchLength = 2;
31005
31011
  else if (this._n3Mode && input2.length > 1 && input2[1] === "=") {
31006
31012
  matchLength = 2;
@@ -31049,9 +31055,9 @@ var PodOS = (() => {
31049
31055
  type5 = "var", value7 = match[0];
31050
31056
  break;
31051
31057
  case "@":
31052
- if (this._previousMarker === "literal" && (match = this._langcode.exec(input2)))
31058
+ if (this._previousMarker === "literal" && (match = this._langcode.exec(input2)) && match[1] !== "version")
31053
31059
  type5 = "langcode", value7 = match[1];
31054
- else if (match = this._keyword.exec(input2))
31060
+ else if (match = this._atKeyword.exec(input2))
31055
31061
  type5 = match[0];
31056
31062
  break;
31057
31063
  case ".":
@@ -31073,6 +31079,11 @@ var PodOS = (() => {
31073
31079
  case "9":
31074
31080
  case "+":
31075
31081
  case "-":
31082
+ if (input2[1] === "-") {
31083
+ if (this._previousMarker === "langcode" && (match = this._dircode.exec(input2)))
31084
+ type5 = "dircode", matchLength = 2, value7 = match[1] || match[2], matchLength = value7.length + 2;
31085
+ break;
31086
+ }
31076
31087
  if (match = this._number.exec(input2) || inputFinished && (match = this._number.exec(`${input2} `))) {
31077
31088
  type5 = "literal", value7 = match[0];
31078
31089
  prefix3 = typeof match[1] === "string" ? xsd.double : typeof match[2] === "string" ? xsd.decimal : xsd.integer;
@@ -31084,7 +31095,9 @@ var PodOS = (() => {
31084
31095
  case "P":
31085
31096
  case "G":
31086
31097
  case "g":
31087
- if (match = this._sparqlKeyword.exec(input2))
31098
+ case "V":
31099
+ case "v":
31100
+ if (match = this._keyword.exec(input2))
31088
31101
  type5 = match[0].toUpperCase();
31089
31102
  else
31090
31103
  inconclusive = true;
@@ -31114,13 +31127,21 @@ var PodOS = (() => {
31114
31127
  case "!":
31115
31128
  if (!this._n3Mode)
31116
31129
  break;
31130
+ case ")":
31131
+ if (!inputFinished && (input2.length === 1 || input2.length === 2 && input2[1] === ">")) {
31132
+ break;
31133
+ }
31134
+ if (input2.length > 2 && input2[1] === ">" && input2[2] === ">") {
31135
+ type5 = ")>>", matchLength = 3;
31136
+ break;
31137
+ }
31117
31138
  case ",":
31118
31139
  case ";":
31119
31140
  case "[":
31120
31141
  case "]":
31121
31142
  case "(":
31122
- case ")":
31123
31143
  case "}":
31144
+ case "~":
31124
31145
  if (!this._lineMode) {
31125
31146
  matchLength = 1;
31126
31147
  type5 = firstChar;
@@ -31285,7 +31306,7 @@ var PodOS = (() => {
31285
31306
  }
31286
31307
  };
31287
31308
 
31288
- // ../node_modules/n3/src/N3DataFactory.js
31309
+ // node_modules/n3/src/N3DataFactory.js
31289
31310
  var { rdf: rdf2, xsd: xsd2 } = IRIs_default;
31290
31311
  var DEFAULTGRAPH;
31291
31312
  var _blankNodeCounter = 0;
@@ -31347,7 +31368,15 @@ var PodOS = (() => {
31347
31368
  get language() {
31348
31369
  const id4 = this.id;
31349
31370
  let atPos = id4.lastIndexOf('"') + 1;
31350
- return atPos < id4.length && id4[atPos++] === "@" ? id4.substr(atPos).toLowerCase() : "";
31371
+ const dirPos = id4.lastIndexOf("--");
31372
+ return atPos < id4.length && id4[atPos++] === "@" ? (dirPos > atPos ? id4.substr(0, dirPos) : id4).substr(atPos).toLowerCase() : "";
31373
+ }
31374
+ // ### The direction of this literal
31375
+ get direction() {
31376
+ const id4 = this.id;
31377
+ const endPos = id4.lastIndexOf('"');
31378
+ const dirPos = id4.lastIndexOf("--");
31379
+ return dirPos > endPos && dirPos + 2 < id4.length ? id4.substr(dirPos + 2).toLowerCase() : "";
31351
31380
  }
31352
31381
  // ### The datatype IRI of this literal
31353
31382
  get datatype() {
@@ -31358,21 +31387,22 @@ var PodOS = (() => {
31358
31387
  const id4 = this.id, dtPos = id4.lastIndexOf('"') + 1;
31359
31388
  const char = dtPos < id4.length ? id4[dtPos] : "";
31360
31389
  return char === "^" ? id4.substr(dtPos + 2) : (
31361
- // If "@" follows, return rdf:langString; xsd:string otherwise
31362
- char !== "@" ? xsd2.string : rdf2.langString
31390
+ // If "@" follows, return rdf:langString or rdf:dirLangString; xsd:string otherwise
31391
+ char !== "@" ? xsd2.string : id4.indexOf("--", dtPos) > 0 ? rdf2.dirLangString : rdf2.langString
31363
31392
  );
31364
31393
  }
31365
31394
  // ### Returns whether this object represents the same term as the other
31366
31395
  equals(other2) {
31367
31396
  if (other2 instanceof _Literal)
31368
31397
  return this.id === other2.id;
31369
- return !!other2 && !!other2.datatype && this.termType === other2.termType && this.value === other2.value && this.language === other2.language && this.datatype.value === other2.datatype.value;
31398
+ return !!other2 && !!other2.datatype && this.termType === other2.termType && this.value === other2.value && this.language === other2.language && (this.direction === other2.direction || this.direction === "" && !other2.direction) && this.datatype.value === other2.datatype.value;
31370
31399
  }
31371
31400
  toJSON() {
31372
31401
  return {
31373
31402
  termType: this.termType,
31374
31403
  value: this.value,
31375
31404
  language: this.language,
31405
+ direction: this.direction,
31376
31406
  datatype: { termType: "NamedNode", value: this.datatypeString }
31377
31407
  };
31378
31408
  }
@@ -31466,6 +31496,9 @@ var PodOS = (() => {
31466
31496
  function literal(value7, languageOrDataType) {
31467
31497
  if (typeof languageOrDataType === "string")
31468
31498
  return new Literal2(`"${value7}"@${languageOrDataType.toLowerCase()}`);
31499
+ if (languageOrDataType !== void 0 && !("termType" in languageOrDataType)) {
31500
+ return new Literal2(`"${value7}"@${languageOrDataType.language.toLowerCase()}${languageOrDataType.direction ? `--${languageOrDataType.direction.toLowerCase()}` : ""}`);
31501
+ }
31469
31502
  let datatype3 = languageOrDataType ? languageOrDataType.value : "";
31470
31503
  if (datatype3 === "") {
31471
31504
  if (typeof value7 === "boolean")
@@ -31519,9 +31552,9 @@ var PodOS = (() => {
31519
31552
  return quad(fromTerm(inQuad.subject), fromTerm(inQuad.predicate), fromTerm(inQuad.object), fromTerm(inQuad.graph));
31520
31553
  }
31521
31554
 
31522
- // ../node_modules/n3/src/N3Parser.js
31555
+ // node_modules/n3/src/N3Parser.js
31523
31556
  var blankNodePrefix = 0;
31524
- var N3Parser = class {
31557
+ var N3Parser = class _N3Parser {
31525
31558
  constructor(options) {
31526
31559
  this._contextStack = [];
31527
31560
  this._graph = null;
@@ -31533,7 +31566,6 @@ var PodOS = (() => {
31533
31566
  this._readPredicateOrNamedGraph = this._readPredicate;
31534
31567
  this._supportsQuads = !(isTurtle || isTriG || isNTriples || isN3);
31535
31568
  this._isImpliedBy = options.isImpliedBy;
31536
- this._supportsRDFStar = format4 === "" || /star|\*$/.test(format4);
31537
31569
  if (isLineMode)
31538
31570
  this._resolveRelativeIRI = (iri) => {
31539
31571
  return null;
@@ -31541,6 +31573,8 @@ var PodOS = (() => {
31541
31573
  this._blankNodePrefix = typeof options.blankNodePrefix !== "string" ? "" : options.blankNodePrefix.replace(/^(?!_:)/, "_:");
31542
31574
  this._lexer = options.lexer || new N3Lexer({ lineMode: isLineMode, n3: isN3, isImpliedBy: this._isImpliedBy });
31543
31575
  this._explicitQuantifiers = !!options.explicitQuantifiers;
31576
+ this._parseUnsupportedVersions = !!options.parseUnsupportedVersions;
31577
+ this._version = options.version;
31544
31578
  }
31545
31579
  // ## Static class methods
31546
31580
  // ### `_resetBlankNodePrefix` restarts blank node prefix identification
@@ -31600,6 +31634,12 @@ var PodOS = (() => {
31600
31634
  this._quantified = context4.quantified;
31601
31635
  }
31602
31636
  }
31637
+ // ### `_readBeforeTopContext` is called once only at the start of parsing.
31638
+ _readBeforeTopContext(token2) {
31639
+ if (this._version && !this._isValidVersion(this._version))
31640
+ return this._error(`Detected unsupported version as media type parameter: "${this._version}"`, token2);
31641
+ return this._readInTopContext(token2);
31642
+ }
31603
31643
  // ### `_readInTopContext` reads a token when in the top context
31604
31644
  _readInTopContext(token2) {
31605
31645
  switch (token2.type) {
@@ -31619,6 +31659,11 @@ var PodOS = (() => {
31619
31659
  this._sparqlStyle = true;
31620
31660
  case "@base":
31621
31661
  return this._readBaseIRI;
31662
+ // It could be a version declaration
31663
+ case "VERSION":
31664
+ this._sparqlStyle = true;
31665
+ case "@version":
31666
+ return this._readVersion;
31622
31667
  // It could be a graph
31623
31668
  case "{":
31624
31669
  if (this._supportsNamedGraphs) {
@@ -31684,6 +31729,10 @@ var PodOS = (() => {
31684
31729
  );
31685
31730
  return this._readBlankNodeHead;
31686
31731
  case "(":
31732
+ const stack = this._contextStack, parent4 = stack.length && stack[stack.length - 1];
31733
+ if (parent4.type === "<<") {
31734
+ return this._error("Unexpected list in reified triple", token2);
31735
+ }
31687
31736
  this._saveContext("list", this._graph, this.RDF_NIL, null, null);
31688
31737
  this._subject = null;
31689
31738
  return this._readListItem;
@@ -31723,9 +31772,13 @@ var PodOS = (() => {
31723
31772
  } else
31724
31773
  this._subject = this._factory.literal(token2.value, this._factory.namedNode(token2.prefix));
31725
31774
  break;
31775
+ case "<<(":
31776
+ if (!this._n3Mode)
31777
+ return this._error("Disallowed triple term as subject", token2);
31778
+ this._saveContext("<<(", this._graph, null, null, null);
31779
+ this._graph = null;
31780
+ return this._readSubject;
31726
31781
  case "<<":
31727
- if (!this._supportsRDFStar)
31728
- return this._error("Unexpected RDF-star syntax", token2);
31729
31782
  this._saveContext("<<", this._graph, null, null, null);
31730
31783
  this._graph = null;
31731
31784
  return this._readSubject;
@@ -31749,6 +31802,7 @@ var PodOS = (() => {
31749
31802
  case ".":
31750
31803
  case "]":
31751
31804
  case "}":
31805
+ case "|}":
31752
31806
  if (this._predicate === null)
31753
31807
  return this._error(`Unexpected ${type5}`, token2);
31754
31808
  this._subject = null;
@@ -31773,6 +31827,7 @@ var PodOS = (() => {
31773
31827
  if ((this._predicate = this._readEntity(token2)) === void 0)
31774
31828
  return;
31775
31829
  }
31830
+ this._validAnnotation = true;
31776
31831
  return this._readObject;
31777
31832
  }
31778
31833
  // ### `_readObject` reads a quad's object
@@ -31795,6 +31850,10 @@ var PodOS = (() => {
31795
31850
  );
31796
31851
  return this._readBlankNodeHead;
31797
31852
  case "(":
31853
+ const stack = this._contextStack, parent4 = stack.length && stack[stack.length - 1];
31854
+ if (parent4.type === "<<") {
31855
+ return this._error("Unexpected list in reified triple", token2);
31856
+ }
31798
31857
  this._saveContext("list", this._graph, this._subject, this._predicate, this.RDF_NIL);
31799
31858
  this._subject = null;
31800
31859
  return this._readListItem;
@@ -31809,9 +31868,11 @@ var PodOS = (() => {
31809
31868
  this._graph = this._factory.blankNode()
31810
31869
  );
31811
31870
  return this._readSubject;
31871
+ case "<<(":
31872
+ this._saveContext("<<(", this._graph, this._subject, this._predicate, null);
31873
+ this._graph = null;
31874
+ return this._readSubject;
31812
31875
  case "<<":
31813
- if (!this._supportsRDFStar)
31814
- return this._error("Unexpected RDF-star syntax", token2);
31815
31876
  this._saveContext("<<", this._graph, this._subject, this._predicate, null);
31816
31877
  this._graph = null;
31817
31878
  return this._readSubject;
@@ -31840,6 +31901,10 @@ var PodOS = (() => {
31840
31901
  this._subject = null;
31841
31902
  return this._readBlankNodeTail(token2);
31842
31903
  } else {
31904
+ const stack = this._contextStack, parentParent = stack.length > 1 && stack[stack.length - 2];
31905
+ if (parentParent.type === "<<") {
31906
+ return this._error("Unexpected compound blank node expression in reified triple", token2);
31907
+ }
31843
31908
  this._predicate = null;
31844
31909
  return this._readPredicate(token2);
31845
31910
  }
@@ -31930,12 +31995,19 @@ var PodOS = (() => {
31930
31995
  this._graph = this._factory.blankNode()
31931
31996
  );
31932
31997
  return this._readSubject;
31998
+ case "<<":
31999
+ this._saveContext("<<", this._graph, null, null, null);
32000
+ this._graph = null;
32001
+ next4 = this._readSubject;
32002
+ break;
31933
32003
  default:
31934
32004
  if ((item4 = this._readEntity(token2)) === void 0)
31935
32005
  return;
31936
32006
  }
31937
32007
  if (list === null)
31938
32008
  this._subject = list = this._factory.blankNode();
32009
+ if (token2.type === "<<")
32010
+ stack[stack.length - 1].subject = this._subject;
31939
32011
  if (previousList === null) {
31940
32012
  if (parent4.predicate === null)
31941
32013
  parent4.subject = list;
@@ -31963,43 +32035,73 @@ var PodOS = (() => {
31963
32035
  return this._completeObjectLiteral(token2, true);
31964
32036
  }
31965
32037
  // ### `_completeLiteral` completes a literal with an optional datatype or language
31966
- _completeLiteral(token2) {
32038
+ _completeLiteral(token2, component2) {
31967
32039
  let literal4 = this._factory.literal(this._literalValue);
32040
+ let readCb;
31968
32041
  switch (token2.type) {
31969
32042
  // Create a datatyped literal
31970
32043
  case "type":
31971
32044
  case "typeIRI":
31972
32045
  const datatype3 = this._readEntity(token2);
31973
32046
  if (datatype3 === void 0) return;
32047
+ if (datatype3.value === IRIs_default.rdf.langString || datatype3.value === IRIs_default.rdf.dirLangString) {
32048
+ return this._error("Detected illegal (directional) languaged-tagged string with explicit datatype", token2);
32049
+ }
31974
32050
  literal4 = this._factory.literal(this._literalValue, datatype3);
31975
32051
  token2 = null;
31976
32052
  break;
31977
32053
  // Create a language-tagged string
31978
32054
  case "langcode":
32055
+ if (token2.value.split("-").some((t) => t.length > 8))
32056
+ return this._error("Detected language tag with subtag longer than 8 characters", token2);
31979
32057
  literal4 = this._factory.literal(this._literalValue, token2.value);
32058
+ this._literalLanguage = token2.value;
31980
32059
  token2 = null;
32060
+ readCb = this._readDirCode.bind(this, component2);
31981
32061
  break;
31982
32062
  }
31983
- return { token: token2, literal: literal4 };
32063
+ return { token: token2, literal: literal4, readCb };
32064
+ }
32065
+ _readDirCode(component2, listItem, token2) {
32066
+ if (token2.type === "dircode") {
32067
+ const term3 = this._factory.literal(this._literalValue, { language: this._literalLanguage, direction: token2.value });
32068
+ if (component2 === "subject")
32069
+ this._subject = term3;
32070
+ else
32071
+ this._object = term3;
32072
+ this._literalLanguage = void 0;
32073
+ token2 = null;
32074
+ }
32075
+ if (component2 === "subject")
32076
+ return token2 === null ? this._readPredicateOrNamedGraph : this._readPredicateOrNamedGraph(token2);
32077
+ return this._completeObjectLiteralPost(token2, listItem);
31984
32078
  }
31985
32079
  // Completes a literal in subject position
31986
32080
  _completeSubjectLiteral(token2) {
31987
- this._subject = this._completeLiteral(token2).literal;
32081
+ const completed2 = this._completeLiteral(token2, "subject");
32082
+ this._subject = completed2.literal;
32083
+ if (completed2.readCb)
32084
+ return completed2.readCb.bind(this, false);
31988
32085
  return this._readPredicateOrNamedGraph;
31989
32086
  }
31990
32087
  // Completes a literal in object position
31991
32088
  _completeObjectLiteral(token2, listItem) {
31992
- const completed2 = this._completeLiteral(token2);
32089
+ const completed2 = this._completeLiteral(token2, "object");
31993
32090
  if (!completed2)
31994
32091
  return;
31995
32092
  this._object = completed2.literal;
32093
+ if (completed2.readCb)
32094
+ return completed2.readCb.bind(this, listItem);
32095
+ return this._completeObjectLiteralPost(completed2.token, listItem);
32096
+ }
32097
+ _completeObjectLiteralPost(token2, listItem) {
31996
32098
  if (listItem)
31997
32099
  this._emit(this._subject, this.RDF_FIRST, this._object, this._graph);
31998
- if (completed2.token === null)
32100
+ if (token2 === null)
31999
32101
  return this._getContextEndReader();
32000
32102
  else {
32001
32103
  this._readCallback = this._getContextEndReader();
32002
- return this._readCallback(completed2.token);
32104
+ return this._readCallback(token2);
32003
32105
  }
32004
32106
  }
32005
32107
  // ### `_readFormulaTail` reads the end of a formula
@@ -32013,7 +32115,7 @@ var PodOS = (() => {
32013
32115
  }
32014
32116
  // ### `_readPunctuation` reads punctuation between quads or quad parts
32015
32117
  _readPunctuation(token2) {
32016
- let next4, graph3 = this._graph;
32118
+ let next4, graph3 = this._graph, startingAnnotation = false;
32017
32119
  const subject8 = this._subject, inversePredicate = this._inversePredicate;
32018
32120
  switch (token2.type) {
32019
32121
  // A closing brace ends a graph
@@ -32026,6 +32128,7 @@ var PodOS = (() => {
32026
32128
  // A dot just ends the statement, without sharing anything with the next
32027
32129
  case ".":
32028
32130
  this._subject = null;
32131
+ this._tripleTerm = null;
32029
32132
  next4 = this._contextStack.length ? this._readSubject : this._readInTopContext;
32030
32133
  if (inversePredicate) this._inversePredicate = false;
32031
32134
  break;
@@ -32037,19 +32140,26 @@ var PodOS = (() => {
32037
32140
  case ",":
32038
32141
  next4 = this._readObject;
32039
32142
  break;
32143
+ // ~ is allowed in the annotation syntax
32144
+ case "~":
32145
+ next4 = this._readReifierInAnnotation;
32146
+ startingAnnotation = true;
32147
+ break;
32040
32148
  // {| means that the current triple is annotated with predicate-object pairs.
32041
32149
  case "{|":
32042
- if (!this._supportsRDFStar)
32043
- return this._error("Unexpected RDF-star syntax", token2);
32044
- const predicate4 = this._predicate, object8 = this._object;
32045
- this._subject = this._factory.quad(subject8, predicate4, object8, this.DEFAULTGRAPH);
32150
+ this._subject = this._readTripleTerm();
32151
+ this._validAnnotation = false;
32152
+ startingAnnotation = true;
32046
32153
  next4 = this._readPredicate;
32047
32154
  break;
32048
- // |} means that the current quoted triple in annotation syntax is finalized.
32155
+ // |} means that the current reified triple in annotation syntax is finalized.
32049
32156
  case "|}":
32050
- if (this._subject.termType !== "Quad")
32051
- return this._error("Unexpected asserted triple closing", token2);
32157
+ if (!this._annotation)
32158
+ return this._error("Unexpected annotation syntax closing", token2);
32159
+ if (!this._validAnnotation)
32160
+ return this._error("Annotation block can not be empty", token2);
32052
32161
  this._subject = null;
32162
+ this._annotation = false;
32053
32163
  next4 = this._readPunctuation;
32054
32164
  break;
32055
32165
  default:
@@ -32059,13 +32169,16 @@ var PodOS = (() => {
32059
32169
  }
32060
32170
  return this._error(`Expected punctuation to follow "${this._object.id}"`, token2);
32061
32171
  }
32062
- if (subject8 !== null) {
32172
+ if (subject8 !== null && (!startingAnnotation || startingAnnotation && !this._annotation)) {
32063
32173
  const predicate4 = this._predicate, object8 = this._object;
32064
32174
  if (!inversePredicate)
32065
32175
  this._emit(subject8, predicate4, object8, graph3);
32066
32176
  else
32067
32177
  this._emit(object8, predicate4, subject8, graph3);
32068
32178
  }
32179
+ if (startingAnnotation) {
32180
+ this._annotation = true;
32181
+ }
32069
32182
  return next4;
32070
32183
  }
32071
32184
  // ### `_readBlankNodePunctuation` reads punctuation in a blank node
@@ -32116,6 +32229,21 @@ var PodOS = (() => {
32116
32229
  this._setBase(iri);
32117
32230
  return this._readDeclarationPunctuation;
32118
32231
  }
32232
+ // ### `_isValidVersion` checks if the given version is valid for this parser to handle.
32233
+ _isValidVersion(version6) {
32234
+ return this._parseUnsupportedVersions || _N3Parser.SUPPORTED_VERSIONS.includes(version6);
32235
+ }
32236
+ // ### `_readVersion` reads version string declaration
32237
+ _readVersion(token2) {
32238
+ if (token2.type !== "literal")
32239
+ return this._error("Expected literal to follow version declaration", token2);
32240
+ if (token2.end - token2.start !== token2.value.length + 2)
32241
+ return this._error("Version declarations must use single quotes", token2);
32242
+ this._versionCallback(token2.value);
32243
+ if (!this._isValidVersion(token2.value))
32244
+ return this._error(`Detected unsupported version: "${token2.value}"`, token2);
32245
+ return this._readDeclarationPunctuation;
32246
+ }
32119
32247
  // ### `_readNamedGraphLabel` reads the label of a named graph
32120
32248
  _readNamedGraphLabel(token2) {
32121
32249
  switch (token2.type) {
@@ -32242,26 +32370,17 @@ var PodOS = (() => {
32242
32370
  this._emit(subject8, predicate4, object8, this._graph);
32243
32371
  return this._readPath;
32244
32372
  }
32245
- // ### `_readRDFStarTailOrGraph` reads the graph of a nested RDF-star quad or the end of a nested RDF-star triple
32246
- _readRDFStarTailOrGraph(token2) {
32247
- if (token2.type !== ">>") {
32248
- if (this._supportsQuads && this._graph === null && (this._graph = this._readEntity(token2)) !== void 0)
32249
- return this._readRDFStarTail;
32250
- return this._error(`Expected >> to follow "${this._object.id}"`, token2);
32251
- }
32252
- return this._readRDFStarTail(token2);
32253
- }
32254
- // ### `_readRDFStarTail` reads the end of a nested RDF-star triple
32255
- _readRDFStarTail(token2) {
32256
- if (token2.type !== ">>")
32257
- return this._error(`Expected >> but got ${token2.type}`, token2);
32373
+ // ### `_readTripleTermTail` reads the end of a triple term
32374
+ _readTripleTermTail(token2) {
32375
+ if (token2.type !== ")>>")
32376
+ return this._error(`Expected )>> but got ${token2.type}`, token2);
32258
32377
  const quad3 = this._factory.quad(
32259
32378
  this._subject,
32260
32379
  this._predicate,
32261
32380
  this._object,
32262
32381
  this._graph || this.DEFAULTGRAPH
32263
32382
  );
32264
- this._restoreContext("<<", token2);
32383
+ this._restoreContext("<<(", token2);
32265
32384
  if (this._subject === null) {
32266
32385
  this._subject = quad3;
32267
32386
  return this._readPredicate;
@@ -32270,6 +32389,63 @@ var PodOS = (() => {
32270
32389
  return this._getContextEndReader();
32271
32390
  }
32272
32391
  }
32392
+ // ### `_readReifiedTripleTailOrReifier` reads a reifier or the end of a nested reified triple
32393
+ _readReifiedTripleTailOrReifier(token2) {
32394
+ if (token2.type === "~") {
32395
+ return this._readReifier;
32396
+ }
32397
+ return this._readReifiedTripleTail(token2);
32398
+ }
32399
+ // ### `_readReifiedTripleTail` reads the end of a nested reified triple
32400
+ _readReifiedTripleTail(token2) {
32401
+ if (token2.type !== ">>")
32402
+ return this._error(`Expected >> but got ${token2.type}`, token2);
32403
+ this._tripleTerm = null;
32404
+ const reifier = this._readTripleTerm();
32405
+ this._restoreContext("<<", token2);
32406
+ const stack = this._contextStack, parent4 = stack.length && stack[stack.length - 1];
32407
+ if (parent4 && parent4.type === "list") {
32408
+ this._emit(this._subject, this.RDF_FIRST, reifier, this._graph);
32409
+ return this._getContextEndReader();
32410
+ } else if (this._subject === null) {
32411
+ this._subject = reifier;
32412
+ return this._readPredicateOrReifierTripleEnd;
32413
+ } else {
32414
+ this._object = reifier;
32415
+ return this._getContextEndReader();
32416
+ }
32417
+ }
32418
+ _readPredicateOrReifierTripleEnd(token2) {
32419
+ if (token2.type === ".") {
32420
+ this._subject = null;
32421
+ return this._readPunctuation(token2);
32422
+ }
32423
+ return this._readPredicate(token2);
32424
+ }
32425
+ // ### `_readReifier` reads the triple term identifier after a tilde when in a reifying triple.
32426
+ _readReifier(token2) {
32427
+ this._reifier = this._readEntity(token2);
32428
+ return this._readReifiedTripleTail;
32429
+ }
32430
+ // ### `_readReifier` reads the optional triple term identifier after a tilde when in annotation syntax.
32431
+ _readReifierInAnnotation(token2) {
32432
+ if (token2.type === "IRI" || token2.type === "typeIRI" || token2.type === "type" || token2.type === "prefixed" || token2.type === "blank" || token2.type === "var") {
32433
+ this._reifier = this._readEntity(token2);
32434
+ return this._readPunctuation;
32435
+ }
32436
+ this._readTripleTerm();
32437
+ this._subject = null;
32438
+ return this._readPunctuation(token2);
32439
+ }
32440
+ _readTripleTerm() {
32441
+ const stack = this._contextStack, parent4 = stack.length && stack[stack.length - 1];
32442
+ const parentGraph = parent4 ? parent4.graph : void 0;
32443
+ const reifier = this._reifier || this._factory.blankNode();
32444
+ this._reifier = null;
32445
+ this._tripleTerm = this._tripleTerm || this._factory.quad(this._subject, this._predicate, this._object);
32446
+ this._emit(reifier, this.RDF_REIFIES, this._tripleTerm, parentGraph || this.DEFAULTGRAPH);
32447
+ return reifier;
32448
+ }
32273
32449
  // ### `_getContextEndReader` gets the next reader function at the end of a context
32274
32450
  _getContextEndReader() {
32275
32451
  const contextStack = this._contextStack;
@@ -32282,8 +32458,10 @@ var PodOS = (() => {
32282
32458
  return this._readListItem;
32283
32459
  case "formula":
32284
32460
  return this._readFormulaTail;
32461
+ case "<<(":
32462
+ return this._readTripleTermTail;
32285
32463
  case "<<":
32286
- return this._readRDFStarTailOrGraph;
32464
+ return this._readReifiedTripleTailOrReifier;
32287
32465
  }
32288
32466
  }
32289
32467
  // ### `_emit` sends a quad through the callback
@@ -32381,21 +32559,24 @@ var PodOS = (() => {
32381
32559
  }
32382
32560
  // ## Public methods
32383
32561
  // ### `parse` parses the N3 input and emits each parsed quad through the onQuad callback.
32384
- parse(input2, quadCallback, prefixCallback) {
32385
- let onQuad, onPrefix, onComment;
32386
- if (quadCallback && (quadCallback.onQuad || quadCallback.onPrefix || quadCallback.onComment)) {
32562
+ parse(input2, quadCallback, prefixCallback, versionCallback) {
32563
+ let onQuad, onPrefix, onComment, onVersion;
32564
+ if (quadCallback && (quadCallback.onQuad || quadCallback.onPrefix || quadCallback.onComment || quadCallback.onVersion)) {
32387
32565
  onQuad = quadCallback.onQuad;
32388
32566
  onPrefix = quadCallback.onPrefix;
32389
32567
  onComment = quadCallback.onComment;
32568
+ onVersion = quadCallback.onVersion;
32390
32569
  } else {
32391
32570
  onQuad = quadCallback;
32392
32571
  onPrefix = prefixCallback;
32572
+ onVersion = versionCallback;
32393
32573
  }
32394
- this._readCallback = this._readInTopContext;
32574
+ this._readCallback = this._readBeforeTopContext;
32395
32575
  this._sparqlStyle = false;
32396
32576
  this._prefixes = /* @__PURE__ */ Object.create(null);
32397
32577
  this._prefixes._ = this._blankNodePrefix ? this._blankNodePrefix.substr(2) : `b${blankNodePrefix++}_`;
32398
32578
  this._prefixCallback = onPrefix || noop2;
32579
+ this._versionCallback = onVersion || noop2;
32399
32580
  this._inversePredicate = false;
32400
32581
  this._quantified = /* @__PURE__ */ Object.create(null);
32401
32582
  if (!onQuad) {
@@ -32441,6 +32622,7 @@ var PodOS = (() => {
32441
32622
  parser.RDF_FIRST = factory.namedNode(IRIs_default.rdf.first);
32442
32623
  parser.RDF_REST = factory.namedNode(IRIs_default.rdf.rest);
32443
32624
  parser.RDF_NIL = factory.namedNode(IRIs_default.rdf.nil);
32625
+ parser.RDF_REIFIES = factory.namedNode(IRIs_default.rdf.reifies);
32444
32626
  parser.N3_FORALL = factory.namedNode(IRIs_default.r.forAll);
32445
32627
  parser.N3_FORSOME = factory.namedNode(IRIs_default.r.forSome);
32446
32628
  parser.ABBREVIATIONS = {
@@ -32451,6 +32633,11 @@ var PodOS = (() => {
32451
32633
  };
32452
32634
  parser.QUANTIFIERS_GRAPH = factory.namedNode("urn:n3:quantifiers");
32453
32635
  }
32636
+ N3Parser.SUPPORTED_VERSIONS = [
32637
+ "1.2",
32638
+ "1.2-basic",
32639
+ "1.1"
32640
+ ];
32454
32641
  initDataFactory(N3Parser.prototype, N3DataFactory_default);
32455
32642
 
32456
32643
  // node_modules/rdflib/esm/rdfaparser.js
@@ -36613,9 +36800,6 @@ _:patch
36613
36800
  var LdpContainer = class extends Thing {
36614
36801
  constructor(uri6, store, editable = false) {
36615
36802
  super(uri6, store, editable);
36616
- this.uri = uri6;
36617
- this.store = store;
36618
- this.editable = editable;
36619
36803
  }
36620
36804
  /**
36621
36805
  * Resources that the LDP Container contains
@@ -36753,8 +36937,6 @@ _:patch
36753
36937
  constructor(webId, store, editable = false) {
36754
36938
  super(webId, store, editable);
36755
36939
  this.webId = webId;
36756
- this.store = store;
36757
- this.editable = editable;
36758
36940
  this.profileQuery = this.store.profileQuery(this.webId);
36759
36941
  }
36760
36942
  /**
@@ -36895,9 +37077,6 @@ _:patch
36895
37077
  var RdfDocument = class extends Thing {
36896
37078
  constructor(uri6, store, editable = false) {
36897
37079
  super(uri6, store, editable);
36898
- this.uri = uri6;
36899
- this.store = store;
36900
- this.editable = editable;
36901
37080
  }
36902
37081
  subjects() {
36903
37082
  const matches = this.store.statementsMatching(
@@ -36919,9 +37098,6 @@ _:patch
36919
37098
  var LabelIndex = class extends RdfDocument {
36920
37099
  constructor(uri6, store, editable = false) {
36921
37100
  super(uri6, store, editable);
36922
- this.uri = uri6;
36923
- this.store = store;
36924
- this.editable = editable;
36925
37101
  }
36926
37102
  /**
36927
37103
  * Returns the URIs and labels for all the things listed in the document.
@@ -58762,8 +58938,6 @@ _:patch
58762
58938
  // src/uri/UriService.ts
58763
58939
  var import_slugify = __toESM(require_slugify(), 1);
58764
58940
  var UriService = class {
58765
- // We expect to use the store for calculating the uris for things
58766
- // e.g. looking up locations in type index
58767
58941
  constructor(store) {
58768
58942
  this.store = store;
58769
58943
  }
@@ -58988,9 +59162,6 @@ _:patch
58988
59162
  var TypeIndex2 = class extends Thing {
58989
59163
  constructor(uri6, store, editable = false) {
58990
59164
  super(uri6, store, editable);
58991
- this.uri = uri6;
58992
- this.store = store;
58993
- this.editable = editable;
58994
59165
  }
58995
59166
  listAll() {
58996
59167
  const forClassStatements = this.store.statementsMatching(