rdflib 2.2.21 → 2.2.22

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 (106) hide show
  1. package/dist/rdflib.min.js +1 -1
  2. package/dist/rdflib.min.js.LICENSE.txt +9 -1
  3. package/dist/rdflib.min.js.map +1 -1
  4. package/esm/blank-node.js +61 -114
  5. package/esm/class-order.js +1 -1
  6. package/esm/collection.js +70 -128
  7. package/esm/convert.js +1 -2
  8. package/esm/default-graph.js +14 -48
  9. package/esm/empty.js +8 -39
  10. package/esm/factories/canonical-data-factory.js +33 -65
  11. package/esm/factories/extended-term-factory.js +18 -25
  12. package/esm/factories/factory-types.js +3 -2
  13. package/esm/factories/rdflib-data-factory.js +9 -19
  14. package/esm/fetcher.js +1341 -1854
  15. package/esm/formula.js +639 -846
  16. package/esm/index.js +40 -76
  17. package/esm/jsonldparser.js +24 -49
  18. package/esm/jsonparser.js +1 -8
  19. package/esm/lists.js +47 -110
  20. package/esm/literal.js +120 -189
  21. package/esm/log.js +7 -7
  22. package/esm/n3parser.js +1015 -1412
  23. package/esm/named-node.js +70 -119
  24. package/esm/namespace.js +2 -5
  25. package/esm/node-internal.js +73 -110
  26. package/esm/node.js +2 -7
  27. package/esm/parse.js +12 -19
  28. package/esm/patch-parser.js +10 -30
  29. package/esm/query-to-sparql.js +0 -18
  30. package/esm/query.js +63 -147
  31. package/esm/rdfaparser.js +794 -997
  32. package/esm/rdfxmlparser.js +347 -461
  33. package/esm/serialize.js +9 -27
  34. package/esm/serializer.js +820 -1049
  35. package/esm/sparql-to-query.js +44 -134
  36. package/esm/statement.js +54 -85
  37. package/esm/store.js +830 -1103
  38. package/esm/types.js +22 -21
  39. package/esm/update-manager.js +869 -1106
  40. package/esm/updates-via.js +104 -161
  41. package/esm/uri.js +9 -53
  42. package/esm/utils/default-graph-uri.js +3 -2
  43. package/esm/utils/termValue.js +0 -1
  44. package/esm/utils/terms.js +19 -21
  45. package/esm/utils-js.js +20 -61
  46. package/esm/utils.js +10 -21
  47. package/esm/variable.js +32 -78
  48. package/esm/xsd.js +2 -2
  49. package/lib/blank-node.js +60 -113
  50. package/lib/class-order.js +1 -2
  51. package/lib/collection.js +69 -131
  52. package/lib/convert.js +3 -9
  53. package/lib/default-graph.js +13 -52
  54. package/lib/empty.js +8 -43
  55. package/lib/factories/canonical-data-factory.js +35 -79
  56. package/lib/factories/extended-term-factory.js +18 -32
  57. package/lib/factories/factory-types.d.ts +6 -6
  58. package/lib/factories/factory-types.js +1 -4
  59. package/lib/factories/rdflib-data-factory.js +9 -23
  60. package/lib/fetcher.d.ts +6 -6
  61. package/lib/fetcher.js +1370 -1843
  62. package/lib/formula.js +640 -855
  63. package/lib/index.js +66 -152
  64. package/lib/jsonldparser.js +23 -53
  65. package/lib/jsonparser.js +1 -10
  66. package/lib/lists.js +55 -112
  67. package/lib/literal.js +120 -195
  68. package/lib/log.d.ts +0 -6
  69. package/lib/log.js +7 -8
  70. package/lib/n3parser.js +1030 -1436
  71. package/lib/named-node.js +69 -126
  72. package/lib/namespace.js +2 -7
  73. package/lib/node-internal.js +74 -107
  74. package/lib/node.js +2 -12
  75. package/lib/parse.d.ts +1 -1
  76. package/lib/parse.js +12 -32
  77. package/lib/patch-parser.js +11 -34
  78. package/lib/query-to-sparql.js +0 -23
  79. package/lib/query.js +62 -167
  80. package/lib/rdfaparser.js +796 -1009
  81. package/lib/rdfxmlparser.js +349 -466
  82. package/lib/serialize.js +11 -37
  83. package/lib/serializer.js +823 -1064
  84. package/lib/sparql-to-query.js +42 -167
  85. package/lib/statement.js +55 -91
  86. package/lib/store.d.ts +1 -1
  87. package/lib/store.js +850 -1112
  88. package/lib/tf-types.d.ts +4 -4
  89. package/lib/types.d.ts +8 -8
  90. package/lib/types.js +23 -23
  91. package/lib/update-manager.d.ts +1 -1
  92. package/lib/update-manager.js +865 -1103
  93. package/lib/updates-via.js +105 -164
  94. package/lib/uri.js +8 -61
  95. package/lib/utils/default-graph-uri.js +3 -5
  96. package/lib/utils/termValue.js +0 -2
  97. package/lib/utils/terms.js +19 -40
  98. package/lib/utils-js.js +23 -88
  99. package/lib/utils.js +10 -27
  100. package/lib/variable.js +34 -85
  101. package/lib/xsd-internal.js +0 -3
  102. package/lib/xsd.js +2 -6
  103. package/package.json +36 -36
  104. package/src/fetcher.ts +2 -2
  105. package/src/update-manager.ts +12 -7
  106. package/changes.txt +0 -59
