rdflib 2.2.34 → 2.2.35-0ebb696c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/515.rdflib.min.js +3 -0
  2. package/dist/515.rdflib.min.js.map +1 -0
  3. package/dist/789.rdflib.min.js +1 -0
  4. package/dist/rdflib.min.js +1 -1
  5. package/dist/rdflib.min.js.LICENSE.txt +0 -2
  6. package/dist/rdflib.min.js.map +1 -1
  7. package/esm/blank-node.js +57 -85
  8. package/esm/class-order.js +1 -1
  9. package/esm/collection.js +70 -106
  10. package/esm/default-graph.js +13 -33
  11. package/esm/empty.js +8 -26
  12. package/esm/factories/canonical-data-factory.js +33 -30
  13. package/esm/factories/extended-term-factory.js +18 -14
  14. package/esm/factories/factory-types.js +1 -1
  15. package/esm/factories/rdflib-data-factory.js +9 -11
  16. package/esm/fetcher.js +1364 -1668
  17. package/esm/formula.js +631 -739
  18. package/esm/index.js +31 -51
  19. package/esm/jsonldparser.js +19 -26
  20. package/esm/jsonparser.js +1 -1
  21. package/esm/lists.js +41 -86
  22. package/esm/literal.js +120 -157
  23. package/esm/log.js +7 -7
  24. package/esm/n3parser.js +1008 -1090
  25. package/esm/named-node.js +69 -99
  26. package/esm/namespace.js +2 -4
  27. package/esm/node-internal.js +73 -97
  28. package/esm/node.js +1 -2
  29. package/esm/parse.js +3 -3
  30. package/esm/patch-parser.js +1 -2
  31. package/esm/query.js +15 -30
  32. package/esm/rdfaparser.js +775 -846
  33. package/esm/rdfxmlparser.js +348 -365
  34. package/esm/serialize.js +2 -3
  35. package/esm/serializer.js +834 -889
  36. package/esm/sparql-to-query.js +0 -2
  37. package/esm/statement.js +52 -72
  38. package/esm/store.js +852 -963
  39. package/esm/types.js +26 -21
  40. package/esm/update-manager.js +964 -1104
  41. package/esm/updates-via.js +104 -134
  42. package/esm/uri.js +3 -3
  43. package/esm/utils/default-graph-uri.js +2 -2
  44. package/esm/utils/terms.js +4 -5
  45. package/esm/utils-js.js +5 -6
  46. package/esm/utils.js +7 -6
  47. package/esm/variable.js +32 -58
  48. package/esm/xsd.js +2 -2
  49. package/lib/blank-node.js +56 -83
  50. package/lib/class-order.js +2 -3
  51. package/lib/collection.js +69 -104
  52. package/lib/default-graph.js +13 -32
  53. package/lib/empty.js +8 -25
  54. package/lib/factories/canonical-data-factory.js +36 -34
  55. package/lib/factories/extended-term-factory.js +19 -16
  56. package/lib/factories/factory-types.js +2 -3
  57. package/lib/factories/rdflib-data-factory.js +10 -13
  58. package/lib/fetcher.js +1394 -1693
  59. package/lib/formula.js +631 -738
  60. package/lib/index.js +66 -89
  61. package/lib/jsonldparser.js +21 -32
  62. package/lib/jsonparser.js +3 -4
  63. package/lib/lists.js +47 -87
  64. package/lib/literal.js +120 -156
  65. package/lib/log.js +8 -9
  66. package/lib/n3parser.js +1011 -1096
  67. package/lib/named-node.js +69 -98
  68. package/lib/namespace.js +2 -4
  69. package/lib/node-internal.js +72 -95
  70. package/lib/node.js +2 -4
  71. package/lib/parse.js +5 -6
  72. package/lib/patch-parser.js +1 -2
  73. package/lib/query.js +19 -32
  74. package/lib/rdfaparser.js +777 -849
  75. package/lib/rdfxmlparser.js +350 -366
  76. package/lib/serialize.js +2 -3
  77. package/lib/serializer.js +838 -892
  78. package/lib/sparql-to-query.js +0 -2
  79. package/lib/statement.js +54 -74
  80. package/lib/store.js +873 -978
  81. package/lib/types.js +22 -43
  82. package/lib/update-manager.js +973 -1111
  83. package/lib/updates-via.js +105 -134
  84. package/lib/uri.js +3 -3
  85. package/lib/utils/default-graph-uri.js +2 -4
  86. package/lib/utils/terms.js +4 -6
  87. package/lib/utils-js.js +11 -13
  88. package/lib/utils.js +6 -7
  89. package/lib/variable.js +34 -60
  90. package/lib/xsd-internal.js +2 -3
  91. package/lib/xsd.js +3 -4
  92. package/package.json +31 -31
  93. package/src/n3parser.js +1 -1
  94. package/src/rdfxmlparser.js +2 -1
  95. package/src/serializer.js +1 -1
  96. package/src/update-manager.ts +2 -1
  97. package/.babelrc +0 -20
  98. package/dist/670.rdflib.min.js +0 -1
  99. package/dist/730.rdflib.min.js +0 -3
  100. package/dist/730.rdflib.min.js.map +0 -1
  101. /package/dist/{730.rdflib.min.js.LICENSE.txt → 515.rdflib.min.js.LICENSE.txt} +0 -0
