rdflib 2.2.21 → 2.2.22-0de51c50

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 (115) hide show
  1. package/dist/rdflib.min.js +1 -1
  2. package/dist/rdflib.min.js.LICENSE.txt +13 -1
  3. package/dist/rdflib.min.js.map +1 -1
  4. package/esm/blank-node.js +3 -27
  5. package/esm/collection.js +7 -29
  6. package/esm/default-graph.js +1 -15
  7. package/esm/empty.js +0 -13
  8. package/esm/factories/canonical-data-factory.js +5 -40
  9. package/esm/factories/extended-term-factory.js +0 -11
  10. package/esm/factories/factory-types.js +2 -1
  11. package/esm/factories/rdflib-data-factory.js +0 -8
  12. package/esm/fetcher.js +257 -481
  13. package/esm/formula.js +43 -142
  14. package/esm/index.js +19 -36
  15. package/esm/jsonldparser.js +20 -29
  16. package/esm/jsonparser.js +0 -7
  17. package/esm/lists.js +18 -33
  18. package/esm/literal.js +10 -42
  19. package/esm/n3parser.js +38 -351
  20. package/esm/named-node.js +8 -27
  21. package/esm/namespace.js +0 -1
  22. package/esm/node-internal.js +11 -24
  23. package/esm/node.js +1 -6
  24. package/esm/parse.js +10 -17
  25. package/esm/patch-parser.js +9 -29
  26. package/esm/query-to-sparql.js +0 -18
  27. package/esm/query.js +50 -133
  28. package/esm/rdfaparser.js +72 -210
  29. package/esm/rdfxmlparser.js +31 -128
  30. package/esm/serialize.js +8 -33
  31. package/esm/serializer.js +122 -286
  32. package/esm/sparql-to-query.js +44 -134
  33. package/esm/statement.js +8 -19
  34. package/esm/store.js +109 -280
  35. package/esm/types.js +3 -2
  36. package/esm/update-manager.js +110 -246
  37. package/esm/updates-via.js +0 -27
  38. package/esm/uri.js +6 -50
  39. package/esm/utils/default-graph-uri.js +1 -0
  40. package/esm/utils/termValue.js +0 -1
  41. package/esm/utils/terms.js +15 -16
  42. package/esm/utils-js.js +16 -57
  43. package/esm/utils.js +4 -15
  44. package/esm/variable.js +0 -20
  45. package/lib/blank-node.js +3 -28
  46. package/lib/class-order.js +0 -1
  47. package/lib/collection.js +7 -34
  48. package/lib/default-graph.js +0 -20
  49. package/lib/empty.js +0 -18
  50. package/lib/factories/canonical-data-factory.js +4 -51
  51. package/lib/factories/extended-term-factory.js +0 -18
  52. package/lib/factories/factory-types.d.ts +6 -6
  53. package/lib/factories/factory-types.js +0 -3
  54. package/lib/factories/rdflib-data-factory.js +0 -12
  55. package/lib/fetcher.d.ts +6 -6
  56. package/lib/fetcher.js +258 -470
  57. package/lib/formula.d.ts +1 -1
  58. package/lib/formula.js +43 -151
  59. package/lib/index.d.ts +1 -2
  60. package/lib/index.js +14 -82
  61. package/lib/jsonldparser.js +19 -33
  62. package/lib/jsonparser.js +0 -9
  63. package/lib/lists.js +14 -39
  64. package/lib/literal.js +10 -49
  65. package/lib/log.d.ts +0 -6
  66. package/lib/log.js +0 -1
  67. package/lib/n3parser.d.ts +1 -0
  68. package/lib/n3parser.js +39 -359
  69. package/lib/named-node.js +7 -35
  70. package/lib/namespace.js +0 -3
  71. package/lib/node-internal.js +11 -21
  72. package/lib/node.js +1 -11
  73. package/lib/parse.d.ts +1 -1
  74. package/lib/parse.js +8 -27
  75. package/lib/patch-parser.js +10 -33
  76. package/lib/query-to-sparql.js +0 -23
  77. package/lib/query.js +46 -152
  78. package/lib/rdfaparser.js +72 -220
  79. package/lib/rdfxmlparser.js +31 -132
  80. package/lib/serialize.d.ts +1 -1
  81. package/lib/serialize.js +8 -43
  82. package/lib/serializer.d.ts +1 -0
  83. package/lib/serializer.js +121 -297
  84. package/lib/sparql-to-query.js +42 -167
  85. package/lib/statement.js +8 -24
  86. package/lib/store.d.ts +2 -2
  87. package/lib/store.js +102 -282
  88. package/lib/tf-types.d.ts +4 -4
  89. package/lib/types.d.ts +8 -8
  90. package/lib/types.js +3 -3
  91. package/lib/update-manager.d.ts +2 -2
  92. package/lib/update-manager.js +110 -254
  93. package/lib/updates-via.js +0 -30
  94. package/lib/uri.js +5 -58
  95. package/lib/utils/default-graph-uri.js +1 -3
  96. package/lib/utils/termValue.js +0 -2
  97. package/lib/utils/terms.js +15 -34
  98. package/lib/utils-js.js +16 -80
  99. package/lib/utils.js +4 -21
  100. package/lib/variable.js +0 -25
  101. package/lib/xsd-internal.js +0 -3
  102. package/lib/xsd.js +0 -4
  103. package/package.json +40 -39
  104. package/src/fetcher.ts +2 -2
  105. package/src/index.ts +0 -2
  106. package/src/jsonldparser.js +13 -4
  107. package/src/n3parser.js +12 -4
  108. package/src/serialize.ts +4 -11
  109. package/src/serializer.js +24 -0
  110. package/src/update-manager.ts +18 -7
  111. package/changes.txt +0 -59
  112. package/esm/convert.js +0 -61
  113. package/lib/convert.d.ts +0 -2
  114. package/lib/convert.js +0 -77
  115. package/src/convert.js +0 -70
