@openhps/rdf 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.serialization.d.ts +1 -0
- package/dist/cjs/index.serialization.js +14 -0
- package/dist/cjs/index.serialization.js.map +1 -1
- package/dist/cjs/rdf/InternalRDFSerializer.js +7 -1
- package/dist/cjs/rdf/InternalRDFSerializer.js.map +1 -1
- package/dist/esm/index.serialization.d.ts +1 -0
- package/dist/esm/index.serialization.js +2 -0
- package/dist/esm/index.serialization.js.map +1 -1
- package/dist/esm/rdf/InternalRDFSerializer.js +7 -1
- package/dist/esm/rdf/InternalRDFSerializer.js.map +1 -1
- package/dist/types/index.serialization.d.ts +1 -0
- package/dist/web/openhps-rdf.all.es.js +14 -2
- package/dist/web/openhps-rdf.all.es.js.map +1 -1
- package/dist/web/openhps-rdf.all.es.min.js +1 -1
- package/dist/web/openhps-rdf.all.es.min.js.map +1 -1
- package/dist/web/openhps-rdf.all.js +12 -1
- package/dist/web/openhps-rdf.all.js.map +1 -1
- package/dist/web/openhps-rdf.all.min.js +1 -1
- package/dist/web/openhps-rdf.all.min.js.map +1 -1
- package/dist/web/openhps-rdf.serialization.es.js +1816 -5
- package/dist/web/openhps-rdf.serialization.es.js.map +1 -1
- package/dist/web/openhps-rdf.serialization.es.min.js +1 -1
- package/dist/web/openhps-rdf.serialization.es.min.js.LICENSE.txt +2 -0
- package/dist/web/openhps-rdf.serialization.es.min.js.map +1 -1
- package/dist/web/openhps-rdf.serialization.js +1819 -4
- package/dist/web/openhps-rdf.serialization.js.map +1 -1
- package/dist/web/openhps-rdf.serialization.min.js +1 -1
- package/dist/web/openhps-rdf.serialization.min.js.LICENSE.txt +2 -0
- package/dist/web/openhps-rdf.serialization.min.js.map +1 -1
- package/dist/web/openhps-rdf.sparql.es.js +7 -1
- package/dist/web/openhps-rdf.sparql.es.js.map +1 -1
- package/dist/web/openhps-rdf.sparql.es.min.js +1 -1
- package/dist/web/openhps-rdf.sparql.es.min.js.map +1 -1
- package/dist/web/openhps-rdf.sparql.js +7 -1
- package/dist/web/openhps-rdf.sparql.js.map +1 -1
- package/dist/web/openhps-rdf.sparql.min.js +1 -1
- package/dist/web/openhps-rdf.sparql.min.js.map +1 -1
- package/package.json +1 -1
- package/src/index.serialization.ts +1 -0
- package/src/rdf/InternalRDFSerializer.ts +8 -1
|
@@ -270,7 +270,7 @@ class InternalRDFSerializer extends _openhps_core__WEBPACK_IMPORTED_MODULE_0__.S
|
|
|
270
270
|
[Set, this.serializeSet.bind(this)],
|
|
271
271
|
]);
|
|
272
272
|
}
|
|
273
|
-
convertSingleValue(sourceObject, typeDescriptor, memberName, memberOptions, serializerOptions) {
|
|
273
|
+
convertSingleValue(sourceObject, typeDescriptor, memberName, memberOptions, serializerOptions = {}) {
|
|
274
274
|
if (this.retrievePreserveNull(memberOptions) && sourceObject === null) {
|
|
275
275
|
return null;
|
|
276
276
|
}
|
|
@@ -346,6 +346,12 @@ class InternalRDFSerializer extends _openhps_core__WEBPACK_IMPORTED_MODULE_0__.S
|
|
|
346
346
|
thing = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.mergeDeep)(thing, options.serializer(sourceObject, serializerOptions.rdf.baseUri));
|
|
347
347
|
}
|
|
348
348
|
thing.termType = thing.value.startsWith('http') ? 'NamedNode' : 'BlankNode';
|
|
349
|
+
if (serializerOptions.root === undefined) {
|
|
350
|
+
serializerOptions.root = thing;
|
|
351
|
+
}
|
|
352
|
+
else if (serializerOptions.root.value === thing.value) {
|
|
353
|
+
return undefined;
|
|
354
|
+
}
|
|
349
355
|
metadata.dataMembers.forEach((member) => {
|
|
350
356
|
const rootMember = rootMetadata.dataMembers.get(member.key);
|
|
351
357
|
const memberOptions = member.options && member.options.rdf
|
|
@@ -15260,14 +15266,18 @@ const RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
|
|
|
15260
15266
|
|
|
15261
15267
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
15262
15268
|
/* harmony export */ "BlankNode": () => (/* binding */ BlankNode),
|
|
15269
|
+
/* harmony export */ "DefaultGraph": () => (/* binding */ DefaultGraph),
|
|
15263
15270
|
/* harmony export */ "Literal": () => (/* binding */ Literal),
|
|
15264
15271
|
/* harmony export */ "NamedNode": () => (/* binding */ NamedNode),
|
|
15272
|
+
/* harmony export */ "Quad": () => (/* binding */ Quad),
|
|
15265
15273
|
/* harmony export */ "Term": () => (/* binding */ Term),
|
|
15274
|
+
/* harmony export */ "Triple": () => (/* binding */ Quad),
|
|
15275
|
+
/* harmony export */ "Variable": () => (/* binding */ Variable),
|
|
15266
15276
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
15267
15277
|
/* harmony export */ "termFromId": () => (/* binding */ termFromId),
|
|
15268
15278
|
/* harmony export */ "termToId": () => (/* binding */ termToId)
|
|
15269
15279
|
/* harmony export */ });
|
|
15270
|
-
/* unused harmony exports
|
|
15280
|
+
/* unused harmony exports escapeQuotes, unescapeQuotes */
|
|
15271
15281
|
/* harmony import */ var _IRIs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./IRIs */ "./node_modules/n3/src/IRIs.js");
|
|
15272
15282
|
/* harmony import */ var _N3Util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./N3Util */ "./node_modules/n3/src/N3Util.js");
|
|
15273
15283
|
// N3.js implementations of the RDF/JS core data types
|
|
@@ -15653,6 +15663,1598 @@ function quad(subject, predicate, object, graph) {
|
|
|
15653
15663
|
}
|
|
15654
15664
|
|
|
15655
15665
|
|
|
15666
|
+
/***/ }),
|
|
15667
|
+
|
|
15668
|
+
/***/ "./node_modules/n3/src/N3Lexer.js":
|
|
15669
|
+
/*!****************************************!*\
|
|
15670
|
+
!*** ./node_modules/n3/src/N3Lexer.js ***!
|
|
15671
|
+
\****************************************/
|
|
15672
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
15673
|
+
|
|
15674
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
15675
|
+
/* harmony export */ "default": () => (/* binding */ N3Lexer)
|
|
15676
|
+
/* harmony export */ });
|
|
15677
|
+
/* harmony import */ var _IRIs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./IRIs */ "./node_modules/n3/src/IRIs.js");
|
|
15678
|
+
/* harmony import */ var queue_microtask__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! queue-microtask */ "./node_modules/queue-microtask/index.js");
|
|
15679
|
+
/* harmony import */ var queue_microtask__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(queue_microtask__WEBPACK_IMPORTED_MODULE_0__);
|
|
15680
|
+
// **N3Lexer** tokenizes N3 documents.
|
|
15681
|
+
|
|
15682
|
+
|
|
15683
|
+
|
|
15684
|
+
const { xsd } = _IRIs__WEBPACK_IMPORTED_MODULE_1__["default"];
|
|
15685
|
+
|
|
15686
|
+
// Regular expression and replacement string to escape N3 strings
|
|
15687
|
+
const escapeSequence = /\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g;
|
|
15688
|
+
const escapeReplacements = {
|
|
15689
|
+
'\\': '\\', "'": "'", '"': '"',
|
|
15690
|
+
'n': '\n', 'r': '\r', 't': '\t', 'f': '\f', 'b': '\b',
|
|
15691
|
+
'_': '_', '~': '~', '.': '.', '-': '-', '!': '!', '$': '$', '&': '&',
|
|
15692
|
+
'(': '(', ')': ')', '*': '*', '+': '+', ',': ',', ';': ';', '=': '=',
|
|
15693
|
+
'/': '/', '?': '?', '#': '#', '@': '@', '%': '%',
|
|
15694
|
+
};
|
|
15695
|
+
const illegalIriChars = /[\x00-\x20<>\\"\{\}\|\^\`]/;
|
|
15696
|
+
|
|
15697
|
+
const lineModeRegExps = {
|
|
15698
|
+
_iri: true,
|
|
15699
|
+
_unescapedIri: true,
|
|
15700
|
+
_simpleQuotedString: true,
|
|
15701
|
+
_langcode: true,
|
|
15702
|
+
_blank: true,
|
|
15703
|
+
_newline: true,
|
|
15704
|
+
_comment: true,
|
|
15705
|
+
_whitespace: true,
|
|
15706
|
+
_endOfFile: true,
|
|
15707
|
+
};
|
|
15708
|
+
const invalidRegExp = /$0^/;
|
|
15709
|
+
|
|
15710
|
+
// ## Constructor
|
|
15711
|
+
class N3Lexer {
|
|
15712
|
+
constructor(options) {
|
|
15713
|
+
// ## Regular expressions
|
|
15714
|
+
// It's slightly faster to have these as properties than as in-scope variables
|
|
15715
|
+
this._iri = /^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/; // IRI with escape sequences; needs sanity check after unescaping
|
|
15716
|
+
this._unescapedIri = /^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/; // IRI without escape sequences; no unescaping
|
|
15717
|
+
this._simpleQuotedString = /^"([^"\\\r\n]*)"(?=[^"])/; // string without escape sequences
|
|
15718
|
+
this._simpleApostropheString = /^'([^'\\\r\n]*)'(?=[^'])/;
|
|
15719
|
+
this._langcode = /^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i;
|
|
15720
|
+
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<])/;
|
|
15721
|
+
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#()\[\]\{\}"'<>]))/;
|
|
15722
|
+
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#()\[\]\{\}"'<>])/;
|
|
15723
|
+
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#()\[\]\{\}"'<>]))/;
|
|
15724
|
+
this._number = /^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/;
|
|
15725
|
+
this._boolean = /^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/;
|
|
15726
|
+
this._keyword = /^@[a-z]+(?=[\s#<:])/i;
|
|
15727
|
+
this._sparqlKeyword = /^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i;
|
|
15728
|
+
this._shortPredicates = /^a(?=[\s#()\[\]\{\}"'<>])/;
|
|
15729
|
+
this._newline = /^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/;
|
|
15730
|
+
this._comment = /#([^\n\r]*)/;
|
|
15731
|
+
this._whitespace = /^[ \t]+/;
|
|
15732
|
+
this._endOfFile = /^(?:#[^\n\r]*)?$/;
|
|
15733
|
+
options = options || {};
|
|
15734
|
+
|
|
15735
|
+
// In line mode (N-Triples or N-Quads), only simple features may be parsed
|
|
15736
|
+
if (this._lineMode = !!options.lineMode) {
|
|
15737
|
+
this._n3Mode = false;
|
|
15738
|
+
// Don't tokenize special literals
|
|
15739
|
+
for (const key in this) {
|
|
15740
|
+
if (!(key in lineModeRegExps) && this[key] instanceof RegExp)
|
|
15741
|
+
this[key] = invalidRegExp;
|
|
15742
|
+
}
|
|
15743
|
+
}
|
|
15744
|
+
// When not in line mode, enable N3 functionality by default
|
|
15745
|
+
else {
|
|
15746
|
+
this._n3Mode = options.n3 !== false;
|
|
15747
|
+
}
|
|
15748
|
+
// Don't output comment tokens by default
|
|
15749
|
+
this._comments = !!options.comments;
|
|
15750
|
+
// Cache the last tested closing position of long literals
|
|
15751
|
+
this._literalClosingPos = 0;
|
|
15752
|
+
}
|
|
15753
|
+
|
|
15754
|
+
// ## Private methods
|
|
15755
|
+
|
|
15756
|
+
// ### `_tokenizeToEnd` tokenizes as for as possible, emitting tokens through the callback
|
|
15757
|
+
_tokenizeToEnd(callback, inputFinished) {
|
|
15758
|
+
// Continue parsing as far as possible; the loop will return eventually
|
|
15759
|
+
let input = this._input;
|
|
15760
|
+
let currentLineLength = input.length;
|
|
15761
|
+
while (true) {
|
|
15762
|
+
// Count and skip whitespace lines
|
|
15763
|
+
let whiteSpaceMatch, comment;
|
|
15764
|
+
while (whiteSpaceMatch = this._newline.exec(input)) {
|
|
15765
|
+
// Try to find a comment
|
|
15766
|
+
if (this._comments && (comment = this._comment.exec(whiteSpaceMatch[0])))
|
|
15767
|
+
emitToken('comment', comment[1], '', this._line, whiteSpaceMatch[0].length);
|
|
15768
|
+
// Advance the input
|
|
15769
|
+
input = input.substr(whiteSpaceMatch[0].length, input.length);
|
|
15770
|
+
currentLineLength = input.length;
|
|
15771
|
+
this._line++;
|
|
15772
|
+
}
|
|
15773
|
+
// Skip whitespace on current line
|
|
15774
|
+
if (!whiteSpaceMatch && (whiteSpaceMatch = this._whitespace.exec(input)))
|
|
15775
|
+
input = input.substr(whiteSpaceMatch[0].length, input.length);
|
|
15776
|
+
|
|
15777
|
+
// Stop for now if we're at the end
|
|
15778
|
+
if (this._endOfFile.test(input)) {
|
|
15779
|
+
// If the input is finished, emit EOF
|
|
15780
|
+
if (inputFinished) {
|
|
15781
|
+
// Try to find a final comment
|
|
15782
|
+
if (this._comments && (comment = this._comment.exec(input)))
|
|
15783
|
+
emitToken('comment', comment[1], '', this._line, input.length);
|
|
15784
|
+
input = null;
|
|
15785
|
+
emitToken('eof', '', '', this._line, 0);
|
|
15786
|
+
}
|
|
15787
|
+
return this._input = input;
|
|
15788
|
+
}
|
|
15789
|
+
|
|
15790
|
+
// Look for specific token types based on the first character
|
|
15791
|
+
const line = this._line, firstChar = input[0];
|
|
15792
|
+
let type = '', value = '', prefix = '',
|
|
15793
|
+
match = null, matchLength = 0, inconclusive = false;
|
|
15794
|
+
switch (firstChar) {
|
|
15795
|
+
case '^':
|
|
15796
|
+
// We need at least 3 tokens lookahead to distinguish ^^<IRI> and ^^pre:fixed
|
|
15797
|
+
if (input.length < 3)
|
|
15798
|
+
break;
|
|
15799
|
+
// Try to match a type
|
|
15800
|
+
else if (input[1] === '^') {
|
|
15801
|
+
this._previousMarker = '^^';
|
|
15802
|
+
// Move to type IRI or prefixed name
|
|
15803
|
+
input = input.substr(2);
|
|
15804
|
+
if (input[0] !== '<') {
|
|
15805
|
+
inconclusive = true;
|
|
15806
|
+
break;
|
|
15807
|
+
}
|
|
15808
|
+
}
|
|
15809
|
+
// If no type, it must be a path expression
|
|
15810
|
+
else {
|
|
15811
|
+
if (this._n3Mode) {
|
|
15812
|
+
matchLength = 1;
|
|
15813
|
+
type = '^';
|
|
15814
|
+
}
|
|
15815
|
+
break;
|
|
15816
|
+
}
|
|
15817
|
+
// Fall through in case the type is an IRI
|
|
15818
|
+
case '<':
|
|
15819
|
+
// Try to find a full IRI without escape sequences
|
|
15820
|
+
if (match = this._unescapedIri.exec(input))
|
|
15821
|
+
type = 'IRI', value = match[1];
|
|
15822
|
+
// Try to find a full IRI with escape sequences
|
|
15823
|
+
else if (match = this._iri.exec(input)) {
|
|
15824
|
+
value = this._unescape(match[1]);
|
|
15825
|
+
if (value === null || illegalIriChars.test(value))
|
|
15826
|
+
return reportSyntaxError(this);
|
|
15827
|
+
type = 'IRI';
|
|
15828
|
+
}
|
|
15829
|
+
// Try to find a nested triple
|
|
15830
|
+
else if (input.length > 1 && input[1] === '<')
|
|
15831
|
+
type = '<<', matchLength = 2;
|
|
15832
|
+
// Try to find a backwards implication arrow
|
|
15833
|
+
else if (this._n3Mode && input.length > 1 && input[1] === '=')
|
|
15834
|
+
type = 'inverse', matchLength = 2, value = '>';
|
|
15835
|
+
break;
|
|
15836
|
+
|
|
15837
|
+
case '>':
|
|
15838
|
+
if (input.length > 1 && input[1] === '>')
|
|
15839
|
+
type = '>>', matchLength = 2;
|
|
15840
|
+
break;
|
|
15841
|
+
|
|
15842
|
+
case '_':
|
|
15843
|
+
// Try to find a blank node. Since it can contain (but not end with) a dot,
|
|
15844
|
+
// we always need a non-dot character before deciding it is a blank node.
|
|
15845
|
+
// Therefore, try inserting a space if we're at the end of the input.
|
|
15846
|
+
if ((match = this._blank.exec(input)) ||
|
|
15847
|
+
inputFinished && (match = this._blank.exec(`${input} `)))
|
|
15848
|
+
type = 'blank', prefix = '_', value = match[1];
|
|
15849
|
+
break;
|
|
15850
|
+
|
|
15851
|
+
case '"':
|
|
15852
|
+
// Try to find a literal without escape sequences
|
|
15853
|
+
if (match = this._simpleQuotedString.exec(input))
|
|
15854
|
+
value = match[1];
|
|
15855
|
+
// Try to find a literal wrapped in three pairs of quotes
|
|
15856
|
+
else {
|
|
15857
|
+
({ value, matchLength } = this._parseLiteral(input));
|
|
15858
|
+
if (value === null)
|
|
15859
|
+
return reportSyntaxError(this);
|
|
15860
|
+
}
|
|
15861
|
+
if (match !== null || matchLength !== 0) {
|
|
15862
|
+
type = 'literal';
|
|
15863
|
+
this._literalClosingPos = 0;
|
|
15864
|
+
}
|
|
15865
|
+
break;
|
|
15866
|
+
|
|
15867
|
+
case "'":
|
|
15868
|
+
if (!this._lineMode) {
|
|
15869
|
+
// Try to find a literal without escape sequences
|
|
15870
|
+
if (match = this._simpleApostropheString.exec(input))
|
|
15871
|
+
value = match[1];
|
|
15872
|
+
// Try to find a literal wrapped in three pairs of quotes
|
|
15873
|
+
else {
|
|
15874
|
+
({ value, matchLength } = this._parseLiteral(input));
|
|
15875
|
+
if (value === null)
|
|
15876
|
+
return reportSyntaxError(this);
|
|
15877
|
+
}
|
|
15878
|
+
if (match !== null || matchLength !== 0) {
|
|
15879
|
+
type = 'literal';
|
|
15880
|
+
this._literalClosingPos = 0;
|
|
15881
|
+
}
|
|
15882
|
+
}
|
|
15883
|
+
break;
|
|
15884
|
+
|
|
15885
|
+
case '?':
|
|
15886
|
+
// Try to find a variable
|
|
15887
|
+
if (this._n3Mode && (match = this._variable.exec(input)))
|
|
15888
|
+
type = 'var', value = match[0];
|
|
15889
|
+
break;
|
|
15890
|
+
|
|
15891
|
+
case '@':
|
|
15892
|
+
// Try to find a language code
|
|
15893
|
+
if (this._previousMarker === 'literal' && (match = this._langcode.exec(input)))
|
|
15894
|
+
type = 'langcode', value = match[1];
|
|
15895
|
+
// Try to find a keyword
|
|
15896
|
+
else if (match = this._keyword.exec(input))
|
|
15897
|
+
type = match[0];
|
|
15898
|
+
break;
|
|
15899
|
+
|
|
15900
|
+
case '.':
|
|
15901
|
+
// Try to find a dot as punctuation
|
|
15902
|
+
if (input.length === 1 ? inputFinished : (input[1] < '0' || input[1] > '9')) {
|
|
15903
|
+
type = '.';
|
|
15904
|
+
matchLength = 1;
|
|
15905
|
+
break;
|
|
15906
|
+
}
|
|
15907
|
+
// Fall through to numerical case (could be a decimal dot)
|
|
15908
|
+
|
|
15909
|
+
case '0':
|
|
15910
|
+
case '1':
|
|
15911
|
+
case '2':
|
|
15912
|
+
case '3':
|
|
15913
|
+
case '4':
|
|
15914
|
+
case '5':
|
|
15915
|
+
case '6':
|
|
15916
|
+
case '7':
|
|
15917
|
+
case '8':
|
|
15918
|
+
case '9':
|
|
15919
|
+
case '+':
|
|
15920
|
+
case '-':
|
|
15921
|
+
// Try to find a number. Since it can contain (but not end with) a dot,
|
|
15922
|
+
// we always need a non-dot character before deciding it is a number.
|
|
15923
|
+
// Therefore, try inserting a space if we're at the end of the input.
|
|
15924
|
+
if (match = this._number.exec(input) ||
|
|
15925
|
+
inputFinished && (match = this._number.exec(`${input} `))) {
|
|
15926
|
+
type = 'literal', value = match[0];
|
|
15927
|
+
prefix = (typeof match[1] === 'string' ? xsd.double :
|
|
15928
|
+
(typeof match[2] === 'string' ? xsd.decimal : xsd.integer));
|
|
15929
|
+
}
|
|
15930
|
+
break;
|
|
15931
|
+
|
|
15932
|
+
case 'B':
|
|
15933
|
+
case 'b':
|
|
15934
|
+
case 'p':
|
|
15935
|
+
case 'P':
|
|
15936
|
+
case 'G':
|
|
15937
|
+
case 'g':
|
|
15938
|
+
// Try to find a SPARQL-style keyword
|
|
15939
|
+
if (match = this._sparqlKeyword.exec(input))
|
|
15940
|
+
type = match[0].toUpperCase();
|
|
15941
|
+
else
|
|
15942
|
+
inconclusive = true;
|
|
15943
|
+
break;
|
|
15944
|
+
|
|
15945
|
+
case 'f':
|
|
15946
|
+
case 't':
|
|
15947
|
+
// Try to match a boolean
|
|
15948
|
+
if (match = this._boolean.exec(input))
|
|
15949
|
+
type = 'literal', value = match[0], prefix = xsd.boolean;
|
|
15950
|
+
else
|
|
15951
|
+
inconclusive = true;
|
|
15952
|
+
break;
|
|
15953
|
+
|
|
15954
|
+
case 'a':
|
|
15955
|
+
// Try to find an abbreviated predicate
|
|
15956
|
+
if (match = this._shortPredicates.exec(input))
|
|
15957
|
+
type = 'abbreviation', value = 'a';
|
|
15958
|
+
else
|
|
15959
|
+
inconclusive = true;
|
|
15960
|
+
break;
|
|
15961
|
+
|
|
15962
|
+
case '=':
|
|
15963
|
+
// Try to find an implication arrow or equals sign
|
|
15964
|
+
if (this._n3Mode && input.length > 1) {
|
|
15965
|
+
type = 'abbreviation';
|
|
15966
|
+
if (input[1] !== '>')
|
|
15967
|
+
matchLength = 1, value = '=';
|
|
15968
|
+
else
|
|
15969
|
+
matchLength = 2, value = '>';
|
|
15970
|
+
}
|
|
15971
|
+
break;
|
|
15972
|
+
|
|
15973
|
+
case '!':
|
|
15974
|
+
if (!this._n3Mode)
|
|
15975
|
+
break;
|
|
15976
|
+
case ',':
|
|
15977
|
+
case ';':
|
|
15978
|
+
case '[':
|
|
15979
|
+
case ']':
|
|
15980
|
+
case '(':
|
|
15981
|
+
case ')':
|
|
15982
|
+
case '{':
|
|
15983
|
+
case '}':
|
|
15984
|
+
if (!this._lineMode) {
|
|
15985
|
+
matchLength = 1;
|
|
15986
|
+
type = firstChar;
|
|
15987
|
+
}
|
|
15988
|
+
break;
|
|
15989
|
+
|
|
15990
|
+
default:
|
|
15991
|
+
inconclusive = true;
|
|
15992
|
+
}
|
|
15993
|
+
|
|
15994
|
+
// Some first characters do not allow an immediate decision, so inspect more
|
|
15995
|
+
if (inconclusive) {
|
|
15996
|
+
// Try to find a prefix
|
|
15997
|
+
if ((this._previousMarker === '@prefix' || this._previousMarker === 'PREFIX') &&
|
|
15998
|
+
(match = this._prefix.exec(input)))
|
|
15999
|
+
type = 'prefix', value = match[1] || '';
|
|
16000
|
+
// Try to find a prefixed name. Since it can contain (but not end with) a dot,
|
|
16001
|
+
// we always need a non-dot character before deciding it is a prefixed name.
|
|
16002
|
+
// Therefore, try inserting a space if we're at the end of the input.
|
|
16003
|
+
else if ((match = this._prefixed.exec(input)) ||
|
|
16004
|
+
inputFinished && (match = this._prefixed.exec(`${input} `)))
|
|
16005
|
+
type = 'prefixed', prefix = match[1] || '', value = this._unescape(match[2]);
|
|
16006
|
+
}
|
|
16007
|
+
|
|
16008
|
+
// A type token is special: it can only be emitted after an IRI or prefixed name is read
|
|
16009
|
+
if (this._previousMarker === '^^') {
|
|
16010
|
+
switch (type) {
|
|
16011
|
+
case 'prefixed': type = 'type'; break;
|
|
16012
|
+
case 'IRI': type = 'typeIRI'; break;
|
|
16013
|
+
default: type = '';
|
|
16014
|
+
}
|
|
16015
|
+
}
|
|
16016
|
+
|
|
16017
|
+
// What if nothing of the above was found?
|
|
16018
|
+
if (!type) {
|
|
16019
|
+
// We could be in streaming mode, and then we just wait for more input to arrive.
|
|
16020
|
+
// Otherwise, a syntax error has occurred in the input.
|
|
16021
|
+
// One exception: error on an unaccounted linebreak (= not inside a triple-quoted literal).
|
|
16022
|
+
if (inputFinished || (!/^'''|^"""/.test(input) && /\n|\r/.test(input)))
|
|
16023
|
+
return reportSyntaxError(this);
|
|
16024
|
+
else
|
|
16025
|
+
return this._input = input;
|
|
16026
|
+
}
|
|
16027
|
+
|
|
16028
|
+
// Emit the parsed token
|
|
16029
|
+
const length = matchLength || match[0].length;
|
|
16030
|
+
const token = emitToken(type, value, prefix, line, length);
|
|
16031
|
+
this.previousToken = token;
|
|
16032
|
+
this._previousMarker = type;
|
|
16033
|
+
|
|
16034
|
+
// Advance to next part to tokenize
|
|
16035
|
+
input = input.substr(length, input.length);
|
|
16036
|
+
}
|
|
16037
|
+
|
|
16038
|
+
// Emits the token through the callback
|
|
16039
|
+
function emitToken(type, value, prefix, line, length) {
|
|
16040
|
+
const start = input ? currentLineLength - input.length : currentLineLength;
|
|
16041
|
+
const end = start + length;
|
|
16042
|
+
const token = { type, value, prefix, line, start, end };
|
|
16043
|
+
callback(null, token);
|
|
16044
|
+
return token;
|
|
16045
|
+
}
|
|
16046
|
+
// Signals the syntax error through the callback
|
|
16047
|
+
function reportSyntaxError(self) { callback(self._syntaxError(/^\S*/.exec(input)[0])); }
|
|
16048
|
+
}
|
|
16049
|
+
|
|
16050
|
+
// ### `_unescape` replaces N3 escape codes by their corresponding characters
|
|
16051
|
+
_unescape(item) {
|
|
16052
|
+
let invalid = false;
|
|
16053
|
+
const replaced = item.replace(escapeSequence, (sequence, unicode4, unicode8, escapedChar) => {
|
|
16054
|
+
// 4-digit unicode character
|
|
16055
|
+
if (typeof unicode4 === 'string')
|
|
16056
|
+
return String.fromCharCode(Number.parseInt(unicode4, 16));
|
|
16057
|
+
// 8-digit unicode character
|
|
16058
|
+
if (typeof unicode8 === 'string') {
|
|
16059
|
+
let charCode = Number.parseInt(unicode8, 16);
|
|
16060
|
+
return charCode <= 0xFFFF ? String.fromCharCode(Number.parseInt(unicode8, 16)) :
|
|
16061
|
+
String.fromCharCode(0xD800 + ((charCode -= 0x10000) >> 10), 0xDC00 + (charCode & 0x3FF));
|
|
16062
|
+
}
|
|
16063
|
+
// fixed escape sequence
|
|
16064
|
+
if (escapedChar in escapeReplacements)
|
|
16065
|
+
return escapeReplacements[escapedChar];
|
|
16066
|
+
// invalid escape sequence
|
|
16067
|
+
invalid = true;
|
|
16068
|
+
return '';
|
|
16069
|
+
});
|
|
16070
|
+
return invalid ? null : replaced;
|
|
16071
|
+
}
|
|
16072
|
+
|
|
16073
|
+
// ### `_parseLiteral` parses a literal into an unescaped value
|
|
16074
|
+
_parseLiteral(input) {
|
|
16075
|
+
// Ensure we have enough lookahead to identify triple-quoted strings
|
|
16076
|
+
if (input.length >= 3) {
|
|
16077
|
+
// Identify the opening quote(s)
|
|
16078
|
+
const opening = input.match(/^(?:"""|"|'''|'|)/)[0];
|
|
16079
|
+
const openingLength = opening.length;
|
|
16080
|
+
|
|
16081
|
+
// Find the next candidate closing quotes
|
|
16082
|
+
let closingPos = Math.max(this._literalClosingPos, openingLength);
|
|
16083
|
+
while ((closingPos = input.indexOf(opening, closingPos)) > 0) {
|
|
16084
|
+
// Count backslashes right before the closing quotes
|
|
16085
|
+
let backslashCount = 0;
|
|
16086
|
+
while (input[closingPos - backslashCount - 1] === '\\')
|
|
16087
|
+
backslashCount++;
|
|
16088
|
+
|
|
16089
|
+
// An even number of backslashes (in particular 0)
|
|
16090
|
+
// means these are actual, non-escaped closing quotes
|
|
16091
|
+
if (backslashCount % 2 === 0) {
|
|
16092
|
+
// Extract and unescape the value
|
|
16093
|
+
const raw = input.substring(openingLength, closingPos);
|
|
16094
|
+
const lines = raw.split(/\r\n|\r|\n/).length - 1;
|
|
16095
|
+
const matchLength = closingPos + openingLength;
|
|
16096
|
+
// Only triple-quoted strings can be multi-line
|
|
16097
|
+
if (openingLength === 1 && lines !== 0 ||
|
|
16098
|
+
openingLength === 3 && this._lineMode)
|
|
16099
|
+
break;
|
|
16100
|
+
this._line += lines;
|
|
16101
|
+
return { value: this._unescape(raw), matchLength };
|
|
16102
|
+
}
|
|
16103
|
+
closingPos++;
|
|
16104
|
+
}
|
|
16105
|
+
this._literalClosingPos = input.length - openingLength + 1;
|
|
16106
|
+
}
|
|
16107
|
+
return { value: '', matchLength: 0 };
|
|
16108
|
+
}
|
|
16109
|
+
|
|
16110
|
+
// ### `_syntaxError` creates a syntax error for the given issue
|
|
16111
|
+
_syntaxError(issue) {
|
|
16112
|
+
this._input = null;
|
|
16113
|
+
const err = new Error(`Unexpected "${issue}" on line ${this._line}.`);
|
|
16114
|
+
err.context = {
|
|
16115
|
+
token: undefined,
|
|
16116
|
+
line: this._line,
|
|
16117
|
+
previousToken: this.previousToken,
|
|
16118
|
+
};
|
|
16119
|
+
return err;
|
|
16120
|
+
}
|
|
16121
|
+
|
|
16122
|
+
// ### Strips off any starting UTF BOM mark.
|
|
16123
|
+
_readStartingBom(input) {
|
|
16124
|
+
return input.startsWith('\ufeff') ? input.substr(1) : input;
|
|
16125
|
+
}
|
|
16126
|
+
|
|
16127
|
+
// ## Public methods
|
|
16128
|
+
|
|
16129
|
+
// ### `tokenize` starts the transformation of an N3 document into an array of tokens.
|
|
16130
|
+
// The input can be a string or a stream.
|
|
16131
|
+
tokenize(input, callback) {
|
|
16132
|
+
this._line = 1;
|
|
16133
|
+
|
|
16134
|
+
// If the input is a string, continuously emit tokens through the callback until the end
|
|
16135
|
+
if (typeof input === 'string') {
|
|
16136
|
+
this._input = this._readStartingBom(input);
|
|
16137
|
+
// If a callback was passed, asynchronously call it
|
|
16138
|
+
if (typeof callback === 'function')
|
|
16139
|
+
queue_microtask__WEBPACK_IMPORTED_MODULE_0___default()(() => this._tokenizeToEnd(callback, true));
|
|
16140
|
+
// If no callback was passed, tokenize synchronously and return
|
|
16141
|
+
else {
|
|
16142
|
+
const tokens = [];
|
|
16143
|
+
let error;
|
|
16144
|
+
this._tokenizeToEnd((e, t) => e ? (error = e) : tokens.push(t), true);
|
|
16145
|
+
if (error) throw error;
|
|
16146
|
+
return tokens;
|
|
16147
|
+
}
|
|
16148
|
+
}
|
|
16149
|
+
// Otherwise, the input must be a stream
|
|
16150
|
+
else {
|
|
16151
|
+
this._pendingBuffer = null;
|
|
16152
|
+
if (typeof input.setEncoding === 'function')
|
|
16153
|
+
input.setEncoding('utf8');
|
|
16154
|
+
// Adds the data chunk to the buffer and parses as far as possible
|
|
16155
|
+
input.on('data', data => {
|
|
16156
|
+
if (this._input !== null && data.length !== 0) {
|
|
16157
|
+
// Prepend any previous pending writes
|
|
16158
|
+
if (this._pendingBuffer) {
|
|
16159
|
+
data = Buffer.concat([this._pendingBuffer, data]);
|
|
16160
|
+
this._pendingBuffer = null;
|
|
16161
|
+
}
|
|
16162
|
+
// Hold if the buffer ends in an incomplete unicode sequence
|
|
16163
|
+
if (data[data.length - 1] & 0x80) {
|
|
16164
|
+
this._pendingBuffer = data;
|
|
16165
|
+
}
|
|
16166
|
+
// Otherwise, tokenize as far as possible
|
|
16167
|
+
else {
|
|
16168
|
+
// Only read a BOM at the start
|
|
16169
|
+
if (typeof this._input === 'undefined')
|
|
16170
|
+
this._input = this._readStartingBom(typeof data === 'string' ? data : data.toString());
|
|
16171
|
+
else
|
|
16172
|
+
this._input += data;
|
|
16173
|
+
this._tokenizeToEnd(callback, false);
|
|
16174
|
+
}
|
|
16175
|
+
}
|
|
16176
|
+
});
|
|
16177
|
+
// Parses until the end
|
|
16178
|
+
input.on('end', () => {
|
|
16179
|
+
if (typeof this._input === 'string')
|
|
16180
|
+
this._tokenizeToEnd(callback, true);
|
|
16181
|
+
});
|
|
16182
|
+
input.on('error', callback);
|
|
16183
|
+
}
|
|
16184
|
+
}
|
|
16185
|
+
}
|
|
16186
|
+
|
|
16187
|
+
|
|
16188
|
+
/***/ }),
|
|
16189
|
+
|
|
16190
|
+
/***/ "./node_modules/n3/src/N3Parser.js":
|
|
16191
|
+
/*!*****************************************!*\
|
|
16192
|
+
!*** ./node_modules/n3/src/N3Parser.js ***!
|
|
16193
|
+
\*****************************************/
|
|
16194
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
16195
|
+
|
|
16196
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
16197
|
+
/* harmony export */ "default": () => (/* binding */ N3Parser)
|
|
16198
|
+
/* harmony export */ });
|
|
16199
|
+
/* harmony import */ var _N3Lexer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./N3Lexer */ "./node_modules/n3/src/N3Lexer.js");
|
|
16200
|
+
/* harmony import */ var _N3DataFactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./N3DataFactory */ "./node_modules/n3/src/N3DataFactory.js");
|
|
16201
|
+
/* harmony import */ var _IRIs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./IRIs */ "./node_modules/n3/src/IRIs.js");
|
|
16202
|
+
// **N3Parser** parses N3 documents.
|
|
16203
|
+
|
|
16204
|
+
|
|
16205
|
+
|
|
16206
|
+
|
|
16207
|
+
let blankNodePrefix = 0;
|
|
16208
|
+
|
|
16209
|
+
// ## Constructor
|
|
16210
|
+
class N3Parser {
|
|
16211
|
+
constructor(options) {
|
|
16212
|
+
this._contextStack = [];
|
|
16213
|
+
this._graph = null;
|
|
16214
|
+
|
|
16215
|
+
// Set the document IRI
|
|
16216
|
+
options = options || {};
|
|
16217
|
+
this._setBase(options.baseIRI);
|
|
16218
|
+
options.factory && initDataFactory(this, options.factory);
|
|
16219
|
+
|
|
16220
|
+
// Set supported features depending on the format
|
|
16221
|
+
const format = (typeof options.format === 'string') ?
|
|
16222
|
+
options.format.match(/\w*$/)[0].toLowerCase() : '',
|
|
16223
|
+
isTurtle = /turtle/.test(format), isTriG = /trig/.test(format),
|
|
16224
|
+
isNTriples = /triple/.test(format), isNQuads = /quad/.test(format),
|
|
16225
|
+
isN3 = this._n3Mode = /n3/.test(format),
|
|
16226
|
+
isLineMode = isNTriples || isNQuads;
|
|
16227
|
+
if (!(this._supportsNamedGraphs = !(isTurtle || isN3)))
|
|
16228
|
+
this._readPredicateOrNamedGraph = this._readPredicate;
|
|
16229
|
+
// Support triples in other graphs
|
|
16230
|
+
this._supportsQuads = !(isTurtle || isTriG || isNTriples || isN3);
|
|
16231
|
+
// Support nesting of triples
|
|
16232
|
+
this._supportsRDFStar = format === '' || /star|\*$/.test(format);
|
|
16233
|
+
// Disable relative IRIs in N-Triples or N-Quads mode
|
|
16234
|
+
if (isLineMode)
|
|
16235
|
+
this._resolveRelativeIRI = iri => { return null; };
|
|
16236
|
+
this._blankNodePrefix = typeof options.blankNodePrefix !== 'string' ? '' :
|
|
16237
|
+
options.blankNodePrefix.replace(/^(?!_:)/, '_:');
|
|
16238
|
+
this._lexer = options.lexer || new _N3Lexer__WEBPACK_IMPORTED_MODULE_0__["default"]({ lineMode: isLineMode, n3: isN3 });
|
|
16239
|
+
// Disable explicit quantifiers by default
|
|
16240
|
+
this._explicitQuantifiers = !!options.explicitQuantifiers;
|
|
16241
|
+
}
|
|
16242
|
+
|
|
16243
|
+
// ## Static class methods
|
|
16244
|
+
|
|
16245
|
+
// ### `_resetBlankNodePrefix` restarts blank node prefix identification
|
|
16246
|
+
static _resetBlankNodePrefix() {
|
|
16247
|
+
blankNodePrefix = 0;
|
|
16248
|
+
}
|
|
16249
|
+
|
|
16250
|
+
// ## Private methods
|
|
16251
|
+
|
|
16252
|
+
// ### `_setBase` sets the base IRI to resolve relative IRIs
|
|
16253
|
+
_setBase(baseIRI) {
|
|
16254
|
+
if (!baseIRI) {
|
|
16255
|
+
this._base = '';
|
|
16256
|
+
this._basePath = '';
|
|
16257
|
+
}
|
|
16258
|
+
else {
|
|
16259
|
+
// Remove fragment if present
|
|
16260
|
+
const fragmentPos = baseIRI.indexOf('#');
|
|
16261
|
+
if (fragmentPos >= 0)
|
|
16262
|
+
baseIRI = baseIRI.substr(0, fragmentPos);
|
|
16263
|
+
// Set base IRI and its components
|
|
16264
|
+
this._base = baseIRI;
|
|
16265
|
+
this._basePath = baseIRI.indexOf('/') < 0 ? baseIRI :
|
|
16266
|
+
baseIRI.replace(/[^\/?]*(?:\?.*)?$/, '');
|
|
16267
|
+
baseIRI = baseIRI.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i);
|
|
16268
|
+
this._baseRoot = baseIRI[0];
|
|
16269
|
+
this._baseScheme = baseIRI[1];
|
|
16270
|
+
}
|
|
16271
|
+
}
|
|
16272
|
+
|
|
16273
|
+
// ### `_saveContext` stores the current parsing context
|
|
16274
|
+
// when entering a new scope (list, blank node, formula)
|
|
16275
|
+
_saveContext(type, graph, subject, predicate, object) {
|
|
16276
|
+
const n3Mode = this._n3Mode;
|
|
16277
|
+
this._contextStack.push({
|
|
16278
|
+
subject: subject, predicate: predicate, object: object,
|
|
16279
|
+
graph: graph, type: type,
|
|
16280
|
+
inverse: n3Mode ? this._inversePredicate : false,
|
|
16281
|
+
blankPrefix: n3Mode ? this._prefixes._ : '',
|
|
16282
|
+
quantified: n3Mode ? this._quantified : null,
|
|
16283
|
+
});
|
|
16284
|
+
// The settings below only apply to N3 streams
|
|
16285
|
+
if (n3Mode) {
|
|
16286
|
+
// Every new scope resets the predicate direction
|
|
16287
|
+
this._inversePredicate = false;
|
|
16288
|
+
// In N3, blank nodes are scoped to a formula
|
|
16289
|
+
// (using a dot as separator, as a blank node label cannot start with it)
|
|
16290
|
+
this._prefixes._ = (this._graph ? `${this._graph.id.substr(2)}.` : '.');
|
|
16291
|
+
// Quantifiers are scoped to a formula
|
|
16292
|
+
this._quantified = Object.create(this._quantified);
|
|
16293
|
+
}
|
|
16294
|
+
}
|
|
16295
|
+
|
|
16296
|
+
// ### `_restoreContext` restores the parent context
|
|
16297
|
+
// when leaving a scope (list, blank node, formula)
|
|
16298
|
+
_restoreContext() {
|
|
16299
|
+
const context = this._contextStack.pop(), n3Mode = this._n3Mode;
|
|
16300
|
+
this._subject = context.subject;
|
|
16301
|
+
this._predicate = context.predicate;
|
|
16302
|
+
this._object = context.object;
|
|
16303
|
+
this._graph = context.graph;
|
|
16304
|
+
// The settings below only apply to N3 streams
|
|
16305
|
+
if (n3Mode) {
|
|
16306
|
+
this._inversePredicate = context.inverse;
|
|
16307
|
+
this._prefixes._ = context.blankPrefix;
|
|
16308
|
+
this._quantified = context.quantified;
|
|
16309
|
+
}
|
|
16310
|
+
}
|
|
16311
|
+
|
|
16312
|
+
// ### `_readInTopContext` reads a token when in the top context
|
|
16313
|
+
_readInTopContext(token) {
|
|
16314
|
+
switch (token.type) {
|
|
16315
|
+
// If an EOF token arrives in the top context, signal that we're done
|
|
16316
|
+
case 'eof':
|
|
16317
|
+
if (this._graph !== null)
|
|
16318
|
+
return this._error('Unclosed graph', token);
|
|
16319
|
+
delete this._prefixes._;
|
|
16320
|
+
return this._callback(null, null, this._prefixes);
|
|
16321
|
+
// It could be a prefix declaration
|
|
16322
|
+
case 'PREFIX':
|
|
16323
|
+
this._sparqlStyle = true;
|
|
16324
|
+
case '@prefix':
|
|
16325
|
+
return this._readPrefix;
|
|
16326
|
+
// It could be a base declaration
|
|
16327
|
+
case 'BASE':
|
|
16328
|
+
this._sparqlStyle = true;
|
|
16329
|
+
case '@base':
|
|
16330
|
+
return this._readBaseIRI;
|
|
16331
|
+
// It could be a graph
|
|
16332
|
+
case '{':
|
|
16333
|
+
if (this._supportsNamedGraphs) {
|
|
16334
|
+
this._graph = '';
|
|
16335
|
+
this._subject = null;
|
|
16336
|
+
return this._readSubject;
|
|
16337
|
+
}
|
|
16338
|
+
case 'GRAPH':
|
|
16339
|
+
if (this._supportsNamedGraphs)
|
|
16340
|
+
return this._readNamedGraphLabel;
|
|
16341
|
+
// Otherwise, the next token must be a subject
|
|
16342
|
+
default:
|
|
16343
|
+
return this._readSubject(token);
|
|
16344
|
+
}
|
|
16345
|
+
}
|
|
16346
|
+
|
|
16347
|
+
// ### `_readEntity` reads an IRI, prefixed name, blank node, or variable
|
|
16348
|
+
_readEntity(token, quantifier) {
|
|
16349
|
+
let value;
|
|
16350
|
+
switch (token.type) {
|
|
16351
|
+
// Read a relative or absolute IRI
|
|
16352
|
+
case 'IRI':
|
|
16353
|
+
case 'typeIRI':
|
|
16354
|
+
const iri = this._resolveIRI(token.value);
|
|
16355
|
+
if (iri === null)
|
|
16356
|
+
return this._error('Invalid IRI', token);
|
|
16357
|
+
value = this._namedNode(iri);
|
|
16358
|
+
break;
|
|
16359
|
+
// Read a prefixed name
|
|
16360
|
+
case 'type':
|
|
16361
|
+
case 'prefixed':
|
|
16362
|
+
const prefix = this._prefixes[token.prefix];
|
|
16363
|
+
if (prefix === undefined)
|
|
16364
|
+
return this._error(`Undefined prefix "${token.prefix}:"`, token);
|
|
16365
|
+
value = this._namedNode(prefix + token.value);
|
|
16366
|
+
break;
|
|
16367
|
+
// Read a blank node
|
|
16368
|
+
case 'blank':
|
|
16369
|
+
value = this._blankNode(this._prefixes[token.prefix] + token.value);
|
|
16370
|
+
break;
|
|
16371
|
+
// Read a variable
|
|
16372
|
+
case 'var':
|
|
16373
|
+
value = this._variable(token.value.substr(1));
|
|
16374
|
+
break;
|
|
16375
|
+
// Everything else is not an entity
|
|
16376
|
+
default:
|
|
16377
|
+
return this._error(`Expected entity but got ${token.type}`, token);
|
|
16378
|
+
}
|
|
16379
|
+
// In N3 mode, replace the entity if it is quantified
|
|
16380
|
+
if (!quantifier && this._n3Mode && (value.id in this._quantified))
|
|
16381
|
+
value = this._quantified[value.id];
|
|
16382
|
+
return value;
|
|
16383
|
+
}
|
|
16384
|
+
|
|
16385
|
+
// ### `_readSubject` reads a quad's subject
|
|
16386
|
+
_readSubject(token) {
|
|
16387
|
+
this._predicate = null;
|
|
16388
|
+
switch (token.type) {
|
|
16389
|
+
case '[':
|
|
16390
|
+
// Start a new quad with a new blank node as subject
|
|
16391
|
+
this._saveContext('blank', this._graph,
|
|
16392
|
+
this._subject = this._blankNode(), null, null);
|
|
16393
|
+
return this._readBlankNodeHead;
|
|
16394
|
+
case '(':
|
|
16395
|
+
// Start a new list
|
|
16396
|
+
this._saveContext('list', this._graph, this.RDF_NIL, null, null);
|
|
16397
|
+
this._subject = null;
|
|
16398
|
+
return this._readListItem;
|
|
16399
|
+
case '{':
|
|
16400
|
+
// Start a new formula
|
|
16401
|
+
if (!this._n3Mode)
|
|
16402
|
+
return this._error('Unexpected graph', token);
|
|
16403
|
+
this._saveContext('formula', this._graph,
|
|
16404
|
+
this._graph = this._blankNode(), null, null);
|
|
16405
|
+
return this._readSubject;
|
|
16406
|
+
case '}':
|
|
16407
|
+
// No subject; the graph in which we are reading is closed instead
|
|
16408
|
+
return this._readPunctuation(token);
|
|
16409
|
+
case '@forSome':
|
|
16410
|
+
if (!this._n3Mode)
|
|
16411
|
+
return this._error('Unexpected "@forSome"', token);
|
|
16412
|
+
this._subject = null;
|
|
16413
|
+
this._predicate = this.N3_FORSOME;
|
|
16414
|
+
this._quantifier = this._blankNode;
|
|
16415
|
+
return this._readQuantifierList;
|
|
16416
|
+
case '@forAll':
|
|
16417
|
+
if (!this._n3Mode)
|
|
16418
|
+
return this._error('Unexpected "@forAll"', token);
|
|
16419
|
+
this._subject = null;
|
|
16420
|
+
this._predicate = this.N3_FORALL;
|
|
16421
|
+
this._quantifier = this._variable;
|
|
16422
|
+
return this._readQuantifierList;
|
|
16423
|
+
case 'literal':
|
|
16424
|
+
if (!this._n3Mode)
|
|
16425
|
+
return this._error('Unexpected literal', token);
|
|
16426
|
+
|
|
16427
|
+
if (token.prefix.length === 0) {
|
|
16428
|
+
this._literalValue = token.value;
|
|
16429
|
+
return this._completeSubjectLiteral;
|
|
16430
|
+
}
|
|
16431
|
+
else
|
|
16432
|
+
this._subject = this._literal(token.value, this._namedNode(token.prefix));
|
|
16433
|
+
|
|
16434
|
+
break;
|
|
16435
|
+
case '<<':
|
|
16436
|
+
if (!this._supportsRDFStar)
|
|
16437
|
+
return this._error('Unexpected RDF* syntax', token);
|
|
16438
|
+
this._saveContext('<<', this._graph, null, null, null);
|
|
16439
|
+
this._graph = null;
|
|
16440
|
+
return this._readSubject;
|
|
16441
|
+
default:
|
|
16442
|
+
// Read the subject entity
|
|
16443
|
+
if ((this._subject = this._readEntity(token)) === undefined)
|
|
16444
|
+
return;
|
|
16445
|
+
// In N3 mode, the subject might be a path
|
|
16446
|
+
if (this._n3Mode)
|
|
16447
|
+
return this._getPathReader(this._readPredicateOrNamedGraph);
|
|
16448
|
+
}
|
|
16449
|
+
|
|
16450
|
+
// The next token must be a predicate,
|
|
16451
|
+
// or, if the subject was actually a graph IRI, a named graph
|
|
16452
|
+
return this._readPredicateOrNamedGraph;
|
|
16453
|
+
}
|
|
16454
|
+
|
|
16455
|
+
// ### `_readPredicate` reads a quad's predicate
|
|
16456
|
+
_readPredicate(token) {
|
|
16457
|
+
const type = token.type;
|
|
16458
|
+
switch (type) {
|
|
16459
|
+
case 'inverse':
|
|
16460
|
+
this._inversePredicate = true;
|
|
16461
|
+
case 'abbreviation':
|
|
16462
|
+
this._predicate = this.ABBREVIATIONS[token.value];
|
|
16463
|
+
break;
|
|
16464
|
+
case '.':
|
|
16465
|
+
case ']':
|
|
16466
|
+
case '}':
|
|
16467
|
+
// Expected predicate didn't come, must have been trailing semicolon
|
|
16468
|
+
if (this._predicate === null)
|
|
16469
|
+
return this._error(`Unexpected ${type}`, token);
|
|
16470
|
+
this._subject = null;
|
|
16471
|
+
return type === ']' ? this._readBlankNodeTail(token) : this._readPunctuation(token);
|
|
16472
|
+
case ';':
|
|
16473
|
+
// Additional semicolons can be safely ignored
|
|
16474
|
+
return this._predicate !== null ? this._readPredicate :
|
|
16475
|
+
this._error('Expected predicate but got ;', token);
|
|
16476
|
+
case '[':
|
|
16477
|
+
if (this._n3Mode) {
|
|
16478
|
+
// Start a new quad with a new blank node as subject
|
|
16479
|
+
this._saveContext('blank', this._graph, this._subject,
|
|
16480
|
+
this._subject = this._blankNode(), null);
|
|
16481
|
+
return this._readBlankNodeHead;
|
|
16482
|
+
}
|
|
16483
|
+
case 'blank':
|
|
16484
|
+
if (!this._n3Mode)
|
|
16485
|
+
return this._error('Disallowed blank node as predicate', token);
|
|
16486
|
+
default:
|
|
16487
|
+
if ((this._predicate = this._readEntity(token)) === undefined)
|
|
16488
|
+
return;
|
|
16489
|
+
}
|
|
16490
|
+
// The next token must be an object
|
|
16491
|
+
return this._readObject;
|
|
16492
|
+
}
|
|
16493
|
+
|
|
16494
|
+
// ### `_readObject` reads a quad's object
|
|
16495
|
+
_readObject(token) {
|
|
16496
|
+
switch (token.type) {
|
|
16497
|
+
case 'literal':
|
|
16498
|
+
// Regular literal, can still get a datatype or language
|
|
16499
|
+
if (token.prefix.length === 0) {
|
|
16500
|
+
this._literalValue = token.value;
|
|
16501
|
+
return this._readDataTypeOrLang;
|
|
16502
|
+
}
|
|
16503
|
+
// Pre-datatyped string literal (prefix stores the datatype)
|
|
16504
|
+
else
|
|
16505
|
+
this._object = this._literal(token.value, this._namedNode(token.prefix));
|
|
16506
|
+
break;
|
|
16507
|
+
case '[':
|
|
16508
|
+
// Start a new quad with a new blank node as subject
|
|
16509
|
+
this._saveContext('blank', this._graph, this._subject, this._predicate,
|
|
16510
|
+
this._subject = this._blankNode());
|
|
16511
|
+
return this._readBlankNodeHead;
|
|
16512
|
+
case '(':
|
|
16513
|
+
// Start a new list
|
|
16514
|
+
this._saveContext('list', this._graph, this._subject, this._predicate, this.RDF_NIL);
|
|
16515
|
+
this._subject = null;
|
|
16516
|
+
return this._readListItem;
|
|
16517
|
+
case '{':
|
|
16518
|
+
// Start a new formula
|
|
16519
|
+
if (!this._n3Mode)
|
|
16520
|
+
return this._error('Unexpected graph', token);
|
|
16521
|
+
this._saveContext('formula', this._graph, this._subject, this._predicate,
|
|
16522
|
+
this._graph = this._blankNode());
|
|
16523
|
+
return this._readSubject;
|
|
16524
|
+
case '<<':
|
|
16525
|
+
if (!this._supportsRDFStar)
|
|
16526
|
+
return this._error('Unexpected RDF* syntax', token);
|
|
16527
|
+
this._saveContext('<<', this._graph, this._subject, this._predicate, null);
|
|
16528
|
+
this._graph = null;
|
|
16529
|
+
return this._readSubject;
|
|
16530
|
+
default:
|
|
16531
|
+
// Read the object entity
|
|
16532
|
+
if ((this._object = this._readEntity(token)) === undefined)
|
|
16533
|
+
return;
|
|
16534
|
+
// In N3 mode, the object might be a path
|
|
16535
|
+
if (this._n3Mode)
|
|
16536
|
+
return this._getPathReader(this._getContextEndReader());
|
|
16537
|
+
}
|
|
16538
|
+
return this._getContextEndReader();
|
|
16539
|
+
}
|
|
16540
|
+
|
|
16541
|
+
// ### `_readPredicateOrNamedGraph` reads a quad's predicate, or a named graph
|
|
16542
|
+
_readPredicateOrNamedGraph(token) {
|
|
16543
|
+
return token.type === '{' ? this._readGraph(token) : this._readPredicate(token);
|
|
16544
|
+
}
|
|
16545
|
+
|
|
16546
|
+
// ### `_readGraph` reads a graph
|
|
16547
|
+
_readGraph(token) {
|
|
16548
|
+
if (token.type !== '{')
|
|
16549
|
+
return this._error(`Expected graph but got ${token.type}`, token);
|
|
16550
|
+
// The "subject" we read is actually the GRAPH's label
|
|
16551
|
+
this._graph = this._subject, this._subject = null;
|
|
16552
|
+
return this._readSubject;
|
|
16553
|
+
}
|
|
16554
|
+
|
|
16555
|
+
// ### `_readBlankNodeHead` reads the head of a blank node
|
|
16556
|
+
_readBlankNodeHead(token) {
|
|
16557
|
+
if (token.type === ']') {
|
|
16558
|
+
this._subject = null;
|
|
16559
|
+
return this._readBlankNodeTail(token);
|
|
16560
|
+
}
|
|
16561
|
+
else {
|
|
16562
|
+
this._predicate = null;
|
|
16563
|
+
return this._readPredicate(token);
|
|
16564
|
+
}
|
|
16565
|
+
}
|
|
16566
|
+
|
|
16567
|
+
// ### `_readBlankNodeTail` reads the end of a blank node
|
|
16568
|
+
_readBlankNodeTail(token) {
|
|
16569
|
+
if (token.type !== ']')
|
|
16570
|
+
return this._readBlankNodePunctuation(token);
|
|
16571
|
+
|
|
16572
|
+
// Store blank node quad
|
|
16573
|
+
if (this._subject !== null)
|
|
16574
|
+
this._emit(this._subject, this._predicate, this._object, this._graph);
|
|
16575
|
+
|
|
16576
|
+
// Restore the parent context containing this blank node
|
|
16577
|
+
const empty = this._predicate === null;
|
|
16578
|
+
this._restoreContext();
|
|
16579
|
+
// If the blank node was the object, restore previous context and read punctuation
|
|
16580
|
+
if (this._object !== null)
|
|
16581
|
+
return this._getContextEndReader();
|
|
16582
|
+
// If the blank node was the predicate, continue reading the object
|
|
16583
|
+
else if (this._predicate !== null)
|
|
16584
|
+
return this._readObject;
|
|
16585
|
+
// If the blank node was the subject, continue reading the predicate
|
|
16586
|
+
else
|
|
16587
|
+
// If the blank node was empty, it could be a named graph label
|
|
16588
|
+
return empty ? this._readPredicateOrNamedGraph : this._readPredicateAfterBlank;
|
|
16589
|
+
}
|
|
16590
|
+
|
|
16591
|
+
// ### `_readPredicateAfterBlank` reads a predicate after an anonymous blank node
|
|
16592
|
+
_readPredicateAfterBlank(token) {
|
|
16593
|
+
switch (token.type) {
|
|
16594
|
+
case '.':
|
|
16595
|
+
case '}':
|
|
16596
|
+
// No predicate is coming if the triple is terminated here
|
|
16597
|
+
this._subject = null;
|
|
16598
|
+
return this._readPunctuation(token);
|
|
16599
|
+
default:
|
|
16600
|
+
return this._readPredicate(token);
|
|
16601
|
+
}
|
|
16602
|
+
}
|
|
16603
|
+
|
|
16604
|
+
// ### `_readListItem` reads items from a list
|
|
16605
|
+
_readListItem(token) {
|
|
16606
|
+
let item = null, // The item of the list
|
|
16607
|
+
list = null, // The list itself
|
|
16608
|
+
next = this._readListItem; // The next function to execute
|
|
16609
|
+
const previousList = this._subject, // The previous list that contains this list
|
|
16610
|
+
stack = this._contextStack, // The stack of parent contexts
|
|
16611
|
+
parent = stack[stack.length - 1]; // The parent containing the current list
|
|
16612
|
+
|
|
16613
|
+
switch (token.type) {
|
|
16614
|
+
case '[':
|
|
16615
|
+
// Stack the current list quad and start a new quad with a blank node as subject
|
|
16616
|
+
this._saveContext('blank', this._graph,
|
|
16617
|
+
list = this._blankNode(), this.RDF_FIRST,
|
|
16618
|
+
this._subject = item = this._blankNode());
|
|
16619
|
+
next = this._readBlankNodeHead;
|
|
16620
|
+
break;
|
|
16621
|
+
case '(':
|
|
16622
|
+
// Stack the current list quad and start a new list
|
|
16623
|
+
this._saveContext('list', this._graph,
|
|
16624
|
+
list = this._blankNode(), this.RDF_FIRST, this.RDF_NIL);
|
|
16625
|
+
this._subject = null;
|
|
16626
|
+
break;
|
|
16627
|
+
case ')':
|
|
16628
|
+
// Closing the list; restore the parent context
|
|
16629
|
+
this._restoreContext();
|
|
16630
|
+
// If this list is contained within a parent list, return the membership quad here.
|
|
16631
|
+
// This will be `<parent list element> rdf:first <this list>.`.
|
|
16632
|
+
if (stack.length !== 0 && stack[stack.length - 1].type === 'list')
|
|
16633
|
+
this._emit(this._subject, this._predicate, this._object, this._graph);
|
|
16634
|
+
// Was this list the parent's subject?
|
|
16635
|
+
if (this._predicate === null) {
|
|
16636
|
+
// The next token is the predicate
|
|
16637
|
+
next = this._readPredicate;
|
|
16638
|
+
// No list tail if this was an empty list
|
|
16639
|
+
if (this._subject === this.RDF_NIL)
|
|
16640
|
+
return next;
|
|
16641
|
+
}
|
|
16642
|
+
// The list was in the parent context's object
|
|
16643
|
+
else {
|
|
16644
|
+
next = this._getContextEndReader();
|
|
16645
|
+
// No list tail if this was an empty list
|
|
16646
|
+
if (this._object === this.RDF_NIL)
|
|
16647
|
+
return next;
|
|
16648
|
+
}
|
|
16649
|
+
// Close the list by making the head nil
|
|
16650
|
+
list = this.RDF_NIL;
|
|
16651
|
+
break;
|
|
16652
|
+
case 'literal':
|
|
16653
|
+
// Regular literal, can still get a datatype or language
|
|
16654
|
+
if (token.prefix.length === 0) {
|
|
16655
|
+
this._literalValue = token.value;
|
|
16656
|
+
next = this._readListItemDataTypeOrLang;
|
|
16657
|
+
}
|
|
16658
|
+
// Pre-datatyped string literal (prefix stores the datatype)
|
|
16659
|
+
else {
|
|
16660
|
+
item = this._literal(token.value, this._namedNode(token.prefix));
|
|
16661
|
+
next = this._getContextEndReader();
|
|
16662
|
+
}
|
|
16663
|
+
break;
|
|
16664
|
+
case '{':
|
|
16665
|
+
// Start a new formula
|
|
16666
|
+
if (!this._n3Mode)
|
|
16667
|
+
return this._error('Unexpected graph', token);
|
|
16668
|
+
this._saveContext('formula', this._graph, this._subject, this._predicate,
|
|
16669
|
+
this._graph = this._blankNode());
|
|
16670
|
+
return this._readSubject;
|
|
16671
|
+
default:
|
|
16672
|
+
if ((item = this._readEntity(token)) === undefined)
|
|
16673
|
+
return;
|
|
16674
|
+
}
|
|
16675
|
+
|
|
16676
|
+
// Create a new blank node if no item head was assigned yet
|
|
16677
|
+
if (list === null)
|
|
16678
|
+
this._subject = list = this._blankNode();
|
|
16679
|
+
|
|
16680
|
+
// Is this the first element of the list?
|
|
16681
|
+
if (previousList === null) {
|
|
16682
|
+
// This list is either the subject or the object of its parent
|
|
16683
|
+
if (parent.predicate === null)
|
|
16684
|
+
parent.subject = list;
|
|
16685
|
+
else
|
|
16686
|
+
parent.object = list;
|
|
16687
|
+
}
|
|
16688
|
+
else {
|
|
16689
|
+
// Continue the previous list with the current list
|
|
16690
|
+
this._emit(previousList, this.RDF_REST, list, this._graph);
|
|
16691
|
+
}
|
|
16692
|
+
// If an item was read, add it to the list
|
|
16693
|
+
if (item !== null) {
|
|
16694
|
+
// In N3 mode, the item might be a path
|
|
16695
|
+
if (this._n3Mode && (token.type === 'IRI' || token.type === 'prefixed')) {
|
|
16696
|
+
// Create a new context to add the item's path
|
|
16697
|
+
this._saveContext('item', this._graph, list, this.RDF_FIRST, item);
|
|
16698
|
+
this._subject = item, this._predicate = null;
|
|
16699
|
+
// _readPath will restore the context and output the item
|
|
16700
|
+
return this._getPathReader(this._readListItem);
|
|
16701
|
+
}
|
|
16702
|
+
// Output the item
|
|
16703
|
+
this._emit(list, this.RDF_FIRST, item, this._graph);
|
|
16704
|
+
}
|
|
16705
|
+
return next;
|
|
16706
|
+
}
|
|
16707
|
+
|
|
16708
|
+
// ### `_readDataTypeOrLang` reads an _optional_ datatype or language
|
|
16709
|
+
_readDataTypeOrLang(token) {
|
|
16710
|
+
return this._completeObjectLiteral(token, false);
|
|
16711
|
+
}
|
|
16712
|
+
|
|
16713
|
+
|
|
16714
|
+
// ### `_readListItemDataTypeOrLang` reads an _optional_ datatype or language in a list
|
|
16715
|
+
_readListItemDataTypeOrLang(token) {
|
|
16716
|
+
return this._completeObjectLiteral(token, true);
|
|
16717
|
+
}
|
|
16718
|
+
|
|
16719
|
+
// ### `_completeLiteral` completes a literal with an optional datatype or language
|
|
16720
|
+
_completeLiteral(token) {
|
|
16721
|
+
// Create a simple string literal by default
|
|
16722
|
+
let literal = this._literal(this._literalValue);
|
|
16723
|
+
|
|
16724
|
+
switch (token.type) {
|
|
16725
|
+
// Create a datatyped literal
|
|
16726
|
+
case 'type':
|
|
16727
|
+
case 'typeIRI':
|
|
16728
|
+
const datatype = this._readEntity(token);
|
|
16729
|
+
if (datatype === undefined) return; // No datatype means an error occurred
|
|
16730
|
+
literal = this._literal(this._literalValue, datatype);
|
|
16731
|
+
token = null;
|
|
16732
|
+
break;
|
|
16733
|
+
// Create a language-tagged string
|
|
16734
|
+
case 'langcode':
|
|
16735
|
+
literal = this._literal(this._literalValue, token.value);
|
|
16736
|
+
token = null;
|
|
16737
|
+
break;
|
|
16738
|
+
}
|
|
16739
|
+
|
|
16740
|
+
return { token, literal };
|
|
16741
|
+
}
|
|
16742
|
+
|
|
16743
|
+
// Completes a literal in subject position
|
|
16744
|
+
_completeSubjectLiteral(token) {
|
|
16745
|
+
this._subject = this._completeLiteral(token).literal;
|
|
16746
|
+
return this._readPredicateOrNamedGraph;
|
|
16747
|
+
}
|
|
16748
|
+
|
|
16749
|
+
// Completes a literal in object position
|
|
16750
|
+
_completeObjectLiteral(token, listItem) {
|
|
16751
|
+
const completed = this._completeLiteral(token);
|
|
16752
|
+
if (!completed)
|
|
16753
|
+
return;
|
|
16754
|
+
this._object = completed.literal;
|
|
16755
|
+
|
|
16756
|
+
// If this literal was part of a list, write the item
|
|
16757
|
+
// (we could also check the context stack, but passing in a flag is faster)
|
|
16758
|
+
if (listItem)
|
|
16759
|
+
this._emit(this._subject, this.RDF_FIRST, this._object, this._graph);
|
|
16760
|
+
// If the token was consumed, continue with the rest of the input
|
|
16761
|
+
if (completed.token === null)
|
|
16762
|
+
return this._getContextEndReader();
|
|
16763
|
+
// Otherwise, consume the token now
|
|
16764
|
+
else {
|
|
16765
|
+
this._readCallback = this._getContextEndReader();
|
|
16766
|
+
return this._readCallback(completed.token);
|
|
16767
|
+
}
|
|
16768
|
+
}
|
|
16769
|
+
|
|
16770
|
+
// ### `_readFormulaTail` reads the end of a formula
|
|
16771
|
+
_readFormulaTail(token) {
|
|
16772
|
+
if (token.type !== '}')
|
|
16773
|
+
return this._readPunctuation(token);
|
|
16774
|
+
|
|
16775
|
+
// Store the last quad of the formula
|
|
16776
|
+
if (this._subject !== null)
|
|
16777
|
+
this._emit(this._subject, this._predicate, this._object, this._graph);
|
|
16778
|
+
|
|
16779
|
+
// Restore the parent context containing this formula
|
|
16780
|
+
this._restoreContext();
|
|
16781
|
+
// If the formula was the subject, continue reading the predicate.
|
|
16782
|
+
// If the formula was the object, read punctuation.
|
|
16783
|
+
return this._object === null ? this._readPredicate : this._getContextEndReader();
|
|
16784
|
+
}
|
|
16785
|
+
|
|
16786
|
+
// ### `_readPunctuation` reads punctuation between quads or quad parts
|
|
16787
|
+
_readPunctuation(token) {
|
|
16788
|
+
let next, graph = this._graph;
|
|
16789
|
+
const subject = this._subject, inversePredicate = this._inversePredicate;
|
|
16790
|
+
switch (token.type) {
|
|
16791
|
+
// A closing brace ends a graph
|
|
16792
|
+
case '}':
|
|
16793
|
+
if (this._graph === null)
|
|
16794
|
+
return this._error('Unexpected graph closing', token);
|
|
16795
|
+
if (this._n3Mode)
|
|
16796
|
+
return this._readFormulaTail(token);
|
|
16797
|
+
this._graph = null;
|
|
16798
|
+
// A dot just ends the statement, without sharing anything with the next
|
|
16799
|
+
case '.':
|
|
16800
|
+
this._subject = null;
|
|
16801
|
+
next = this._contextStack.length ? this._readSubject : this._readInTopContext;
|
|
16802
|
+
if (inversePredicate) this._inversePredicate = false;
|
|
16803
|
+
break;
|
|
16804
|
+
// Semicolon means the subject is shared; predicate and object are different
|
|
16805
|
+
case ';':
|
|
16806
|
+
next = this._readPredicate;
|
|
16807
|
+
break;
|
|
16808
|
+
// Comma means both the subject and predicate are shared; the object is different
|
|
16809
|
+
case ',':
|
|
16810
|
+
next = this._readObject;
|
|
16811
|
+
break;
|
|
16812
|
+
default:
|
|
16813
|
+
// An entity means this is a quad (only allowed if not already inside a graph)
|
|
16814
|
+
if (this._supportsQuads && this._graph === null && (graph = this._readEntity(token)) !== undefined) {
|
|
16815
|
+
next = this._readQuadPunctuation;
|
|
16816
|
+
break;
|
|
16817
|
+
}
|
|
16818
|
+
return this._error(`Expected punctuation to follow "${this._object.id}"`, token);
|
|
16819
|
+
}
|
|
16820
|
+
// A quad has been completed now, so return it
|
|
16821
|
+
if (subject !== null) {
|
|
16822
|
+
const predicate = this._predicate, object = this._object;
|
|
16823
|
+
if (!inversePredicate)
|
|
16824
|
+
this._emit(subject, predicate, object, graph);
|
|
16825
|
+
else
|
|
16826
|
+
this._emit(object, predicate, subject, graph);
|
|
16827
|
+
}
|
|
16828
|
+
return next;
|
|
16829
|
+
}
|
|
16830
|
+
|
|
16831
|
+
// ### `_readBlankNodePunctuation` reads punctuation in a blank node
|
|
16832
|
+
_readBlankNodePunctuation(token) {
|
|
16833
|
+
let next;
|
|
16834
|
+
switch (token.type) {
|
|
16835
|
+
// Semicolon means the subject is shared; predicate and object are different
|
|
16836
|
+
case ';':
|
|
16837
|
+
next = this._readPredicate;
|
|
16838
|
+
break;
|
|
16839
|
+
// Comma means both the subject and predicate are shared; the object is different
|
|
16840
|
+
case ',':
|
|
16841
|
+
next = this._readObject;
|
|
16842
|
+
break;
|
|
16843
|
+
default:
|
|
16844
|
+
return this._error(`Expected punctuation to follow "${this._object.id}"`, token);
|
|
16845
|
+
}
|
|
16846
|
+
// A quad has been completed now, so return it
|
|
16847
|
+
this._emit(this._subject, this._predicate, this._object, this._graph);
|
|
16848
|
+
return next;
|
|
16849
|
+
}
|
|
16850
|
+
|
|
16851
|
+
// ### `_readQuadPunctuation` reads punctuation after a quad
|
|
16852
|
+
_readQuadPunctuation(token) {
|
|
16853
|
+
if (token.type !== '.')
|
|
16854
|
+
return this._error('Expected dot to follow quad', token);
|
|
16855
|
+
return this._readInTopContext;
|
|
16856
|
+
}
|
|
16857
|
+
|
|
16858
|
+
// ### `_readPrefix` reads the prefix of a prefix declaration
|
|
16859
|
+
_readPrefix(token) {
|
|
16860
|
+
if (token.type !== 'prefix')
|
|
16861
|
+
return this._error('Expected prefix to follow @prefix', token);
|
|
16862
|
+
this._prefix = token.value;
|
|
16863
|
+
return this._readPrefixIRI;
|
|
16864
|
+
}
|
|
16865
|
+
|
|
16866
|
+
// ### `_readPrefixIRI` reads the IRI of a prefix declaration
|
|
16867
|
+
_readPrefixIRI(token) {
|
|
16868
|
+
if (token.type !== 'IRI')
|
|
16869
|
+
return this._error(`Expected IRI to follow prefix "${this._prefix}:"`, token);
|
|
16870
|
+
const prefixNode = this._readEntity(token);
|
|
16871
|
+
this._prefixes[this._prefix] = prefixNode.value;
|
|
16872
|
+
this._prefixCallback(this._prefix, prefixNode);
|
|
16873
|
+
return this._readDeclarationPunctuation;
|
|
16874
|
+
}
|
|
16875
|
+
|
|
16876
|
+
// ### `_readBaseIRI` reads the IRI of a base declaration
|
|
16877
|
+
_readBaseIRI(token) {
|
|
16878
|
+
const iri = token.type === 'IRI' && this._resolveIRI(token.value);
|
|
16879
|
+
if (!iri)
|
|
16880
|
+
return this._error('Expected valid IRI to follow base declaration', token);
|
|
16881
|
+
this._setBase(iri);
|
|
16882
|
+
return this._readDeclarationPunctuation;
|
|
16883
|
+
}
|
|
16884
|
+
|
|
16885
|
+
// ### `_readNamedGraphLabel` reads the label of a named graph
|
|
16886
|
+
_readNamedGraphLabel(token) {
|
|
16887
|
+
switch (token.type) {
|
|
16888
|
+
case 'IRI':
|
|
16889
|
+
case 'blank':
|
|
16890
|
+
case 'prefixed':
|
|
16891
|
+
return this._readSubject(token), this._readGraph;
|
|
16892
|
+
case '[':
|
|
16893
|
+
return this._readNamedGraphBlankLabel;
|
|
16894
|
+
default:
|
|
16895
|
+
return this._error('Invalid graph label', token);
|
|
16896
|
+
}
|
|
16897
|
+
}
|
|
16898
|
+
|
|
16899
|
+
// ### `_readNamedGraphLabel` reads a blank node label of a named graph
|
|
16900
|
+
_readNamedGraphBlankLabel(token) {
|
|
16901
|
+
if (token.type !== ']')
|
|
16902
|
+
return this._error('Invalid graph label', token);
|
|
16903
|
+
this._subject = this._blankNode();
|
|
16904
|
+
return this._readGraph;
|
|
16905
|
+
}
|
|
16906
|
+
|
|
16907
|
+
// ### `_readDeclarationPunctuation` reads the punctuation of a declaration
|
|
16908
|
+
_readDeclarationPunctuation(token) {
|
|
16909
|
+
// SPARQL-style declarations don't have punctuation
|
|
16910
|
+
if (this._sparqlStyle) {
|
|
16911
|
+
this._sparqlStyle = false;
|
|
16912
|
+
return this._readInTopContext(token);
|
|
16913
|
+
}
|
|
16914
|
+
|
|
16915
|
+
if (token.type !== '.')
|
|
16916
|
+
return this._error('Expected declaration to end with a dot', token);
|
|
16917
|
+
return this._readInTopContext;
|
|
16918
|
+
}
|
|
16919
|
+
|
|
16920
|
+
// Reads a list of quantified symbols from a @forSome or @forAll statement
|
|
16921
|
+
_readQuantifierList(token) {
|
|
16922
|
+
let entity;
|
|
16923
|
+
switch (token.type) {
|
|
16924
|
+
case 'IRI':
|
|
16925
|
+
case 'prefixed':
|
|
16926
|
+
if ((entity = this._readEntity(token, true)) !== undefined)
|
|
16927
|
+
break;
|
|
16928
|
+
default:
|
|
16929
|
+
return this._error(`Unexpected ${token.type}`, token);
|
|
16930
|
+
}
|
|
16931
|
+
// Without explicit quantifiers, map entities to a quantified entity
|
|
16932
|
+
if (!this._explicitQuantifiers)
|
|
16933
|
+
this._quantified[entity.id] = this._quantifier(this._blankNode().value);
|
|
16934
|
+
// With explicit quantifiers, output the reified quantifier
|
|
16935
|
+
else {
|
|
16936
|
+
// If this is the first item, start a new quantifier list
|
|
16937
|
+
if (this._subject === null)
|
|
16938
|
+
this._emit(this._graph || this.DEFAULTGRAPH, this._predicate,
|
|
16939
|
+
this._subject = this._blankNode(), this.QUANTIFIERS_GRAPH);
|
|
16940
|
+
// Otherwise, continue the previous list
|
|
16941
|
+
else
|
|
16942
|
+
this._emit(this._subject, this.RDF_REST,
|
|
16943
|
+
this._subject = this._blankNode(), this.QUANTIFIERS_GRAPH);
|
|
16944
|
+
// Output the list item
|
|
16945
|
+
this._emit(this._subject, this.RDF_FIRST, entity, this.QUANTIFIERS_GRAPH);
|
|
16946
|
+
}
|
|
16947
|
+
return this._readQuantifierPunctuation;
|
|
16948
|
+
}
|
|
16949
|
+
|
|
16950
|
+
// Reads punctuation from a @forSome or @forAll statement
|
|
16951
|
+
_readQuantifierPunctuation(token) {
|
|
16952
|
+
// Read more quantifiers
|
|
16953
|
+
if (token.type === ',')
|
|
16954
|
+
return this._readQuantifierList;
|
|
16955
|
+
// End of the quantifier list
|
|
16956
|
+
else {
|
|
16957
|
+
// With explicit quantifiers, close the quantifier list
|
|
16958
|
+
if (this._explicitQuantifiers) {
|
|
16959
|
+
this._emit(this._subject, this.RDF_REST, this.RDF_NIL, this.QUANTIFIERS_GRAPH);
|
|
16960
|
+
this._subject = null;
|
|
16961
|
+
}
|
|
16962
|
+
// Read a dot
|
|
16963
|
+
this._readCallback = this._getContextEndReader();
|
|
16964
|
+
return this._readCallback(token);
|
|
16965
|
+
}
|
|
16966
|
+
}
|
|
16967
|
+
|
|
16968
|
+
// ### `_getPathReader` reads a potential path and then resumes with the given function
|
|
16969
|
+
_getPathReader(afterPath) {
|
|
16970
|
+
this._afterPath = afterPath;
|
|
16971
|
+
return this._readPath;
|
|
16972
|
+
}
|
|
16973
|
+
|
|
16974
|
+
// ### `_readPath` reads a potential path
|
|
16975
|
+
_readPath(token) {
|
|
16976
|
+
switch (token.type) {
|
|
16977
|
+
// Forward path
|
|
16978
|
+
case '!': return this._readForwardPath;
|
|
16979
|
+
// Backward path
|
|
16980
|
+
case '^': return this._readBackwardPath;
|
|
16981
|
+
// Not a path; resume reading where we left off
|
|
16982
|
+
default:
|
|
16983
|
+
const stack = this._contextStack, parent = stack.length && stack[stack.length - 1];
|
|
16984
|
+
// If we were reading a list item, we still need to output it
|
|
16985
|
+
if (parent && parent.type === 'item') {
|
|
16986
|
+
// The list item is the remaining subejct after reading the path
|
|
16987
|
+
const item = this._subject;
|
|
16988
|
+
// Switch back to the context of the list
|
|
16989
|
+
this._restoreContext();
|
|
16990
|
+
// Output the list item
|
|
16991
|
+
this._emit(this._subject, this.RDF_FIRST, item, this._graph);
|
|
16992
|
+
}
|
|
16993
|
+
return this._afterPath(token);
|
|
16994
|
+
}
|
|
16995
|
+
}
|
|
16996
|
+
|
|
16997
|
+
// ### `_readForwardPath` reads a '!' path
|
|
16998
|
+
_readForwardPath(token) {
|
|
16999
|
+
let subject, predicate;
|
|
17000
|
+
const object = this._blankNode();
|
|
17001
|
+
// The next token is the predicate
|
|
17002
|
+
if ((predicate = this._readEntity(token)) === undefined)
|
|
17003
|
+
return;
|
|
17004
|
+
// If we were reading a subject, replace the subject by the path's object
|
|
17005
|
+
if (this._predicate === null)
|
|
17006
|
+
subject = this._subject, this._subject = object;
|
|
17007
|
+
// If we were reading an object, replace the subject by the path's object
|
|
17008
|
+
else
|
|
17009
|
+
subject = this._object, this._object = object;
|
|
17010
|
+
// Emit the path's current quad and read its next section
|
|
17011
|
+
this._emit(subject, predicate, object, this._graph);
|
|
17012
|
+
return this._readPath;
|
|
17013
|
+
}
|
|
17014
|
+
|
|
17015
|
+
// ### `_readBackwardPath` reads a '^' path
|
|
17016
|
+
_readBackwardPath(token) {
|
|
17017
|
+
const subject = this._blankNode();
|
|
17018
|
+
let predicate, object;
|
|
17019
|
+
// The next token is the predicate
|
|
17020
|
+
if ((predicate = this._readEntity(token)) === undefined)
|
|
17021
|
+
return;
|
|
17022
|
+
// If we were reading a subject, replace the subject by the path's subject
|
|
17023
|
+
if (this._predicate === null)
|
|
17024
|
+
object = this._subject, this._subject = subject;
|
|
17025
|
+
// If we were reading an object, replace the subject by the path's subject
|
|
17026
|
+
else
|
|
17027
|
+
object = this._object, this._object = subject;
|
|
17028
|
+
// Emit the path's current quad and read its next section
|
|
17029
|
+
this._emit(subject, predicate, object, this._graph);
|
|
17030
|
+
return this._readPath;
|
|
17031
|
+
}
|
|
17032
|
+
|
|
17033
|
+
// ### `_readRDFStarTailOrGraph` reads the graph of a nested RDF* quad or the end of a nested RDF* triple
|
|
17034
|
+
_readRDFStarTailOrGraph(token) {
|
|
17035
|
+
if (token.type !== '>>') {
|
|
17036
|
+
// An entity means this is a quad (only allowed if not already inside a graph)
|
|
17037
|
+
if (this._supportsQuads && this._graph === null && (this._graph = this._readEntity(token)) !== undefined)
|
|
17038
|
+
return this._readRDFStarTail;
|
|
17039
|
+
return this._error(`Expected >> to follow "${this._object.id}"`, token);
|
|
17040
|
+
}
|
|
17041
|
+
return this._readRDFStarTail(token);
|
|
17042
|
+
}
|
|
17043
|
+
|
|
17044
|
+
// ### `_readRDFStarTail` reads the end of a nested RDF* triple
|
|
17045
|
+
_readRDFStarTail(token) {
|
|
17046
|
+
if (token.type !== '>>')
|
|
17047
|
+
return this._error(`Expected >> but got ${token.type}`, token);
|
|
17048
|
+
// Read the quad and restore the previous context
|
|
17049
|
+
const quad = this._quad(this._subject, this._predicate, this._object,
|
|
17050
|
+
this._graph || this.DEFAULTGRAPH);
|
|
17051
|
+
this._restoreContext();
|
|
17052
|
+
// If the triple was the subject, continue by reading the predicate.
|
|
17053
|
+
if (this._subject === null) {
|
|
17054
|
+
this._subject = quad;
|
|
17055
|
+
return this._readPredicate;
|
|
17056
|
+
}
|
|
17057
|
+
// If the triple was the object, read context end.
|
|
17058
|
+
else {
|
|
17059
|
+
this._object = quad;
|
|
17060
|
+
return this._getContextEndReader();
|
|
17061
|
+
}
|
|
17062
|
+
}
|
|
17063
|
+
|
|
17064
|
+
// ### `_getContextEndReader` gets the next reader function at the end of a context
|
|
17065
|
+
_getContextEndReader() {
|
|
17066
|
+
const contextStack = this._contextStack;
|
|
17067
|
+
if (!contextStack.length)
|
|
17068
|
+
return this._readPunctuation;
|
|
17069
|
+
|
|
17070
|
+
switch (contextStack[contextStack.length - 1].type) {
|
|
17071
|
+
case 'blank':
|
|
17072
|
+
return this._readBlankNodeTail;
|
|
17073
|
+
case 'list':
|
|
17074
|
+
return this._readListItem;
|
|
17075
|
+
case 'formula':
|
|
17076
|
+
return this._readFormulaTail;
|
|
17077
|
+
case '<<':
|
|
17078
|
+
return this._readRDFStarTailOrGraph;
|
|
17079
|
+
}
|
|
17080
|
+
}
|
|
17081
|
+
|
|
17082
|
+
// ### `_emit` sends a quad through the callback
|
|
17083
|
+
_emit(subject, predicate, object, graph) {
|
|
17084
|
+
this._callback(null, this._quad(subject, predicate, object, graph || this.DEFAULTGRAPH));
|
|
17085
|
+
}
|
|
17086
|
+
|
|
17087
|
+
// ### `_error` emits an error message through the callback
|
|
17088
|
+
_error(message, token) {
|
|
17089
|
+
const err = new Error(`${message} on line ${token.line}.`);
|
|
17090
|
+
err.context = {
|
|
17091
|
+
token: token,
|
|
17092
|
+
line: token.line,
|
|
17093
|
+
previousToken: this._lexer.previousToken,
|
|
17094
|
+
};
|
|
17095
|
+
this._callback(err);
|
|
17096
|
+
this._callback = noop;
|
|
17097
|
+
}
|
|
17098
|
+
|
|
17099
|
+
// ### `_resolveIRI` resolves an IRI against the base path
|
|
17100
|
+
_resolveIRI(iri) {
|
|
17101
|
+
return /^[a-z][a-z0-9+.-]*:/i.test(iri) ? iri : this._resolveRelativeIRI(iri);
|
|
17102
|
+
}
|
|
17103
|
+
|
|
17104
|
+
// ### `_resolveRelativeIRI` resolves an IRI against the base path,
|
|
17105
|
+
// assuming that a base path has been set and that the IRI is indeed relative
|
|
17106
|
+
_resolveRelativeIRI(iri) {
|
|
17107
|
+
// An empty relative IRI indicates the base IRI
|
|
17108
|
+
if (!iri.length)
|
|
17109
|
+
return this._base;
|
|
17110
|
+
// Decide resolving strategy based in the first character
|
|
17111
|
+
switch (iri[0]) {
|
|
17112
|
+
// Resolve relative fragment IRIs against the base IRI
|
|
17113
|
+
case '#': return this._base + iri;
|
|
17114
|
+
// Resolve relative query string IRIs by replacing the query string
|
|
17115
|
+
case '?': return this._base.replace(/(?:\?.*)?$/, iri);
|
|
17116
|
+
// Resolve root-relative IRIs at the root of the base IRI
|
|
17117
|
+
case '/':
|
|
17118
|
+
// Resolve scheme-relative IRIs to the scheme
|
|
17119
|
+
return (iri[1] === '/' ? this._baseScheme : this._baseRoot) + this._removeDotSegments(iri);
|
|
17120
|
+
// Resolve all other IRIs at the base IRI's path
|
|
17121
|
+
default:
|
|
17122
|
+
// Relative IRIs cannot contain a colon in the first path segment
|
|
17123
|
+
return (/^[^/:]*:/.test(iri)) ? null : this._removeDotSegments(this._basePath + iri);
|
|
17124
|
+
}
|
|
17125
|
+
}
|
|
17126
|
+
|
|
17127
|
+
// ### `_removeDotSegments` resolves './' and '../' path segments in an IRI as per RFC3986
|
|
17128
|
+
_removeDotSegments(iri) {
|
|
17129
|
+
// Don't modify the IRI if it does not contain any dot segments
|
|
17130
|
+
if (!/(^|\/)\.\.?($|[/#?])/.test(iri))
|
|
17131
|
+
return iri;
|
|
17132
|
+
|
|
17133
|
+
// Start with an imaginary slash before the IRI in order to resolve trailing './' and '../'
|
|
17134
|
+
const length = iri.length;
|
|
17135
|
+
let result = '', i = -1, pathStart = -1, segmentStart = 0, next = '/';
|
|
17136
|
+
|
|
17137
|
+
while (i < length) {
|
|
17138
|
+
switch (next) {
|
|
17139
|
+
// The path starts with the first slash after the authority
|
|
17140
|
+
case ':':
|
|
17141
|
+
if (pathStart < 0) {
|
|
17142
|
+
// Skip two slashes before the authority
|
|
17143
|
+
if (iri[++i] === '/' && iri[++i] === '/')
|
|
17144
|
+
// Skip to slash after the authority
|
|
17145
|
+
while ((pathStart = i + 1) < length && iri[pathStart] !== '/')
|
|
17146
|
+
i = pathStart;
|
|
17147
|
+
}
|
|
17148
|
+
break;
|
|
17149
|
+
// Don't modify a query string or fragment
|
|
17150
|
+
case '?':
|
|
17151
|
+
case '#':
|
|
17152
|
+
i = length;
|
|
17153
|
+
break;
|
|
17154
|
+
// Handle '/.' or '/..' path segments
|
|
17155
|
+
case '/':
|
|
17156
|
+
if (iri[i + 1] === '.') {
|
|
17157
|
+
next = iri[++i + 1];
|
|
17158
|
+
switch (next) {
|
|
17159
|
+
// Remove a '/.' segment
|
|
17160
|
+
case '/':
|
|
17161
|
+
result += iri.substring(segmentStart, i - 1);
|
|
17162
|
+
segmentStart = i + 1;
|
|
17163
|
+
break;
|
|
17164
|
+
// Remove a trailing '/.' segment
|
|
17165
|
+
case undefined:
|
|
17166
|
+
case '?':
|
|
17167
|
+
case '#':
|
|
17168
|
+
return result + iri.substring(segmentStart, i) + iri.substr(i + 1);
|
|
17169
|
+
// Remove a '/..' segment
|
|
17170
|
+
case '.':
|
|
17171
|
+
next = iri[++i + 1];
|
|
17172
|
+
if (next === undefined || next === '/' || next === '?' || next === '#') {
|
|
17173
|
+
result += iri.substring(segmentStart, i - 2);
|
|
17174
|
+
// Try to remove the parent path from result
|
|
17175
|
+
if ((segmentStart = result.lastIndexOf('/')) >= pathStart)
|
|
17176
|
+
result = result.substr(0, segmentStart);
|
|
17177
|
+
// Remove a trailing '/..' segment
|
|
17178
|
+
if (next !== '/')
|
|
17179
|
+
return `${result}/${iri.substr(i + 1)}`;
|
|
17180
|
+
segmentStart = i + 1;
|
|
17181
|
+
}
|
|
17182
|
+
}
|
|
17183
|
+
}
|
|
17184
|
+
}
|
|
17185
|
+
next = iri[++i];
|
|
17186
|
+
}
|
|
17187
|
+
return result + iri.substring(segmentStart);
|
|
17188
|
+
}
|
|
17189
|
+
|
|
17190
|
+
// ## Public methods
|
|
17191
|
+
|
|
17192
|
+
// ### `parse` parses the N3 input and emits each parsed quad through the callback
|
|
17193
|
+
parse(input, quadCallback, prefixCallback) {
|
|
17194
|
+
// The read callback is the next function to be executed when a token arrives.
|
|
17195
|
+
// We start reading in the top context.
|
|
17196
|
+
this._readCallback = this._readInTopContext;
|
|
17197
|
+
this._sparqlStyle = false;
|
|
17198
|
+
this._prefixes = Object.create(null);
|
|
17199
|
+
this._prefixes._ = this._blankNodePrefix ? this._blankNodePrefix.substr(2)
|
|
17200
|
+
: `b${blankNodePrefix++}_`;
|
|
17201
|
+
this._prefixCallback = prefixCallback || noop;
|
|
17202
|
+
this._inversePredicate = false;
|
|
17203
|
+
this._quantified = Object.create(null);
|
|
17204
|
+
|
|
17205
|
+
// Parse synchronously if no quad callback is given
|
|
17206
|
+
if (!quadCallback) {
|
|
17207
|
+
const quads = [];
|
|
17208
|
+
let error;
|
|
17209
|
+
this._callback = (e, t) => { e ? (error = e) : t && quads.push(t); };
|
|
17210
|
+
this._lexer.tokenize(input).every(token => {
|
|
17211
|
+
return this._readCallback = this._readCallback(token);
|
|
17212
|
+
});
|
|
17213
|
+
if (error) throw error;
|
|
17214
|
+
return quads;
|
|
17215
|
+
}
|
|
17216
|
+
|
|
17217
|
+
// Parse asynchronously otherwise, executing the read callback when a token arrives
|
|
17218
|
+
this._callback = quadCallback;
|
|
17219
|
+
this._lexer.tokenize(input, (error, token) => {
|
|
17220
|
+
if (error !== null)
|
|
17221
|
+
this._callback(error), this._callback = noop;
|
|
17222
|
+
else if (this._readCallback)
|
|
17223
|
+
this._readCallback = this._readCallback(token);
|
|
17224
|
+
});
|
|
17225
|
+
}
|
|
17226
|
+
}
|
|
17227
|
+
|
|
17228
|
+
// The empty function
|
|
17229
|
+
function noop() {}
|
|
17230
|
+
|
|
17231
|
+
// Initializes the parser with the given data factory
|
|
17232
|
+
function initDataFactory(parser, factory) {
|
|
17233
|
+
// Set factory methods
|
|
17234
|
+
const namedNode = factory.namedNode;
|
|
17235
|
+
parser._namedNode = namedNode;
|
|
17236
|
+
parser._blankNode = factory.blankNode;
|
|
17237
|
+
parser._literal = factory.literal;
|
|
17238
|
+
parser._variable = factory.variable;
|
|
17239
|
+
parser._quad = factory.quad;
|
|
17240
|
+
parser.DEFAULTGRAPH = factory.defaultGraph();
|
|
17241
|
+
|
|
17242
|
+
// Set common named nodes
|
|
17243
|
+
parser.RDF_FIRST = namedNode(_IRIs__WEBPACK_IMPORTED_MODULE_1__["default"].rdf.first);
|
|
17244
|
+
parser.RDF_REST = namedNode(_IRIs__WEBPACK_IMPORTED_MODULE_1__["default"].rdf.rest);
|
|
17245
|
+
parser.RDF_NIL = namedNode(_IRIs__WEBPACK_IMPORTED_MODULE_1__["default"].rdf.nil);
|
|
17246
|
+
parser.N3_FORALL = namedNode(_IRIs__WEBPACK_IMPORTED_MODULE_1__["default"].r.forAll);
|
|
17247
|
+
parser.N3_FORSOME = namedNode(_IRIs__WEBPACK_IMPORTED_MODULE_1__["default"].r.forSome);
|
|
17248
|
+
parser.ABBREVIATIONS = {
|
|
17249
|
+
'a': namedNode(_IRIs__WEBPACK_IMPORTED_MODULE_1__["default"].rdf.type),
|
|
17250
|
+
'=': namedNode(_IRIs__WEBPACK_IMPORTED_MODULE_1__["default"].owl.sameAs),
|
|
17251
|
+
'>': namedNode(_IRIs__WEBPACK_IMPORTED_MODULE_1__["default"].log.implies),
|
|
17252
|
+
};
|
|
17253
|
+
parser.QUANTIFIERS_GRAPH = namedNode('urn:n3:quantifiers');
|
|
17254
|
+
}
|
|
17255
|
+
initDataFactory(N3Parser.prototype, _N3DataFactory__WEBPACK_IMPORTED_MODULE_2__["default"]);
|
|
17256
|
+
|
|
17257
|
+
|
|
15656
17258
|
/***/ }),
|
|
15657
17259
|
|
|
15658
17260
|
/***/ "./node_modules/n3/src/N3Store.js":
|
|
@@ -16494,6 +18096,107 @@ class DatasetCoreAndReadableStream extends readable_stream__WEBPACK_IMPORTED_MOD
|
|
|
16494
18096
|
}
|
|
16495
18097
|
|
|
16496
18098
|
|
|
18099
|
+
/***/ }),
|
|
18100
|
+
|
|
18101
|
+
/***/ "./node_modules/n3/src/N3StreamParser.js":
|
|
18102
|
+
/*!***********************************************!*\
|
|
18103
|
+
!*** ./node_modules/n3/src/N3StreamParser.js ***!
|
|
18104
|
+
\***********************************************/
|
|
18105
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
18106
|
+
|
|
18107
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
18108
|
+
/* harmony export */ "default": () => (/* binding */ N3StreamParser)
|
|
18109
|
+
/* harmony export */ });
|
|
18110
|
+
/* harmony import */ var _N3Parser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./N3Parser */ "./node_modules/n3/src/N3Parser.js");
|
|
18111
|
+
/* harmony import */ var readable_stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! readable-stream */ "./node_modules/readable-stream/readable-browser.js");
|
|
18112
|
+
/* harmony import */ var readable_stream__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(readable_stream__WEBPACK_IMPORTED_MODULE_0__);
|
|
18113
|
+
// **N3StreamParser** parses a text stream into a quad stream.
|
|
18114
|
+
|
|
18115
|
+
|
|
18116
|
+
|
|
18117
|
+
// ## Constructor
|
|
18118
|
+
class N3StreamParser extends readable_stream__WEBPACK_IMPORTED_MODULE_0__.Transform {
|
|
18119
|
+
constructor(options) {
|
|
18120
|
+
super({ decodeStrings: true });
|
|
18121
|
+
this._readableState.objectMode = true;
|
|
18122
|
+
|
|
18123
|
+
// Set up parser with dummy stream to obtain `data` and `end` callbacks
|
|
18124
|
+
const parser = new _N3Parser__WEBPACK_IMPORTED_MODULE_1__["default"](options);
|
|
18125
|
+
let onData, onEnd;
|
|
18126
|
+
parser.parse({
|
|
18127
|
+
on: (event, callback) => {
|
|
18128
|
+
switch (event) {
|
|
18129
|
+
case 'data': onData = callback; break;
|
|
18130
|
+
case 'end': onEnd = callback; break;
|
|
18131
|
+
}
|
|
18132
|
+
},
|
|
18133
|
+
},
|
|
18134
|
+
// Handle quads by pushing them down the pipeline
|
|
18135
|
+
(error, quad) => { error && this.emit('error', error) || quad && this.push(quad); },
|
|
18136
|
+
// Emit prefixes through the `prefix` event
|
|
18137
|
+
(prefix, uri) => { this.emit('prefix', prefix, uri); }
|
|
18138
|
+
);
|
|
18139
|
+
|
|
18140
|
+
// Implement Transform methods through parser callbacks
|
|
18141
|
+
this._transform = (chunk, encoding, done) => { onData(chunk); done(); };
|
|
18142
|
+
this._flush = done => { onEnd(); done(); };
|
|
18143
|
+
}
|
|
18144
|
+
|
|
18145
|
+
// ### Parses a stream of strings
|
|
18146
|
+
import(stream) {
|
|
18147
|
+
stream.on('data', chunk => { this.write(chunk); });
|
|
18148
|
+
stream.on('end', () => { this.end(); });
|
|
18149
|
+
stream.on('error', error => { this.emit('error', error); });
|
|
18150
|
+
return this;
|
|
18151
|
+
}
|
|
18152
|
+
}
|
|
18153
|
+
|
|
18154
|
+
|
|
18155
|
+
/***/ }),
|
|
18156
|
+
|
|
18157
|
+
/***/ "./node_modules/n3/src/N3StreamWriter.js":
|
|
18158
|
+
/*!***********************************************!*\
|
|
18159
|
+
!*** ./node_modules/n3/src/N3StreamWriter.js ***!
|
|
18160
|
+
\***********************************************/
|
|
18161
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
18162
|
+
|
|
18163
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
18164
|
+
/* harmony export */ "default": () => (/* binding */ N3StreamWriter)
|
|
18165
|
+
/* harmony export */ });
|
|
18166
|
+
/* harmony import */ var readable_stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! readable-stream */ "./node_modules/readable-stream/readable-browser.js");
|
|
18167
|
+
/* harmony import */ var readable_stream__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(readable_stream__WEBPACK_IMPORTED_MODULE_0__);
|
|
18168
|
+
/* harmony import */ var _N3Writer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./N3Writer */ "./node_modules/n3/src/N3Writer.js");
|
|
18169
|
+
// **N3StreamWriter** serializes a quad stream into a text stream.
|
|
18170
|
+
|
|
18171
|
+
|
|
18172
|
+
|
|
18173
|
+
// ## Constructor
|
|
18174
|
+
class N3StreamWriter extends readable_stream__WEBPACK_IMPORTED_MODULE_0__.Transform {
|
|
18175
|
+
constructor(options) {
|
|
18176
|
+
super({ encoding: 'utf8', writableObjectMode: true });
|
|
18177
|
+
|
|
18178
|
+
// Set up writer with a dummy stream object
|
|
18179
|
+
const writer = this._writer = new _N3Writer__WEBPACK_IMPORTED_MODULE_1__["default"]({
|
|
18180
|
+
write: (quad, encoding, callback) => { this.push(quad); callback && callback(); },
|
|
18181
|
+
end: callback => { this.push(null); callback && callback(); },
|
|
18182
|
+
}, options);
|
|
18183
|
+
|
|
18184
|
+
// Implement Transform methods on top of writer
|
|
18185
|
+
this._transform = (quad, encoding, done) => { writer.addQuad(quad, done); };
|
|
18186
|
+
this._flush = done => { writer.end(done); };
|
|
18187
|
+
}
|
|
18188
|
+
|
|
18189
|
+
// ### Serializes a stream of quads
|
|
18190
|
+
import(stream) {
|
|
18191
|
+
stream.on('data', quad => { this.write(quad); });
|
|
18192
|
+
stream.on('end', () => { this.end(); });
|
|
18193
|
+
stream.on('error', error => { this.emit('error', error); });
|
|
18194
|
+
stream.on('prefix', (prefix, iri) => { this._writer.addPrefix(prefix, iri); });
|
|
18195
|
+
return this;
|
|
18196
|
+
}
|
|
18197
|
+
}
|
|
18198
|
+
|
|
18199
|
+
|
|
16497
18200
|
/***/ }),
|
|
16498
18201
|
|
|
16499
18202
|
/***/ "./node_modules/n3/src/N3Util.js":
|
|
@@ -16502,10 +18205,17 @@ class DatasetCoreAndReadableStream extends readable_stream__WEBPACK_IMPORTED_MOD
|
|
|
16502
18205
|
\***************************************/
|
|
16503
18206
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
16504
18207
|
|
|
18208
|
+
__webpack_require__.r(__webpack_exports__);
|
|
16505
18209
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
16506
|
-
/* harmony export */ "
|
|
18210
|
+
/* harmony export */ "inDefaultGraph": () => (/* binding */ inDefaultGraph),
|
|
18211
|
+
/* harmony export */ "isBlankNode": () => (/* binding */ isBlankNode),
|
|
18212
|
+
/* harmony export */ "isDefaultGraph": () => (/* binding */ isDefaultGraph),
|
|
18213
|
+
/* harmony export */ "isLiteral": () => (/* binding */ isLiteral),
|
|
18214
|
+
/* harmony export */ "isNamedNode": () => (/* binding */ isNamedNode),
|
|
18215
|
+
/* harmony export */ "isVariable": () => (/* binding */ isVariable),
|
|
18216
|
+
/* harmony export */ "prefix": () => (/* binding */ prefix),
|
|
18217
|
+
/* harmony export */ "prefixes": () => (/* binding */ prefixes)
|
|
16507
18218
|
/* harmony export */ });
|
|
16508
|
-
/* unused harmony exports isNamedNode, isBlankNode, isLiteral, isVariable, inDefaultGraph, prefix, prefixes */
|
|
16509
18219
|
/* harmony import */ var _N3DataFactory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./N3DataFactory */ "./node_modules/n3/src/N3DataFactory.js");
|
|
16510
18220
|
// **N3Util** provides N3 utility functions.
|
|
16511
18221
|
|
|
@@ -16990,6 +18700,102 @@ function escapeRegex(regex) {
|
|
|
16990
18700
|
}
|
|
16991
18701
|
|
|
16992
18702
|
|
|
18703
|
+
/***/ }),
|
|
18704
|
+
|
|
18705
|
+
/***/ "./node_modules/n3/src/index.js":
|
|
18706
|
+
/*!**************************************!*\
|
|
18707
|
+
!*** ./node_modules/n3/src/index.js ***!
|
|
18708
|
+
\**************************************/
|
|
18709
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
18710
|
+
|
|
18711
|
+
__webpack_require__.r(__webpack_exports__);
|
|
18712
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
18713
|
+
/* harmony export */ "BlankNode": () => (/* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.BlankNode),
|
|
18714
|
+
/* harmony export */ "DataFactory": () => (/* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__["default"]),
|
|
18715
|
+
/* harmony export */ "DefaultGraph": () => (/* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.DefaultGraph),
|
|
18716
|
+
/* harmony export */ "Lexer": () => (/* reexport safe */ _N3Lexer__WEBPACK_IMPORTED_MODULE_0__["default"]),
|
|
18717
|
+
/* harmony export */ "Literal": () => (/* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Literal),
|
|
18718
|
+
/* harmony export */ "NamedNode": () => (/* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.NamedNode),
|
|
18719
|
+
/* harmony export */ "Parser": () => (/* reexport safe */ _N3Parser__WEBPACK_IMPORTED_MODULE_1__["default"]),
|
|
18720
|
+
/* harmony export */ "Quad": () => (/* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Quad),
|
|
18721
|
+
/* harmony export */ "Store": () => (/* reexport safe */ _N3Store__WEBPACK_IMPORTED_MODULE_3__["default"]),
|
|
18722
|
+
/* harmony export */ "StreamParser": () => (/* reexport safe */ _N3StreamParser__WEBPACK_IMPORTED_MODULE_4__["default"]),
|
|
18723
|
+
/* harmony export */ "StreamWriter": () => (/* reexport safe */ _N3StreamWriter__WEBPACK_IMPORTED_MODULE_5__["default"]),
|
|
18724
|
+
/* harmony export */ "Term": () => (/* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Term),
|
|
18725
|
+
/* harmony export */ "Triple": () => (/* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Triple),
|
|
18726
|
+
/* harmony export */ "Util": () => (/* reexport module object */ _N3Util__WEBPACK_IMPORTED_MODULE_6__),
|
|
18727
|
+
/* harmony export */ "Variable": () => (/* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Variable),
|
|
18728
|
+
/* harmony export */ "Writer": () => (/* reexport safe */ _N3Writer__WEBPACK_IMPORTED_MODULE_2__["default"]),
|
|
18729
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
18730
|
+
/* harmony export */ "termFromId": () => (/* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.termFromId),
|
|
18731
|
+
/* harmony export */ "termToId": () => (/* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.termToId)
|
|
18732
|
+
/* harmony export */ });
|
|
18733
|
+
/* harmony import */ var _N3Lexer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./N3Lexer */ "./node_modules/n3/src/N3Lexer.js");
|
|
18734
|
+
/* harmony import */ var _N3Parser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./N3Parser */ "./node_modules/n3/src/N3Parser.js");
|
|
18735
|
+
/* harmony import */ var _N3Writer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./N3Writer */ "./node_modules/n3/src/N3Writer.js");
|
|
18736
|
+
/* harmony import */ var _N3Store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./N3Store */ "./node_modules/n3/src/N3Store.js");
|
|
18737
|
+
/* harmony import */ var _N3StreamParser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./N3StreamParser */ "./node_modules/n3/src/N3StreamParser.js");
|
|
18738
|
+
/* harmony import */ var _N3StreamWriter__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./N3StreamWriter */ "./node_modules/n3/src/N3StreamWriter.js");
|
|
18739
|
+
/* harmony import */ var _N3Util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./N3Util */ "./node_modules/n3/src/N3Util.js");
|
|
18740
|
+
/* harmony import */ var _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./N3DataFactory */ "./node_modules/n3/src/N3DataFactory.js");
|
|
18741
|
+
|
|
18742
|
+
|
|
18743
|
+
|
|
18744
|
+
|
|
18745
|
+
|
|
18746
|
+
|
|
18747
|
+
|
|
18748
|
+
|
|
18749
|
+
|
|
18750
|
+
|
|
18751
|
+
// Named exports
|
|
18752
|
+
|
|
18753
|
+
|
|
18754
|
+
// Export all named exports as a default object for backward compatibility
|
|
18755
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
|
18756
|
+
Lexer: _N3Lexer__WEBPACK_IMPORTED_MODULE_0__["default"],
|
|
18757
|
+
Parser: _N3Parser__WEBPACK_IMPORTED_MODULE_1__["default"],
|
|
18758
|
+
Writer: _N3Writer__WEBPACK_IMPORTED_MODULE_2__["default"],
|
|
18759
|
+
Store: _N3Store__WEBPACK_IMPORTED_MODULE_3__["default"],
|
|
18760
|
+
StreamParser: _N3StreamParser__WEBPACK_IMPORTED_MODULE_4__["default"],
|
|
18761
|
+
StreamWriter: _N3StreamWriter__WEBPACK_IMPORTED_MODULE_5__["default"],
|
|
18762
|
+
Util: _N3Util__WEBPACK_IMPORTED_MODULE_6__,
|
|
18763
|
+
|
|
18764
|
+
DataFactory: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__["default"],
|
|
18765
|
+
|
|
18766
|
+
Term: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Term,
|
|
18767
|
+
NamedNode: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.NamedNode,
|
|
18768
|
+
Literal: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Literal,
|
|
18769
|
+
BlankNode: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.BlankNode,
|
|
18770
|
+
Variable: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Variable,
|
|
18771
|
+
DefaultGraph: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.DefaultGraph,
|
|
18772
|
+
Quad: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Quad,
|
|
18773
|
+
Triple: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Triple,
|
|
18774
|
+
|
|
18775
|
+
termFromId: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.termFromId,
|
|
18776
|
+
termToId: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.termToId,
|
|
18777
|
+
});
|
|
18778
|
+
|
|
18779
|
+
|
|
18780
|
+
/***/ }),
|
|
18781
|
+
|
|
18782
|
+
/***/ "./node_modules/queue-microtask/index.js":
|
|
18783
|
+
/*!***********************************************!*\
|
|
18784
|
+
!*** ./node_modules/queue-microtask/index.js ***!
|
|
18785
|
+
\***********************************************/
|
|
18786
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
18787
|
+
|
|
18788
|
+
/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
18789
|
+
let promise
|
|
18790
|
+
|
|
18791
|
+
module.exports = typeof queueMicrotask === 'function'
|
|
18792
|
+
? queueMicrotask.bind(typeof window !== 'undefined' ? window : __webpack_require__.g)
|
|
18793
|
+
// reuse resolved promise, and allocate it lazily
|
|
18794
|
+
: cb => (promise || (promise = Promise.resolve()))
|
|
18795
|
+
.then(cb)
|
|
18796
|
+
.catch(err => setTimeout(() => { throw err }, 0))
|
|
18797
|
+
|
|
18798
|
+
|
|
16993
18799
|
/***/ }),
|
|
16994
18800
|
|
|
16995
18801
|
/***/ "./node_modules/readable-stream/errors-browser.js":
|
|
@@ -20797,21 +22603,26 @@ var __webpack_exports__ = {};
|
|
|
20797
22603
|
!*** ./dist/esm/index.serialization.js ***!
|
|
20798
22604
|
\*****************************************/
|
|
20799
22605
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
22606
|
+
/* harmony export */ "N3": () => (/* reexport module object */ n3__WEBPACK_IMPORTED_MODULE_2__),
|
|
20800
22607
|
/* harmony export */ "RDFSerializer": () => (/* reexport safe */ _rdf__WEBPACK_IMPORTED_MODULE_0__.RDFSerializer),
|
|
20801
22608
|
/* harmony export */ "SerializableNamedNode": () => (/* reexport safe */ _rdf__WEBPACK_IMPORTED_MODULE_0__.SerializableNamedNode),
|
|
20802
22609
|
/* harmony export */ "xsd": () => (/* reexport safe */ _decorators__WEBPACK_IMPORTED_MODULE_1__.xsd)
|
|
20803
22610
|
/* harmony export */ });
|
|
20804
22611
|
/* harmony import */ var _rdf__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./rdf */ "./dist/esm/rdf/index.js");
|
|
20805
22612
|
/* harmony import */ var _decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./decorators */ "./dist/esm/decorators/index.js");
|
|
22613
|
+
/* harmony import */ var n3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! n3 */ "./node_modules/n3/src/index.js");
|
|
22614
|
+
|
|
22615
|
+
|
|
20806
22616
|
|
|
20807
22617
|
|
|
20808
22618
|
|
|
20809
22619
|
//# sourceMappingURL=index.serialization.js.map
|
|
20810
22620
|
})();
|
|
20811
22621
|
|
|
22622
|
+
var __webpack_exports__N3 = __webpack_exports__.N3;
|
|
20812
22623
|
var __webpack_exports__RDFSerializer = __webpack_exports__.RDFSerializer;
|
|
20813
22624
|
var __webpack_exports__SerializableNamedNode = __webpack_exports__.SerializableNamedNode;
|
|
20814
22625
|
var __webpack_exports__xsd = __webpack_exports__.xsd;
|
|
20815
|
-
export { __webpack_exports__RDFSerializer as RDFSerializer, __webpack_exports__SerializableNamedNode as SerializableNamedNode, __webpack_exports__xsd as xsd };
|
|
22626
|
+
export { __webpack_exports__N3 as N3, __webpack_exports__RDFSerializer as RDFSerializer, __webpack_exports__SerializableNamedNode as SerializableNamedNode, __webpack_exports__xsd as xsd };
|
|
20816
22627
|
|
|
20817
22628
|
//# sourceMappingURL=openhps-rdf.serialization.es.js.map
|