package/lib/named-node.js CHANGED
@@ -5,137 +5,108 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
9
  var _classOrder = _interopRequireDefault(require("./class-order"));
16
10
  var _nodeInternal = _interopRequireDefault(require("./node-internal"));
17
11
  var _types = require("./types");
18
12
  var _termValue = require("./utils/termValue");
19
13
  var _terms = require("./utils/terms");
20
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
21
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
22
14
  /**
23
15
  * A named (IRI) RDF node
24
16
  */
25
- var NamedNode = /*#__PURE__*/function (_Node) {
26
- (0, _inherits2.default)(NamedNode, _Node);
27
- var _super = _createSuper(NamedNode);
17
+ class NamedNode extends _nodeInternal.default {
28
18
  /**
29
19
  * Create a named (IRI) RDF Node
30
20
  * @constructor
31
21
  * @param iri - The IRI for this node
32
22
  */
33
- function NamedNode(iri) {
34
- var _this;
35
- (0, _classCallCheck2.default)(this, NamedNode);
36
- _this = _super.call(this, (0, _termValue.termValue)(iri));
37
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "termType", _types.NamedNodeTermType);
38
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "classOrder", _classOrder.default.NamedNode);
39
- if (!_this.value) {
23
+ constructor(iri) {
24
+ super((0, _termValue.termValue)(iri));
25
+ (0, _defineProperty2.default)(this, "termType", _types.NamedNodeTermType);
26
+ (0, _defineProperty2.default)(this, "classOrder", _classOrder.default.NamedNode);
27
+ if (!this.value) {
40
28
  throw new Error('Missing IRI for NamedNode');
41
29
  }
42
- if (!_this.value.includes(':')) {
30
+ if (!this.value.includes(':')) {
43
31
  throw new Error('NamedNode IRI "' + iri + '" must be absolute.');
44
32
  }
45
- if (_this.value.includes(' ')) {
33
+ if (this.value.includes(' ')) {
46
34
  var message = 'Error: NamedNode IRI "' + iri + '" must not contain unencoded spaces.';
47
35
  throw new Error(message);
48
36
  }
49
- return _this;
50
37
  }
51
38
 
52
39
  /**
53
40
  * Returns an $rdf node for the containing directory, ending in slash.
54
41
  */
55
- (0, _createClass2.default)(NamedNode, [{
56
- key: "dir",
57
- value: function dir() {
58
- var str = this.value.split('#')[0];
59
- var p = str.slice(0, -1).lastIndexOf('/');
60
- var q = str.indexOf('//');
61
- if (q >= 0 && p < q + 2 || p < 0) return null;
62
- return new NamedNode(str.slice(0, p + 1));
63
- }
42
+ dir() {
43
+ var str = this.value.split('#')[0];
44
+ var p = str.slice(0, -1).lastIndexOf('/');
45
+ var q = str.indexOf('//');
46
+ if (q >= 0 && p < q + 2 || p < 0) return null;
47
+ return new NamedNode(str.slice(0, p + 1));
48
+ }
64
49
 
65
- /**
66
- * Returns an NN for the whole web site, ending in slash.
67
- * Contrast with the "origin" which does NOT have a trailing slash
68
- */
69
- }, {
70
- key: "site",
71
- value: function site() {
72
- var str = this.value.split('#')[0];
73
- var p = str.indexOf('//');
74
- if (p < 0) throw new Error('This URI does not have a web site part (origin)');
75
- var q = str.indexOf('/', p + 2);
76
- if (q < 0) {
77
- return new NamedNode(str.slice(0) + '/'); // Add slash to a bare origin
78
- } else {
79
- return new NamedNode(str.slice(0, q + 1));
80
- }
50
+ /**
51
+ * Returns an NN for the whole web site, ending in slash.
52
+ * Contrast with the "origin" which does NOT have a trailing slash
53
+ */
54
+ site() {
55
+ var str = this.value.split('#')[0];
56
+ var p = str.indexOf('//');
57
+ if (p < 0) throw new Error('This URI does not have a web site part (origin)');
58
+ var q = str.indexOf('/', p + 2);
59
+ if (q < 0) {
60
+ return new NamedNode(str.slice(0) + '/'); // Add slash to a bare origin
61
+ } else {
62
+ return new NamedNode(str.slice(0, q + 1));
81
63
  }
64
+ }
82
65
 
83
- /**
84
- * Creates the fetchable named node for the document.
85
- * Removes everything from the # anchor tag.
86
- */
87
- }, {
88
- key: "doc",
89
- value: function doc() {
90
- if (this.value.indexOf('#') < 0) {
91
- return this;
92
- } else {
93
- return new NamedNode(this.value.split('#')[0]);
94
- }
66
+ /**
67
+ * Creates the fetchable named node for the document.
68
+ * Removes everything from the # anchor tag.
69
+ */
70
+ doc() {
71
+ if (this.value.indexOf('#') < 0) {
72
+ return this;
73
+ } else {
74
+ return new NamedNode(this.value.split('#')[0]);
95
75
  }
76
+ }
96
77
 
97
- /**
98
- * Returns the URI including <brackets>
99
- */
100
- }, {
101
- key: "toString",
102
- value: function toString() {
103
- return '<' + this.value + '>';
104
- }
78
+ /**
79
+ * Returns the URI including <brackets>
80
+ */
81
+ toString() {
82
+ return '<' + this.value + '>';
83
+ }
105
84
 
106
- /** The local identifier with the document */
107
- }, {
108
- key: "id",
109
- value: function id() {
110
- return this.value.split('#')[1];
111
- }
85
+ /** The local identifier with the document */
86
+ id() {
87
+ return this.value.split('#')[1];
88
+ }
112
89
 
113
- /** Alias for value, favored by Tim */
114
- }, {
115
- key: "uri",
116
- get: function get() {
117
- return this.value;
118
- },
119
- set: function set(uri) {
120
- this.value = uri;
121
- }
90
+ /** Alias for value, favored by Tim */
91
+ get uri() {
92
+ return this.value;
93
+ }
94
+ set uri(uri) {
95
+ this.value = uri;
96
+ }
122
97
 
123
- /**
124
- * Creates a named node from the specified input value
125
- * @param value - An input value
126
- */
127
- }], [{
128
- key: "fromValue",
129
- value: function fromValue(value) {
130
- if (typeof value === 'undefined' || value === null) {
131
- return value;
132
- }
133
- if ((0, _terms.isTerm)(value)) {
134
- return value;
135
- }
136
- return new NamedNode(value);
98
+ /**
99
+ * Creates a named node from the specified input value
100
+ * @param value - An input value
101
+ */
102
+ static fromValue(value) {
103
+ if (typeof value === 'undefined' || value === null) {
104
+ return value;
137
105
  }
138
- }]);
139
- return NamedNode;
140
- }(_nodeInternal.default);
106
+ if ((0, _terms.isTerm)(value)) {
107
+ return value;
108
+ }
109
+ return new NamedNode(value);
110
+ }
111
+ }
141
112
  exports.default = NamedNode;
package/lib/namespace.js CHANGED
@@ -12,10 +12,8 @@ var _namedNode = _interopRequireDefault(require("./named-node"));
12
12
  * @param [factory] - The factory for creating named nodes with
13
13
  */
14
14
  function Namespace(nsuri, factory) {
15
- var dataFactory = factory || {
16
- namedNode: function namedNode(value) {
17
- return new _namedNode.default(value);
18
- }
15
+ const dataFactory = factory || {
16
+ namedNode: value => new _namedNode.default(value)
19
17
  };
20
18
  return function (ln) {
21
19
  return dataFactory.namedNode(nsuri + (ln || ''));
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
9
  /**
12
10
  * The superclass of all RDF Statement objects, that is
@@ -16,9 +14,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
16
14
  * @link https://rdf.js.org/data-model-spec/#term-interface
17
15
  * @class Node
18
16
  */
19
- var Node = /*#__PURE__*/function () {
20
- function Node(value) {
21
- (0, _classCallCheck2.default)(this, Node);
17
+ class Node {
18
+ constructor(value) {
22
19
  /** The type of node */
23
20
  (0, _defineProperty2.default)(this, "termType", void 0);
24
21
  /** The class order for this node */
@@ -32,106 +29,86 @@ var Node = /*#__PURE__*/function () {
32
29
  * Creates the substituted node for this one, according to the specified bindings
33
30
  * @param bindings - Bindings of identifiers to nodes
34
31
  */
35
- (0, _createClass2.default)(Node, [{
36
- key: "substitute",
37
- value: function substitute(bindings) {
38
- return this;
39
- }
32
+ substitute(bindings) {
33
+ return this;
34
+ }
40
35
 
41
- /**
42
- * Compares this node with another
43
- * @see {equals} to check if two nodes are equal
44
- * @param other - The other node
45
- */
46
- }, {
47
- key: "compareTerm",
48
- value: function compareTerm(other) {
49
- if (this.classOrder < other.classOrder) {
50
- return -1;
51
- }
52
- if (this.classOrder > other.classOrder) {
53
- return +1;
54
- }
55
- if (this.value < other.value) {
56
- return -1;
57
- }
58
- if (this.value > other.value) {
59
- return +1;
60
- }
61
- return 0;
36
+ /**
37
+ * Compares this node with another
38
+ * @see {equals} to check if two nodes are equal
39
+ * @param other - The other node
40
+ */
41
+ compareTerm(other) {
42
+ if (this.classOrder < other.classOrder) {
43
+ return -1;
62
44
  }
63
-
64
- /**
65
- * Compares whether the two nodes are equal
66
- * @param other The other node
67
- */
68
- }, {
69
- key: "equals",
70
- value: function equals(other) {
71
- if (!other) {
72
- return false;
73
- }
74
- return this.termType === other.termType && this.value === other.value;
45
+ if (this.classOrder > other.classOrder) {
46
+ return +1;
75
47
  }
76
-
77
- /**
78
- * Creates a hash for this node
79
- * @deprecated use {rdfFactory.id} instead if possible
80
- */
81
- }, {
82
- key: "hashString",
83
- value: function hashString() {
84
- return this.toCanonical();
48
+ if (this.value < other.value) {
49
+ return -1;
85
50
  }
86
-
87
- /**
88
- * Compares whether this node is the same as the other one
89
- * @param other - Another node
90
- */
91
- }, {
92
- key: "sameTerm",
93
- value: function sameTerm(other) {
94
- return this.equals(other);
51
+ if (this.value > other.value) {
52
+ return +1;
95
53
  }
54
+ return 0;
55
+ }
96
56
 
97
- /**
98
- * Creates a canonical string representation of this node
99
- */
100
- }, {
101
- key: "toCanonical",
102
- value: function toCanonical() {
103
- return this.toNT();
57
+ /**
58
+ * Compares whether the two nodes are equal
59
+ * @param other The other node
60
+ */
61
+ equals(other) {
62
+ if (!other) {
63
+ return false;
104
64
  }
65
+ return this.termType === other.termType && this.value === other.value;
66
+ }
105
67
 
106
- /**
107
- * Creates a n-triples string representation of this node
108
- */
109
- }, {
110
- key: "toNT",
111
- value: function toNT() {
112
- return this.toString();
113
- }
68
+ /**
69
+ * Creates a hash for this node
70
+ * @deprecated use {rdfFactory.id} instead if possible
71
+ */
72
+ hashString() {
73
+ return this.toCanonical();
74
+ }
114
75
 
115
- /**
116
- * Creates a n-quads string representation of this node
117
- */
118
- }, {
119
- key: "toNQ",
120
- value: function toNQ() {
121
- return this.toNT();
122
- }
76
+ /**
77
+ * Compares whether this node is the same as the other one
78
+ * @param other - Another node
79
+ */
80
+ sameTerm(other) {
81
+ return this.equals(other);
82
+ }
123
83
 
124
- /**
125
- * Creates a string representation of this node
126
- */
127
- }, {
128
- key: "toString",
129
- value: function toString() {
130
- throw new Error('Node.toString() is abstract - see the subclasses instead');
131
- }
132
- }]);
133
- return Node;
134
- }();
84
+ /**
85
+ * Creates a canonical string representation of this node
86
+ */
87
+ toCanonical() {
88
+ return this.toNT();
89
+ }
90
+
91
+ /**
92
+ * Creates a n-triples string representation of this node
93
+ */
94
+ toNT() {
95
+ return this.toString();
96
+ }
97
+
98
+ /**
99
+ * Creates a n-quads string representation of this node
100
+ */
101
+ toNQ() {
102
+ return this.toNT();
103
+ }
104
+
105
+ /**
106
+ * Creates a string representation of this node
107
+ */
108
+ toString() {
109
+ throw new Error('Node.toString() is abstract - see the subclasses instead');
110
+ }
111
+ }
135
112
  exports.default = Node;
136
113
  // Specified in './node.ts' to prevent circular dependency
137
114
  (0, _defineProperty2.default)(Node, "fromValue", void 0);
package/lib/node.js CHANGED
@@ -21,9 +21,8 @@ var _terms = require("./utils/terms");
21
21
  * @return {Node|Collection}
22
22
  */
23
23
  _nodeInternal.default.fromValue = _collection.fromValue;
24
- var _default = _nodeInternal.default;
25
- exports.default = _default;
26
- var ns = {
24
+ var _default = exports.default = _nodeInternal.default;
25
+ const ns = {
27
26
  xsd: (0, _namespace.default)('http://www.w3.org/2001/XMLSchema#')
28
27
  };
29
28
 
@@ -35,7 +34,6 @@ _nodeInternal.default.toJS = function (term) {
35
34
  if ((0, _terms.isCollection)(term)) {
36
35
  return term.elements.map(_nodeInternal.default.toJS); // Array node (not standard RDFJS)
37
36
  }
38
-
39
37
  if (!(0, _terms.isLiteral)(term)) return term;
40
38
  if (term.datatype.equals(ns.xsd('boolean'))) {
41
39
  return term.value === '1' || term.value === 'true';
package/lib/parse.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -15,8 +14,8 @@ var _rdfxmlparser = _interopRequireDefault(require("./rdfxmlparser"));
15
14
  var _patchParser = _interopRequireDefault(require("./patch-parser"));
16
15
  var Util = _interopRequireWildcard(require("./utils-js"));
17
16
  var _types = require("./types");
18
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
18
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
19
  // @ts-ignore is this injected?
21
20
  // @@ Goal: remove this dependency
22
21
 
@@ -32,8 +31,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
32
31
  * @param [callback] - The callback to call when the data has been loaded
33
32
  */
34
33
  function parse(str, kb, base) {
35
- var contentType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'text/turtle';
36
- var callback = arguments.length > 4 ? arguments[4] : undefined;
34
+ let contentType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'text/turtle';
35
+ let callback = arguments.length > 4 ? arguments[4] : undefined;
37
36
  contentType = contentType || _types.TurtleContentType;
38
37
  contentType = contentType.split(';')[0];
39
38
  try {
@@ -105,7 +104,7 @@ function parse(str, kb, base) {
105
104
  if (callback) {
106
105
  callback(e, kb);
107
106
  } else {
108
- var e2 = new Error('' + e + ' while trying to parse <' + base + '> as ' + contentType);
107
+ let e2 = new Error('' + e + ' while trying to parse <' + base + '> as ' + contentType);
109
108
  //@ts-ignore .cause is not a default error property
110
109
  e2.cause = e;
111
110
  throw e2;
@@ -21,7 +21,7 @@ function sparqlUpdateParser(str, kb, base) {
21
21
  var SQNS = (0, _namespace.default)('http://www.w3.org/ns/pim/patch#');
22
22
  var p = (0, _n3parser.default)(kb, kb, base, base, null, null, '', null);
23
23
  var clauses = {};
24
- var badSyntax = function badSyntax(uri, lines, str, i, why) {
24
+ var badSyntax = function (uri, lines, str, i, why) {
25
25
  return 'Line ' + (lines + 1) + ' of <' + uri + '>: Bad syntax:\n ' + why + '\n at: "' + str.slice(i, i + 30) + '"';
26
26
  };
27
27
 
@@ -47,7 +47,6 @@ function sparqlUpdateParser(str, kb, base) {
47
47
  if (i < 0) {
48
48
  return clauses; // Allow end in a
49
49
  }
50
-
51
50
  j = i;
52
51
  }
53
52
  var found = false;