package/esm/named-node.js CHANGED
@@ -1,154 +1,105 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
-
11
- 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; } }
12
-
13
2
  import ClassOrder from './class-order';
14
3
  import Node from './node-internal';
15
4
  import { NamedNodeTermType } from './types';
16
5
  import { termValue } from './utils/termValue';
17
6
  import { isTerm } from './utils/terms';
7
+
18
8
  /**
19
9
  * A named (IRI) RDF node
20
10
  */
21
-
22
- var NamedNode = /*#__PURE__*/function (_Node) {
23
- _inherits(NamedNode, _Node);
24
-
25
- var _super = _createSuper(NamedNode);
26
-
11
+ export default class NamedNode extends Node {
27
12
  /**
28
13
  * Create a named (IRI) RDF Node
29
14
  * @constructor
30
15
  * @param iri - The IRI for this node
31
16
  */
32
- function NamedNode(iri) {
33
- var _this;
34
-
35
- _classCallCheck(this, NamedNode);
36
-
37
- _this = _super.call(this, termValue(iri));
38
-
39
- _defineProperty(_assertThisInitialized(_this), "termType", NamedNodeTermType);
40
-
41
- _defineProperty(_assertThisInitialized(_this), "classOrder", ClassOrder.NamedNode);
42
-
43
- if (!_this.value) {
17
+ constructor(iri) {
18
+ super(termValue(iri));
19
+ _defineProperty(this, "termType", NamedNodeTermType);
20
+ _defineProperty(this, "classOrder", ClassOrder.NamedNode);
21
+ if (!this.value) {
44
22
  throw new Error('Missing IRI for NamedNode');
45
23
  }
46
-
47
- if (!_this.value.includes(':')) {
24
+ if (!this.value.includes(':')) {
48
25
  throw new Error('NamedNode IRI "' + iri + '" must be absolute.');
49
26
  }
50
-
51
- if (_this.value.includes(' ')) {
27
+ if (this.value.includes(' ')) {
52
28
  var message = 'Error: NamedNode IRI "' + iri + '" must not contain unencoded spaces.';
53
29
  throw new Error(message);
54
30
  }
55
-
56
- return _this;
57
31
  }
32
+
58
33
  /**
59
34
  * Returns an $rdf node for the containing directory, ending in slash.
60
35
  */
36
+ dir() {
37
+ var str = this.value.split('#')[0];
38
+ var p = str.slice(0, -1).lastIndexOf('/');
39
+ var q = str.indexOf('//');
40
+ if (q >= 0 && p < q + 2 || p < 0) return null;
41
+ return new NamedNode(str.slice(0, p + 1));
42
+ }
61
43
 
62
-
63
- _createClass(NamedNode, [{
64
- key: "dir",
65
- value: function dir() {
66
- var str = this.value.split('#')[0];
67
- var p = str.slice(0, -1).lastIndexOf('/');
68
- var q = str.indexOf('//');
69
- if (q >= 0 && p < q + 2 || p < 0) return null;
70
- return new NamedNode(str.slice(0, p + 1));
44
+ /**
45
+ * Returns an NN for the whole web site, ending in slash.
46
+ * Contrast with the "origin" which does NOT have a trailing slash
47
+ */
48
+ site() {
49
+ var str = this.value.split('#')[0];
50
+ var p = str.indexOf('//');
51
+ if (p < 0) throw new Error('This URI does not have a web site part (origin)');
52
+ var q = str.indexOf('/', p + 2);
53
+ if (q < 0) {
54
+ return new NamedNode(str.slice(0) + '/'); // Add slash to a bare origin
55
+ } else {
56
+ return new NamedNode(str.slice(0, q + 1));
71
57
  }
72
- /**
73
- * Returns an NN for the whole web site, ending in slash.
74
- * Contrast with the "origin" which does NOT have a trailing slash
75
- */
76
-
77
- }, {
78
- key: "site",
79
- value: function site() {
80
- var str = this.value.split('#')[0];
81
- var p = str.indexOf('//');
82
- if (p < 0) throw new Error('This URI does not have a web site part (origin)');
83
- var q = str.indexOf('/', p + 2);
58
+ }
84
59
 
85
- if (q < 0) {
86
- return new NamedNode(str.slice(0) + '/'); // Add slash to a bare origin
87
- } else {
88
- return new NamedNode(str.slice(0, q + 1));
89
- }
60
+ /**
61
+ * Creates the fetchable named node for the document.
62
+ * Removes everything from the # anchor tag.
63
+ */
64
+ doc() {
65
+ if (this.value.indexOf('#') < 0) {
66
+ return this;
67
+ } else {
68
+ return new NamedNode(this.value.split('#')[0]);
90
69
  }
91
- /**
92
- * Creates the fetchable named node for the document.
93
- * Removes everything from the # anchor tag.
94
- */
70
+ }
95
71
 
96
- }, {
97
- key: "doc",
98
- value: function doc() {
99
- if (this.value.indexOf('#') < 0) {
100
- return this;
101
- } else {
102
- return new NamedNode(this.value.split('#')[0]);
103
- }
104
- }
105
- /**
106
- * Returns the URI including <brackets>
107
- */
72
+ /**
73
+ * Returns the URI including <brackets>
74
+ */
75
+ toString() {
76
+ return '<' + this.value + '>';
77
+ }
108
78
 
109
- }, {
110
- key: "toString",
111
- value: function toString() {
112
- return '<' + this.value + '>';
113
- }
114
- /** The local identifier with the document */
79
+ /** The local identifier with the document */
80
+ id() {
81
+ return this.value.split('#')[1];
82
+ }
115
83
 
116
- }, {
117
- key: "id",
118
- value: function id() {
119
- return this.value.split('#')[1];
120
- }
121
- /** Alias for value, favored by Tim */
84
+ /** Alias for value, favored by Tim */
85
+ get uri() {
86
+ return this.value;
87
+ }
88
+ set uri(uri) {
89
+ this.value = uri;
90
+ }
122
91
 
123
- }, {
124
- key: "uri",
125
- get: function get() {
126
- return this.value;
127
- },
128
- set: function set(uri) {
129
- this.value = uri;
92
+ /**
93
+ * Creates a named node from the specified input value
94
+ * @param value - An input value
95
+ */
96
+ static fromValue(value) {
97
+ if (typeof value === 'undefined' || value === null) {
98
+ return value;
130
99
  }
131
- /**
132
- * Creates a named node from the specified input value
133
- * @param value - An input value
134
- */
135
-
136
- }], [{
137
- key: "fromValue",
138
- value: function fromValue(value) {
139
- if (typeof value === 'undefined' || value === null) {
140
- return value;
141
- }
142
-
143
- if (isTerm(value)) {
144
- return value;
145
- }
146
-
147
- return new NamedNode(value);
100
+ if (isTerm(value)) {
101
+ return value;
148
102
  }
149
- }]);
150
-
151
- return NamedNode;
152
- }(Node);
153
-
154
- export { NamedNode as default };
103
+ return new NamedNode(value);
104
+ }
105
+ }
package/esm/namespace.js CHANGED
@@ -1,15 +1,12 @@
1
1
  import RDFlibNamedNode from './named-node';
2
-
3
2
  /**
4
3
  * Gets a namespace for the specified namespace's URI
5
4
  * @param nsuri - The URI for the namespace
6
5
  * @param [factory] - The factory for creating named nodes with
7
6
  */
8
7
  export default function Namespace(nsuri, factory) {
9
- var dataFactory = factory || {
10
- namedNode: function namedNode(value) {
11
- return new RDFlibNamedNode(value);
12
- }
8
+ const dataFactory = factory || {
9
+ namedNode: value => new RDFlibNamedNode(value)
13
10
  };
14
11
  return function (ln) {
15
12
  return dataFactory.namedNode(nsuri + (ln || ''));
@@ -1,7 +1,4 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
-
5
2
  /**
6
3
  * The superclass of all RDF Statement objects, that is
7
4
  * NamedNode, Literal, BlankNode, etc.
@@ -10,8 +7,9 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
7
  * @link https://rdf.js.org/data-model-spec/#term-interface
11
8
  * @class Node
12
9
  */
13
- var Node = /*#__PURE__*/function () {
10
+ export default class Node {
14
11
  // Specified in './node.ts' to prevent circular dependency
12
+
15
13
  // Specified in './node.ts' to prevent circular dependency
16
14
 
17
15
  /** The type of node */
@@ -19,133 +17,98 @@ var Node = /*#__PURE__*/function () {
19
17
  /** The class order for this node */
20
18
 
21
19
  /** The node's value */
22
- function Node(value) {
23
- _classCallCheck(this, Node);
24
20
 
21
+ constructor(value) {
25
22
  _defineProperty(this, "termType", void 0);
26
-
27
23
  _defineProperty(this, "classOrder", void 0);
28
-
29
24
  _defineProperty(this, "value", void 0);
30
-
31
25
  this.value = value;
32
26
  }
27
+
33
28
  /**
34
29
  * Creates the substituted node for this one, according to the specified bindings
35
30
  * @param bindings - Bindings of identifiers to nodes
36
31
  */
32
+ substitute(bindings) {
33
+ console.log('@@@ node substitute' + this);
34
+ return this;
35
+ }
37
36
 
38
-
39
- _createClass(Node, [{
40
- key: "substitute",
41
- value: function substitute(bindings) {
42
- console.log('@@@ node substitute' + this);
43
- return this;
37
+ /**
38
+ * Compares this node with another
39
+ * @see {equals} to check if two nodes are equal
40
+ * @param other - The other node
41
+ */
42
+ compareTerm(other) {
43
+ if (this.classOrder < other.classOrder) {
44
+ return -1;
44
45
  }
45
- /**
46
- * Compares this node with another
47
- * @see {equals} to check if two nodes are equal
48
- * @param other - The other node
49
- */
50
-
51
- }, {
52
- key: "compareTerm",
53
- value: function compareTerm(other) {
54
- if (this.classOrder < other.classOrder) {
55
- return -1;
56
- }
57
-
58
- if (this.classOrder > other.classOrder) {
59
- return +1;
60
- }
61
-
62
- if (this.value < other.value) {
63
- return -1;
64
- }
65
-
66
- if (this.value > other.value) {
67
- return +1;
68
- }
69
-
70
- return 0;
46
+ if (this.classOrder > other.classOrder) {
47
+ return +1;
71
48
  }
72
- /**
73
- * Compares whether the two nodes are equal
74
- * @param other The other node
75
- */
76
-
77
- }, {
78
- key: "equals",
79
- value: function equals(other) {
80
- if (!other) {
81
- return false;
82
- }
83
-
84
- return this.termType === other.termType && this.value === other.value;
49
+ if (this.value < other.value) {
50
+ return -1;
85
51
  }
86
- /**
87
- * Creates a hash for this node
88
- * @deprecated use {rdfFactory.id} instead if possible
89
- */
90
-
91
- }, {
92
- key: "hashString",
93
- value: function hashString() {
94
- return this.toCanonical();
52
+ if (this.value > other.value) {
53
+ return +1;
95
54
  }
96
- /**
97
- * Compares whether this node is the same as the other one
98
- * @param other - Another node
99
- */
55
+ return 0;
56
+ }
100
57
 
101
- }, {
102
- key: "sameTerm",
103
- value: function sameTerm(other) {
104
- return this.equals(other);
58
+ /**
59
+ * Compares whether the two nodes are equal
60
+ * @param other The other node
61
+ */
62
+ equals(other) {
63
+ if (!other) {
64
+ return false;
105
65
  }
106
- /**
107
- * Creates a canonical string representation of this node
108
- */
66
+ return this.termType === other.termType && this.value === other.value;
67
+ }
109
68
 
110
- }, {
111
- key: "toCanonical",
112
- value: function toCanonical() {
113
- return this.toNT();
114
- }
115
- /**
116
- * Creates a n-triples string representation of this node
117
- */
69
+ /**
70
+ * Creates a hash for this node
71
+ * @deprecated use {rdfFactory.id} instead if possible
72
+ */
73
+ hashString() {
74
+ return this.toCanonical();
75
+ }
118
76
 
119
- }, {
120
- key: "toNT",
121
- value: function toNT() {
122
- return this.toString();
123
- }
124
- /**
125
- * Creates a n-quads string representation of this node
126
- */
77
+ /**
78
+ * Compares whether this node is the same as the other one
79
+ * @param other - Another node
80
+ */
81
+ sameTerm(other) {
82
+ return this.equals(other);
83
+ }
127
84
 
128
- }, {
129
- key: "toNQ",
130
- value: function toNQ() {
131
- return this.toNT();
132
- }
133
- /**
134
- * Creates a string representation of this node
135
- */
85
+ /**
86
+ * Creates a canonical string representation of this node
87
+ */
88
+ toCanonical() {
89
+ return this.toNT();
90
+ }
136
91
 
137
- }, {
138
- key: "toString",
139
- value: function toString() {
140
- throw new Error('Node.toString() is abstract - see the subclasses instead');
141
- }
142
- }]);
92
+ /**
93
+ * Creates a n-triples string representation of this node
94
+ */
95
+ toNT() {
96
+ return this.toString();
97
+ }
143
98
 
144
- return Node;
145
- }();
99
+ /**
100
+ * Creates a n-quads string representation of this node
101
+ */
102
+ toNQ() {
103
+ return this.toNT();
104
+ }
146
105
 
106
+ /**
107
+ * Creates a string representation of this node
108
+ */
109
+ toString() {
110
+ throw new Error('Node.toString() is abstract - see the subclasses instead');
111
+ }
112
+ }
147
113
  _defineProperty(Node, "fromValue", void 0);
148
-
149
- _defineProperty(Node, "toJS", void 0);
150
-
151
- export { Node as default };
114
+ _defineProperty(Node, "toJS", void 0);
package/esm/node.js CHANGED
@@ -4,7 +4,6 @@ import { fromValue } from './collection';
4
4
  import Node from './node-internal';
5
5
  import Namespace from './namespace';
6
6
  import { isCollection, isLiteral } from './utils/terms';
7
-
8
7
  /**
9
8
  * Creates an RDF Node from a native javascript value.
10
9
  * RDF Nodes are returned unchanged, undefined returned as itself.
@@ -15,32 +14,28 @@ import { isCollection, isLiteral } from './utils/terms';
15
14
  */
16
15
  Node.fromValue = fromValue;
17
16
  export default Node;
18
- var ns = {
17
+ const ns = {
19
18
  xsd: Namespace('http://www.w3.org/2001/XMLSchema#')
20
19
  };
20
+
21
21
  /**
22
22
  * Gets the javascript object equivalent to a node
23
23
  * @param term The RDF node
24
24
  */
25
-
26
25
  Node.toJS = function (term) {
27
26
  if (isCollection(term)) {
28
27
  return term.elements.map(Node.toJS); // Array node (not standard RDFJS)
29
28
  }
30
29
 
31
30
  if (!isLiteral(term)) return term;
32
-
33
31
  if (term.datatype.equals(ns.xsd('boolean'))) {
34
32
  return term.value === '1' || term.value === 'true';
35
33
  }
36
-
37
34
  if (term.datatype.equals(ns.xsd('dateTime')) || term.datatype.equals(ns.xsd('date'))) {
38
35
  return new Date(term.value);
39
36
  }
40
-
41
37
  if (term.datatype.equals(ns.xsd('integer')) || term.datatype.equals(ns.xsd('float')) || term.datatype.equals(ns.xsd('decimal'))) {
42
38
  return Number(term.value);
43
39
  }
44
-
45
40
  return term.value;
46
41
  };
package/esm/parse.js CHANGED
@@ -1,15 +1,13 @@
1
1
  import DataFactory from './factories/extended-term-factory';
2
- import jsonldParser from './jsonldparser'; // @ts-ignore is this injected?
3
-
2
+ import jsonldParser from './jsonldparser';
3
+ // @ts-ignore is this injected?
4
4
  import { Parser as N3jsParser } from 'n3'; // @@ Goal: remove this dependency
5
-
6
5
  import N3Parser from './n3parser';
7
6
  import { parseRDFaDOM } from './rdfaparser';
8
7
  import RDFParser from './rdfxmlparser';
9
8
  import sparqlUpdateParser from './patch-parser';
10
9
  import * as Util from './utils-js';
11
10
  import { TurtleContentType, N3ContentType, RDFXMLContentType, XHTMLContentType, HTMLContentType, SPARQLUpdateContentType, SPARQLUpdateSingleMatchContentType, JSONLDContentType, NQuadsContentType, NQuadsAltContentType } from './types';
12
-
13
11
  /**
14
12
  * Parse a string and put the result into the graph kb.
15
13
  * Normal method is sync.
@@ -22,11 +20,10 @@ import { TurtleContentType, N3ContentType, RDFXMLContentType, XHTMLContentType,
22
20
  * @param [callback] - The callback to call when the data has been loaded
23
21
  */
24
22
  export default function parse(str, kb, base) {
25
- var contentType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'text/turtle';
26
- var callback = arguments.length > 4 ? arguments[4] : undefined;
23
+ let contentType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'text/turtle';
24
+ let callback = arguments.length > 4 ? arguments[4] : undefined;
27
25
  contentType = contentType || TurtleContentType;
28
26
  contentType = contentType.split(';')[0];
29
-
30
27
  try {
31
28
  if (contentType === N3ContentType || contentType === TurtleContentType) {
32
29
  var p = N3Parser(kb, kb, base, base, null, null, '', null);
@@ -66,7 +63,6 @@ export default function parse(str, kb, base) {
66
63
  // @ts-ignore
67
64
  executeErrorCallback(e);
68
65
  }
69
-
70
66
  parse.handled = {
71
67
  'text/n3': true,
72
68
  'text/turtle': true,
@@ -79,7 +75,6 @@ export default function parse(str, kb, base) {
79
75
  'application/nquads': true,
80
76
  'application/n-quads': true
81
77
  };
82
-
83
78
  function executeCallback() {
84
79
  if (callback) {
85
80
  callback(null, kb);
@@ -87,17 +82,19 @@ export default function parse(str, kb, base) {
87
82
  return;
88
83
  }
89
84
  }
90
-
91
85
  function executeErrorCallback(e) {
92
- if ( // TODO: Always true, what is the right behavior
93
- contentType !== JSONLDContentType || // @ts-ignore always true?
94
- contentType !== NQuadsContentType || // @ts-ignore always true?
86
+ if (
87
+ // TODO: Always true, what is the right behavior
88
+ contentType !== JSONLDContentType ||
89
+ // @ts-ignore always true?
90
+ contentType !== NQuadsContentType ||
91
+ // @ts-ignore always true?
95
92
  contentType !== NQuadsAltContentType) {
96
93
  if (callback) {
97
94
  callback(e, kb);
98
95
  } else {
99
- var e2 = new Error('' + e + ' while trying to parse <' + base + '> as ' + contentType); //@ts-ignore .cause is not a default error property
100
-
96
+ let e2 = new Error('' + e + ' while trying to parse <' + base + '> as ' + contentType);
97
+ //@ts-ignore .cause is not a default error property
101
98
  e2.cause = e;
102
99
  throw e2;
103
100
  }
@@ -114,20 +111,16 @@ export default function parse(str, kb, base) {
114
111
  doc['@context']['@base'] = base
115
112
  }
116
113
  */
117
-
118
-
119
114
  function nquadCallback(err, nquads) {
120
115
  if (err) {
121
116
  callback(err, kb);
122
117
  }
123
-
124
118
  try {
125
119
  n3Parser.parse(nquads, tripleCallback);
126
120
  } catch (err) {
127
121
  callback(err, kb);
128
122
  }
129
123
  }
130
-
131
124
  function tripleCallback(err, triple) {
132
125
  if (triple) {
133
126
  kb.add(triple.subject, triple.predicate, triple.object, triple.graph);