package/lib/literal.js CHANGED
@@ -1,53 +1,33 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
-
12
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
11
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
12
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
16
  var _classOrder = _interopRequireDefault(require("./class-order"));
27
-
28
17
  var _namedNode = _interopRequireDefault(require("./named-node"));
29
-
30
18
  var _nodeInternal = _interopRequireDefault(require("./node-internal"));
31
-
32
19
  var _types = require("./types");
33
-
34
20
  var _terms = require("./utils/terms");
35
-
36
21
  var _xsdInternal = _interopRequireDefault(require("./xsd-internal"));
37
-
38
22
  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); }; }
39
-
40
23
  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; } }
41
-
42
24
  /**
43
25
  * An RDF literal, containing some value which isn't expressed as an IRI.
44
26
  * @link https://rdf.js.org/data-model-spec/#literal-interface
45
27
  */
46
28
  var Literal = /*#__PURE__*/function (_Node) {
47
29
  (0, _inherits2.default)(Literal, _Node);
48
-
49
30
  var _super = _createSuper(Literal);
50
-
51
31
  /**
52
32
  * The literal's datatype as a named node
53
33
  */
@@ -64,7 +44,6 @@ var Literal = /*#__PURE__*/function (_Node) {
64
44
  */
65
45
  function Literal(value, language, datatype) {
66
46
  var _this;
67
-
68
47
  (0, _classCallCheck2.default)(this, Literal);
69
48
  _this = _super.call(this, value);
70
49
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "termType", _types.LiteralTermType);
@@ -72,7 +51,6 @@ var Literal = /*#__PURE__*/function (_Node) {
72
51
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "datatype", _xsdInternal.default.string);
73
52
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isVar", 0);
74
53
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "language", '');
75
-
76
54
  if (language) {
77
55
  _this.language = language;
78
56
  _this.datatype = _xsdInternal.default.langString;
@@ -81,38 +59,35 @@ var Literal = /*#__PURE__*/function (_Node) {
81
59
  } else {
82
60
  _this.datatype = _xsdInternal.default.string;
83
61
  }
84
-
85
62
  return _this;
86
63
  }
64
+
87
65
  /**
88
66
  * Gets a copy of this literal
89
67
  */
90
-
91
-
92
68
  (0, _createClass2.default)(Literal, [{
93
69
  key: "copy",
94
70
  value: function copy() {
95
71
  return new Literal(this.value, this.lang, this.datatype);
96
72
  }
73
+
97
74
  /**
98
75
  * Gets whether two literals are the same
99
76
  * @param other The other statement
100
77
  */
101
-
102
78
  }, {
103
79
  key: "equals",
104
80
  value: function equals(other) {
105
81
  if (!other) {
106
82
  return false;
107
83
  }
108
-
109
84
  return this.termType === other.termType && this.value === other.value && this.language === other.language && (!this.datatype && !other.datatype || this.datatype && this.datatype.equals(other.datatype));
110
85
  }
86
+
111
87
  /**
112
88
  * The language for the literal
113
89
  * @deprecated use {language} instead
114
90
  */
115
-
116
91
  }, {
117
92
  key: "lang",
118
93
  get: function get() {
@@ -126,18 +101,18 @@ var Literal = /*#__PURE__*/function (_Node) {
126
101
  value: function toNT() {
127
102
  return Literal.toNT(this);
128
103
  }
129
- /** Serializes a literal to an N-Triples string */
130
104
 
105
+ /** Serializes a literal to an N-Triples string */
131
106
  }, {
132
107
  key: "toString",
133
108
  value: function toString() {
134
109
  return '' + this.value;
135
110
  }
111
+
136
112
  /**
137
113
  * Builds a literal node from a boolean value
138
114
  * @param value - The value
139
115
  */
140
-
141
116
  }], [{
142
117
  key: "toNT",
143
118
  value: function toNT(literal) {
@@ -146,23 +121,20 @@ var Literal = /*#__PURE__*/function (_Node) {
146
121
  } else if (typeof literal.value !== 'string') {
147
122
  throw new Error('Value of RDF literal is not string or number: ' + literal.value);
148
123
  }
149
-
150
- var str = literal.value; // #x22 ("), #x5C (\), #x0A (\n) and #xD (\r) are disallowed and need to be replaced
124
+ var str = literal.value;
125
+ // #x22 ("), #x5C (\), #x0A (\n) and #xD (\r) are disallowed and need to be replaced
151
126
  // see https://www.w3.org/TR/n-triples/#grammar-production-STRING_LITERAL_QUOTE
152
-
153
127
  str = str.replace(/\\/g, '\\\\');
154
128
  str = str.replace(/\"/g, '\\"');
155
129
  str = str.replace(/\n/g, '\\n');
156
130
  str = str.replace(/\r/g, '\\r');
157
131
  str = '"' + str + '"';
158
-
159
132
  if (literal.language) {
160
133
  str += '@' + literal.language;
161
134
  } else if (!literal.datatype.equals(_xsdInternal.default.string)) {
162
135
  // Only add datatype if it's not a string
163
136
  str += '^^' + literal.datatype.toCanonical();
164
137
  }
165
-
166
138
  return str;
167
139
  }
168
140
  }, {
@@ -171,80 +143,69 @@ var Literal = /*#__PURE__*/function (_Node) {
171
143
  var strValue = value ? '1' : '0';
172
144
  return new Literal(strValue, null, _xsdInternal.default.boolean);
173
145
  }
146
+
174
147
  /**
175
148
  * Builds a literal node from a date value
176
149
  * @param value The value
177
150
  */
178
-
179
151
  }, {
180
152
  key: "fromDate",
181
153
  value: function fromDate(value) {
182
154
  if (!(value instanceof Date)) {
183
155
  throw new TypeError('Invalid argument to Literal.fromDate()');
184
156
  }
185
-
186
157
  var d2 = function d2(x) {
187
158
  return ('' + (100 + x)).slice(1, 3);
188
159
  };
189
-
190
160
  var date = '' + value.getUTCFullYear() + '-' + d2(value.getUTCMonth() + 1) + '-' + d2(value.getUTCDate()) + 'T' + d2(value.getUTCHours()) + ':' + d2(value.getUTCMinutes()) + ':' + d2(value.getUTCSeconds()) + 'Z';
191
161
  return new Literal(date, null, _xsdInternal.default.dateTime);
192
162
  }
163
+
193
164
  /**
194
165
  * Builds a literal node from a number value
195
166
  * @param value - The value
196
167
  */
197
-
198
168
  }, {
199
169
  key: "fromNumber",
200
170
  value: function fromNumber(value) {
201
171
  if (typeof value !== 'number') {
202
172
  throw new TypeError('Invalid argument to Literal.fromNumber()');
203
173
  }
204
-
205
174
  var datatype;
206
175
  var strValue = value.toString();
207
-
208
176
  if (strValue.indexOf('e') < 0 && Math.abs(value) <= Number.MAX_SAFE_INTEGER) {
209
177
  datatype = Number.isInteger(value) ? _xsdInternal.default.integer : _xsdInternal.default.decimal;
210
178
  } else {
211
179
  datatype = _xsdInternal.default.double;
212
180
  }
213
-
214
181
  return new Literal(strValue, null, datatype);
215
182
  }
183
+
216
184
  /**
217
185
  * Builds a literal node from an input value
218
186
  * @param value - The input value
219
187
  */
220
-
221
188
  }, {
222
189
  key: "fromValue",
223
190
  value: function fromValue(value) {
224
191
  if ((0, _terms.isLiteral)(value)) {
225
192
  return value;
226
193
  }
227
-
228
194
  switch ((0, _typeof2.default)(value)) {
229
195
  case 'object':
230
196
  if (value instanceof Date) {
231
197
  return Literal.fromDate(value);
232
198
  }
233
-
234
199
  case 'boolean':
235
200
  return Literal.fromBoolean(value);
236
-
237
201
  case 'number':
238
202
  return Literal.fromNumber(value);
239
-
240
203
  case 'string':
241
204
  return new Literal(value);
242
205
  }
243
-
244
206
  throw new Error("Can't make literal from " + value + ' of type ' + (0, _typeof2.default)(value));
245
207
  }
246
208
  }]);
247
209
  return Literal;
248
210
  }(_nodeInternal.default);
249
-
250
211
  exports.default = Literal;
package/lib/log.d.ts CHANGED
@@ -1,15 +1,9 @@
1
1
  export default log;
2
2
  declare namespace log {
3
3
  function debug(x: any): void;
4
- function debug(x: any): void;
5
- function warn(x: any): void;
6
4
  function warn(x: any): void;
7
5
  function info(x: any): void;
8
- function info(x: any): void;
9
6
  function error(x: any): void;
10
- function error(x: any): void;
11
- function success(x: any): void;
12
7
  function success(x: any): void;
13
8
  function msg(x: any): void;
14
- function msg(x: any): void;
15
9
  }
package/lib/log.js CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /**
9
8
  * A Dummy log
10
9
  * @module log
package/lib/n3parser.d.ts CHANGED
@@ -8,6 +8,7 @@ export class SinkParser {
8
8
  source: any;
9
9
  lines: number;
10
10
  statementCount: number;
11
+ hasNil: boolean;
11
12
  startOfLine: number;
12
13
  previousLine: number;
13
14
  _genPrefix: any;