@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/lib/index.js CHANGED
@@ -22222,8 +22222,8 @@ var PodOS = (() => {
22222
22222
  var _ = { label: 0, sent: function() {
22223
22223
  if (t[0] & 1) throw t[1];
22224
22224
  return t[1];
22225
- }, trys: [], ops: [] }, f, y, t, g;
22226
- return g = { next: verb2(0), "throw": verb2(1), "return": verb2(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
22225
+ }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
22226
+ return g.next = verb2(0), g["throw"] = verb2(1), g["return"] = verb2(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
22227
22227
  return this;
22228
22228
  }), g;
22229
22229
  function verb2(n2) {
@@ -22330,16 +22330,24 @@ var PodOS = (() => {
22330
22330
  function __asyncGenerator(thisArg, _arguments, generator3) {
22331
22331
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
22332
22332
  var g = generator3.apply(thisArg, _arguments || []), i, q = [];
22333
- return i = {}, verb2("next"), verb2("throw"), verb2("return"), i[Symbol.asyncIterator] = function() {
22333
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb2("next"), verb2("throw"), verb2("return", awaitReturn), i[Symbol.asyncIterator] = function() {
22334
22334
  return this;
22335
22335
  }, i;
22336
- function verb2(n2) {
22337
- if (g[n2]) i[n2] = function(v2) {
22338
- return new Promise(function(a, b) {
22339
- q.push([n2, v2, a, b]) > 1 || resume(n2, v2);
22340
- });
22336
+ function awaitReturn(f) {
22337
+ return function(v2) {
22338
+ return Promise.resolve(v2).then(f, reject);
22341
22339
  };
22342
22340
  }
22341
+ function verb2(n2, f) {
22342
+ if (g[n2]) {
22343
+ i[n2] = function(v2) {
22344
+ return new Promise(function(a, b) {
22345
+ q.push([n2, v2, a, b]) > 1 || resume(n2, v2);
22346
+ });
22347
+ };
22348
+ if (f) i[n2] = f(i[n2]);
22349
+ }
22350
+ }
22343
22351
  function resume(n2, v2) {
22344
22352
  try {
22345
22353
  step4(g[n2](v2));
@@ -30832,10 +30840,10 @@ var PodOS = (() => {
30832
30840
  return kb.rdfFactory.quad(id4, predicate4, object8, kb.rdfFactory.namedNode(base2));
30833
30841
  }
30834
30842
 
30835
- // ../node_modules/n3/src/N3Lexer.js
30843
+ // node_modules/n3/src/N3Lexer.js
30836
30844
  var import_buffer = __toESM(require_buffer());
30837
30845
 
30838
- // ../node_modules/n3/src/IRIs.js
30846
+ // node_modules/n3/src/IRIs.js
30839
30847
  var RDF2 = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
30840
30848
  var XSD = "http://www.w3.org/2001/XMLSchema#";
30841
30849
  var SWAP = "http://www.w3.org/2000/10/swap/";
@@ -30852,7 +30860,9 @@ var PodOS = (() => {
30852
30860
  nil: `${RDF2}nil`,
30853
30861
  first: `${RDF2}first`,
30854
30862
  rest: `${RDF2}rest`,
30855
- langString: `${RDF2}langString`
30863
+ langString: `${RDF2}langString`,
30864
+ dirLangString: `${RDF2}dirLangString`,
30865
+ reifies: `${RDF2}reifies`
30856
30866
  },
30857
30867
  owl: {
30858
30868
  sameAs: "http://www.w3.org/2002/07/owl#sameAs"
@@ -30867,7 +30877,7 @@ var PodOS = (() => {
30867
30877
  }
30868
30878
  };
30869
30879
 
30870
- // ../node_modules/n3/src/N3Lexer.js
30880
+ // node_modules/n3/src/N3Lexer.js
30871
30881
  var { xsd } = IRIs_default;
30872
30882
  var escapeSequence = /\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g;
30873
30883
  var escapeReplacements = {
@@ -30905,6 +30915,7 @@ var PodOS = (() => {
30905
30915
  _unescapedIri: true,
30906
30916
  _simpleQuotedString: true,
30907
30917
  _langcode: true,
30918
+ _dircode: true,
30908
30919
  _blank: true,
30909
30920
  _newline: true,
30910
30921
  _comment: true,
@@ -30918,15 +30929,16 @@ var PodOS = (() => {
30918
30929
  this._unescapedIri = /^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/;
30919
30930
  this._simpleQuotedString = /^"([^"\\\r\n]*)"(?=[^"])/;
30920
30931
  this._simpleApostropheString = /^'([^'\\\r\n]*)'(?=[^'])/;
30921
- this._langcode = /^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i;
30932
+ this._langcode = /^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9])/i;
30933
+ this._dircode = /^--(ltr)|(rtl)/;
30922
30934
  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
30935
  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
30936
  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
30937
  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
30938
  this._number = /^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/;
30927
30939
  this._boolean = /^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/;
30928
- this._keyword = /^@[a-z]+(?=[\s#<:])/i;
30929
- this._sparqlKeyword = /^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i;
30940
+ this._atKeyword = /^@[a-z]+(?=[\s#<:])/i;
30941
+ this._keyword = /^(?:PREFIX|BASE|VERSION|GRAPH)(?=[\s#<])/i;
30930
30942
  this._shortPredicates = /^a(?=[\s#()\[\]\{\}"'<>])/;
30931
30943
  this._newline = /^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/;
30932
30944
  this._comment = /#([^\n\r]*)/;
@@ -31000,7 +31012,9 @@ var PodOS = (() => {
31000
31012
  if (value7 === null || illegalIriChars.test(value7))
31001
31013
  return reportSyntaxError(this);
31002
31014
  type5 = "IRI";
31003
- } else if (input2.length > 1 && input2[1] === "<")
31015
+ } else if (input2.length > 2 && input2[1] === "<" && input2[2] === "(")
31016
+ type5 = "<<(", matchLength = 3;
31017
+ else if (!this._lineMode && input2.length > (inputFinished ? 1 : 2) && input2[1] === "<")
31004
31018
  type5 = "<<", matchLength = 2;
31005
31019
  else if (this._n3Mode && input2.length > 1 && input2[1] === "=") {
31006
31020
  matchLength = 2;
@@ -31049,9 +31063,9 @@ var PodOS = (() => {
31049
31063
  type5 = "var", value7 = match[0];
31050
31064
  break;
31051
31065
  case "@":
31052
- if (this._previousMarker === "literal" && (match = this._langcode.exec(input2)))
31066
+ if (this._previousMarker === "literal" && (match = this._langcode.exec(input2)) && match[1] !== "version")
31053
31067
  type5 = "langcode", value7 = match[1];
31054
- else if (match = this._keyword.exec(input2))
31068
+ else if (match = this._atKeyword.exec(input2))
31055
31069
  type5 = match[0];
31056
31070
  break;
31057
31071
  case ".":
@@ -31073,6 +31087,11 @@ var PodOS = (() => {
31073
31087
  case "9":
31074
31088
  case "+":
31075
31089
  case "-":
31090
+ if (input2[1] === "-") {
31091
+ if (this._previousMarker === "langcode" && (match = this._dircode.exec(input2)))
31092
+ type5 = "dircode", matchLength = 2, value7 = match[1] || match[2], matchLength = value7.length + 2;
31093
+ break;
31094
+ }
31076
31095
  if (match = this._number.exec(input2) || inputFinished && (match = this._number.exec(`${input2} `))) {
31077
31096
  type5 = "literal", value7 = match[0];
31078
31097
  prefix3 = typeof match[1] === "string" ? xsd.double : typeof match[2] === "string" ? xsd.decimal : xsd.integer;
@@ -31084,7 +31103,9 @@ var PodOS = (() => {
31084
31103
  case "P":
31085
31104
  case "G":
31086
31105
  case "g":
31087
- if (match = this._sparqlKeyword.exec(input2))
31106
+ case "V":
31107
+ case "v":
31108
+ if (match = this._keyword.exec(input2))
31088
31109
  type5 = match[0].toUpperCase();
31089
31110
  else
31090
31111
  inconclusive = true;
@@ -31114,13 +31135,21 @@ var PodOS = (() => {
31114
31135
  case "!":
31115
31136
  if (!this._n3Mode)
31116
31137
  break;
31138
+ case ")":
31139
+ if (!inputFinished && (input2.length === 1 || input2.length === 2 && input2[1] === ">")) {
31140
+ break;
31141
+ }
31142
+ if (input2.length > 2 && input2[1] === ">" && input2[2] === ">") {
31143
+ type5 = ")>>", matchLength = 3;
31144
+ break;
31145
+ }
31117
31146
  case ",":
31118
31147
  case ";":
31119
31148
  case "[":
31120
31149
  case "]":
31121
31150
  case "(":
31122
- case ")":
31123
31151
  case "}":
31152
+ case "~":
31124
31153
  if (!this._lineMode) {
31125
31154
  matchLength = 1;
31126
31155
  type5 = firstChar;
@@ -31285,7 +31314,7 @@ var PodOS = (() => {
31285
31314
  }
31286
31315
  };
31287
31316
 
31288
- // ../node_modules/n3/src/N3DataFactory.js
31317
+ // node_modules/n3/src/N3DataFactory.js
31289
31318
  var { rdf: rdf2, xsd: xsd2 } = IRIs_default;
31290
31319
  var DEFAULTGRAPH;
31291
31320
  var _blankNodeCounter = 0;
@@ -31347,7 +31376,15 @@ var PodOS = (() => {
31347
31376
  get language() {
31348
31377
  const id4 = this.id;
31349
31378
  let atPos = id4.lastIndexOf('"') + 1;
31350
- return atPos < id4.length && id4[atPos++] === "@" ? id4.substr(atPos).toLowerCase() : "";
31379
+ const dirPos = id4.lastIndexOf("--");
31380
+ return atPos < id4.length && id4[atPos++] === "@" ? (dirPos > atPos ? id4.substr(0, dirPos) : id4).substr(atPos).toLowerCase() : "";
31381
+ }
31382
+ // ### The direction of this literal
31383
+ get direction() {
31384
+ const id4 = this.id;
31385
+ const endPos = id4.lastIndexOf('"');
31386
+ const dirPos = id4.lastIndexOf("--");
31387
+ return dirPos > endPos && dirPos + 2 < id4.length ? id4.substr(dirPos + 2).toLowerCase() : "";
31351
31388
  }
31352
31389
  // ### The datatype IRI of this literal
31353
31390
  get datatype() {
@@ -31358,21 +31395,22 @@ var PodOS = (() => {
31358
31395
  const id4 = this.id, dtPos = id4.lastIndexOf('"') + 1;
31359
31396
  const char = dtPos < id4.length ? id4[dtPos] : "";
31360
31397
  return char === "^" ? id4.substr(dtPos + 2) : (
31361
- // If "@" follows, return rdf:langString; xsd:string otherwise
31362
- char !== "@" ? xsd2.string : rdf2.langString
31398
+ // If "@" follows, return rdf:langString or rdf:dirLangString; xsd:string otherwise
31399
+ char !== "@" ? xsd2.string : id4.indexOf("--", dtPos) > 0 ? rdf2.dirLangString : rdf2.langString
31363
31400
  );
31364
31401
  }
31365
31402
  // ### Returns whether this object represents the same term as the other
31366
31403
  equals(other2) {
31367
31404
  if (other2 instanceof _Literal)
31368
31405
  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;
31406
+ 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
31407
  }
31371
31408
  toJSON() {
31372
31409
  return {
31373
31410
  termType: this.termType,
31374
31411
  value: this.value,
31375
31412
  language: this.language,
31413
+ direction: this.direction,
31376
31414
  datatype: { termType: "NamedNode", value: this.datatypeString }
31377
31415
  };
31378
31416
  }
@@ -31466,6 +31504,9 @@ var PodOS = (() => {
31466
31504
  function literal(value7, languageOrDataType) {
31467
31505
  if (typeof languageOrDataType === "string")
31468
31506
  return new Literal2(`"${value7}"@${languageOrDataType.toLowerCase()}`);
31507
+ if (languageOrDataType !== void 0 && !("termType" in languageOrDataType)) {
31508
+ return new Literal2(`"${value7}"@${languageOrDataType.language.toLowerCase()}${languageOrDataType.direction ? `--${languageOrDataType.direction.toLowerCase()}` : ""}`);
31509
+ }
31469
31510
  let datatype3 = languageOrDataType ? languageOrDataType.value : "";
31470
31511
  if (datatype3 === "") {
31471
31512
  if (typeof value7 === "boolean")
@@ -31519,9 +31560,9 @@ var PodOS = (() => {
31519
31560
  return quad(fromTerm(inQuad.subject), fromTerm(inQuad.predicate), fromTerm(inQuad.object), fromTerm(inQuad.graph));
31520
31561
  }
31521
31562
 
31522
- // ../node_modules/n3/src/N3Parser.js
31563
+ // node_modules/n3/src/N3Parser.js
31523
31564
  var blankNodePrefix = 0;
31524
- var N3Parser = class {
31565
+ var N3Parser = class _N3Parser {
31525
31566
  constructor(options) {
31526
31567
  this._contextStack = [];
31527
31568
  this._graph = null;
@@ -31533,7 +31574,6 @@ var PodOS = (() => {
31533
31574
  this._readPredicateOrNamedGraph = this._readPredicate;
31534
31575
  this._supportsQuads = !(isTurtle || isTriG || isNTriples || isN3);
31535
31576
  this._isImpliedBy = options.isImpliedBy;
31536
- this._supportsRDFStar = format4 === "" || /star|\*$/.test(format4);
31537
31577
  if (isLineMode)
31538
31578
  this._resolveRelativeIRI = (iri) => {
31539
31579
  return null;
@@ -31541,6 +31581,8 @@ var PodOS = (() => {
31541
31581
  this._blankNodePrefix = typeof options.blankNodePrefix !== "string" ? "" : options.blankNodePrefix.replace(/^(?!_:)/, "_:");
31542
31582
  this._lexer = options.lexer || new N3Lexer({ lineMode: isLineMode, n3: isN3, isImpliedBy: this._isImpliedBy });
31543
31583
  this._explicitQuantifiers = !!options.explicitQuantifiers;
31584
+ this._parseUnsupportedVersions = !!options.parseUnsupportedVersions;
31585
+ this._version = options.version;
31544
31586
  }
31545
31587
  // ## Static class methods
31546
31588
  // ### `_resetBlankNodePrefix` restarts blank node prefix identification
@@ -31600,6 +31642,12 @@ var PodOS = (() => {
31600
31642
  this._quantified = context4.quantified;
31601
31643
  }
31602
31644
  }
31645
+ // ### `_readBeforeTopContext` is called once only at the start of parsing.
31646
+ _readBeforeTopContext(token2) {
31647
+ if (this._version && !this._isValidVersion(this._version))
31648
+ return this._error(`Detected unsupported version as media type parameter: "${this._version}"`, token2);
31649
+ return this._readInTopContext(token2);
31650
+ }
31603
31651
  // ### `_readInTopContext` reads a token when in the top context
31604
31652
  _readInTopContext(token2) {
31605
31653
  switch (token2.type) {
@@ -31619,6 +31667,11 @@ var PodOS = (() => {
31619
31667
  this._sparqlStyle = true;
31620
31668
  case "@base":
31621
31669
  return this._readBaseIRI;
31670
+ // It could be a version declaration
31671
+ case "VERSION":
31672
+ this._sparqlStyle = true;
31673
+ case "@version":
31674
+ return this._readVersion;
31622
31675
  // It could be a graph
31623
31676
  case "{":
31624
31677
  if (this._supportsNamedGraphs) {
@@ -31684,6 +31737,10 @@ var PodOS = (() => {
31684
31737
  );
31685
31738
  return this._readBlankNodeHead;
31686
31739
  case "(":
31740
+ const stack = this._contextStack, parent4 = stack.length && stack[stack.length - 1];
31741
+ if (parent4.type === "<<") {
31742
+ return this._error("Unexpected list in reified triple", token2);
31743
+ }
31687
31744
  this._saveContext("list", this._graph, this.RDF_NIL, null, null);
31688
31745
  this._subject = null;
31689
31746
  return this._readListItem;
@@ -31723,9 +31780,13 @@ var PodOS = (() => {
31723
31780
  } else
31724
31781
  this._subject = this._factory.literal(token2.value, this._factory.namedNode(token2.prefix));
31725
31782
  break;
31783
+ case "<<(":
31784
+ if (!this._n3Mode)
31785
+ return this._error("Disallowed triple term as subject", token2);
31786
+ this._saveContext("<<(", this._graph, null, null, null);
31787
+ this._graph = null;
31788
+ return this._readSubject;
31726
31789
  case "<<":
31727
- if (!this._supportsRDFStar)
31728
- return this._error("Unexpected RDF-star syntax", token2);
31729
31790
  this._saveContext("<<", this._graph, null, null, null);
31730
31791
  this._graph = null;
31731
31792
  return this._readSubject;
@@ -31749,6 +31810,7 @@ var PodOS = (() => {
31749
31810
  case ".":
31750
31811
  case "]":
31751
31812
  case "}":
31813
+ case "|}":
31752
31814
  if (this._predicate === null)
31753
31815
  return this._error(`Unexpected ${type5}`, token2);
31754
31816
  this._subject = null;
@@ -31773,6 +31835,7 @@ var PodOS = (() => {
31773
31835
  if ((this._predicate = this._readEntity(token2)) === void 0)
31774
31836
  return;
31775
31837
  }
31838
+ this._validAnnotation = true;
31776
31839
  return this._readObject;
31777
31840
  }
31778
31841
  // ### `_readObject` reads a quad's object
@@ -31795,6 +31858,10 @@ var PodOS = (() => {
31795
31858
  );
31796
31859
  return this._readBlankNodeHead;
31797
31860
  case "(":
31861
+ const stack = this._contextStack, parent4 = stack.length && stack[stack.length - 1];
31862
+ if (parent4.type === "<<") {
31863
+ return this._error("Unexpected list in reified triple", token2);
31864
+ }
31798
31865
  this._saveContext("list", this._graph, this._subject, this._predicate, this.RDF_NIL);
31799
31866
  this._subject = null;
31800
31867
  return this._readListItem;
@@ -31809,9 +31876,11 @@ var PodOS = (() => {
31809
31876
  this._graph = this._factory.blankNode()
31810
31877
  );
31811
31878
  return this._readSubject;
31879
+ case "<<(":
31880
+ this._saveContext("<<(", this._graph, this._subject, this._predicate, null);
31881
+ this._graph = null;
31882
+ return this._readSubject;
31812
31883
  case "<<":
31813
- if (!this._supportsRDFStar)
31814
- return this._error("Unexpected RDF-star syntax", token2);
31815
31884
  this._saveContext("<<", this._graph, this._subject, this._predicate, null);
31816
31885
  this._graph = null;
31817
31886
  return this._readSubject;
@@ -31840,6 +31909,10 @@ var PodOS = (() => {
31840
31909
  this._subject = null;
31841
31910
  return this._readBlankNodeTail(token2);
31842
31911
  } else {
31912
+ const stack = this._contextStack, parentParent = stack.length > 1 && stack[stack.length - 2];
31913
+ if (parentParent.type === "<<") {
31914
+ return this._error("Unexpected compound blank node expression in reified triple", token2);
31915
+ }
31843
31916
  this._predicate = null;
31844
31917
  return this._readPredicate(token2);
31845
31918
  }
@@ -31930,12 +32003,19 @@ var PodOS = (() => {
31930
32003
  this._graph = this._factory.blankNode()
31931
32004
  );
31932
32005
  return this._readSubject;
32006
+ case "<<":
32007
+ this._saveContext("<<", this._graph, null, null, null);
32008
+ this._graph = null;
32009
+ next4 = this._readSubject;
32010
+ break;
31933
32011
  default:
31934
32012
  if ((item4 = this._readEntity(token2)) === void 0)
31935
32013
  return;
31936
32014
  }
31937
32015
  if (list === null)
31938
32016
  this._subject = list = this._factory.blankNode();
32017
+ if (token2.type === "<<")
32018
+ stack[stack.length - 1].subject = this._subject;
31939
32019
  if (previousList === null) {
31940
32020
  if (parent4.predicate === null)
31941
32021
  parent4.subject = list;
@@ -31963,43 +32043,73 @@ var PodOS = (() => {
31963
32043
  return this._completeObjectLiteral(token2, true);
31964
32044
  }
31965
32045
  // ### `_completeLiteral` completes a literal with an optional datatype or language
31966
- _completeLiteral(token2) {
32046
+ _completeLiteral(token2, component2) {
31967
32047
  let literal4 = this._factory.literal(this._literalValue);
32048
+ let readCb;
31968
32049
  switch (token2.type) {
31969
32050
  // Create a datatyped literal
31970
32051
  case "type":
31971
32052
  case "typeIRI":
31972
32053
  const datatype3 = this._readEntity(token2);
31973
32054
  if (datatype3 === void 0) return;
32055
+ if (datatype3.value === IRIs_default.rdf.langString || datatype3.value === IRIs_default.rdf.dirLangString) {
32056
+ return this._error("Detected illegal (directional) languaged-tagged string with explicit datatype", token2);
32057
+ }
31974
32058
  literal4 = this._factory.literal(this._literalValue, datatype3);
31975
32059
  token2 = null;
31976
32060
  break;
31977
32061
  // Create a language-tagged string
31978
32062
  case "langcode":
32063
+ if (token2.value.split("-").some((t) => t.length > 8))
32064
+ return this._error("Detected language tag with subtag longer than 8 characters", token2);
31979
32065
  literal4 = this._factory.literal(this._literalValue, token2.value);
32066
+ this._literalLanguage = token2.value;
31980
32067
  token2 = null;
32068
+ readCb = this._readDirCode.bind(this, component2);
31981
32069
  break;
31982
32070
  }
31983
- return { token: token2, literal: literal4 };
32071
+ return { token: token2, literal: literal4, readCb };
32072
+ }
32073
+ _readDirCode(component2, listItem, token2) {
32074
+ if (token2.type === "dircode") {
32075
+ const term3 = this._factory.literal(this._literalValue, { language: this._literalLanguage, direction: token2.value });
32076
+ if (component2 === "subject")
32077
+ this._subject = term3;
32078
+ else
32079
+ this._object = term3;
32080
+ this._literalLanguage = void 0;
32081
+ token2 = null;
32082
+ }
32083
+ if (component2 === "subject")
32084
+ return token2 === null ? this._readPredicateOrNamedGraph : this._readPredicateOrNamedGraph(token2);
32085
+ return this._completeObjectLiteralPost(token2, listItem);
31984
32086
  }
31985
32087
  // Completes a literal in subject position
31986
32088
  _completeSubjectLiteral(token2) {
31987
- this._subject = this._completeLiteral(token2).literal;
32089
+ const completed2 = this._completeLiteral(token2, "subject");
32090
+ this._subject = completed2.literal;
32091
+ if (completed2.readCb)
32092
+ return completed2.readCb.bind(this, false);
31988
32093
  return this._readPredicateOrNamedGraph;
31989
32094
  }
31990
32095
  // Completes a literal in object position
31991
32096
  _completeObjectLiteral(token2, listItem) {
31992
- const completed2 = this._completeLiteral(token2);
32097
+ const completed2 = this._completeLiteral(token2, "object");
31993
32098
  if (!completed2)
31994
32099
  return;
31995
32100
  this._object = completed2.literal;
32101
+ if (completed2.readCb)
32102
+ return completed2.readCb.bind(this, listItem);
32103
+ return this._completeObjectLiteralPost(completed2.token, listItem);
32104
+ }
32105
+ _completeObjectLiteralPost(token2, listItem) {
31996
32106
  if (listItem)
31997
32107
  this._emit(this._subject, this.RDF_FIRST, this._object, this._graph);
31998
- if (completed2.token === null)
32108
+ if (token2 === null)
31999
32109
  return this._getContextEndReader();
32000
32110
  else {
32001
32111
  this._readCallback = this._getContextEndReader();
32002
- return this._readCallback(completed2.token);
32112
+ return this._readCallback(token2);
32003
32113
  }
32004
32114
  }
32005
32115
  // ### `_readFormulaTail` reads the end of a formula
@@ -32013,7 +32123,7 @@ var PodOS = (() => {
32013
32123
  }
32014
32124
  // ### `_readPunctuation` reads punctuation between quads or quad parts
32015
32125
  _readPunctuation(token2) {
32016
- let next4, graph3 = this._graph;
32126
+ let next4, graph3 = this._graph, startingAnnotation = false;
32017
32127
  const subject8 = this._subject, inversePredicate = this._inversePredicate;
32018
32128
  switch (token2.type) {
32019
32129
  // A closing brace ends a graph
@@ -32026,6 +32136,7 @@ var PodOS = (() => {
32026
32136
  // A dot just ends the statement, without sharing anything with the next
32027
32137
  case ".":
32028
32138
  this._subject = null;
32139
+ this._tripleTerm = null;
32029
32140
  next4 = this._contextStack.length ? this._readSubject : this._readInTopContext;
32030
32141
  if (inversePredicate) this._inversePredicate = false;
32031
32142
  break;
@@ -32037,19 +32148,26 @@ var PodOS = (() => {
32037
32148
  case ",":
32038
32149
  next4 = this._readObject;
32039
32150
  break;
32151
+ // ~ is allowed in the annotation syntax
32152
+ case "~":
32153
+ next4 = this._readReifierInAnnotation;
32154
+ startingAnnotation = true;
32155
+ break;
32040
32156
  // {| means that the current triple is annotated with predicate-object pairs.
32041
32157
  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);
32158
+ this._subject = this._readTripleTerm();
32159
+ this._validAnnotation = false;
32160
+ startingAnnotation = true;
32046
32161
  next4 = this._readPredicate;
32047
32162
  break;
32048
- // |} means that the current quoted triple in annotation syntax is finalized.
32163
+ // |} means that the current reified triple in annotation syntax is finalized.
32049
32164
  case "|}":
32050
- if (this._subject.termType !== "Quad")
32051
- return this._error("Unexpected asserted triple closing", token2);
32165
+ if (!this._annotation)
32166
+ return this._error("Unexpected annotation syntax closing", token2);
32167
+ if (!this._validAnnotation)
32168
+ return this._error("Annotation block can not be empty", token2);
32052
32169
  this._subject = null;
32170
+ this._annotation = false;
32053
32171
  next4 = this._readPunctuation;
32054
32172
  break;
32055
32173
  default:
@@ -32059,13 +32177,16 @@ var PodOS = (() => {
32059
32177
  }
32060
32178
  return this._error(`Expected punctuation to follow "${this._object.id}"`, token2);
32061
32179
  }
32062
- if (subject8 !== null) {
32180
+ if (subject8 !== null && (!startingAnnotation || startingAnnotation && !this._annotation)) {
32063
32181
  const predicate4 = this._predicate, object8 = this._object;
32064
32182
  if (!inversePredicate)
32065
32183
  this._emit(subject8, predicate4, object8, graph3);
32066
32184
  else
32067
32185
  this._emit(object8, predicate4, subject8, graph3);
32068
32186
  }
32187
+ if (startingAnnotation) {
32188
+ this._annotation = true;
32189
+ }
32069
32190
  return next4;
32070
32191
  }
32071
32192
  // ### `_readBlankNodePunctuation` reads punctuation in a blank node
@@ -32116,6 +32237,21 @@ var PodOS = (() => {
32116
32237
  this._setBase(iri);
32117
32238
  return this._readDeclarationPunctuation;
32118
32239
  }
32240
+ // ### `_isValidVersion` checks if the given version is valid for this parser to handle.
32241
+ _isValidVersion(version6) {
32242
+ return this._parseUnsupportedVersions || _N3Parser.SUPPORTED_VERSIONS.includes(version6);
32243
+ }
32244
+ // ### `_readVersion` reads version string declaration
32245
+ _readVersion(token2) {
32246
+ if (token2.type !== "literal")
32247
+ return this._error("Expected literal to follow version declaration", token2);
32248
+ if (token2.end - token2.start !== token2.value.length + 2)
32249
+ return this._error("Version declarations must use single quotes", token2);
32250
+ this._versionCallback(token2.value);
32251
+ if (!this._isValidVersion(token2.value))
32252
+ return this._error(`Detected unsupported version: "${token2.value}"`, token2);
32253
+ return this._readDeclarationPunctuation;
32254
+ }
32119
32255
  // ### `_readNamedGraphLabel` reads the label of a named graph
32120
32256
  _readNamedGraphLabel(token2) {
32121
32257
  switch (token2.type) {
@@ -32242,26 +32378,17 @@ var PodOS = (() => {
32242
32378
  this._emit(subject8, predicate4, object8, this._graph);
32243
32379
  return this._readPath;
32244
32380
  }
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);
32381
+ // ### `_readTripleTermTail` reads the end of a triple term
32382
+ _readTripleTermTail(token2) {
32383
+ if (token2.type !== ")>>")
32384
+ return this._error(`Expected )>> but got ${token2.type}`, token2);
32258
32385
  const quad3 = this._factory.quad(
32259
32386
  this._subject,
32260
32387
  this._predicate,
32261
32388
  this._object,
32262
32389
  this._graph || this.DEFAULTGRAPH
32263
32390
  );
32264
- this._restoreContext("<<", token2);
32391
+ this._restoreContext("<<(", token2);
32265
32392
  if (this._subject === null) {
32266
32393
  this._subject = quad3;
32267
32394
  return this._readPredicate;
@@ -32270,6 +32397,63 @@ var PodOS = (() => {
32270
32397
  return this._getContextEndReader();
32271
32398
  }
32272
32399
  }
32400
+ // ### `_readReifiedTripleTailOrReifier` reads a reifier or the end of a nested reified triple
32401
+ _readReifiedTripleTailOrReifier(token2) {
32402
+ if (token2.type === "~") {
32403
+ return this._readReifier;
32404
+ }
32405
+ return this._readReifiedTripleTail(token2);
32406
+ }
32407
+ // ### `_readReifiedTripleTail` reads the end of a nested reified triple
32408
+ _readReifiedTripleTail(token2) {
32409
+ if (token2.type !== ">>")
32410
+ return this._error(`Expected >> but got ${token2.type}`, token2);
32411
+ this._tripleTerm = null;
32412
+ const reifier = this._readTripleTerm();
32413
+ this._restoreContext("<<", token2);
32414
+ const stack = this._contextStack, parent4 = stack.length && stack[stack.length - 1];
32415
+ if (parent4 && parent4.type === "list") {
32416
+ this._emit(this._subject, this.RDF_FIRST, reifier, this._graph);
32417
+ return this._getContextEndReader();
32418
+ } else if (this._subject === null) {
32419
+ this._subject = reifier;
32420
+ return this._readPredicateOrReifierTripleEnd;
32421
+ } else {
32422
+ this._object = reifier;
32423
+ return this._getContextEndReader();
32424
+ }
32425
+ }
32426
+ _readPredicateOrReifierTripleEnd(token2) {
32427
+ if (token2.type === ".") {
32428
+ this._subject = null;
32429
+ return this._readPunctuation(token2);
32430
+ }
32431
+ return this._readPredicate(token2);
32432
+ }
32433
+ // ### `_readReifier` reads the triple term identifier after a tilde when in a reifying triple.
32434
+ _readReifier(token2) {
32435
+ this._reifier = this._readEntity(token2);
32436
+ return this._readReifiedTripleTail;
32437
+ }
32438
+ // ### `_readReifier` reads the optional triple term identifier after a tilde when in annotation syntax.
32439
+ _readReifierInAnnotation(token2) {
32440
+ if (token2.type === "IRI" || token2.type === "typeIRI" || token2.type === "type" || token2.type === "prefixed" || token2.type === "blank" || token2.type === "var") {
32441
+ this._reifier = this._readEntity(token2);
32442
+ return this._readPunctuation;
32443
+ }
32444
+ this._readTripleTerm();
32445
+ this._subject = null;
32446
+ return this._readPunctuation(token2);
32447
+ }
32448
+ _readTripleTerm() {
32449
+ const stack = this._contextStack, parent4 = stack.length && stack[stack.length - 1];
32450
+ const parentGraph = parent4 ? parent4.graph : void 0;
32451
+ const reifier = this._reifier || this._factory.blankNode();
32452
+ this._reifier = null;
32453
+ this._tripleTerm = this._tripleTerm || this._factory.quad(this._subject, this._predicate, this._object);
32454
+ this._emit(reifier, this.RDF_REIFIES, this._tripleTerm, parentGraph || this.DEFAULTGRAPH);
32455
+ return reifier;
32456
+ }
32273
32457
  // ### `_getContextEndReader` gets the next reader function at the end of a context
32274
32458
  _getContextEndReader() {
32275
32459
  const contextStack = this._contextStack;
@@ -32282,8 +32466,10 @@ var PodOS = (() => {
32282
32466
  return this._readListItem;
32283
32467
  case "formula":
32284
32468
  return this._readFormulaTail;
32469
+ case "<<(":
32470
+ return this._readTripleTermTail;
32285
32471
  case "<<":
32286
- return this._readRDFStarTailOrGraph;
32472
+ return this._readReifiedTripleTailOrReifier;
32287
32473
  }
32288
32474
  }
32289
32475
  // ### `_emit` sends a quad through the callback
@@ -32381,21 +32567,24 @@ var PodOS = (() => {
32381
32567
  }
32382
32568
  // ## Public methods
32383
32569
  // ### `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)) {
32570
+ parse(input2, quadCallback, prefixCallback, versionCallback) {
32571
+ let onQuad, onPrefix, onComment, onVersion;
32572
+ if (quadCallback && (quadCallback.onQuad || quadCallback.onPrefix || quadCallback.onComment || quadCallback.onVersion)) {
32387
32573
  onQuad = quadCallback.onQuad;
32388
32574
  onPrefix = quadCallback.onPrefix;
32389
32575
  onComment = quadCallback.onComment;
32576
+ onVersion = quadCallback.onVersion;
32390
32577
  } else {
32391
32578
  onQuad = quadCallback;
32392
32579
  onPrefix = prefixCallback;
32580
+ onVersion = versionCallback;
32393
32581
  }
32394
- this._readCallback = this._readInTopContext;
32582
+ this._readCallback = this._readBeforeTopContext;
32395
32583
  this._sparqlStyle = false;
32396
32584
  this._prefixes = /* @__PURE__ */ Object.create(null);
32397
32585
  this._prefixes._ = this._blankNodePrefix ? this._blankNodePrefix.substr(2) : `b${blankNodePrefix++}_`;
32398
32586
  this._prefixCallback = onPrefix || noop2;
32587
+ this._versionCallback = onVersion || noop2;
32399
32588
  this._inversePredicate = false;
32400
32589
  this._quantified = /* @__PURE__ */ Object.create(null);
32401
32590
  if (!onQuad) {
@@ -32441,6 +32630,7 @@ var PodOS = (() => {
32441
32630
  parser.RDF_FIRST = factory.namedNode(IRIs_default.rdf.first);
32442
32631
  parser.RDF_REST = factory.namedNode(IRIs_default.rdf.rest);
32443
32632
  parser.RDF_NIL = factory.namedNode(IRIs_default.rdf.nil);
32633
+ parser.RDF_REIFIES = factory.namedNode(IRIs_default.rdf.reifies);
32444
32634
  parser.N3_FORALL = factory.namedNode(IRIs_default.r.forAll);
32445
32635
  parser.N3_FORSOME = factory.namedNode(IRIs_default.r.forSome);
32446
32636
  parser.ABBREVIATIONS = {
@@ -32451,6 +32641,11 @@ var PodOS = (() => {
32451
32641
  };
32452
32642
  parser.QUANTIFIERS_GRAPH = factory.namedNode("urn:n3:quantifiers");
32453
32643
  }
32644
+ N3Parser.SUPPORTED_VERSIONS = [
32645
+ "1.2",
32646
+ "1.2-basic",
32647
+ "1.1"
32648
+ ];
32454
32649
  initDataFactory(N3Parser.prototype, N3DataFactory_default);
32455
32650
 
32456
32651
  // node_modules/rdflib/esm/rdfaparser.js
@@ -36613,9 +36808,6 @@ _:patch
36613
36808
  var LdpContainer = class extends Thing {
36614
36809
  constructor(uri6, store, editable = false) {
36615
36810
  super(uri6, store, editable);
36616
- this.uri = uri6;
36617
- this.store = store;
36618
- this.editable = editable;
36619
36811
  }
36620
36812
  /**
36621
36813
  * Resources that the LDP Container contains
@@ -36753,8 +36945,6 @@ _:patch
36753
36945
  constructor(webId, store, editable = false) {
36754
36946
  super(webId, store, editable);
36755
36947
  this.webId = webId;
36756
- this.store = store;
36757
- this.editable = editable;
36758
36948
  this.profileQuery = this.store.profileQuery(this.webId);
36759
36949
  }
36760
36950
  /**
@@ -36895,9 +37085,6 @@ _:patch
36895
37085
  var RdfDocument = class extends Thing {
36896
37086
  constructor(uri6, store, editable = false) {
36897
37087
  super(uri6, store, editable);
36898
- this.uri = uri6;
36899
- this.store = store;
36900
- this.editable = editable;
36901
37088
  }
36902
37089
  subjects() {
36903
37090
  const matches = this.store.statementsMatching(
@@ -36919,9 +37106,6 @@ _:patch
36919
37106
  var LabelIndex = class extends RdfDocument {
36920
37107
  constructor(uri6, store, editable = false) {
36921
37108
  super(uri6, store, editable);
36922
- this.uri = uri6;
36923
- this.store = store;
36924
- this.editable = editable;
36925
37109
  }
36926
37110
  /**
36927
37111
  * Returns the URIs and labels for all the things listed in the document.
@@ -58762,8 +58946,6 @@ _:patch
58762
58946
  // src/uri/UriService.ts
58763
58947
  var import_slugify = __toESM(require_slugify(), 1);
58764
58948
  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
58949
  constructor(store) {
58768
58950
  this.store = store;
58769
58951
  }
@@ -58988,9 +59170,6 @@ _:patch
58988
59170
  var TypeIndex2 = class extends Thing {
58989
59171
  constructor(uri6, store, editable = false) {
58990
59172
  super(uri6, store, editable);
58991
- this.uri = uri6;
58992
- this.store = store;
58993
- this.editable = editable;
58994
59173
  }
58995
59174
  listAll() {
58996
59175
  const forClassStatements = this.store.statementsMatching(