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