rdflib 2.2.22-2f49e8ef → 2.2.22-53d65d90

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/rdflib.min.js +1 -1
  2. package/dist/rdflib.min.js.LICENSE.txt +4 -0
  3. package/dist/rdflib.min.js.map +1 -1
  4. package/esm/blank-node.js +90 -61
  5. package/esm/class-order.js +1 -1
  6. package/esm/collection.js +106 -70
  7. package/esm/default-graph.js +33 -13
  8. package/esm/empty.js +26 -8
  9. package/esm/factories/canonical-data-factory.js +30 -33
  10. package/esm/factories/extended-term-factory.js +14 -18
  11. package/esm/factories/factory-types.js +1 -1
  12. package/esm/factories/rdflib-data-factory.js +11 -9
  13. package/esm/fetcher.js +1644 -1355
  14. package/esm/formula.js +740 -632
  15. package/esm/index.js +52 -33
  16. package/esm/jsonldparser.js +35 -19
  17. package/esm/jsonparser.js +1 -1
  18. package/esm/lists.js +86 -38
  19. package/esm/literal.js +157 -120
  20. package/esm/log.js +7 -7
  21. package/esm/n3parser.js +1085 -1008
  22. package/esm/named-node.js +99 -69
  23. package/esm/namespace.js +4 -2
  24. package/esm/node-internal.js +98 -74
  25. package/esm/node.js +1 -1
  26. package/esm/parse.js +3 -3
  27. package/esm/patch-parser.js +1 -1
  28. package/esm/query.js +16 -15
  29. package/esm/rdfaparser.js +846 -781
  30. package/esm/rdfxmlparser.js +365 -348
  31. package/esm/serialize.js +4 -11
  32. package/esm/serializer.js +886 -821
  33. package/esm/statement.js +72 -52
  34. package/esm/store.js +924 -822
  35. package/esm/types.js +21 -21
  36. package/esm/update-manager.js +983 -882
  37. package/esm/updates-via.js +134 -104
  38. package/esm/uri.js +3 -3
  39. package/esm/utils/default-graph-uri.js +2 -2
  40. package/esm/utils/terms.js +5 -4
  41. package/esm/utils-js.js +5 -5
  42. package/esm/utils.js +6 -6
  43. package/esm/variable.js +58 -32
  44. package/esm/xsd.js +2 -2
  45. package/lib/blank-node.js +88 -60
  46. package/lib/class-order.js +1 -1
  47. package/lib/collection.js +104 -69
  48. package/lib/default-graph.js +32 -13
  49. package/lib/empty.js +25 -8
  50. package/lib/factories/canonical-data-factory.js +32 -35
  51. package/lib/factories/extended-term-factory.js +14 -18
  52. package/lib/factories/factory-types.js +1 -1
  53. package/lib/factories/rdflib-data-factory.js +11 -9
  54. package/lib/fetcher.js +1646 -1385
  55. package/lib/formula.d.ts +1 -1
  56. package/lib/formula.js +739 -632
  57. package/lib/index.d.ts +1 -2
  58. package/lib/index.js +88 -70
  59. package/lib/jsonldparser.js +35 -19
  60. package/lib/jsonparser.js +1 -1
  61. package/lib/lists.js +86 -54
  62. package/lib/literal.js +156 -120
  63. package/lib/log.js +7 -7
  64. package/lib/n3parser.js +1089 -1010
  65. package/lib/named-node.js +98 -69
  66. package/lib/namespace.js +4 -2
  67. package/lib/node-internal.js +96 -73
  68. package/lib/node.js +1 -1
  69. package/lib/parse.js +6 -5
  70. package/lib/patch-parser.js +1 -1
  71. package/lib/query.js +18 -19
  72. package/lib/rdfaparser.js +848 -783
  73. package/lib/rdfxmlparser.js +366 -350
  74. package/lib/serialize.d.ts +1 -1
  75. package/lib/serialize.js +4 -13
  76. package/lib/serializer.d.ts +1 -0
  77. package/lib/serializer.js +890 -825
  78. package/lib/statement.js +74 -54
  79. package/lib/store.d.ts +1 -1
  80. package/lib/store.js +926 -844
  81. package/lib/types.js +21 -21
  82. package/lib/update-manager.d.ts +1 -1
  83. package/lib/update-manager.js +959 -865
  84. package/lib/updates-via.js +134 -105
  85. package/lib/uri.js +3 -3
  86. package/lib/utils/default-graph-uri.js +2 -2
  87. package/lib/utils/terms.js +6 -4
  88. package/lib/utils-js.js +9 -8
  89. package/lib/utils.js +6 -6
  90. package/lib/variable.js +60 -34
  91. package/lib/xsd.js +2 -2
  92. package/package.json +9 -8
  93. package/src/index.ts +0 -2
  94. package/src/jsonldparser.js +13 -4
  95. package/src/serialize.ts +4 -11
  96. package/src/serializer.js +24 -0
  97. package/src/update-manager.ts +8 -2
  98. package/esm/convert.js +0 -60
  99. package/lib/convert.d.ts +0 -2
  100. package/lib/convert.js +0 -71
  101. package/src/convert.js +0 -70
