@pod-os/core 0.29.0 → 0.30.0-rc.27b005a.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -13785,8 +13785,8 @@ function __generator(thisArg, body) {
13785
13785
  var _ = { label: 0, sent: function() {
13786
13786
  if (t[0] & 1) throw t[1];
13787
13787
  return t[1];
13788
- }, trys: [], ops: [] }, f, y, t, g;
13789
- return g = { next: verb2(0), "throw": verb2(1), "return": verb2(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
13788
+ }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13789
+ return g.next = verb2(0), g["throw"] = verb2(1), g["return"] = verb2(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
13790
13790
  return this;
13791
13791
  }), g;
13792
13792
  function verb2(n2) {
@@ -13893,16 +13893,24 @@ function __await(v2) {
13893
13893
  function __asyncGenerator(thisArg, _arguments, generator3) {
13894
13894
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
13895
13895
  var g = generator3.apply(thisArg, _arguments || []), i, q = [];
13896
- return i = {}, verb2("next"), verb2("throw"), verb2("return"), i[Symbol.asyncIterator] = function() {
13896
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb2("next"), verb2("throw"), verb2("return", awaitReturn), i[Symbol.asyncIterator] = function() {
13897
13897
  return this;
13898
13898
  }, i;
13899
- function verb2(n2) {
13900
- if (g[n2]) i[n2] = function(v2) {
13901
- return new Promise(function(a, b) {
13902
- q.push([n2, v2, a, b]) > 1 || resume(n2, v2);
13903
- });
13899
+ function awaitReturn(f) {
13900
+ return function(v2) {
13901
+ return Promise.resolve(v2).then(f, reject);
13904
13902
  };
13905
13903
  }
13904
+ function verb2(n2, f) {
13905
+ if (g[n2]) {
13906
+ i[n2] = function(v2) {
13907
+ return new Promise(function(a, b) {
13908
+ q.push([n2, v2, a, b]) > 1 || resume(n2, v2);
13909
+ });
13910
+ };
13911
+ if (f) i[n2] = f(i[n2]);
13912
+ }
13913
+ }
13906
13914
  function resume(n2, v2) {
13907
13915
  try {
13908
13916
  step4(g[n2](v2));
@@ -22395,10 +22403,10 @@ function createStatement(kb, id4, property4, value7, base2) {
22395
22403
  return kb.rdfFactory.quad(id4, predicate4, object8, kb.rdfFactory.namedNode(base2));
22396
22404
  }
22397
22405
 
22398
- // ../node_modules/n3/src/N3Lexer.js
22406
+ // node_modules/n3/src/N3Lexer.js
22399
22407
  var import_buffer = __toESM(require_buffer());
22400
22408
 
22401
- // ../node_modules/n3/src/IRIs.js
22409
+ // node_modules/n3/src/IRIs.js
22402
22410
  var RDF2 = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
22403
22411
  var XSD = "http://www.w3.org/2001/XMLSchema#";
22404
22412
  var SWAP = "http://www.w3.org/2000/10/swap/";
@@ -22415,7 +22423,9 @@ var IRIs_default = {
22415
22423
  nil: `${RDF2}nil`,
22416
22424
  first: `${RDF2}first`,
22417
22425
  rest: `${RDF2}rest`,
22418
- langString: `${RDF2}langString`
22426
+ langString: `${RDF2}langString`,
22427
+ dirLangString: `${RDF2}dirLangString`,
22428
+ reifies: `${RDF2}reifies`
22419
22429
  },
22420
22430
  owl: {
22421
22431
  sameAs: "http://www.w3.org/2002/07/owl#sameAs"
@@ -22430,7 +22440,7 @@ var IRIs_default = {
22430
22440
  }
22431
22441
  };
22432
22442
 
22433
- // ../node_modules/n3/src/N3Lexer.js
22443
+ // node_modules/n3/src/N3Lexer.js
22434
22444
  var { xsd } = IRIs_default;
22435
22445
  var escapeSequence = /\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g;
22436
22446
  var escapeReplacements = {
@@ -22468,6 +22478,7 @@ var lineModeRegExps = {
22468
22478
  _unescapedIri: true,
22469
22479
  _simpleQuotedString: true,
22470
22480
  _langcode: true,
22481
+ _dircode: true,
22471
22482
  _blank: true,
22472
22483
  _newline: true,
22473
22484
  _comment: true,
@@ -22481,15 +22492,16 @@ var N3Lexer = class {
22481
22492
  this._unescapedIri = /^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/;
22482
22493
  this._simpleQuotedString = /^"([^"\\\r\n]*)"(?=[^"])/;
22483
22494
  this._simpleApostropheString = /^'([^'\\\r\n]*)'(?=[^'])/;
22484
- this._langcode = /^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i;
22495
+ this._langcode = /^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9])/i;
22496
+ this._dircode = /^--(ltr)|(rtl)/;
22485
22497
  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<])/;
22486
22498
  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#()\[\]\{\}"'<>]))/;
22487
22499
  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#()\[\]\{\}"'<>])/;
22488
22500
  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#()\[\]\{\}"'<>]))/;
22489
22501
  this._number = /^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/;
22490
22502
  this._boolean = /^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/;
