@pod-os/elements 0.40.0 → 0.41.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.
Files changed (25) hide show
  1. package/dist/cjs/{index-Bc4gZgPG.js → index-BP03J2RA.js} +246 -75
  2. package/dist/cjs/{jsonld-V2RB47OZ-JAbnY92y.js → jsonld-V2RB47OZ-B6QDxKa1.js} +1 -1
  3. package/dist/cjs/pos-add-literal-value_3.cjs.entry.js +1 -1
  4. package/dist/cjs/pos-add-new-thing_32.cjs.entry.js +1 -1
  5. package/dist/cjs/pos-add-relation.cjs.entry.js +1 -1
  6. package/dist/cjs/pos-container-contents.cjs.entry.js +1 -1
  7. package/dist/cjs/pos-subjects.cjs.entry.js +1 -1
  8. package/dist/components/index2.js +1 -1
  9. package/dist/elements/elements.esm.js +1 -1
  10. package/dist/elements/{p-57d32176.entry.js → p-1e0bd264.entry.js} +1 -1
  11. package/dist/elements/{p-a8628eb4.entry.js → p-3ef3a9a9.entry.js} +1 -1
  12. package/dist/elements/{p-f6da714c.entry.js → p-5506bf9a.entry.js} +1 -1
  13. package/dist/elements/{p-DuW6UWKz.js → p-DqO-cIHe.js} +1 -1
  14. package/dist/elements/{p-ed1d9d77.entry.js → p-d31c55b9.entry.js} +1 -1
  15. package/dist/elements/{p-2ee1efdb.entry.js → p-f9c10964.entry.js} +1 -1
  16. package/dist/elements/p-sVi8GCz5.js +67 -0
  17. package/dist/esm/{index-LnGgDqFG.js → index-CMbRpNym.js} +246 -75
  18. package/dist/esm/{jsonld-V2RB47OZ-DFmZ008Y.js → jsonld-V2RB47OZ-zn531VHn.js} +1 -1
  19. package/dist/esm/pos-add-literal-value_3.entry.js +1 -1
  20. package/dist/esm/pos-add-new-thing_32.entry.js +1 -1
  21. package/dist/esm/pos-add-relation.entry.js +1 -1
  22. package/dist/esm/pos-container-contents.entry.js +1 -1
  23. package/dist/esm/pos-subjects.entry.js +1 -1
  24. package/package.json +2 -2
  25. package/dist/elements/p-BXBNVUZ5.js +0 -67
@@ -22138,7 +22138,7 @@ function listToCollection(kb, obj) {
22138
22138
  }
22139
22139
  async function jsonldParser(str, kb, base2) {
22140
22140
  const baseString = base2 && Object.prototype.hasOwnProperty.call(base2, "termType") ? base2.value : base2;
22141
- const jsonld = await import('./jsonld-V2RB47OZ-DFmZ008Y.js');
22141
+ const jsonld = await import('./jsonld-V2RB47OZ-zn531VHn.js');
22142
22142
  const flattened = await jsonld.default.flatten(JSON.parse(str), null, {
22143
22143
  base: baseString
22144
22144
  });
@@ -22186,10 +22186,10 @@ function createStatement(kb, id4, property4, value7, base2) {
22186
22186
  return kb.rdfFactory.quad(id4, predicate4, object8, kb.rdfFactory.namedNode(base2));
22187
22187
  }
22188
22188
 
22189
- // ../node_modules/n3/src/N3Lexer.js
22189
+ // node_modules/n3/src/N3Lexer.js
22190
22190
  var import_buffer = __toESM(require_buffer());
22191
22191
 
22192
- // ../node_modules/n3/src/IRIs.js
22192
+ // node_modules/n3/src/IRIs.js
22193
22193
  var RDF2 = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
22194
22194
  var XSD = "http://www.w3.org/2001/XMLSchema#";
22195
22195
  var SWAP = "http://www.w3.org/2000/10/swap/";
@@ -22206,7 +22206,9 @@ var IRIs_default = {
22206
22206
  nil: `${RDF2}nil`,
22207
22207
  first: `${RDF2}first`,
22208
22208
  rest: `${RDF2}rest`,
22209
- langString: `${RDF2}langString`
22209
+ langString: `${RDF2}langString`,
22210
+ dirLangString: `${RDF2}dirLangString`,
22211
+ reifies: `${RDF2}reifies`
22210
22212
  },
22211
22213
  owl: {
22212
22214
  sameAs: "http://www.w3.org/2002/07/owl#sameAs"
@@ -22221,7 +22223,7 @@ var IRIs_default = {
22221
22223
  }
22222
22224
  };
22223
22225
 
22224
- // ../node_modules/n3/src/N3Lexer.js
22226
+ // node_modules/n3/src/N3Lexer.js
22225
22227
  var { xsd } = IRIs_default;
22226
22228
  var escapeSequence = /\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g;
22227
22229
  var escapeReplacements = {
@@ -22259,6 +22261,7 @@ var lineModeRegExps = {
22259
22261
  _unescapedIri: true,
22260
22262
  _simpleQuotedString: true,
22261
22263
  _langcode: true,
22264
+ _dircode: true,
22262
22265
  _blank: true,
22263
22266
  _newline: true,
22264
22267
  _comment: true,
@@ -22272,15 +22275,16 @@ var N3Lexer = class {
22272
22275
  this._unescapedIri = /^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/;
22273
22276
  this._simpleQuotedString = /^"([^"\\\r\n]*)"(?=[^"])/;