package/lib/named-node.js CHANGED
@@ -5,108 +5,137 @@ 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"));
8
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
15
  var _classOrder = _interopRequireDefault(require("./class-order"));
10
16
  var _nodeInternal = _interopRequireDefault(require("./node-internal"));
11
17
  var _types = require("./types");
12
18
  var _termValue = require("./utils/termValue");
13
19
  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; } }
14
22
  /**
15
23
  * A named (IRI) RDF node
16
24
  */
17
- class NamedNode extends _nodeInternal.default {
25
+ var NamedNode = /*#__PURE__*/function (_Node) {
26
+ (0, _inherits2.default)(NamedNode, _Node);
27
+ var _super = _createSuper(NamedNode);
18
28
  /**
19
29
  * Create a named (IRI) RDF Node
20
30
  * @constructor
21
31
  * @param iri - The IRI for this node
22
32
  */
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) {
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) {
28
40
  throw new Error('Missing IRI for NamedNode');
29
41
  }
30
- if (!this.value.includes(':')) {
42
+ if (!_this.value.includes(':')) {
31
43
  throw new Error('NamedNode IRI "' + iri + '" must be absolute.');
32
44
  }
33
- if (this.value.includes(' ')) {
45
+ if (_this.value.includes(' ')) {
34
46
  var message = 'Error: NamedNode IRI "' + iri + '" must not contain unencoded spaces.';
35
47
  throw new Error(message);
36
48
  }
49
+ return _this;
37
50
  }
38
51
 
39
52
  /**
40
53
  * Returns an $rdf node for the containing directory, ending in slash.
41
54
  */
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
- }
49
-
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));
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
63
  }
64
- }
65
64
 
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]);
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
+ }
75
81
  }
76
- }
77
82
 
78
- /**
79
- * Returns the URI including <brackets>
80
- */
81
- toString() {
82
- return '<' + this.value + '>';
83
- }
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
+ }
95
+ }
84
96
 
85
- /** The local identifier with the document */
86
- id() {
87
- return this.value.split('#')[1];
88
- }
97
+ /**
98
+ * Returns the URI including <brackets>
99
+ */
100
+ }, {
101
+ key: "toString",
102
+ value: function toString() {
103
+ return '<' + this.value + '>';
104
+ }
89
105
 
90
- /** Alias for value, favored by Tim */
91
- get uri() {
92
- return this.value;
93
- }
94
- set uri(uri) {
95
- this.value = uri;
96
- }
106
+ /** The local identifier with the document */
107
+ }, {
108
+ key: "id",
109
+ value: function id() {
110
+ return this.value.split('#')[1];
111
+ }
97
112
 
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;
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;
105
121
  }
106
- if ((0, _terms.isTerm)(value)) {
107
- return value;
122
+
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);
108
137
  }
109
- return new NamedNode(value);
110
- }
111
- }
138
+ }]);
139
+ return NamedNode;
140
+ }(_nodeInternal.default);
112
141
  exports.default = NamedNode;