22491
- this._keyword = /^@[a-z]+(?=[\s#<:])/i;
22492
- this._sparqlKeyword = /^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i;
22503
+ this._atKeyword = /^@[a-z]+(?=[\s#<:])/i;
22504
+ this._keyword = /^(?:PREFIX|BASE|VERSION|GRAPH)(?=[\s#<])/i;
22493
22505
  this._shortPredicates = /^a(?=[\s#()\[\]\{\}"'<>])/;
22494
22506
  this._newline = /^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/;
22495
22507
  this._comment = /#([^\n\r]*)/;
@@ -22563,7 +22575,9 @@ var N3Lexer = class {
22563
22575
  if (value7 === null || illegalIriChars.test(value7))
22564
22576
  return reportSyntaxError(this);
22565
22577
  type5 = "IRI";
22566
- } else if (input2.length > 1 && input2[1] === "<")
22578
+ } else if (input2.length > 2 && input2[1] === "<" && input2[2] === "(")
22579
+ type5 = "<<(", matchLength = 3;
22580
+ else if (!this._lineMode && input2.length > (inputFinished ? 1 : 2) && input2[1] === "<")
22567
22581
  type5 = "<<", matchLength = 2;
22568
22582
  else if (this._n3Mode && input2.length > 1 && input2[1] === "=") {
22569
22583
  matchLength = 2;
@@ -22612,9 +22626,9 @@ var N3Lexer = class {
22612
22626
  type5 = "var", value7 = match[0];
22613
22627
  break;
22614
22628
  case "@":
22615
- if (this._previousMarker === "literal" && (match = this._langcode.exec(input2)))
22629
+ if (this._previousMarker === "literal" && (match = this._langcode.exec(input2)) && match[1] !== "version")
22616
22630
  type5 = "langcode", value7 = match[1];
22617
- else if (match = this._keyword.exec(input2))
22631
+ else if (match = this._atKeyword.exec(input2))
22618
22632
  type5 = match[0];
22619
22633
  break;
22620
22634
  case ".":
@@ -22636,6 +22650,11 @@ var N3Lexer = class {
22636
22650
  case "9":
22637
22651
  case "+":
22638
22652
  case "-":
22653
+ if (input2[1] === "-") {
22654
+ if (this._previousMarker === "langcode" && (match = this._dircode.exec(input2)))
22655
+ type5 = "dircode", matchLength = 2, value7 = match[1] || match[2], matchLength = value7.length + 2;
22656
+ break;
22657
+ }
22639
22658
  if (match = this._number.exec(input2) || inputFinished && (match = this._number.exec(`${input2} `))) {
22640
22659
  type5 = "literal", value7 = match[0];
22641
22660
  prefix3 = typeof match[1] === "string" ? xsd.double : typeof match[2] === "string" ? xsd.decimal : xsd.integer;
@@ -22647,7 +22666,9 @@ var N3Lexer = class {
22647
22666
  case "P":
22648
22667
  case "G":
22649
22668
  case "g":
22650
- if (match = this._sparqlKeyword.exec(input2))
22669
+ case "V":
22670
+ case "v":
22671
+ if (match = this._keyword.exec(input2))
22651
22672
  type5 = match[0].toUpperCase();
22652
22673
  else
22653
22674
  inconclusive = true;
@@ -22677,13 +22698,21 @@ var N3Lexer = class {
22677
22698
  case "!":
22678
22699
  if (!this._n3Mode)
22679
22700
  break;
22701
+ case ")":
22702
+ if (!inputFinished && (input2.length === 1 || input2.length === 2 && input2[1] === ">")) {
22703
+ break;
22704
+ }
22705
+ if (input2.length > 2 && input2[1] === ">" && input2[2] === ">") {
22706
+ type5 = ")>>", matchLength = 3;
22707
+ break;
22708
+ }
22680
22709
  case ",":
22681
22710
  case ";":
22682
22711
  case "[":
22683
22712
  case "]":
22684
22713
  case "(":
22685
- case ")":
22686
22714
  case "}":
22715
+ case "~":
22687
22716
  if (!this._lineMode) {
22688
22717
  matchLength = 1;
22689
22718
  type5 = firstChar;
@@ -22848,7 +22877,7 @@ var N3Lexer = class {
22848
22877
  }
22849
22878
  };
22850
22879
 
22851
- // ../node_modules/n3/src/N3DataFactory.js
22880
+ // node_modules/n3/src/N3DataFactory.js
22852
22881
  var { rdf: rdf2, xsd: xsd2 } = IRIs_default;
22853
22882
  var DEFAULTGRAPH;
22854
22883
  var _blankNodeCounter = 0;
@@ -22910,7 +22939,15 @@ var Literal2 = class _Literal extends Term {
22910
22939
  get language() {
22911
22940
  const id4 = this.id;
22912
22941
  let atPos = id4.lastIndexOf('"') + 1;
22913
- return atPos < id4.length && id4[atPos++] === "@" ? id4.substr(atPos).toLowerCase() : "";
22942
+ const dirPos = id4.lastIndexOf("--");
22943
+ return atPos < id4.length && id4[atPos++] === "@" ? (dirPos > atPos ? id4.substr(0, dirPos) : id4).substr(atPos).toLowerCase() : "";
22944
+ }
22945
+ // ### The direction of this literal
22946
+ get direction() {
22947
+ const id4 = this.id;
22948
+ const endPos = id4.lastIndexOf('"');
22949
+ const dirPos = id4.lastIndexOf("--");
22950
+ return dirPos > endPos && dirPos + 2 < id4.length ? id4.substr(dirPos + 2).toLowerCase() : "";
22914
22951
  }
22915
22952
  // ### The datatype IRI of this literal
22916
22953
  get datatype() {
@@ -22921,21 +22958,22 @@ var Literal2 = class _Literal extends Term {
22921
22958
  const id4 = this.id, dtPos = id4.lastIndexOf('"') + 1;
22922
22959
  const char = dtPos < id4.length ? id4[dtPos] : "";
22923
22960
  return char === "^" ? id4.substr(dtPos + 2) : (
22924
- // If "@" follows, return rdf:langString; xsd:string otherwise
22925
- char !== "@" ? xsd2.string : rdf2.langString
22961
+ // If "@" follows, return rdf:langString or rdf:dirLangString; xsd:string otherwise
22962
+ char !== "@" ? xsd2.string : id4.indexOf("--", dtPos) > 0 ? rdf2.dirLangString : rdf2.langString
22926
22963
  );
22927
22964
  }
22928
22965
  // ### Returns whether this object represents the same term as the other
22929
22966
  equals(other2) {
22930
22967
  if (other2 instanceof _Literal)
22931
22968
  return this.id === other2.id;
22932
- return !!other2 && !!other2.datatype && this.termType === other2.termType && this.value === other2.value && this.language === other2.language && this.datatype.value === other2.datatype.value;
22969
+ 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;
22933
22970
  }
22934
22971
  toJSON() {
22935
22972
  return {
22936
22973
  termType: this.termType,
22937
22974
  value: this.value,
22938
22975
  language: this.language,
22976
+ direction: this.direction,
22939
22977
  datatype: { termType: "NamedNode", value: this.datatypeString }
22940
22978
  };
22941
22979
  }
@@ -23029,6 +23067,9 @@ function blankNode(name9) {
23029
23067
  function literal(value7, languageOrDataType) {
23030
23068
  if (typeof languageOrDataType === "string")
23031
23069
  return new Literal2(`"${value7}"@${languageOrDataType.toLowerCase()}`);
23070
+ if (languageOrDataType !== void 0 && !("termType" in languageOrDataType)) {
23071
+ return new Literal2(`"${value7}"@${languageOrDataType.language.toLowerCase()}${languageOrDataType.direction ? `--${languageOrDataType.direction.toLowerCase()}` : ""}`);
23072
+ }
23032
23073
  let datatype3 = languageOrDataType ? languageOrDataType.value : "";
23033
23074
  if (datatype3 === "") {
23034
23075
  if (typeof value7 === "boolean")
@@ -23082,9 +23123,9 @@ function fromQuad(inQuad) {
23082
23123
  return quad(fromTerm(inQuad.subject), fromTerm(inQuad.predicate), fromTerm(inQuad.object), fromTerm(inQuad.graph));
23083
23124
  }
23084
23125
 
23085
- // ../node_modules/n3/src/N3Parser.js
23126
+ // node_modules/n3/src/N3Parser.js
23086
23127
  var blankNodePrefix = 0;
23087
- var N3Parser = class {
23128
+ var N3Parser = class _N3Parser {
23088
23129
  constructor(options) {
23089
23130
  this._contextStack = [];
23090
23131
  this._graph = null;
@@ -23096,7 +23137,6 @@ var N3Parser = class {
23096
23137
  this._readPredicateOrNamedGraph = this._readPredicate;
23097
23138
  this._supportsQuads = !(isTurtle || isTriG || isNTriples || isN3);
23098
23139
  this._isImpliedBy = options.isImpliedBy;
23099
- this._supportsRDFStar = format4 === "" || /star|\*$/.test(format4);
23100
23140
  if (isLineMode)
23101
23141
  this._resolveRelativeIRI = (iri) => {
23102
23142
  return null;
@@ -23104,6 +23144,8 @@ var N3Parser = class {
23104
23144
  this._blankNodePrefix = typeof options.blankNodePrefix !== "string" ? "" : options.blankNodePrefix.replace(/^(?!_:)/, "_:");
23105
23145
  this._lexer = options.lexer || new N3Lexer({ lineMode: isLineMode, n3: isN3, isImpliedBy: this._isImpliedBy });
23106
23146
  this._explicitQuantifiers = !!options.explicitQuantifiers;
23147
+ this._parseUnsupportedVersions = !!options.parseUnsupportedVersions;
23148
+ this._version = options.version;
23107
23149
  }
23108
23150
  // ## Static class methods
23109
23151
  // ### `_resetBlankNodePrefix` restarts blank node prefix identification
@@ -23163,6 +23205,12 @@ var N3Parser = class {
23163
23205
  this._quantified = context4.quantified;
23164
23206
  }
23165
23207
  }
23208
+ // ### `_readBeforeTopContext` is called once only at the start of parsing.
23209
+ _readBeforeTopContext(token2) {
23210
+ if (this._version && !this._isValidVersion(this._version))
23211
+ return this._error(`Detected unsupported version as media type parameter: "${this._version}"`, token2);
23212
+ return this._readInTopContext(token2);
23213
+ }
23166
23214
  // ### `_readInTopContext` reads a token when in the top context
23167
23215
  _readInTopContext(token2) {
23168
23216
  switch (token2.type) {
@@ -23182,6 +23230,11 @@ var N3Parser = class {
23182
23230
  this._sparqlStyle = true;
23183
23231
  case "@base":
23184
23232
  return this._readBaseIRI;
23233
+ // It could be a version declaration
23234
+ case "VERSION":
23235
+ this._sparqlStyle = true;
23236
+ case "@version":
23237
+ return this._readVersion;
23185
23238
  // It could be a graph
23186
23239
  case "{":
23187
23240
  if (this._supportsNamedGraphs) {
@@ -23247,6 +23300,10 @@ var N3Parser = class {
23247
23300
  );
23248
23301
  return this._readBlankNodeHead;
23249
23302
  case "(":
23303
+ const stack = this._contextStack, parent4 = stack.length && stack[stack.length - 1];
23304
+ if (parent4.type === "<<") {
23305
+ return this._error("Unexpected list in reified triple", token2);
23306
+ }
23250
23307
  this._saveContext("list", this._graph, this.RDF_NIL, null, null);
23251
23308
  this._subject = null;
23252
23309
  return this._readListItem;
@@ -23286,9 +23343,13 @@ var N3Parser = class {
23286
23343
  } else
23287
23344
  this._subject = this._factory.literal(token2.value, this._factory.namedNode(token2.prefix));
23288
23345
  break;
23346
+ case "<<(":
23347
+ if (!this._n3Mode)
23348
+ return this._error("Disallowed triple term as subject", token2);
23349
+ this._saveContext("<<(", this._graph, null, null, null);
23350
+ this._graph = null;
23351
+ return this._readSubject;
23289
23352
  case "<<":
23290
- if (!this._supportsRDFStar)
23291
- return this._error("Unexpected RDF-star syntax", token2);
23292
23353
  this._saveContext("<<", this._graph, null, null, null);
23293
23354
  this._graph = null;
23294
23355
  return this._readSubject;
@@ -23312,6 +23373,7 @@ var N3Parser = class {
23312
23373
  case ".":
23313
23374
  case "]":
23314
23375
  case "}":
23376
+ case "|}":
23315
23377
  if (this._predicate === null)
23316
23378
  return this._error(`Unexpected ${type5}`, token2);
23317
23379
  this._subject = null;
@@ -23336,6 +23398,7 @@ var N3Parser = class {
23336
23398
  if ((this._predicate = this._readEntity(token2)) === void 0)
23337
23399
  return;
23338
23400
  }
23401
+ this._validAnnotation = true;
23339
23402
  return this._readObject;
23340
23403
  }
23341
23404
  // ### `_readObject` reads a quad's object
@@ -23358,6 +23421,10 @@ var N3Parser = class {
23358
23421
  );
23359
23422
  return this._readBlankNodeHead;
23360
23423
  case "(":
23424
+ const stack = this._contextStack, parent4 = stack.length && stack[stack.length - 1];
23425
+ if (parent4.type === "<<") {
23426
+ return this._error("Unexpected list in reified triple", token2);
23427
+ }
23361
23428
  this._saveContext("list", this._graph, this._subject, this._predicate, this.RDF_NIL);
23362
23429
  this._subject = null;
23363
23430
  return this._readListItem;
@@ -23372,9 +23439,11 @@ var N3Parser = class {
23372
23439
  this._graph = this._factory.blankNode()
23373
23440
  );
23374
23441
  return this._readSubject;
23442
+ case "<<(":
23443
+ this._saveContext("<<(", this._graph, this._subject, this._predicate, null);
23444
+ this._graph = null;
23445
+ return this._readSubject;
23375
23446
  case "<<":
23376
- if (!this._supportsRDFStar)
23377
- return this._error("Unexpected RDF-star syntax", token2);
23378
23447
  this._saveContext("<<", this._graph, this._subject, this._predicate, null);
23379
23448
  this._graph = null;
23380
23449
  return this._readSubject;
@@ -23403,6 +23472,10 @@ var N3Parser = class {
23403
23472
  this._subject = null;
23404
23473
  return this._readBlankNodeTail(token2);
23405
23474
  } else {
23475
+ const stack = this._contextStack, parentParent = stack.length > 1 && stack[stack.length - 2];
23476
+ if (parentParent.type === "<<") {
23477
+ return this._error("Unexpected compound blank node expression in reified triple", token2);
23478
+ }
23406
23479
  this._predicate = null;
23407
23480
  return this._readPredicate(token2);
23408
23481
  }
@@ -23493,12 +23566,19 @@ var N3Parser = class {
23493
23566
  this._graph = this._factory.blankNode()
23494
23567
  );
23495
23568
  return this._readSubject;
23569
+ case "<<":
23570
+ this._saveContext("<<", this._graph, null, null, null);
23571
+ this._graph = null;
23572
+ next4 = this._readSubject;
23573
+ break;
23496
23574
  default:
23497
23575
  if ((item4 = this._readEntity(token2)) === void 0)
23498
23576
  return;
23499
23577
  }
23500
23578
  if (list === null)
23501
23579
  this._subject = list = this._factory.blankNode();
23580
+ if (token2.type === "<<")
23581
+ stack[stack.length - 1].subject = this._subject;
23502
23582
  if (previousList === null) {
23503
23583
  if (parent4.predicate === null)
23504
23584
  parent4.subject = list;
@@ -23526,43 +23606,73 @@ var N3Parser = class {
23526
23606
  return this._completeObjectLiteral(token2, true);
23527
23607
  }
23528
23608
  // ### `_completeLiteral` completes a literal with an optional datatype or language
23529
- _completeLiteral(token2) {
23609
+ _completeLiteral(token2, component2) {
23530
23610
  let literal4 = this._factory.literal(this._literalValue);
23611
+ let readCb;
23531
23612
  switch (token2.type) {
23532
23613
  // Create a datatyped literal
23533
23614
  case "type":
23534
23615
  case "typeIRI":
23535
23616
  const datatype3 = this._readEntity(token2);
23536
23617
  if (datatype3 === void 0) return;
23618
+ if (datatype3.value === IRIs_default.rdf.langString || datatype3.value === IRIs_default.rdf.dirLangString) {
23619
+ return this._error("Detected illegal (directional) languaged-tagged string with explicit datatype", token2);
23620
+ }
23537
23621
  literal4 = this._factory.literal(this._literalValue, datatype3);
23538
23622
  token2 = null;
23539
23623
  break;
23540
23624
  // Create a language-tagged string
23541
23625
  case "langcode":
23626
+ if (token2.value.split("-").some((t) => t.length > 8))
23627
+ return this._error("Detected language tag with subtag longer than 8 characters", token2);
23542
23628
  literal4 = this._factory.literal(this._literalValue, token2.value);
23629
+ this._literalLanguage = token2.value;
23543
23630
  token2 = null;
23631
+ readCb = this._readDirCode.bind(this, component2);
23544
23632
  break;
23545
23633
  }
23546
- return { token: token2, literal: literal4 };
23634
+ return { token: token2, literal: literal4, readCb };
23635
+ }
23636
+ _readDirCode(component2, listItem, token2) {
23637
+ if (token2.type === "dircode") {
23638
+ const term3 = this._factory.literal(this._literalValue, { language: this._literalLanguage, direction: token2.value });
23639
+ if (component2 === "subject")
23640
+ this._subject = term3;
23641
+ else
23642
+ this._object = term3;
23643
+ this._literalLanguage = void 0;
23644
+ token2 = null;
23645
+ }
23646
+ if (component2 === "subject")
23647
+ return token2 === null ? this._readPredicateOrNamedGraph : this._readPredicateOrNamedGraph(token2);
23648
+ return this._completeObjectLiteralPost(token2, listItem);
23547
23649
  }
23548
23650
  // Completes a literal in subject position
23549
23651
  _completeSubjectLiteral(token2) {
23550
- this._subject = this._completeLiteral(token2).literal;
23652
+ const completed2 = this._completeLiteral(token2, "subject");
23653
+ this._subject = completed2.literal;
23654
+ if (completed2.readCb)
23655
+ return completed2.readCb.bind(this, false);
23551
23656
  return this._readPredicateOrNamedGraph;
23552
23657
  }
23553
23658
  // Completes a literal in object position
23554
23659
  _completeObjectLiteral(token2, listItem) {
23555
- const completed2 = this._completeLiteral(token2);
23660
+ const completed2 = this._completeLiteral(token2, "object");
23556
23661
  if (!completed2)
23557
23662
  return;
23558
23663
  this._object = completed2.literal;
23664
+ if (completed2.readCb)
23665
+ return completed2.readCb.bind(this, listItem);
23666
+ return this._completeObjectLiteralPost(completed2.token, listItem);
23667
+ }
23668
+ _completeObjectLiteralPost(token2, listItem) {
23559
23669
  if (listItem)
23560
23670
  this._emit(this._subject, this.RDF_FIRST, this._object, this._graph);
23561
- if (completed2.token === null)
23671
+ if (token2 === null)
23562
23672
  return this._getContextEndReader();
23563
23673
  else {
23564
23674
  this._readCallback = this._getContextEndReader();
23565
- return this._readCallback(completed2.token);
23675
+ return this._readCallback(token2);
23566
23676
  }
23567
23677
  }
23568
23678
  // ### `_readFormulaTail` reads the end of a formula
@@ -23576,7 +23686,7 @@ var N3Parser = class {
23576
23686
  }
23577
23687
  // ### `_readPunctuation` reads punctuation between quads or quad parts
23578
23688
  _readPunctuation(token2) {
23579
- let next4, graph3 = this._graph;
23689
+ let next4, graph3 = this._graph, startingAnnotation = false;
23580
23690
  const subject8 = this._subject, inversePredicate = this._inversePredicate;
23581
23691
  switch (token2.type) {
23582
23692
  // A closing brace ends a graph
@@ -23589,6 +23699,7 @@ var N3Parser = class {
23589
23699
  // A dot just ends the statement, without sharing anything with the next
23590
23700
  case ".":
23591
23701
  this._subject = null;
23702
+ this._tripleTerm = null;
23592
23703
  next4 = this._contextStack.length ? this._readSubject : this._readInTopContext;
23593
23704
  if (inversePredicate) this._inversePredicate = false;
23594
23705
  break;
@@ -23600,19 +23711,26 @@ var N3Parser = class {
23600
23711
  case ",":
23601
23712
  next4 = this._readObject;
23602
23713
  break;
23714
+ // ~ is allowed in the annotation syntax
23715
+ case "~":
23716
+ next4 = this._readReifierInAnnotation;
23717
+ startingAnnotation = true;
23718
+ break;
23603
23719
  // {| means that the current triple is annotated with predicate-object pairs.
23604
23720
  case "{|":
23605
- if (!this._supportsRDFStar)
23606
- return this._error("Unexpected RDF-star syntax", token2);
23607
- const predicate4 = this._predicate, object8 = this._object;
23608
- this._subject = this._factory.quad(subject8, predicate4, object8, this.DEFAULTGRAPH);
23721
+ this._subject = this._readTripleTerm();
23722
+ this._validAnnotation = false;
23723
+ startingAnnotation = true;
23609
23724
  next4 = this._readPredicate;
23610
23725
  break;
23611
- // |} means that the current quoted triple in annotation syntax is finalized.
23726
+ // |} means that the current reified triple in annotation syntax is finalized.
23612
23727
  case "|}":
23613
- if (this._subject.termType !== "Quad")
23614
- return this._error("Unexpected asserted triple closing", token2);
23728
+ if (!this._annotation)
23729
+ return this._error("Unexpected annotation syntax closing", token2);
23730
+ if (!this._validAnnotation)
23731
+ return this._error("Annotation block can not be empty", token2);
23615
23732
  this._subject = null;
23733
+ this._annotation = false;
23616
23734
  next4 = this._readPunctuation;
23617
23735
  break;
23618
23736
  default:
@@ -23622,13 +23740,16 @@ var N3Parser = class {
23622
23740
  }
23623
23741
  return this._error(`Expected punctuation to follow "${this._object.id}"`, token2);
23624
23742
  }
23625
- if (subject8 !== null) {
23743
+ if (subject8 !== null && (!startingAnnotation || startingAnnotation && !this._annotation)) {
23626
23744
  const predicate4 = this._predicate, object8 = this._object;
23627
23745
  if (!inversePredicate)
23628
23746
  this._emit(subject8, predicate4, object8, graph3);
23629
23747
  else
23630
23748
  this._emit(object8, predicate4, subject8, graph3);
23631
23749
  }
23750
+ if (startingAnnotation) {
23751
+ this._annotation = true;
23752
+ }
23632
23753
  return next4;
23633
23754
  }
23634
23755
  // ### `_readBlankNodePunctuation` reads punctuation in a blank node
@@ -23679,6 +23800,21 @@ var N3Parser = class {
23679
23800
  this._setBase(iri);
23680
23801
  return this._readDeclarationPunctuation;
23681
23802
  }
23803
+ // ### `_isValidVersion` checks if the given version is valid for this parser to handle.
23804
+ _isValidVersion(version6) {
23805
+ return this._parseUnsupportedVersions || _N3Parser.SUPPORTED_VERSIONS.includes(version6);
23806
+ }
23807
+ // ### `_readVersion` reads version string declaration
23808
+ _readVersion(token2) {
23809
+ if (token2.type !== "literal")
23810
+ return this._error("Expected literal to follow version declaration", token2);
23811
+ if (token2.end - token2.start !== token2.value.length + 2)
23812
+ return this._error("Version declarations must use single quotes", token2);
23813
+ this._versionCallback(token2.value);
23814
+ if (!this._isValidVersion(token2.value))
23815
+ return this._error(`Detected unsupported version: "${token2.value}"`, token2);
23816
+ return this._readDeclarationPunctuation;
23817
+ }
23682
23818
  // ### `_readNamedGraphLabel` reads the label of a named graph
23683
23819
  _readNamedGraphLabel(token2) {
23684
23820
  switch (token2.type) {
@@ -23805,26 +23941,17 @@ var N3Parser = class {
23805
23941
  this._emit(subject8, predicate4, object8, this._graph);
23806
23942
  return this._readPath;
23807
23943
  }
23808
- // ### `_readRDFStarTailOrGraph` reads the graph of a nested RDF-star quad or the end of a nested RDF-star triple
23809
- _readRDFStarTailOrGraph(token2) {
23810
- if (token2.type !== ">>") {
23811
- if (this._supportsQuads && this._graph === null && (this._graph = this._readEntity(token2)) !== void 0)
23812
- return this._readRDFStarTail;
23813
- return this._error(`Expected >> to follow "${this._object.id}"`, token2);
23814
- }
23815
- return this._readRDFStarTail(token2);
23816
- }
23817
- // ### `_readRDFStarTail` reads the end of a nested RDF-star triple
23818
- _readRDFStarTail(token2) {
23819
- if (token2.type !== ">>")
23820
- return this._error(`Expected >> but got ${token2.type}`, token2);
23944
+ // ### `_readTripleTermTail` reads the end of a triple term
23945
+ _readTripleTermTail(token2) {
23946
+ if (token2.type !== ")>>")
23947
+ return this._error(`Expected )>> but got ${token2.type}`, token2);
23821
23948
  const quad3 = this._factory.quad(
23822
23949
  this._subject,
23823
23950
  this._predicate,
23824
23951
  this._object,
23825
23952
  this._graph || this.DEFAULTGRAPH
23826
23953
  );
23827
- this._restoreContext("<<", token2);
23954
+ this._restoreContext("<<(", token2);
23828
23955
  if (this._subject === null) {
23829
23956
  this._subject = quad3;
23830
23957
  return this._readPredicate;
@@ -23833,6 +23960,63 @@ var N3Parser = class {
23833
23960
  return this._getContextEndReader();
23834
23961
  }
23835
23962
  }
23963
+ // ### `_readReifiedTripleTailOrReifier` reads a reifier or the end of a nested reified triple
23964
+ _readReifiedTripleTailOrReifier(token2) {
23965
+ if (token2.type === "~") {
23966
+ return this._readReifier;
23967
+ }
23968
+ return this._readReifiedTripleTail(token2);
23969
+ }
23970
+ // ### `_readReifiedTripleTail` reads the end of a nested reified triple
23971
+ _readReifiedTripleTail(token2) {
23972
+ if (token2.type !== ">>")
23973
+ return this._error(`Expected >> but got ${token2.type}`, token2);
23974
+ this._tripleTerm = null;
23975
+ const reifier = this._readTripleTerm();
23976
+ this._restoreContext("<<", token2);
23977
+ const stack = this._contextStack, parent4 = stack.length && stack[stack.length - 1];
23978
+ if (parent4 && parent4.type === "list") {
23979
+ this._emit(this._subject, this.RDF_FIRST, reifier, this._graph);
23980
+ return this._getContextEndReader();
23981
+ } else if (this._subject === null) {
23982
+ this._subject = reifier;
23983
+ return this._readPredicateOrReifierTripleEnd;
23984
+ } else {
23985
+ this._object = reifier;
23986
+ return this._getContextEndReader();
23987
+ }
23988
+ }
23989
+ _readPredicateOrReifierTripleEnd(token2) {
23990
+ if (token2.type === ".") {
23991
+ this._subject = null;
23992
+ return this._readPunctuation(token2);
23993
+ }
23994
+ return this._readPredicate(token2);
23995
+ }
23996
+ // ### `_readReifier` reads the triple term identifier after a tilde when in a reifying triple.
23997
+ _readReifier(token2) {
23998
+ this._reifier = this._readEntity(token2);
23999
+ return this._readReifiedTripleTail;
24000
+ }
24001
+ // ### `_readReifier` reads the optional triple term identifier after a tilde when in annotation syntax.
24002
+ _readReifierInAnnotation(token2) {
24003
+ if (token2.type === "IRI" || token2.type === "typeIRI" || token2.type === "type" || token2.type === "prefixed" || token2.type === "blank" || token2.type === "var") {
24004
+ this._reifier = this._readEntity(token2);
24005
+ return this._readPunctuation;
24006
+ }
24007
+ this._readTripleTerm();
24008
+ this._subject = null;
24009
+ return this._readPunctuation(token2);
24010
+ }
24011
+ _readTripleTerm() {
24012
+ const stack = this._contextStack, parent4 = stack.length && stack[stack.length - 1];
24013
+ const parentGraph = parent4 ? parent4.graph : void 0;
24014
+ const reifier = this._reifier || this._factory.blankNode();
24015
+ this._reifier = null;
24016
+ this._tripleTerm = this._tripleTerm || this._factory.quad(this._subject, this._predicate, this._object);
24017
+ this._emit(reifier, this.RDF_REIFIES, this._tripleTerm, parentGraph || this.DEFAULTGRAPH);
24018
+ return reifier;
24019
+ }
23836
24020
  // ### `_getContextEndReader` gets the next reader function at the end of a context
23837
24021
  _getContextEndReader() {
23838
24022
  const contextStack = this._contextStack;
@@ -23845,8 +24029,10 @@ var N3Parser = class {
23845
24029
  return this._readListItem;
23846
24030
  case "formula":
23847
24031
  return this._readFormulaTail;
24032
+ case "<<(":
24033
+ return this._readTripleTermTail;
23848
24034
  case "<<":
23849
- return this._readRDFStarTailOrGraph;
24035
+ return this._readReifiedTripleTailOrReifier;
23850
24036
  }
23851
24037
  }
23852
24038
  // ### `_emit` sends a quad through the callback
@@ -23944,21 +24130,24 @@ var N3Parser = class {
23944
24130
  }
23945
24131
  // ## Public methods
23946
24132
  // ### `parse` parses the N3 input and emits each parsed quad through the onQuad callback.
23947
- parse(input2, quadCallback, prefixCallback) {
23948
- let onQuad, onPrefix, onComment;
23949
- if (quadCallback && (quadCallback.onQuad || quadCallback.onPrefix || quadCallback.onComment)) {
24133
+ parse(input2, quadCallback, prefixCallback, versionCallback) {
24134
+ let onQuad, onPrefix, onComment, onVersion;
24135
+ if (quadCallback && (quadCallback.onQuad || quadCallback.onPrefix || quadCallback.onComment || quadCallback.onVersion)) {
23950
24136
  onQuad = quadCallback.onQuad;
23951
24137
  onPrefix = quadCallback.onPrefix;
23952
24138
  onComment = quadCallback.onComment;
24139
+ onVersion = quadCallback.onVersion;
23953
24140
  } else {
23954
24141
  onQuad = quadCallback;
23955
24142
  onPrefix = prefixCallback;
24143
+ onVersion = versionCallback;
23956
24144
  }
23957
- this._readCallback = this._readInTopContext;
24145
+ this._readCallback = this._readBeforeTopContext;
23958
24146
  this._sparqlStyle = false;
23959
24147
  this._prefixes = /* @__PURE__ */ Object.create(null);
23960
24148
  this._prefixes._ = this._blankNodePrefix ? this._blankNodePrefix.substr(2) : `b${blankNodePrefix++}_`;
23961
24149
  this._prefixCallback = onPrefix || noop2;
24150
+ this._versionCallback = onVersion || noop2;
23962
24151
  this._inversePredicate = false;
23963
24152
  this._quantified = /* @__PURE__ */ Object.create(null);
23964
24153
  if (!onQuad) {
@@ -24004,6 +24193,7 @@ function initDataFactory(parser, factory) {
24004
24193
  parser.RDF_FIRST = factory.namedNode(IRIs_default.rdf.first);
24005
24194
  parser.RDF_REST = factory.namedNode(IRIs_default.rdf.rest);
24006
24195
  parser.RDF_NIL = factory.namedNode(IRIs_default.rdf.nil);
24196
+ parser.RDF_REIFIES = factory.namedNode(IRIs_default.rdf.reifies);
24007
24197
  parser.N3_FORALL = factory.namedNode(IRIs_default.r.forAll);
24008
24198
  parser.N3_FORSOME = factory.namedNode(IRIs_default.r.forSome);
24009
24199
  parser.ABBREVIATIONS = {
@@ -24014,6 +24204,11 @@ function initDataFactory(parser, factory) {
24014
24204
  };
24015
24205
  parser.QUANTIFIERS_GRAPH = factory.namedNode("urn:n3:quantifiers");
24016
24206
  }
24207
+ N3Parser.SUPPORTED_VERSIONS = [
24208
+ "1.2",
24209
+ "1.2-basic",
24210
+ "1.1"
24211
+ ];
24017
24212
  initDataFactory(N3Parser.prototype, N3DataFactory_default);
24018
24213
 
24019
24214
  // node_modules/rdflib/esm/rdfaparser.js
@@ -28176,9 +28371,6 @@ var Thing = class {
28176
28371
  var LdpContainer = class extends Thing {
28177
28372
  constructor(uri6, store, editable = false) {
28178
28373
  super(uri6, store, editable);
28179
- this.uri = uri6;
28180
- this.store = store;
28181
- this.editable = editable;
28182
28374
  }
28183
28375
  /**
28184
28376
  * Resources that the LDP Container contains
@@ -28316,8 +28508,6 @@ var WebIdProfile = class extends Thing {
28316
28508
  constructor(webId, store, editable = false) {
28317
28509
  super(webId, store, editable);
28318
28510
  this.webId = webId;
28319
- this.store = store;
28320
- this.editable = editable;
28321
28511
  this.profileQuery = this.store.profileQuery(this.webId);
28322
28512
  }
28323
28513
  /**
@@ -28458,9 +28648,6 @@ var SearchIndex = class {
28458
28648
  var RdfDocument = class extends Thing {
28459
28649
  constructor(uri6, store, editable = false) {
28460
28650
  super(uri6, store, editable);
28461
- this.uri = uri6;
28462
- this.store = store;
28463
- this.editable = editable;
28464
28651
  }
28465
28652
  subjects() {
28466
28653
  const matches = this.store.statementsMatching(
@@ -28482,9 +28669,6 @@ var RdfDocument = class extends Thing {
28482
28669
  var LabelIndex = class extends RdfDocument {
28483
28670
  constructor(uri6, store, editable = false) {
28484
28671
  super(uri6, store, editable);
28485
- this.uri = uri6;
28486
- this.store = store;
28487
- this.editable = editable;
28488
28672
  }
28489
28673
  /**
28490
28674
  * Returns the URIs and labels for all the things listed in the document.
@@ -50325,8 +50509,6 @@ function listKnownTerms() {
50325
50509
  // src/uri/UriService.ts
50326
50510
  var import_slugify = __toESM(require_slugify(), 1);
50327
50511
  var UriService = class {
50328
- // We expect to use the store for calculating the uris for things
50329
- // e.g. looking up locations in type index
50330
50512
  constructor(store) {
50331
50513
  this.store = store;
50332
50514
  }
@@ -50551,9 +50733,6 @@ var AnonymousSession = class {
50551
50733
  var TypeIndex2 = class extends Thing {
50552
50734
  constructor(uri6, store, editable = false) {
50553
50735
  super(uri6, store, editable);
50554
- this.uri = uri6;
50555
- this.store = store;
50556
- this.editable = editable;
50557
50736
  }
50558
50737
  listAll() {
50559
50738
  const forClassStatements = this.store.statementsMatching(