22274
22277
  this._simpleApostropheString = /^'([^'\\\r\n]*)'(?=[^'])/;
22275
- this._langcode = /^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i;
22278
+ this._langcode = /^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9])/i;
22279
+ this._dircode = /^--(ltr)|(rtl)/;
22276
22280
  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<])/;
22277
22281
  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#()\[\]\{\}"'<>]))/;
22278
22282
  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#()\[\]\{\}"'<>])/;
22279
22283
  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#()\[\]\{\}"'<>]))/;
22280
22284
  this._number = /^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/;
22281
22285
  this._boolean = /^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/;
22282
- this._keyword = /^@[a-z]+(?=[\s#<:])/i;
22283
- this._sparqlKeyword = /^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i;
22286
+ this._atKeyword = /^@[a-z]+(?=[\s#<:])/i;
22287
+ this._keyword = /^(?:PREFIX|BASE|VERSION|GRAPH)(?=[\s#<])/i;
22284
22288
  this._shortPredicates = /^a(?=[\s#()\[\]\{\}"'<>])/;
22285
22289
  this._newline = /^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/;
22286
22290
  this._comment = /#([^\n\r]*)/;
@@ -22354,7 +22358,9 @@ var N3Lexer = class {
22354
22358
  if (value7 === null || illegalIriChars.test(value7))
22355
22359
  return reportSyntaxError(this);
22356
22360
  type5 = "IRI";
22357
- } else if (input2.length > 1 && input2[1] === "<")
22361
+ } else if (input2.length > 2 && input2[1] === "<" && input2[2] === "(")
22362
+ type5 = "<<(", matchLength = 3;
22363
+ else if (!this._lineMode && input2.length > (inputFinished ? 1 : 2) && input2[1] === "<")
22358
22364
  type5 = "<<", matchLength = 2;
22359
22365
  else if (this._n3Mode && input2.length > 1 && input2[1] === "=") {
22360
22366
  matchLength = 2;
@@ -22403,9 +22409,9 @@ var N3Lexer = class {
22403
22409
  type5 = "var", value7 = match[0];
22404
22410
  break;
22405
22411
  case "@":
22406
- if (this._previousMarker === "literal" && (match = this._langcode.exec(input2)))
22412
+ if (this._previousMarker === "literal" && (match = this._langcode.exec(input2)) && match[1] !== "version")
22407
22413
  type5 = "langcode", value7 = match[1];
22408
- else if (match = this._keyword.exec(input2))
22414
+ else if (match = this._atKeyword.exec(input2))
22409
22415
  type5 = match[0];
22410
22416
  break;
22411
22417
  case ".":
@@ -22427,6 +22433,11 @@ var N3Lexer = class {
22427
22433
  case "9":
22428
22434
  case "+":
22429
22435
  case "-":
22436
+ if (input2[1] === "-") {
22437
+ if (this._previousMarker === "langcode" && (match = this._dircode.exec(input2)))
22438
+ type5 = "dircode", matchLength = 2, value7 = match[1] || match[2], matchLength = value7.length + 2;
22439
+ break;
22440
+ }
22430
22441
  if (match = this._number.exec(input2) || inputFinished && (match = this._number.exec(`${input2} `))) {
22431
22442
  type5 = "literal", value7 = match[0];
22432
22443
  prefix3 = typeof match[1] === "string" ? xsd.double : typeof match[2] === "string" ? xsd.decimal : xsd.integer;
@@ -22438,7 +22449,9 @@ var N3Lexer = class {
22438
22449
  case "P":
22439
22450
  case "G":
22440
22451
  case "g":
22441
- if (match = this._sparqlKeyword.exec(input2))
22452
+ case "V":
22453
+ case "v":
22454
+ if (match = this._keyword.exec(input2))
22442
22455
  type5 = match[0].toUpperCase();
22443
22456
  else
22444
22457
  inconclusive = true;
@@ -22468,13 +22481,21 @@ var N3Lexer = class {
22468
22481
  case "!":
22469
22482
  if (!this._n3Mode)
22470
22483
  break;
22484
+ case ")":
22485
+ if (!inputFinished && (input2.length === 1 || input2.length === 2 && input2[1] === ">")) {
22486
+ break;
22487
+ }
22488
+ if (input2.length > 2 && input2[1] === ">" && input2[2] === ">") {
22489
+ type5 = ")>>", matchLength = 3;
22490
+ break;
22491
+ }
22471
22492
  case ",":
22472
22493
  case ";":
22473
22494
  case "[":
22474
22495
  case "]":
22475
22496
  case "(":
22476
- case ")":
22477
22497
  case "}":
22498
+ case "~":
22478
22499
  if (!this._lineMode) {
22479
22500
  matchLength = 1;
22480
22501
  type5 = firstChar;
@@ -22639,7 +22660,7 @@ var N3Lexer = class {
22639
22660
  }
22640
22661
  };
22641
22662
 
22642
- // ../node_modules/n3/src/N3DataFactory.js
22663
+ // node_modules/n3/src/N3DataFactory.js
22643
22664
  var { rdf: rdf2, xsd: xsd2 } = IRIs_default;
22644
22665
  var DEFAULTGRAPH;
22645
22666
  var _blankNodeCounter = 0;
@@ -22701,7 +22722,15 @@ var Literal2 = class _Literal extends Term {
22701
22722
  get language() {
22702
22723
  const id4 = this.id;
22703
22724
  let atPos = id4.lastIndexOf('"') + 1;
22704
- return atPos < id4.length && id4[atPos++] === "@" ? id4.substr(atPos).toLowerCase() : "";
22725
+ const dirPos = id4.lastIndexOf("--");
22726
+ return atPos < id4.length && id4[atPos++] === "@" ? (dirPos > atPos ? id4.substr(0, dirPos) : id4).substr(atPos).toLowerCase() : "";
22727
+ }
22728
+ // ### The direction of this literal
22729
+ get direction() {
22730
+ const id4 = this.id;
22731
+ const endPos = id4.lastIndexOf('"');
22732
+ const dirPos = id4.lastIndexOf("--");
22733
+ return dirPos > endPos && dirPos + 2 < id4.length ? id4.substr(dirPos + 2).toLowerCase() : "";
22705
22734
  }
22706
22735
  // ### The datatype IRI of this literal
22707
22736
  get datatype() {
@@ -22712,21 +22741,22 @@ var Literal2 = class _Literal extends Term {
22712
22741
  const id4 = this.id, dtPos = id4.lastIndexOf('"') + 1;
22713
22742
  const char = dtPos < id4.length ? id4[dtPos] : "";
22714
22743
  return char === "^" ? id4.substr(dtPos + 2) : (
22715
- // If "@" follows, return rdf:langString; xsd:string otherwise
22716
- char !== "@" ? xsd2.string : rdf2.langString
22744
+ // If "@" follows, return rdf:langString or rdf:dirLangString; xsd:string otherwise
22745
+ char !== "@" ? xsd2.string : id4.indexOf("--", dtPos) > 0 ? rdf2.dirLangString : rdf2.langString
22717
22746
  );
22718
22747
  }
22719
22748
  // ### Returns whether this object represents the same term as the other
22720
22749
  equals(other2) {
22721
22750
  if (other2 instanceof _Literal)
22722
22751
  return this.id === other2.id;
22723
- return !!other2 && !!other2.datatype && this.termType === other2.termType && this.value === other2.value && this.language === other2.language && this.datatype.value === other2.datatype.value;
22752
+ 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;
22724
22753
  }
22725
22754
  toJSON() {
22726
22755
  return {
22727
22756
  termType: this.termType,
22728
22757
  value: this.value,
22729
22758
  language: this.language,
22759
+ direction: this.direction,
22730
22760
  datatype: { termType: "NamedNode", value: this.datatypeString }
22731
22761
  };
22732
22762
  }
@@ -22820,6 +22850,9 @@ function blankNode(name9) {
22820
22850
  function literal(value7, languageOrDataType) {
22821
22851
  if (typeof languageOrDataType === "string")
22822
22852
  return new Literal2(`"${value7}"@${languageOrDataType.toLowerCase()}`);
22853
+ if (languageOrDataType !== void 0 && !("termType" in languageOrDataType)) {
22854
+ return new Literal2(`"${value7}"@${languageOrDataType.language.toLowerCase()}${languageOrDataType.direction ? `--${languageOrDataType.direction.toLowerCase()}` : ""}`);
22855
+ }
22823
22856
  let datatype3 = languageOrDataType ? languageOrDataType.value : "";
22824
22857
  if (datatype3 === "") {
22825
22858
  if (typeof value7 === "boolean")
@@ -22873,9 +22906,9 @@ function fromQuad(inQuad) {
22873
22906
  return quad(fromTerm(inQuad.subject), fromTerm(inQuad.predicate), fromTerm(inQuad.object), fromTerm(inQuad.graph));
22874
22907
  }
22875
22908
 
22876
- // ../node_modules/n3/src/N3Parser.js
22909
+ // node_modules/n3/src/N3Parser.js
22877
22910
  var blankNodePrefix = 0;
22878
- var N3Parser = class {
22911
+ var N3Parser = class _N3Parser {
22879
22912
  constructor(options) {
22880
22913
  this._contextStack = [];
22881
22914
  this._graph = null;
@@ -22887,7 +22920,6 @@ var N3Parser = class {
22887
22920
  this._readPredicateOrNamedGraph = this._readPredicate;
22888
22921
  this._supportsQuads = !(isTurtle || isTriG || isNTriples || isN3);
22889
22922
  this._isImpliedBy = options.isImpliedBy;
22890
- this._supportsRDFStar = format4 === "" || /star|\*$/.test(format4);
22891
22923
  if (isLineMode)
22892
22924
  this._resolveRelativeIRI = (iri) => {
22893
22925
  return null;
@@ -22895,6 +22927,8 @@ var N3Parser = class {
22895
22927
  this._blankNodePrefix = typeof options.blankNodePrefix !== "string" ? "" : options.blankNodePrefix.replace(/^(?!_:)/, "_:");
22896
22928
  this._lexer = options.lexer || new N3Lexer({ lineMode: isLineMode, n3: isN3, isImpliedBy: this._isImpliedBy });
22897
22929
  this._explicitQuantifiers = !!options.explicitQuantifiers;
22930
+ this._parseUnsupportedVersions = !!options.parseUnsupportedVersions;
22931
+ this._version = options.version;
22898
22932
  }
22899
22933
  // ## Static class methods
22900
22934
  // ### `_resetBlankNodePrefix` restarts blank node prefix identification
@@ -22954,6 +22988,12 @@ var N3Parser = class {
22954
22988
  this._quantified = context4.quantified;
22955
22989
  }
22956
22990
  }
22991
+ // ### `_readBeforeTopContext` is called once only at the start of parsing.
22992
+ _readBeforeTopContext(token2) {
22993
+ if (this._version && !this._isValidVersion(this._version))
22994
+ return this._error(`Detected unsupported version as media type parameter: "${this._version}"`, token2);
22995
+ return this._readInTopContext(token2);
22996
+ }
22957
22997
  // ### `_readInTopContext` reads a token when in the top context
22958
22998
  _readInTopContext(token2) {
22959
22999
  switch (token2.type) {
@@ -22973,6 +23013,11 @@ var N3Parser = class {
22973
23013
  this._sparqlStyle = true;
22974
23014
  case "@base":
22975
23015
  return this._readBaseIRI;
23016
+ // It could be a version declaration
23017
+ case "VERSION":
23018
+ this._sparqlStyle = true;
23019
+ case "@version":
23020
+ return this._readVersion;
22976
23021
  // It could be a graph
22977
23022
  case "{":
22978
23023
  if (this._supportsNamedGraphs) {
@@ -23038,6 +23083,10 @@ var N3Parser = class {
23038
23083
  );
23039
23084
  return this._readBlankNodeHead;
23040
23085
  case "(":
23086
+ const stack = this._contextStack, parent4 = stack.length && stack[stack.length - 1];
23087
+ if (parent4.type === "<<") {
23088
+ return this._error("Unexpected list in reified triple", token2);
23089
+ }
23041
23090
  this._saveContext("list", this._graph, this.RDF_NIL, null, null);
23042
23091
  this._subject = null;
23043
23092
  return this._readListItem;
@@ -23077,9 +23126,13 @@ var N3Parser = class {
23077
23126
  } else
23078
23127
  this._subject = this._factory.literal(token2.value, this._factory.namedNode(token2.prefix));
23079
23128
  break;
23129
+ case "<<(":
23130
+ if (!this._n3Mode)
23131
+ return this._error("Disallowed triple term as subject", token2);
23132
+ this._saveContext("<<(", this._graph, null, null, null);
23133
+ this._graph = null;
23134
+ return this._readSubject;
23080
23135
  case "<<":
23081
- if (!this._supportsRDFStar)
23082
- return this._error("Unexpected RDF-star syntax", token2);
23083
23136
  this._saveContext("<<", this._graph, null, null, null);
23084
23137
  this._graph = null;
23085
23138
  return this._readSubject;
@@ -23103,6 +23156,7 @@ var N3Parser = class {
23103
23156
  case ".":
23104
23157
  case "]":
23105
23158
  case "}":
23159
+ case "|}":
23106
23160
  if (this._predicate === null)
23107
23161
  return this._error(`Unexpected ${type5}`, token2);
23108
23162
  this._subject = null;
@@ -23127,6 +23181,7 @@ var N3Parser = class {
23127
23181
  if ((this._predicate = this._readEntity(token2)) === void 0)
23128
23182
  return;
23129
23183
  }
23184
+ this._validAnnotation = true;
23130
23185
  return this._readObject;
23131
23186
  }
23132
23187
  // ### `_readObject` reads a quad's object
@@ -23149,6 +23204,10 @@ var N3Parser = class {
23149
23204
  );
23150
23205
  return this._readBlankNodeHead;
23151
23206
  case "(":
23207
+ const stack = this._contextStack, parent4 = stack.length && stack[stack.length - 1];
23208
+ if (parent4.type === "<<") {
23209
+ return this._error("Unexpected list in reified triple", token2);
23210
+ }
23152
23211
  this._saveContext("list", this._graph, this._subject, this._predicate, this.RDF_NIL);
23153
23212
  this._subject = null;
23154
23213
  return this._readListItem;
@@ -23163,9 +23222,11 @@ var N3Parser = class {
23163
23222
  this._graph = this._factory.blankNode()
23164
23223
  );
23165
23224
  return this._readSubject;
23225
+ case "<<(":
23226
+ this._saveContext("<<(", this._graph, this._subject, this._predicate, null);
23227
+ this._graph = null;
23228
+ return this._readSubject;
23166
23229
  case "<<":
23167
- if (!this._supportsRDFStar)
23168
- return this._error("Unexpected RDF-star syntax", token2);
23169
23230
  this._saveContext("<<", this._graph, this._subject, this._predicate, null);
23170
23231
  this._graph = null;
23171
23232
  return this._readSubject;
@@ -23194,6 +23255,10 @@ var N3Parser = class {
23194
23255
  this._subject = null;
23195
23256
  return this._readBlankNodeTail(token2);
23196
23257
  } else {
23258
+ const stack = this._contextStack, parentParent = stack.length > 1 && stack[stack.length - 2];
23259
+ if (parentParent.type === "<<") {
23260
+ return this._error("Unexpected compound blank node expression in reified triple", token2);
23261
+ }
23197
23262
  this._predicate = null;
23198
23263
  return this._readPredicate(token2);
23199
23264
  }
@@ -23284,12 +23349,19 @@ var N3Parser = class {
23284
23349
  this._graph = this._factory.blankNode()
23285
23350
  );
23286
23351
  return this._readSubject;
23352
+ case "<<":
23353
+ this._saveContext("<<", this._graph, null, null, null);
23354
+ this._graph = null;
23355
+ next4 = this._readSubject;
23356
+ break;
23287
23357
  default:
23288
23358
  if ((item4 = this._readEntity(token2)) === void 0)
23289
23359
  return;
23290
23360
  }
23291
23361
  if (list === null)
23292
23362
  this._subject = list = this._factory.blankNode();
23363
+ if (token2.type === "<<")
23364
+ stack[stack.length - 1].subject = this._subject;
23293
23365
  if (previousList === null) {
23294
23366
  if (parent4.predicate === null)
23295
23367
  parent4.subject = list;
@@ -23317,43 +23389,73 @@ var N3Parser = class {
23317
23389
  return this._completeObjectLiteral(token2, true);
23318
23390
  }
23319
23391
  // ### `_completeLiteral` completes a literal with an optional datatype or language
23320
- _completeLiteral(token2) {
23392
+ _completeLiteral(token2, component2) {
23321
23393
  let literal4 = this._factory.literal(this._literalValue);
23394
+ let readCb;
23322
23395
  switch (token2.type) {
23323
23396
  // Create a datatyped literal
23324
23397
  case "type":
23325
23398
  case "typeIRI":
23326
23399
  const datatype3 = this._readEntity(token2);
23327
23400
  if (datatype3 === void 0) return;
23401
+ if (datatype3.value === IRIs_default.rdf.langString || datatype3.value === IRIs_default.rdf.dirLangString) {
23402
+ return this._error("Detected illegal (directional) languaged-tagged string with explicit datatype", token2);
23403
+ }
23328
23404
  literal4 = this._factory.literal(this._literalValue, datatype3);
23329
23405
  token2 = null;
23330
23406
  break;
23331
23407
  // Create a language-tagged string
23332
23408
  case "langcode":
23409
+ if (token2.value.split("-").some((t) => t.length > 8))
23410
+ return this._error("Detected language tag with subtag longer than 8 characters", token2);
23333
23411
  literal4 = this._factory.literal(this._literalValue, token2.value);
23412
+ this._literalLanguage = token2.value;
23334
23413
  token2 = null;
23414
+ readCb = this._readDirCode.bind(this, component2);
23335
23415
  break;
23336
23416
  }
23337
- return { token: token2, literal: literal4 };
23417
+ return { token: token2, literal: literal4, readCb };
23418
+ }
23419
+ _readDirCode(component2, listItem, token2) {
23420
+ if (token2.type === "dircode") {
23421
+ const term3 = this._factory.literal(this._literalValue, { language: this._literalLanguage, direction: token2.value });
23422
+ if (component2 === "subject")
23423
+ this._subject = term3;
23424
+ else
23425
+ this._object = term3;
23426
+ this._literalLanguage = void 0;
23427
+ token2 = null;
23428
+ }
23429
+ if (component2 === "subject")
23430
+ return token2 === null ? this._readPredicateOrNamedGraph : this._readPredicateOrNamedGraph(token2);
23431
+ return this._completeObjectLiteralPost(token2, listItem);
23338
23432
  }
23339
23433
  // Completes a literal in subject position
23340
23434
  _completeSubjectLiteral(token2) {
23341
- this._subject = this._completeLiteral(token2).literal;
23435
+ const completed2 = this._completeLiteral(token2, "subject");
23436
+ this._subject = completed2.literal;
23437
+ if (completed2.readCb)
23438
+ return completed2.readCb.bind(this, false);
23342
23439
  return this._readPredicateOrNamedGraph;
23343
23440
  }
23344
23441
  // Completes a literal in object position
23345
23442
  _completeObjectLiteral(token2, listItem) {
23346
- const completed2 = this._completeLiteral(token2);
23443
+ const completed2 = this._completeLiteral(token2, "object");
23347
23444
  if (!completed2)
23348
23445
  return;
23349
23446
  this._object = completed2.literal;
23447
+ if (completed2.readCb)
23448
+ return completed2.readCb.bind(this, listItem);
23449
+ return this._completeObjectLiteralPost(completed2.token, listItem);
23450
+ }
23451
+ _completeObjectLiteralPost(token2, listItem) {
23350
23452
  if (listItem)
23351
23453
  this._emit(this._subject, this.RDF_FIRST, this._object, this._graph);
23352
- if (completed2.token === null)
23454
+ if (token2 === null)
23353
23455
  return this._getContextEndReader();
23354
23456
  else {
23355
23457
  this._readCallback = this._getContextEndReader();
23356
- return this._readCallback(completed2.token);
23458
+ return this._readCallback(token2);
23357
23459
  }
23358
23460
  }
23359
23461
  // ### `_readFormulaTail` reads the end of a formula
@@ -23367,7 +23469,7 @@ var N3Parser = class {
23367
23469
  }
23368
23470
  // ### `_readPunctuation` reads punctuation between quads or quad parts
23369
23471
  _readPunctuation(token2) {
23370
- let next4, graph3 = this._graph;
23472
+ let next4, graph3 = this._graph, startingAnnotation = false;
23371
23473
  const subject8 = this._subject, inversePredicate = this._inversePredicate;
23372
23474
  switch (token2.type) {
23373
23475
  // A closing brace ends a graph
@@ -23380,6 +23482,7 @@ var N3Parser = class {
23380
23482
  // A dot just ends the statement, without sharing anything with the next
23381
23483
  case ".":
23382
23484
  this._subject = null;
23485
+ this._tripleTerm = null;
23383
23486
  next4 = this._contextStack.length ? this._readSubject : this._readInTopContext;
23384
23487
  if (inversePredicate) this._inversePredicate = false;
23385
23488
  break;
@@ -23391,19 +23494,26 @@ var N3Parser = class {
23391
23494
  case ",":
23392
23495
  next4 = this._readObject;
23393
23496
  break;
23497
+ // ~ is allowed in the annotation syntax
23498
+ case "~":
23499
+ next4 = this._readReifierInAnnotation;
23500
+ startingAnnotation = true;
23501
+ break;
23394
23502
  // {| means that the current triple is annotated with predicate-object pairs.
23395
23503
  case "{|":
23396
- if (!this._supportsRDFStar)
23397
- return this._error("Unexpected RDF-star syntax", token2);
23398
- const predicate4 = this._predicate, object8 = this._object;
23399
- this._subject = this._factory.quad(subject8, predicate4, object8, this.DEFAULTGRAPH);
23504
+ this._subject = this._readTripleTerm();
23505
+ this._validAnnotation = false;
23506
+ startingAnnotation = true;
23400
23507
  next4 = this._readPredicate;
23401
23508
  break;
23402
- // |} means that the current quoted triple in annotation syntax is finalized.
23509
+ // |} means that the current reified triple in annotation syntax is finalized.
23403
23510
  case "|}":
23404
- if (this._subject.termType !== "Quad")
23405
- return this._error("Unexpected asserted triple closing", token2);
23511
+ if (!this._annotation)
23512
+ return this._error("Unexpected annotation syntax closing", token2);
23513
+ if (!this._validAnnotation)
23514
+ return this._error("Annotation block can not be empty", token2);
23406
23515
  this._subject = null;
23516
+ this._annotation = false;
23407
23517
  next4 = this._readPunctuation;
23408
23518
  break;
23409
23519
  default:
@@ -23413,13 +23523,16 @@ var N3Parser = class {
23413
23523
  }
23414
23524
  return this._error(`Expected punctuation to follow "${this._object.id}"`, token2);
23415
23525
  }
23416
- if (subject8 !== null) {
23526
+ if (subject8 !== null && (!startingAnnotation || startingAnnotation && !this._annotation)) {
23417
23527
  const predicate4 = this._predicate, object8 = this._object;
23418
23528
  if (!inversePredicate)
23419
23529
  this._emit(subject8, predicate4, object8, graph3);
23420
23530
  else
23421
23531
  this._emit(object8, predicate4, subject8, graph3);
23422
23532
  }
23533
+ if (startingAnnotation) {
23534
+ this._annotation = true;
23535
+ }
23423
23536
  return next4;
23424
23537
  }
23425
23538
  // ### `_readBlankNodePunctuation` reads punctuation in a blank node
@@ -23470,6 +23583,21 @@ var N3Parser = class {
23470
23583
  this._setBase(iri);
23471
23584
  return this._readDeclarationPunctuation;
23472
23585
  }
23586
+ // ### `_isValidVersion` checks if the given version is valid for this parser to handle.
23587
+ _isValidVersion(version6) {
23588
+ return this._parseUnsupportedVersions || _N3Parser.SUPPORTED_VERSIONS.includes(version6);
23589
+ }
23590
+ // ### `_readVersion` reads version string declaration
23591
+ _readVersion(token2) {
23592
+ if (token2.type !== "literal")
23593
+ return this._error("Expected literal to follow version declaration", token2);
23594
+ if (token2.end - token2.start !== token2.value.length + 2)
23595
+ return this._error("Version declarations must use single quotes", token2);
23596
+ this._versionCallback(token2.value);
23597
+ if (!this._isValidVersion(token2.value))
23598
+ return this._error(`Detected unsupported version: "${token2.value}"`, token2);
23599
+ return this._readDeclarationPunctuation;
23600
+ }
23473
23601
  // ### `_readNamedGraphLabel` reads the label of a named graph
23474
23602
  _readNamedGraphLabel(token2) {
23475
23603
  switch (token2.type) {
@@ -23596,26 +23724,17 @@ var N3Parser = class {
23596
23724
  this._emit(subject8, predicate4, object8, this._graph);
23597
23725
  return this._readPath;
23598
23726
  }
23599
- // ### `_readRDFStarTailOrGraph` reads the graph of a nested RDF-star quad or the end of a nested RDF-star triple
23600
- _readRDFStarTailOrGraph(token2) {
23601
- if (token2.type !== ">>") {
23602
- if (this._supportsQuads && this._graph === null && (this._graph = this._readEntity(token2)) !== void 0)
23603
- return this._readRDFStarTail;
23604
- return this._error(`Expected >> to follow "${this._object.id}"`, token2);
23605
- }
23606
- return this._readRDFStarTail(token2);
23607
- }
23608
- // ### `_readRDFStarTail` reads the end of a nested RDF-star triple
23609
- _readRDFStarTail(token2) {
23610
- if (token2.type !== ">>")
23611
- return this._error(`Expected >> but got ${token2.type}`, token2);
23727
+ // ### `_readTripleTermTail` reads the end of a triple term
23728
+ _readTripleTermTail(token2) {
23729
+ if (token2.type !== ")>>")
23730
+ return this._error(`Expected )>> but got ${token2.type}`, token2);
23612
23731
  const quad3 = this._factory.quad(
23613
23732
  this._subject,
23614
23733
  this._predicate,
23615
23734
  this._object,
23616
23735
  this._graph || this.DEFAULTGRAPH
23617
23736
  );
23618
- this._restoreContext("<<", token2);
23737
+ this._restoreContext("<<(", token2);
23619
23738
  if (this._subject === null) {
23620
23739
  this._subject = quad3;
23621
23740
  return this._readPredicate;
@@ -23624,6 +23743,63 @@ var N3Parser = class {
23624
23743
  return this._getContextEndReader();
23625
23744
  }
23626
23745
  }
23746
+ // ### `_readReifiedTripleTailOrReifier` reads a reifier or the end of a nested reified triple
23747
+ _readReifiedTripleTailOrReifier(token2) {
23748
+ if (token2.type === "~") {
23749
+ return this._readReifier;
23750
+ }
23751
+ return this._readReifiedTripleTail(token2);
23752
+ }
23753
+ // ### `_readReifiedTripleTail` reads the end of a nested reified triple
23754
+ _readReifiedTripleTail(token2) {
23755
+ if (token2.type !== ">>")
23756
+ return this._error(`Expected >> but got ${token2.type}`, token2);
23757
+ this._tripleTerm = null;
23758
+ const reifier = this._readTripleTerm();
23759
+ this._restoreContext("<<", token2);
23760
+ const stack = this._contextStack, parent4 = stack.length && stack[stack.length - 1];
23761
+ if (parent4 && parent4.type === "list") {
23762
+ this._emit(this._subject, this.RDF_FIRST, reifier, this._graph);
23763
+ return this._getContextEndReader();
23764
+ } else if (this._subject === null) {
23765
+ this._subject = reifier;
23766
+ return this._readPredicateOrReifierTripleEnd;
23767
+ } else {
23768
+ this._object = reifier;
23769
+ return this._getContextEndReader();
23770
+ }
23771
+ }
23772
+ _readPredicateOrReifierTripleEnd(token2) {
23773
+ if (token2.type === ".") {
23774
+ this._subject = null;
23775
+ return this._readPunctuation(token2);
23776
+ }
23777
+ return this._readPredicate(token2);
23778
+ }
23779
+ // ### `_readReifier` reads the triple term identifier after a tilde when in a reifying triple.
23780
+ _readReifier(token2) {
23781
+ this._reifier = this._readEntity(token2);
23782
+ return this._readReifiedTripleTail;
23783
+ }
23784
+ // ### `_readReifier` reads the optional triple term identifier after a tilde when in annotation syntax.
23785
+ _readReifierInAnnotation(token2) {
23786
+ if (token2.type === "IRI" || token2.type === "typeIRI" || token2.type === "type" || token2.type === "prefixed" || token2.type === "blank" || token2.type === "var") {
23787
+ this._reifier = this._readEntity(token2);
23788
+ return this._readPunctuation;
23789
+ }
23790
+ this._readTripleTerm();
23791
+ this._subject = null;
23792
+ return this._readPunctuation(token2);
23793
+ }
23794
+ _readTripleTerm() {
23795
+ const stack = this._contextStack, parent4 = stack.length && stack[stack.length - 1];
23796
+ const parentGraph = parent4 ? parent4.graph : void 0;
23797
+ const reifier = this._reifier || this._factory.blankNode();
23798
+ this._reifier = null;
23799
+ this._tripleTerm = this._tripleTerm || this._factory.quad(this._subject, this._predicate, this._object);
23800
+ this._emit(reifier, this.RDF_REIFIES, this._tripleTerm, parentGraph || this.DEFAULTGRAPH);
23801
+ return reifier;
23802
+ }
23627
23803
  // ### `_getContextEndReader` gets the next reader function at the end of a context
23628
23804
  _getContextEndReader() {
23629
23805
  const contextStack = this._contextStack;
@@ -23636,8 +23812,10 @@ var N3Parser = class {
23636
23812
  return this._readListItem;
23637
23813
  case "formula":
23638
23814
  return this._readFormulaTail;
23815
+ case "<<(":
23816
+ return this._readTripleTermTail;
23639
23817
  case "<<":
23640
- return this._readRDFStarTailOrGraph;
23818
+ return this._readReifiedTripleTailOrReifier;
23641
23819
  }
23642
23820
  }
23643
23821
  // ### `_emit` sends a quad through the callback
@@ -23735,21 +23913,24 @@ var N3Parser = class {
23735
23913
  }
23736
23914
  // ## Public methods
23737
23915
  // ### `parse` parses the N3 input and emits each parsed quad through the onQuad callback.
23738
- parse(input2, quadCallback, prefixCallback) {
23739
- let onQuad, onPrefix, onComment;
23740
- if (quadCallback && (quadCallback.onQuad || quadCallback.onPrefix || quadCallback.onComment)) {
23916
+ parse(input2, quadCallback, prefixCallback, versionCallback) {
23917
+ let onQuad, onPrefix, onComment, onVersion;
23918
+ if (quadCallback && (quadCallback.onQuad || quadCallback.onPrefix || quadCallback.onComment || quadCallback.onVersion)) {
23741
23919
  onQuad = quadCallback.onQuad;
23742
23920
  onPrefix = quadCallback.onPrefix;
23743
23921
  onComment = quadCallback.onComment;
23922
+ onVersion = quadCallback.onVersion;
23744
23923
  } else {
23745
23924
  onQuad = quadCallback;
23746
23925
  onPrefix = prefixCallback;
23926
+ onVersion = versionCallback;
23747
23927
  }
23748
- this._readCallback = this._readInTopContext;
23928
+ this._readCallback = this._readBeforeTopContext;
23749
23929
  this._sparqlStyle = false;
23750
23930
  this._prefixes = /* @__PURE__ */ Object.create(null);
23751
23931
  this._prefixes._ = this._blankNodePrefix ? this._blankNodePrefix.substr(2) : `b${blankNodePrefix++}_`;
23752
23932
  this._prefixCallback = onPrefix || noop2;
23933
+ this._versionCallback = onVersion || noop2;
23753
23934
  this._inversePredicate = false;
23754
23935
  this._quantified = /* @__PURE__ */ Object.create(null);
23755
23936
  if (!onQuad) {
@@ -23795,6 +23976,7 @@ function initDataFactory(parser, factory) {
23795
23976
  parser.RDF_FIRST = factory.namedNode(IRIs_default.rdf.first);
23796
23977
  parser.RDF_REST = factory.namedNode(IRIs_default.rdf.rest);
23797
23978
  parser.RDF_NIL = factory.namedNode(IRIs_default.rdf.nil);
23979
+ parser.RDF_REIFIES = factory.namedNode(IRIs_default.rdf.reifies);
23798
23980
  parser.N3_FORALL = factory.namedNode(IRIs_default.r.forAll);
23799
23981
  parser.N3_FORSOME = factory.namedNode(IRIs_default.r.forSome);
23800
23982
  parser.ABBREVIATIONS = {
@@ -23805,6 +23987,11 @@ function initDataFactory(parser, factory) {
23805
23987
  };
23806
23988
  parser.QUANTIFIERS_GRAPH = factory.namedNode("urn:n3:quantifiers");
23807
23989
  }
23990
+ N3Parser.SUPPORTED_VERSIONS = [
23991
+ "1.2",
23992
+ "1.2-basic",
23993
+ "1.1"
23994
+ ];
23808
23995
  initDataFactory(N3Parser.prototype, N3DataFactory_default);
23809
23996
 
23810
23997
  // node_modules/rdflib/esm/rdfaparser.js
@@ -27939,9 +28126,6 @@ var Thing = class {
27939
28126
  var LdpContainer = class extends Thing {
27940
28127
  constructor(uri6, store, editable = false) {
27941
28128
  super(uri6, store, editable);
27942
- this.uri = uri6;
27943
- this.store = store;
27944
- this.editable = editable;
27945
28129
  }
27946
28130
  /**
27947
28131
  * Resources that the LDP Container contains
@@ -28079,8 +28263,6 @@ var WebIdProfile = class extends Thing {
28079
28263
  constructor(webId, store, editable = false) {
28080
28264
  super(webId, store, editable);
28081
28265
  this.webId = webId;
28082
- this.store = store;
28083
- this.editable = editable;
28084
28266
  this.profileQuery = this.store.profileQuery(this.webId);
28085
28267
  }
28086
28268
  /**
@@ -28221,9 +28403,6 @@ var SearchIndex = class {
28221
28403
  var RdfDocument = class extends Thing {
28222
28404
  constructor(uri6, store, editable = false) {
28223
28405
  super(uri6, store, editable);
28224
- this.uri = uri6;
28225
- this.store = store;
28226
- this.editable = editable;
28227
28406
  }
28228
28407
  subjects() {
28229
28408
  const matches = this.store.statementsMatching(
@@ -28245,9 +28424,6 @@ var RdfDocument = class extends Thing {
28245
28424
  var LabelIndex = class extends RdfDocument {
28246
28425
  constructor(uri6, store, editable = false) {
28247
28426
  super(uri6, store, editable);
28248
- this.uri = uri6;
28249
- this.store = store;
28250
- this.editable = editable;
28251
28427
  }
28252
28428
  /**
28253
28429
  * Returns the URIs and labels for all the things listed in the document.
@@ -50084,8 +50260,6 @@ function listKnownTerms() {
50084
50260
  // src/uri/UriService.ts
50085
50261
  var import_slugify = __toESM(require_slugify(), 1);
50086
50262
  var UriService = class {
50087
- // We expect to use the store for calculating the uris for things
50088
- // e.g. looking up locations in type index
50089
50263
  constructor(store) {
50090
50264
  this.store = store;
50091
50265
  }
@@ -50288,9 +50462,6 @@ function proposeAppsFor(thing) {
50288
50462
  var TypeIndex2 = class extends Thing {
50289
50463
  constructor(uri6, store, editable = false) {
50290
50464
  super(uri6, store, editable);
50291
- this.uri = uri6;
50292
- this.store = store;
50293
- this.editable = editable;
50294
50465
  }
50295
50466
  listAll() {
50296
50467
  const forClassStatements = this.store.statementsMatching(