rdflib 2.2.31 → 2.2.32-2f2a2f3c

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 (54) hide show
  1. package/dist/670.rdflib.min.js +1 -0
  2. package/dist/730.rdflib.min.js +3 -0
  3. package/dist/730.rdflib.min.js.LICENSE.txt +58 -0
  4. package/dist/730.rdflib.min.js.map +1 -0
  5. package/dist/rdflib.min.js +1 -1
  6. package/dist/rdflib.min.js.LICENSE.txt +0 -59
  7. package/dist/rdflib.min.js.map +1 -1
  8. package/esm/blank-node.js +10 -6
  9. package/esm/collection.js +3 -4
  10. package/esm/factories/factory-types.js +10 -10
  11. package/esm/fetcher.js +64 -35
  12. package/esm/formula.js +10 -13
  13. package/esm/jsonldparser.js +4 -3
  14. package/esm/lists.js +2 -1
  15. package/esm/literal.js +6 -8
  16. package/esm/node-internal.js +5 -10
  17. package/esm/rdfxmlparser.js +3 -0
  18. package/esm/serializer.js +2 -3
  19. package/esm/statement.js +7 -11
  20. package/esm/store.js +39 -32
  21. package/esm/types.js +18 -1
  22. package/esm/update-manager.js +150 -83
  23. package/esm/utils.js +0 -1
  24. package/esm/variable.js +2 -4
  25. package/lib/blank-node.js +10 -6
  26. package/lib/collection.js +3 -4
  27. package/lib/factories/factory-types.js +10 -10
  28. package/lib/fetcher.js +88 -36
  29. package/lib/formula.js +10 -13
  30. package/lib/index.d.ts +1 -1
  31. package/lib/jsonldparser.js +9 -3
  32. package/lib/lists.js +15 -1
  33. package/lib/literal.js +6 -8
  34. package/lib/node-internal.js +5 -10
  35. package/lib/query.d.ts +1 -1
  36. package/lib/rdfxmlparser.js +3 -0
  37. package/lib/serializer.d.ts +1 -1
  38. package/lib/serializer.js +2 -3
  39. package/lib/sparql-to-query.d.ts +1 -1
  40. package/lib/statement.js +7 -11
  41. package/lib/store.d.ts +1 -1
  42. package/lib/store.js +55 -34
  43. package/lib/types.js +22 -0
  44. package/lib/update-manager.d.ts +25 -5
  45. package/lib/update-manager.js +154 -82
  46. package/lib/utils-js.d.ts +3 -3
  47. package/lib/variable.js +2 -4
  48. package/lib/xsd-internal.d.ts +1 -1
  49. package/package.json +20 -19
  50. package/src/fetcher.ts +13 -0
  51. package/src/jsonldparser.js +2 -4
  52. package/src/serializer.js +1 -1
  53. package/src/store.ts +18 -1
  54. package/src/update-manager.ts +243 -163
@@ -9,9 +9,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
9
9
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
10
10
  /* @file Update Manager Class
11
11
  **
12
- ** 2007-07-15 originall sparl update module by Joe Presbrey <presbrey@mit.edu>
12
+ ** 2007-07-15 original SPARQL Update module by Joe Presbrey <presbrey@mit.edu>
13
13
  ** 2010-08-08 TimBL folded in Kenny's WEBDAV
14
- ** 2010-12-07 TimBL addred local file write code
14
+ ** 2010-12-07 TimBL added local file write code
15
15
  */
16
16
  import IndexedFormula from './store';
17
17
  import { docpart, join as uriJoin } from './uri';
@@ -28,10 +28,6 @@ import { termValue } from './utils/termValue';
28
28
  * and also looking out for concurrent updates from other agents
29
29
  */