package/lib/namespace.js CHANGED
@@ -12,8 +12,10 @@ 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
- const dataFactory = factory || {
16
- namedNode: value => new _namedNode.default(value)
15
+ var dataFactory = factory || {
16
+ namedNode: function namedNode(value) {
17
+ return new _namedNode.default(value);
18
+ }
17
19
  };
18
20
  return function (ln) {
19
21
  return dataFactory.namedNode(nsuri + (ln || ''));
@@ -5,6 +5,8 @@ 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"));
8
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
11
  /**
10
12
  * The superclass of all RDF Statement objects, that is
@@ -14,7 +16,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
14
16
  * @link https://rdf.js.org/data-model-spec/#term-interface
15
17
  * @class Node
16
18
  */
17
- class Node {
19
+ var Node = /*#__PURE__*/function () {
18
20
  // Specified in './node.ts' to prevent circular dependency
19
21
 
20
22
  // Specified in './node.ts' to prevent circular dependency
@@ -25,7 +27,8 @@ class Node {
25
27
 
26
28
  /** The node's value */
27
29
 
28
- constructor(value) {
30
+ function Node(value) {
31
+ (0, _classCallCheck2.default)(this, Node);
29
32
  (0, _defineProperty2.default)(this, "termType", void 0);
30
33
  (0, _defineProperty2.default)(this, "classOrder", void 0);
31
34
  (0, _defineProperty2.default)(this, "value", void 0);
@@ -36,87 +39,107 @@ class Node {
36
39
  * Creates the substituted node for this one, according to the specified bindings
37
40
  * @param bindings - Bindings of identifiers to nodes
38
41
  */
39
- substitute(bindings) {
40
- console.log('@@@ node substitute' + this);
41
- return this;
42
- }
43
-
44
- /**
45
- * Compares this node with another
46
- * @see {equals} to check if two nodes are equal
47
- * @param other - The other node
48
- */
49
- compareTerm(other) {
50
- if (this.classOrder < other.classOrder) {
51
- return -1;
52
- }
53
- if (this.classOrder > other.classOrder) {
54
- return +1;
42
+ (0, _createClass2.default)(Node, [{
43
+ key: "substitute",
44
+ value: function substitute(bindings) {
45
+ console.log('@@@ node substitute' + this);
46
+ return this;
55
47
  }
56
- if (this.value < other.value) {
57
- return -1;
58
- }
59
- if (this.value > other.value) {
60
- return +1;
48
+
49
+ /**
50
+ * Compares this node with another
51
+ * @see {equals} to check if two nodes are equal
52
+ * @param other - The other node
53
+ */
54
+ }, {
55
+ key: "compareTerm",
56
+ value: function compareTerm(other) {
57
+ if (this.classOrder < other.classOrder) {
58
+ return -1;
59
+ }
60
+ if (this.classOrder > other.classOrder) {
61
+ return +1;
62
+ }
63
+ if (this.value < other.value) {
64
+ return -1;
65
+ }
66
+ if (this.value > other.value) {
67
+ return +1;
68
+ }
69
+ return 0;
61
70
  }
62
- return 0;
63
- }
64
71
 
65
- /**
66
- * Compares whether the two nodes are equal
67
- * @param other The other node
68
- */
69
- equals(other) {
70
- if (!other) {
71
- return false;
72
+ /**
73
+ * Compares whether the two nodes are equal
74
+ * @param other The other node
75
+ */
76
+ }, {
77
+ key: "equals",
78
+ value: function equals(other) {
79
+ if (!other) {
80
+ return false;
81
+ }
82
+ return this.termType === other.termType && this.value === other.value;
72
83
  }
73
- return this.termType === other.termType && this.value === other.value;
74
- }
75
84
 
76
- /**
77
- * Creates a hash for this node
78
- * @deprecated use {rdfFactory.id} instead if possible
79
- */
80
- hashString() {
81
- return this.toCanonical();
82
- }
85
+ /**
86
+ * Creates a hash for this node
87
+ * @deprecated use {rdfFactory.id} instead if possible
88
+ */
89
+ }, {
90
+ key: "hashString",
91
+ value: function hashString() {
92
+ return this.toCanonical();
93
+ }
83
94
 
84
- /**
85
- * Compares whether this node is the same as the other one
86
- * @param other - Another node
87
- */
88
- sameTerm(other) {
89
- return this.equals(other);
90
- }
95
+ /**
96
+ * Compares whether this node is the same as the other one
97
+ * @param other - Another node
98
+ */
99
+ }, {
100
+ key: "sameTerm",
101
+ value: function sameTerm(other) {
102
+ return this.equals(other);
103
+ }
91
104
 
92
- /**
93
- * Creates a canonical string representation of this node
94
- */
95
- toCanonical() {
96
- return this.toNT();
97
- }
105
+ /**
106
+ * Creates a canonical string representation of this node
107
+ */
108
+ }, {
109
+ key: "toCanonical",
110
+ value: function toCanonical() {
111
+ return this.toNT();
112
+ }
98
113
 
99
- /**
100
- * Creates a n-triples string representation of this node
101
- */
102
- toNT() {
103
- return this.toString();
104
- }
114
+ /**
115
+ * Creates a n-triples string representation of this node
116
+ */
117
+ }, {
118
+ key: "toNT",
119
+ value: function toNT() {
120
+ return this.toString();
121
+ }
105
122
 
106
- /**
107
- * Creates a n-quads string representation of this node
108
- */
109
- toNQ() {
110
- return this.toNT();
111
- }
123
+ /**
124
+ * Creates a n-quads string representation of this node
125
+ */
126
+ }, {
127
+ key: "toNQ",
128
+ value: function toNQ() {
129
+ return this.toNT();
130
+ }
112
131
 
113
- /**
114
- * Creates a string representation of this node
115
- */
116
- toString() {
117
- throw new Error('Node.toString() is abstract - see the subclasses instead');
118
- }
119
- }
132
+ /**
133
+ * Creates a string representation of this node
134
+ */
135
+ }, {
136
+ key: "toString",
137
+ value: function toString() {
138
+ throw new Error('Node.toString() is abstract - see the subclasses instead');
139
+ }
140
+ }]);
141
+ return Node;
142
+ }();
120
143
  exports.default = Node;
121
144
  (0, _defineProperty2.default)(Node, "fromValue", void 0);
122
145
  (0, _defineProperty2.default)(Node, "toJS", void 0);
package/lib/node.js CHANGED
@@ -23,7 +23,7 @@ var _terms = require("./utils/terms");
23
23
  _nodeInternal.default.fromValue = _collection.fromValue;
24
24
  var _default = _nodeInternal.default;
25
25
  exports.default = _default;
26
- const ns = {
26
+ var ns = {
27
27
  xsd: (0, _namespace.default)('http://www.w3.org/2001/XMLSchema#')
28
28
  };
29
29
 
package/lib/parse.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
@@ -14,8 +15,8 @@ var _rdfxmlparser = _interopRequireDefault(require("./rdfxmlparser"));
14
15
  var _patchParser = _interopRequireDefault(require("./patch-parser"));
15
16
  var Util = _interopRequireWildcard(require("./utils-js"));
16
17
  var _types = require("./types");
17
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
- 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; }
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; }
19
20
  // @ts-ignore is this injected?
20
21
  // @@ Goal: remove this dependency
21
22
 
@@ -31,8 +32,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
31
32
  * @param [callback] - The callback to call when the data has been loaded
32
33
  */
33
34
  function parse(str, kb, base) {
34
- let contentType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'text/turtle';
35
- let callback = arguments.length > 4 ? arguments[4] : undefined;
35
+ var contentType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'text/turtle';
36
+ var callback = arguments.length > 4 ? arguments[4] : undefined;
36
37
  contentType = contentType || _types.TurtleContentType;
37
38
  contentType = contentType.split(';')[0];
38
39
  try {
@@ -104,7 +105,7 @@ function parse(str, kb, base) {
104
105
  if (callback) {
105
106
  callback(e, kb);
106
107
  } else {
107
- let e2 = new Error('' + e + ' while trying to parse <' + base + '> as ' + contentType);
108
+ var e2 = new Error('' + e + ' while trying to parse <' + base + '> as ' + contentType);
108
109
  //@ts-ignore .cause is not a default error property
109
110
  e2.cause = e;
110
111
  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 (uri, lines, str, i, why) {
24
+ var badSyntax = function badSyntax(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
 
package/lib/query.js CHANGED
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.Query = void 0;
8
8
  exports.indexedFormulaQuery = indexedFormulaQuery;
9
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
11
  var _store = _interopRequireDefault(require("./store"));
10
12
  var _defaultGraphUri = require("./utils/default-graph-uri");
11
13
  var _log = _interopRequireDefault(require("./log"));
@@ -21,27 +23,24 @@ var _uri = require("./uri");
21
23
  // Here we introduce for the first time a subclass of term: variable.
22
24
  //
23
25
  // SVN ID: $Id: query.js 25116 2008-11-15 16:13:48Z timbl $
24
-
25
26
  // Variable
26
27
  //
27
28
  // Compare with BlankNode. They are similar, but a variable
28
29
  // stands for something whose value is to be returned.
29
30
  // Also, users name variables and want the same name back when stuff is printed
30
- /* jsl:option explicit */ // Turn on JavaScriptLint variable declaration checking
31
-
31
+ /* jsl:option explicit */
32
+ // Turn on JavaScriptLint variable declaration checking
32
33
  /**
33
34
  * Query class, for tracking queries the user has in the UI.
34
35
  */
35
- class Query {
36
- constructor(name, id) {
37
- this.pat = new _store.default(); // The pattern to search for
38
- this.vars = []; // Used by UI code but not in query.js
39
- // this.orderBy = [] // Not used yet
40
- this.name = name;
41
- this.id = id;
42
- }
43
- }
44
-
36
+ var Query = /*#__PURE__*/(0, _createClass2.default)(function Query(name, id) {
37
+ (0, _classCallCheck2.default)(this, Query);
38
+ this.pat = new _store.default(); // The pattern to search for
39
+ this.vars = []; // Used by UI code but not in query.js
40
+ // this.orderBy = [] // Not used yet
41
+ this.name = name;
42
+ this.id = id;
43
+ });
45
44
  /**
46
45
  * This function will match a pattern to the current Store
47
46
  *
@@ -270,7 +269,7 @@ function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
270
269
  };
271
270
 
272
271
  // An optional branch hoards its results.
273
- var OptionalBranch = function (junction) {
272
+ var OptionalBranch = function OptionalBranch(junction) {
274
273
  this.count = 0;
275
274
  this.done = false;
276
275
  this.results = [];
@@ -309,7 +308,7 @@ function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
309
308
  terms = [item.subject, item.predicate, item.object, item.why];
310
309
  ind = [f.subjectIndex, f.predicateIndex, f.objectIndex, f.whyIndex];
311
310
  for (i = 0; i < 4; i++) {
312
- let t = terms[i];
311
+ var t = terms[i];
313
312
  // console.log(" Prepare (" + t + ") "+(t in bindings))
314
313
  if (t.uri && t.uri === _defaultGraphUri.defaultGraphURI) {// chrome:session
315
314
  // console.log(' query: Ignoring slot ' + i)
@@ -363,7 +362,7 @@ function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
363
362
  *
364
363
  * Will fetch linked data from the web iff the knowledge base an associated source fetcher (f.fetcher)
365
364
  ***/
366
- var match = function (f, g, bindingsSoFar, level, fetcher, localCallback, branch) {
365
+ var match = function match(f, g, bindingsSoFar, level, fetcher, localCallback, branch) {
367
366
  _log.default.debug('Match begins, Branch count now: ' + branch.count + ' for ' + branch.pattern_debug);
368
367
 
369
368
  // log.debug("match: f has "+f.statements.length+", g has "+g.statements.length)
@@ -402,7 +401,7 @@ function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
402
401
  if (fetcher) {
403
402
  // Fetcher is used to fetch URIs, function first term is a URI term, second is the requester
404
403
  var id = 'match' + matchIndex++;
405
- var fetchResource = function (requestedTerm, id) {
404
+ var fetchResource = function fetchResource(requestedTerm, id) {
406
405
  var docuri = requestedTerm.uri.split('#')[0];
407
406
  fetcher.nowOrWhenFetched(docuri, undefined, function (ok, body, xhr) {
408
407
  if (!ok) {
@@ -430,7 +429,7 @@ function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
430
429
  match2(f, g, bindingsSoFar, level, fetcher, localCallback, branch);
431
430
  }; // match
432
431
 
433
- var constraintsSatisfied = function (bindings, constraints) {
432
+ var constraintsSatisfied = function constraintsSatisfied(bindings, constraints) {
434
433
  var res = true;
435
434
  var x;
436
435
  var test;
@@ -448,7 +447,7 @@ function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
448
447
  };
449
448
 
450
449
  /** match2 -- stuff after the fetch **/
451
- var match2 = function (f, g, bindingsSoFar, level, fetcher, callback, branch) {
450
+ var match2 = function match2(f, g, bindingsSoFar, level, fetcher, callback, branch) {
452
451
  // post fetch
453
452
  var pattern = g.statements;
454
453
  var n = pattern.length;