30
30
  var UpdateManager = /*#__PURE__*/function () {
31
- /** Index of objects for coordinating incoming and outgoing patches */
32
-
33
- /** Object of namespaces */
34
-
35
31
  /**
36
32
  * @param store - The quadstore to store data and metadata. Created if not passed.
37
33
  */
@@ -40,7 +36,9 @@ var UpdateManager = /*#__PURE__*/function () {
40
36
  _defineProperty(this, "store", void 0);
41
37
  _defineProperty(this, "ifps", void 0);
42
38
  _defineProperty(this, "fps", void 0);
39
+ /** Index of objects for coordinating incoming and outgoing patches */
43
40
  _defineProperty(this, "patchControl", void 0);
41
+ /** Object of namespaces */
44
42
  _defineProperty(this, "ns", void 0);
45
43
  store = store || new IndexedFormula();
46
44
  if (store.updater) {
@@ -79,16 +77,19 @@ var UpdateManager = /*#__PURE__*/function () {
79
77
  }
80
78
 
81
79
  /** Remove from the store HTTP authorization metadata
82
- * The editble function below relies on copies we have in the store
83
- * of the results of previous HTTP transactions. Howver, when
80
+ * The editable function below relies on copies we have in the store
81
+ * of the results of previous HTTP transactions. However, when
84
82
  * the user logs in, then that data misrepresents what would happen
85
83
  * if the user tried again.
86
84
  */
87
85
  }, {
88
86
  key: "flagAuthorizationMetadata",
89
- value: function flagAuthorizationMetadata() {
90
- var kb = this.store;
91
- var meta = kb.fetcher.appNode;
87
+ value: function flagAuthorizationMetadata(kb) {
88
+ var _kb$fetcher;
89
+ if (!kb) {
90
+ kb = this.store;
91
+ }
92
+ var meta = (_kb$fetcher = kb.fetcher) === null || _kb$fetcher === void 0 ? void 0 : _kb$fetcher.appNode;
92
93
  var requests = kb.statementsMatching(undefined, this.ns.link('requestedURI'), undefined, meta).map(function (st) {
93
94
  return st.subject;
94
95
  });
@@ -100,7 +101,7 @@ var UpdateManager = /*#__PURE__*/function () {
100
101
  var _response = kb.any(request, this.ns.link('response'), null, meta);
101
102
  if (_response !== undefined) {
102
103
  // ts
103
- this.store.add(_response, this.ns.link('outOfDate'), true, meta); // @@ Boolean is fine - fix types
104
+ kb.add(_response, this.ns.link('outOfDate'), true, meta); // @@ Boolean is fine - fix types
104
105
  }
105
106
  }
106
107
  } catch (err) {
@@ -118,30 +119,40 @@ var UpdateManager = /*#__PURE__*/function () {
118
119
  * and local write access is determined by those headers.
119
120
  * This async version not only looks at past HTTP requests, it also makes new ones if necessary.
120
121
  *
121
- * @returns The method string SPARQL or DAV or
122
+ * @returns The method string N3PATCH or SPARQL or DAV or
122
123
  * LOCALFILE or false if known, undefined if not known.
123
124
  */
124
125
  }, {
125
126
  key: "checkEditable",
126
127
  value: function () {
127
128
  var _checkEditable = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(uri, kb) {
129
+ var _kb$fetcher2;
128
130
  var initial, final;
129
131
  return _regeneratorRuntime.wrap(function _callee$(_context) {
130
132
  while (1) switch (_context.prev = _context.next) {
131
133
  case 0:
134
+ if (uri) {
135
+ _context.next = 2;
136
+ break;
137
+ }
138
+ return _context.abrupt("return", false);
139
+ case 2:
140
+ if (!kb) {
141
+ kb = this.store;
142
+ }
132
143
  initial = this.editable(uri, kb);
133
144
  if (!(initial !== undefined)) {
134
- _context.next = 3;
145
+ _context.next = 6;
135
146
  break;
136
147
  }
137
148
  return _context.abrupt("return", initial);
138
- case 3:
139
- _context.next = 5;
140
- return this.store.fetcher.load(uri);
141
- case 5:
149
+ case 6:
150
+ _context.next = 8;
151
+ return (_kb$fetcher2 = kb.fetcher) === null || _kb$fetcher2 === void 0 ? void 0 : _kb$fetcher2.load(uri);
152
+ case 8:
142
153
  final = this.editable(uri, kb); // console.log(`Loaded ${uri} just to check editable, result: ${final}.`)
143
154
  return _context.abrupt("return", final);
144
- case 7:
155
+ case 10:
145
156
  case "end":
146
157
  return _context.stop();
147
158
  }
@@ -166,6 +177,7 @@ var UpdateManager = /*#__PURE__*/function () {
166
177
  }, {
167
178
  key: "editable",
168
179
  value: function editable(uri, kb) {
180
+ var _kb$fetcher3;
169
181
  if (!uri) {
170
182
  return false; // Eg subject is bnode, no known doc to write to
171
183
  }
@@ -175,13 +187,13 @@ var UpdateManager = /*#__PURE__*/function () {
175
187
  }
176
188
  uri = termValue(uri);
177
189
  if (!this.isHttpUri(uri)) {
178
- if (this.store.holds(this.store.rdfFactory.namedNode(uri), this.store.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), this.store.rdfFactory.namedNode('http://www.w3.org/2007/ont/link#MachineEditableDocument'))) {
190
+ if (kb.holds(kb.rdfFactory.namedNode(uri), kb.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), kb.rdfFactory.namedNode('http://www.w3.org/2007/ont/link#MachineEditableDocument'))) {
179
191
  return 'LOCALFILE';
180
192
  }
181
193
  }
182
194
  var request;
183
195
  var definitive = false;
184
- var meta = this.store.fetcher.appNode;
196
+ var meta = (_kb$fetcher3 = kb.fetcher) === null || _kb$fetcher3 === void 0 ? void 0 : _kb$fetcher3.appNode;
185
197
  // const kb = s
186
198
 
187
199
  // @ts-ignore passes a string to kb.each, which expects a term. Should this work?
@@ -219,6 +231,7 @@ var UpdateManager = /*#__PURE__*/function () {
219
231
  if (acceptPatch.length) {
220
232
  for (var i = 0; i < acceptPatch.length; i++) {
221
233
  method = acceptPatch[i].value.trim();
234
+ if (method.indexOf('text/n3') >= 0) return 'N3PATCH';
222
235
  if (method.indexOf('application/sparql-update') >= 0) return 'SPARQL';
223
236
  if (method.indexOf('application/sparql-update-single-match') >= 0) return 'SPARQL';
224
237
  }
@@ -266,7 +279,8 @@ var UpdateManager = /*#__PURE__*/function () {
266
279
  }, {
267
280
  key: "anonymize",
268
281
  value: function anonymize(obj) {
269
- return obj.toNT().substr(0, 2) === '_:' && this.mentioned(obj) ? '?' + obj.toNT().substr(2) : obj.toNT();
282
+ var anonymized = obj.toNT().substr(0, 2) === '_:' && this.mentioned(obj) ? '?' + obj.toNT().substr(2) : obj.toNT();
283
+ return anonymized;
270
284
  }
271
285
  }, {
272
286
  key: "anonymizeNT",
@@ -464,7 +478,7 @@ var UpdateManager = /*#__PURE__*/function () {
464
478
  // console.log('UpdateManager: sending update to <' + uri + '>')
465
479
 
466
480
  options.noMeta = true;
467
- options.contentType = 'application/sparql-update';
481
+ options.contentType = options.contentType || 'application/sparql-update';
468
482
  options.body = query;
469
483
  return _this.store.fetcher.webOperation('PATCH', uri, options);
470
484
  }).then(function (response) {
@@ -482,7 +496,7 @@ var UpdateManager = /*#__PURE__*/function () {
482
496
  });
483
497
  }
484
498
 
485
- // ARE THESE THEE FUNCTIONS USED? DEPROCATE?
499
+ // ARE THESE THREE FUNCTIONS USED? DEPRECATE?
486
500
 
487
501
  /** return a statemnet updating function
488
502
  *
@@ -792,7 +806,93 @@ var UpdateManager = /*#__PURE__*/function () {
792
806
  }
793
807
 
794
808
  /**
795
- * This high-level function updates the local store iff the web is changed successfully.
809
+ * @private
810
+ *
811
+ * This helper function constructs SPARQL Update query from resolved arguments.
812
+ *
813
+ * @param ds: deletions array.
814
+ * @param is: insertions array.
815
+ * @param bnodes_context: Additional context to uniquely identify any blank nodes.
816
+ */
817
+ }, {
818
+ key: "constructSparqlUpdateQuery",
819
+ value: function constructSparqlUpdateQuery(ds, is, bnodes_context) {
820
+ var whereClause = this.contextWhere(bnodes_context);
821
+ var query = '';
822
+ if (whereClause.length) {
823
+ // Is there a WHERE clause?
824
+ if (ds.length) {
825
+ query += 'DELETE { ';
826
+ for (var i = 0; i < ds.length; i++) {
827
+ query += this.anonymizeNT(ds[i]) + '\n';
828
+ }
829
+ query += ' }\n';
830
+ }
831
+ if (is.length) {
832
+ query += 'INSERT { ';
833
+ for (var _i5 = 0; _i5 < is.length; _i5++) {
834
+ query += this.anonymizeNT(is[_i5]) + '\n';
835
+ }
836
+ query += ' }\n';
837
+ }
838
+ query += whereClause;
839
+ } else {
840
+ // no where clause
841
+ if (ds.length) {
842
+ query += 'DELETE DATA { ';
843
+ for (var _i6 = 0; _i6 < ds.length; _i6++) {
844
+ query += this.anonymizeNT(ds[_i6]) + '\n';
845
+ }
846
+ query += ' } \n';
847
+ }
848
+ if (is.length) {
849
+ if (ds.length) query += ' ; ';
850
+ query += 'INSERT DATA { ';
851
+ for (var _i7 = 0; _i7 < is.length; _i7++) {
852
+ query += this.nTriples(is[_i7]) + '\n';
853
+ }
854
+ query += ' }\n';
855
+ }
856
+ }
857
+ return query;
858
+ }
859
+
860
+ /**
861
+ * @private
862
+ *
863
+ * This helper function constructs n3-patch query from resolved arguments.
864
+ *
865
+ * @param ds: deletions array.
866
+ * @param is: insertions array.
867
+ * @param bnodes_context: Additional context to uniquely identify any blanknodes.
868
+ */
869
+ }, {
870
+ key: "constructN3PatchQuery",
871
+ value: function constructN3PatchQuery(ds, is, bnodes_context) {
872
+ var _this3 = this;
873
+ var query = "\n@prefix solid: <http://www.w3.org/ns/solid/terms#>.\n@prefix ex: <http://www.example.org/terms#>.\n\n_:patch\n";
874
+ // If bnode context is non trivial, express it as ?conditions formula.
875
+ if (bnodes_context && bnodes_context.length > 0) {
876
+ query += "\n solid:where {\n ".concat(bnodes_context.map(function (x) {
877
+ return _this3.anonymizeNT(x);
878
+ }).join('\n '), "\n };");
879
+ }
880
+ if (ds.length > 0) {
881
+ query += "\n solid:deletes {\n ".concat(ds.map(function (x) {
882
+ return _this3.anonymizeNT(x);
883
+ }).join('\n '), "\n };");
884
+ }
885
+ if (is.length > 0) {
886
+ query += "\n solid:inserts {\n ".concat(is.map(function (x) {
887
+ return _this3.anonymizeNT(x);
888
+ }).join('\n '), "\n };");
889
+ }
890
+ query += " a solid:InsertDeletePatch .\n";
891
+ return query;
892
+ }
893
+
894
+ /**
895
+ * This high-level function updates the local store if the web is changed successfully.
796
896
  * Deletions, insertions may be undefined or single statements or lists or formulae (may contain bnodes which can be indirectly identified by a where clause).
797
897
  * The `why` property of each statement must be the same and give the web document to be updated.
798
898
  * @param deletions - Statement or statements to be deleted.
@@ -804,7 +904,7 @@ var UpdateManager = /*#__PURE__*/function () {
804
904
  }, {
805
905
  key: "update",
806
906
  value: function update(deletions, insertions, callback, secondTry) {
807
- var _this3 = this;
907
+ var _this4 = this;
808
908
  var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
809
909
  if (!callback) {
810
910
  var thisUpdater = this;
@@ -872,64 +972,31 @@ var UpdateManager = /*#__PURE__*/function () {
872
972
  if (protocol === undefined) {
873
973
  // Not enough metadata
874
974
  if (secondTry) {
875
- throw new Error('Update: Loaded ' + doc + "but stil can't figure out what editing protcol it supports.");
975
+ throw new Error('Update: Loaded ' + doc + "but still can't figure out what editing protocol it supports.");
876
976
  }
877
977
  // console.log(`Update: have not loaded ${doc} before: loading now...`);
878
978
  this.store.fetcher.load(doc).then(function (response) {
879
- _this3.update(deletions, insertions, callback, true, options);
979
+ _this4.update(deletions, insertions, callback, true, options);
880
980
  }, function (err) {
881
981
  if (err.response.status === 404) {
882
982
  // nonexistent files are fine
883
- _this3.update(deletions, insertions, callback, true, options);
983
+ _this4.update(deletions, insertions, callback, true, options);
884
984
  } else {
885
985
  throw new Error("Update: Can't get updatability status ".concat(doc, " before patching: ").concat(err));
886
986
  }
887
987
  });
888
988
  return;
889
- } else if (protocol.indexOf('SPARQL') >= 0) {
989
+ } else if (protocol.indexOf('SPARQL') >= 0 || protocol.indexOf('N3PATCH') >= 0) {
990
+ var isSparql = protocol.indexOf('SPARQL') >= 0;
890
991
  var bnodes = [];
891
992
  // change ReadOnly type to Mutable type
892
993
 
893
994
  if (ds.length) bnodes = this.statementArrayBnodes(ds);
894
995
  if (is.length) bnodes = bnodes.concat(this.statementArrayBnodes(is));
895
996
  var context = this.bnodeContext(bnodes, doc);
896
- var whereClause = this.contextWhere(context);
897
- var query = '';
898
- if (whereClause.length) {
899
- // Is there a WHERE clause?
900
- if (ds.length) {
901
- query += 'DELETE { ';
902
- for (var i = 0; i < ds.length; i++) {
903
- query += this.anonymizeNT(ds[i]) + '\n';
904
- }
905
- query += ' }\n';
906
- }
907
- if (is.length) {
908
- query += 'INSERT { ';
909
- for (var _i5 = 0; _i5 < is.length; _i5++) {
910
- query += this.anonymizeNT(is[_i5]) + '\n';
911
- }
912
- query += ' }\n';
913
- }
914
- query += whereClause;
915
- } else {
916
- // no where clause
917
- if (ds.length) {
918
- query += 'DELETE DATA { ';
919
- for (var _i6 = 0; _i6 < ds.length; _i6++) {
920
- query += this.anonymizeNT(ds[_i6]) + '\n';
921
- }
922
- query += ' } \n';
923
- }
924
- if (is.length) {
925
- if (ds.length) query += ' ; ';
926
- query += 'INSERT DATA { ';
927
- for (var _i7 = 0; _i7 < is.length; _i7++) {
928
- query += this.nTriples(is[_i7]) + '\n';
929
- }
930
- query += ' }\n';
931
- }
932
- }
997
+ var query = isSparql ? this.constructSparqlUpdateQuery(ds, is, context) : this.constructN3PatchQuery(ds, is, context);
998
+ options.contentType = isSparql ? 'application/sparql-update' : 'text/n3';
999
+
933
1000
  // Track pending upstream patches until they have finished their callbackFunction
934
1001
  control.pendingUpstream = control.pendingUpstream ? control.pendingUpstream + 1 : 1;
935
1002
  if ('upstreamCount' in control) {
@@ -950,8 +1017,8 @@ var UpdateManager = /*#__PURE__*/function () {
950
1017
  success = false;
951
1018
  body = 'Remote Ok BUT error deleting ' + ds.length + ' from store!!! ' + e;
952
1019
  } // Add in any case -- help recover from weirdness??
953
- for (var _i8 = 0; _i8 < is.length; _i8++) {
954
- kb.add(is[_i8].subject, is[_i8].predicate, is[_i8].object, doc);
1020
+ for (var i = 0; i < is.length; i++) {
1021
+ kb.add(is[i].subject, is[i].predicate, is[i].object, doc);
955
1022
  }
956
1023
  }
957
1024
  callback(uri, success, body, response);
@@ -1005,8 +1072,8 @@ var UpdateManager = /*#__PURE__*/function () {
1005
1072
  for (var i = 0; i < ds.length; i++) {
1006
1073
  Util.RDFArrayRemove(newSts, ds[i]);
1007
1074
  }
1008
- for (var _i9 = 0; _i9 < is.length; _i9++) {
1009
- newSts.push(is[_i9]);
1075
+ for (var _i8 = 0; _i8 < is.length; _i8++) {
1076
+ newSts.push(is[_i8]);
1010
1077
  }
1011
1078
  var documentString = this.serialize(doc.value, newSts, contentType);
1012
1079
 
@@ -1023,11 +1090,11 @@ var UpdateManager = /*#__PURE__*/function () {
1023
1090
  if (!response.ok) {
1024
1091
  throw new Error(response.error);
1025
1092
  }
1026
- for (var _i10 = 0; _i10 < ds.length; _i10++) {
1027
- kb.remove(ds[_i10]);
1093
+ for (var _i9 = 0; _i9 < ds.length; _i9++) {
1094
+ kb.remove(ds[_i9]);
1028
1095
  }
1029
- for (var _i11 = 0; _i11 < is.length; _i11++) {
1030
- kb.add(is[_i11].subject, is[_i11].predicate, is[_i11].object, doc);
1096
+ for (var _i10 = 0; _i10 < is.length; _i10++) {
1097
+ kb.add(is[_i10].subject, is[_i10].predicate, is[_i10].object, doc);
1031
1098
  }
1032
1099
  callbackFunction(doc.value, response.ok, response.responseText, response);
1033
1100
  }).catch(function (err) {
@@ -1057,8 +1124,8 @@ var UpdateManager = /*#__PURE__*/function () {
1057
1124
  for (var i = 0; i < ds.length; i++) {
1058
1125
  Util.RDFArrayRemove(newSts, ds[i]);
1059
1126
  }
1060
- for (var _i12 = 0; _i12 < is.length; _i12++) {
1061
- newSts.push(is[_i12]);
1127
+ for (var _i11 = 0; _i11 < is.length; _i11++) {
1128
+ newSts.push(is[_i11]);
1062
1129
  }
1063
1130
  // serialize to the appropriate format
1064
1131
  var dot = doc.value.lastIndexOf('.');
@@ -1074,11 +1141,11 @@ var UpdateManager = /*#__PURE__*/function () {
1074
1141
  options.contentType = contentType;
1075
1142
  kb.fetcher.webOperation('PUT', doc.value, options).then(function (response) {
1076
1143
  if (!response.ok) return callbackFunction(doc.value, false, response.error);
1077
- for (var _i13 = 0; _i13 < ds.length; _i13++) {
1078
- kb.remove(ds[_i13]);
1144
+ for (var _i12 = 0; _i12 < ds.length; _i12++) {
1145
+ kb.remove(ds[_i12]);
1079
1146
  }
1080
- for (var _i14 = 0; _i14 < is.length; _i14++) {
1081
- kb.add(is[_i14].subject, is[_i14].predicate, is[_i14].object, doc);
1147
+ for (var _i13 = 0; _i13 < is.length; _i13++) {
1148
+ kb.add(is[_i13].subject, is[_i13].predicate, is[_i13].object, doc);
1082
1149
  }
1083
1150
  callbackFunction(doc.value, true, ''); // success!
1084
1151
  });
@@ -1126,11 +1193,11 @@ var UpdateManager = /*#__PURE__*/function () {
1126
1193
  }, {
1127
1194
  key: "put",
1128
1195
  value: function put(doc, data, contentType, callback) {
1129
- var _this4 = this;
1196
+ var _this5 = this;
1130
1197
  var kb = this.store;
1131
1198
  var documentString;
1132
1199
  return Promise.resolve().then(function () {
1133
- documentString = _this4.serialize(doc.value, data, contentType);
1200
+ documentString = _this5.serialize(doc.value, data, contentType);
1134
1201
  return kb.fetcher.webOperation('PUT', doc.value, {
1135
1202
  contentType: contentType,
1136
1203
  body: documentString
package/esm/utils.js CHANGED
@@ -2,7 +2,6 @@ import log from './log';
2
2
  import { docpart } from './uri';
3
3
  import { string_startswith } from './utils-js';
4
4
  /** RDF/JS spec Typeguards */
5
-
6
5
  /**
7
6
  * Loads ontologies of the data we load (this is the callback from the kb to
8
7
  * the fetcher).
package/esm/variable.js CHANGED
@@ -21,10 +21,6 @@ import * as Uri from './uri';
21
21
  var Variable = /*#__PURE__*/function (_Node) {
22
22
  _inherits(Variable, _Node);
23
23
  var _super = _createSuper(Variable);
24
- /** The base string for a variable's name */
25
-
26
- /** The unique identifier of this variable */
27
-
28
24
  /**
29
25
  * Initializes this variable
30
26
  * @param name The variable's name
@@ -35,9 +31,11 @@ var Variable = /*#__PURE__*/function (_Node) {
35
31
  _classCallCheck(this, Variable);
36
32
  _this = _super.call(this, name);
37
33
  _defineProperty(_assertThisInitialized(_this), "termType", VariableTermType);
34
+ /** The base string for a variable's name */
38
35
  _defineProperty(_assertThisInitialized(_this), "base", 'varid:');
39
36
  _defineProperty(_assertThisInitialized(_this), "classOrder", ClassOrder.Variable);
40
37
  _defineProperty(_assertThisInitialized(_this), "isVar", 1);
38
+ /** The unique identifier of this variable */
41
39
  _defineProperty(_assertThisInitialized(_this), "uri", void 0);
42
40
  _this.base = 'varid:';
43
41
  _this.uri = Uri.join(name, _this.base);
package/lib/blank-node.js CHANGED
@@ -34,7 +34,13 @@ var BlankNode = /*#__PURE__*/function (_Node) {
34
34
  _this = _super.call(this, BlankNode.getId(id));
35
35
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "termType", _types.BlankNodeTermType);
36
36
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "classOrder", _classOrder.default.BlankNode);
37
+ /** Whether this is a blank node */
37
38
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isBlank", 1);
39
+ /**
40
+ * This type of node is a variable.
41
+ *
42
+ * Note that the existence of this property already indicates that it is a variable.
43
+ */
38
44
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isVar", 1);
39
45
  return _this;
40
46
  }
@@ -92,12 +98,7 @@ var BlankNode = /*#__PURE__*/function (_Node) {
92
98
  }
93
99
  }], [{
94
100
  key: "getId",
95
- value:
96
- /**
97
- * The next unique identifier for blank nodes
98
- */
99
-
100
- function getId(id) {
101
+ value: function getId(id) {
101
102
  if (id) {
102
103
  if (typeof id !== 'string') {
103
104
  throw new Error('Bad id argument to new blank node: ' + id);
@@ -115,5 +116,8 @@ var BlankNode = /*#__PURE__*/function (_Node) {
115
116
  return BlankNode;
116
117
  }(_nodeInternal.default);
117
118
  exports.default = BlankNode;
119
+ /**
120
+ * The next unique identifier for blank nodes
121
+ */
118
122
  (0, _defineProperty2.default)(BlankNode, "nextId", 0);
119
123
  (0, _defineProperty2.default)(BlankNode, "NTAnonymousNodePrefix", '_:');
package/lib/collection.js CHANGED
@@ -51,10 +51,6 @@ function fromValue(value) {
51
51
  var Collection = /*#__PURE__*/function (_Node) {
52
52
  (0, _inherits2.default)(Collection, _Node);
53
53
  var _super = _createSuper(Collection);
54
- /**
55
- * The nodes in this collection
56
- */
57
-
58
54
  function Collection(initial) {
59
55
  var _this;
60
56
  (0, _classCallCheck2.default)(this, Collection);
@@ -63,6 +59,9 @@ var Collection = /*#__PURE__*/function (_Node) {
63
59
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "classOrder", _classOrder.default.Collection);
64
60
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "closed", false);
65
61
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "compareTerm", _blankNode.default.prototype.compareTerm);
62
+ /**
63
+ * The nodes in this collection
64
+ */
66
65
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "elements", []);
67
66
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isVar", 0);
68
67
  if (initial && initial.length > 0) {
@@ -5,15 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Feature = void 0;
7
7
  /** A set of features that may be supported by a Data Factory */
8
- var Feature;
9
- /**
10
- * Defines a DataFactory as used in rdflib, based on the RDF/JS: Data model specification,
11
- * but with additional extensions
12
- *
13
- * bnIndex is optional but useful.
14
- */
15
- exports.Feature = Feature;
16
- (function (Feature) {
8
+ var Feature = /*#__PURE__*/function (Feature) {
17
9
  Feature["collections"] = "COLLECTIONS";
18
10
  Feature["defaultGraphType"] = "DEFAULT_GRAPH_TYPE";
19
11
  Feature["equalsMethod"] = "EQUALS_METHOD";
@@ -21,4 +13,12 @@ exports.Feature = Feature;
21
13
  Feature["identity"] = "IDENTITY";
22
14
  Feature["reversibleId"] = "REVERSIBLE_ID";
23
15
  Feature["variableType"] = "VARIABLE_TYPE";
24
- })(Feature || (exports.Feature = Feature = {}));
16
+ return Feature;
17
+ }({});
18
+ /**
19
+ * Defines a DataFactory as used in rdflib, based on the RDF/JS: Data model specification,
20
+ * but with additional extensions
21
+ *
22
+ * bnIndex is optional but useful.
23
+ */
24
+ exports.Feature = Feature;