rdflib 2.2.19-c14dfd57 → 2.2.19-e127c2a5

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.
package/esm/fetcher.js CHANGED
@@ -1441,8 +1441,8 @@ var Fetcher = /*#__PURE__*/function () {
1441
1441
  }
1442
1442
  }
1443
1443
  /**
1444
- * A generic web opeation, at the fetch() level.
1445
- * does not invole the quadstore.
1444
+ * A generic web operation, at the fetch() level.
1445
+ * does not involve the quad store.
1446
1446
  *
1447
1447
  * Returns promise of Response
1448
1448
  * If data is returned, copies it to response.responseText before returning
package/esm/serializer.js CHANGED
@@ -60,7 +60,7 @@ export var Serializer = /*#__PURE__*/function () {
60
60
  this.prefixchars = 'abcdefghijklmnopqustuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
61
61
  this.incoming = null; // Array not calculated yet
62
62
 
63
- this.formulas = []; // remebering original formulae from hashes
63
+ this.formulas = []; // remembering original formulae from hashes
64
64
 
65
65
  this.store = store;
66
66
  this.rdfFactory = store.rdfFactory || CanonicalDataFactory;
@@ -102,7 +102,7 @@ export var Serializer = /*#__PURE__*/function () {
102
102
  return this.store.fromNT(s);
103
103
  }
104
104
  /**
105
- * Defines a set of [prefix, namespace] pairs to be uised by this Serializer instance.
105
+ * Defines a set of [prefix, namespace] pairs to be used by this Serializer instance.
106
106
  * Overrides previous prefixes if any
107
107
  * @param namespaces
108
108
  * @return {Serializer}
@@ -665,7 +665,7 @@ export var Serializer = /*#__PURE__*/function () {
665
665
  return val;
666
666
 
667
667
  case 'http://www.w3.org/2001/XMLSchema#decimal':
668
- // In urtle must have dot
668
+ // In Turtle, must have dot
669
669
  if (val.indexOf('.') < 0) val += '.0';
670
670
  return val;
671
671
 
@@ -696,6 +696,9 @@ export var Serializer = /*#__PURE__*/function () {
696
696
  case 'NamedNode':
697
697
  return this.symbolToN3(expr);
698
698
 
699
+ case 'DefaultGraph':
700
+ return '';
701
+
699
702
  default:
700
703
  throw new Error('Internal: atomicTermToN3 cannot handle ' + expr + ' of termType: ' + expr.termType);
701
704
  }
@@ -16,12 +16,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
16
16
  ** 2010-12-07 TimBL addred local file write code
17
17
  */
18
18
  import IndexedFormula from './store';
19
- import { docpart } from './uri';
19
+ import { docpart, join as uriJoin } from './uri';
20
20
  import Fetcher from './fetcher';
21
21
  import Namespace from './namespace';
22
22
  import Serializer from './serializer';
23
- import { join as uriJoin } from './uri';
24
- import { isStore, isBlankNode } from './utils/terms';
23
+ import { isBlankNode, isStore } from './utils/terms';
25
24
  import * as Util from './utils-js';
26
25
  import { termValue } from './utils/termValue';
27
26
 
@@ -224,6 +223,11 @@ var UpdateManager = /*#__PURE__*/function () {
224
223
  value: function anonymizeNT(stmt) {
225
224
  return this.anonymize(stmt.subject) + ' ' + this.anonymize(stmt.predicate) + ' ' + this.anonymize(stmt.object) + ' .';
226
225
  }
226
+ }, {
227
+ key: "nTriples",
228
+ value: function nTriples(stmt) {
229
+ return "".concat(stmt.subject.toNT(), " ").concat(stmt.predicate.toNT(), " ").concat(stmt.object.toNT(), " .");
230
+ }
227
231
  /**
228
232
  * Returns a list of all bnodes occurring in a statement
229
233
  * @private
@@ -425,17 +429,16 @@ var UpdateManager = /*#__PURE__*/function () {
425
429
  value: function fire(uri, query, callbackFunction) {
426
430
  var _this = this;
427
431
 
432
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
428
433
  return Promise.resolve().then(function () {
429
434
  if (!uri) {
430
435
  throw new Error('No URI given for remote editing operation: ' + query);
431
436
  } // console.log('UpdateManager: sending update to <' + uri + '>')
432
437
 
433
438
 
434
- var options = {
435
- noMeta: true,
436
- contentType: 'application/sparql-update',
437
- body: query
438
- };
439
+ options.noMeta = true;
440
+ options.contentType = 'application/sparql-update';
441
+ options.body = query;
439
442
  return _this.store.fetcher.webOperation('PATCH', uri, options);
440
443
  }).then(function (response) {
441
444
  if (!response.ok) {
@@ -800,6 +803,7 @@ var UpdateManager = /*#__PURE__*/function () {
800
803
  * @param insertions - Statement or statements to be inserted.
801
804
  * @param callback - called as callbackFunction(uri, success, errorbody)
802
805
  * OR returns a promise
806
+ * @param options - Options for the fetch call
803
807
  */
804
808
 
805
809
  }, {
@@ -807,6 +811,8 @@ var UpdateManager = /*#__PURE__*/function () {
807
811
  value: function update(deletions, insertions, callback, secondTry) {
808
812
  var _this3 = this;
809
813
 
814
+ var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
815
+
810
816
  if (!callback) {
811
817
  var thisUpdater = this;
812
818
  return new Promise(function (resolve, reject) {
@@ -817,7 +823,7 @@ var UpdateManager = /*#__PURE__*/function () {
817
823
  } else {
818
824
  resolve();
819
825
  }
820
- }); // callbackFunction
826
+ }, secondTry, options); // callbackFunction
821
827
  }); // promise
822
828
  } // if
823
829
 
@@ -883,11 +889,11 @@ var UpdateManager = /*#__PURE__*/function () {
883
889
 
884
890
 
885
891
  this.store.fetcher.load(doc).then(function (response) {
886
- _this3.update(deletions, insertions, callback, true);
892
+ _this3.update(deletions, insertions, callback, true, options);
887
893
  }, function (err) {
888
894
  if (err.response.status === 404) {
889
895
  // nonexistent files are fine
890
- _this3.update(deletions, insertions, callback, true);
896
+ _this3.update(deletions, insertions, callback, true, options);
891
897
  } else {
892
898
  throw new Error("Update: Can't get updatability status ".concat(doc, " before patching: ").concat(err));
893
899
  }
@@ -941,7 +947,7 @@ var UpdateManager = /*#__PURE__*/function () {
941
947
  query += 'INSERT DATA { ';
942
948
 
943
949
  for (var _i7 = 0; _i7 < is.length; _i7++) {
944
- query += this.anonymizeNT(is[_i7]) + '\n';
950
+ query += this.nTriples(is[_i7]) + '\n';
945
951
  }
946
952
 
947
953
  query += ' }\n';
@@ -983,13 +989,13 @@ var UpdateManager = /*#__PURE__*/function () {
983
989
 
984
990
  downstreamAction(doc);
985
991
  }
986
- });
992
+ }, options);
987
993
  } else if (protocol.indexOf('DAV') >= 0) {
988
- this.updateDav(doc, ds, is, callback);
994
+ this.updateDav(doc, ds, is, callback, options);
989
995
  } else {
990
996
  if (protocol.indexOf('LOCALFILE') >= 0) {
991
997
  try {
992
- this.updateLocalFile(doc, ds, is, callback);
998
+ this.updateLocalFile(doc, ds, is, callback, options);
993
999
  } catch (e) {
994
1000
  callback(doc.value, false, 'Exception trying to write back file <' + doc.value + '>\n' // + tabulator.Util.stackString(e))
995
1001
  );
@@ -1005,6 +1011,7 @@ var UpdateManager = /*#__PURE__*/function () {
1005
1011
  }, {
1006
1012
  key: "updateDav",
1007
1013
  value: function updateDav(doc, ds, is, callbackFunction) {
1014
+ var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
1008
1015
  var kb = this.store; // The code below is derived from Kenny's UpdateCenter.js
1009
1016
 
1010
1017
  var request = kb.any(doc, this.ns.link('request'));
@@ -1041,11 +1048,9 @@ var UpdateManager = /*#__PURE__*/function () {
1041
1048
  targetURI = uriJoin(candidateTarget.value, targetURI);
1042
1049
  }
1043
1050
 
1044
- var options = {
1045
- contentType: contentType,
1046
- noMeta: true,
1047
- body: documentString
1048
- };
1051
+ options.contentType = contentType;
1052
+ options.noMeta = true;
1053
+ options.body = documentString;
1049
1054
  return kb.fetcher.webOperation('PUT', targetURI, options).then(function (response) {
1050
1055
  if (!response.ok) {
1051
1056
  throw new Error(response.error);
@@ -1071,11 +1076,13 @@ var UpdateManager = /*#__PURE__*/function () {
1071
1076
  * @param ds
1072
1077
  * @param is
1073
1078
  * @param callbackFunction
1079
+ * @param options
1074
1080
  */
1075
1081
 
1076
1082
  }, {
1077
1083
  key: "updateLocalFile",
1078
1084
  value: function updateLocalFile(doc, ds, is, callbackFunction) {
1085
+ var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
1079
1086
  var kb = this.store; // console.log('Writing back to local file\n')
1080
1087
  // prepare contents of revised document
1081
1088
 
@@ -1103,11 +1110,9 @@ var UpdateManager = /*#__PURE__*/function () {
1103
1110
  throw new Error('File extension .' + ext + ' not supported for data write');
1104
1111
  }
1105
1112
 
1106
- var documentString = this.serialize(doc.value, newSts, contentType);
1107
- kb.fetcher.webOperation('PUT', doc.value, {
1108
- "body": documentString,
1109
- contentType: contentType
1110
- }).then(function (response) {
1113
+ options.body = this.serialize(doc.value, newSts, contentType);
1114
+ options.contentType = contentType;
1115
+ kb.fetcher.webOperation('PUT', doc.value, options).then(function (response) {
1111
1116
  if (!response.ok) return callbackFunction(doc.value, false, response.error);
1112
1117
 
1113
1118
  for (var _i13 = 0; _i13 < ds.length; _i13++) {
package/lib/fetcher.d.ts CHANGED
@@ -56,7 +56,7 @@ declare global {
56
56
  declare type UserCallback = (ok: boolean, message: string, response?: any) => void;
57
57
  declare type HTTPMethods = 'GET' | 'PUT' | 'POST' | 'PATCH' | 'HEAD' | 'DELETE' | 'CONNECT' | 'TRACE' | 'OPTIONS';
58
58
  /** All valid inputs for initFetchOptions */
59
- declare type Options = Partial<AutoInitOptions>;
59
+ export declare type Options = Partial<AutoInitOptions>;
60
60
  /** Initiated by initFetchOptions, which runs on load */
61
61
  export interface AutoInitOptions extends RequestInit {
62
62
  /** The used Fetch function */
@@ -370,8 +370,8 @@ export default class Fetcher implements CallbackifyInterface {
370
370
  createContainer(parentURI: string, folderName: string, data: string): Promise<Response>;
371
371
  invalidateCache(iri: string | NamedNode): void;
372
372
  /**
373
- * A generic web opeation, at the fetch() level.
374
- * does not invole the quadstore.
373
+ * A generic web operation, at the fetch() level.
374
+ * does not involve the quad store.
375
375
  *
376
376
  * Returns promise of Response
377
377
  * If data is returned, copies it to response.responseText before returning
package/lib/fetcher.js CHANGED
@@ -1415,8 +1415,8 @@ var Fetcher = /*#__PURE__*/function () {
1415
1415
  }
1416
1416
  }
1417
1417
  /**
1418
- * A generic web opeation, at the fetch() level.
1419
- * does not invole the quadstore.
1418
+ * A generic web operation, at the fetch() level.
1419
+ * does not involve the quad store.
1420
1420
  *
1421
1421
  * Returns promise of Response
1422
1422
  * If data is returned, copies it to response.responseText before returning
@@ -26,7 +26,7 @@ export class Serializer {
26
26
  toStr(x: any): any;
27
27
  fromStr(s: any): any;
28
28
  /**
29
- * Defines a set of [prefix, namespace] pairs to be uised by this Serializer instance.
29
+ * Defines a set of [prefix, namespace] pairs to be used by this Serializer instance.
30
30
  * Overrides previous prefixes if any
31
31
  * @param namespaces
32
32
  * @return {Serializer}
package/lib/serializer.js CHANGED
@@ -81,7 +81,7 @@ var Serializer = /*#__PURE__*/function () {
81
81
  this.prefixchars = 'abcdefghijklmnopqustuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
82
82
  this.incoming = null; // Array not calculated yet
83
83
 
84
- this.formulas = []; // remebering original formulae from hashes
84
+ this.formulas = []; // remembering original formulae from hashes
85
85
 
86
86
  this.store = store;
87
87
  this.rdfFactory = store.rdfFactory || _canonicalDataFactory.default;
@@ -123,7 +123,7 @@ var Serializer = /*#__PURE__*/function () {
123
123
  return this.store.fromNT(s);
124
124
  }
125
125
  /**
126
- * Defines a set of [prefix, namespace] pairs to be uised by this Serializer instance.
126
+ * Defines a set of [prefix, namespace] pairs to be used by this Serializer instance.
127
127
  * Overrides previous prefixes if any
128
128
  * @param namespaces
129
129
  * @return {Serializer}
@@ -686,7 +686,7 @@ var Serializer = /*#__PURE__*/function () {
686
686
  return val;
687
687
 
688
688
  case 'http://www.w3.org/2001/XMLSchema#decimal':
689
- // In urtle must have dot
689
+ // In Turtle, must have dot
690
690
  if (val.indexOf('.') < 0) val += '.0';
691
691
  return val;
692
692
 
@@ -717,6 +717,9 @@ var Serializer = /*#__PURE__*/function () {
717
717
  case 'NamedNode':
718
718
  return this.symbolToN3(expr);
719
719
 
720
+ case 'DefaultGraph':
721
+ return '';
722
+
720
723
  default:
721
724
  throw new Error('Internal: atomicTermToN3 cannot handle ' + expr + ' of termType: ' + expr.termType);
722
725
  }
@@ -1,8 +1,8 @@
1
1
  import IndexedFormula from './store';
2
- import Fetcher from './fetcher';
2
+ import Fetcher, { Options } from './fetcher';
3
3
  import Statement from './statement';
4
4
  import RDFlibNamedNode from './named-node';
5
- import { BlankNode, NamedNode, Quad_Subject, Quad, Term } from './tf-types';
5
+ import { BlankNode, NamedNode, Quad, Quad_Subject, Term } from './tf-types';
6
6
  interface UpdateManagerFormula extends IndexedFormula {
7
7
  fetcher: Fetcher;
8
8
  }
@@ -41,6 +41,7 @@ export default class UpdateManager {
41
41
  editable(uri: string | NamedNode, kb?: IndexedFormula): string | boolean | undefined;
42
42
  anonymize(obj: any): any;
43
43
  anonymizeNT(stmt: Quad): string;
44
+ nTriples(stmt: any): string;
44
45
  /**
45
46
  * Returns a list of all bnodes occurring in a statement
46
47
  * @private
@@ -86,7 +87,7 @@ export default class UpdateManager {
86
87
  /**
87
88
  * @private
88
89
  */
89
- fire(uri: string, query: string, callbackFunction: CallBackFunction): Promise<void>;
90
+ fire(uri: string, query: string, callbackFunction: CallBackFunction, options?: Options): Promise<void>;
90
91
  /** return a statemnet updating function
91
92
  *
92
93
  * This does NOT update the statement.
@@ -155,9 +156,10 @@ export default class UpdateManager {
155
156
  * @param insertions - Statement or statements to be inserted.
156
157
  * @param callback - called as callbackFunction(uri, success, errorbody)
157
158
  * OR returns a promise
159
+ * @param options - Options for the fetch call
158
160
  */
159
- update(deletions: ReadonlyArray<Statement>, insertions: ReadonlyArray<Statement>, callback?: (uri: string | undefined | null, success: boolean, errorBody?: string, response?: Response | Error) => void, secondTry?: boolean): void | Promise<void>;
160
- updateDav(doc: Quad_Subject, ds: any, is: any, callbackFunction: any): null | Promise<void>;
161
+ update(deletions: ReadonlyArray<Statement>, insertions: ReadonlyArray<Statement>, callback?: (uri: string | undefined | null, success: boolean, errorBody?: string, response?: Response | Error) => void, secondTry?: boolean, options?: Options): void | Promise<void>;
162
+ updateDav(doc: Quad_Subject, ds: any, is: any, callbackFunction: any, options?: Options): null | Promise<void>;
161
163
  /**
162
164
  * Likely deprecated, since this lib no longer deals with browser extension
163
165
  *
@@ -165,8 +167,9 @@ export default class UpdateManager {
165
167
  * @param ds
166
168
  * @param is
167
169
  * @param callbackFunction
170
+ * @param options
168
171
  */
169
- updateLocalFile(doc: NamedNode, ds: any, is: any, callbackFunction: any): void;
172
+ updateLocalFile(doc: NamedNode, ds: any, is: any, callbackFunction: any, options?: Options): void;
170
173
  /**
171
174
  * @throws {Error} On unsupported content type
172
175
  *
@@ -236,6 +236,11 @@ var UpdateManager = /*#__PURE__*/function () {
236
236
  value: function anonymizeNT(stmt) {
237
237
  return this.anonymize(stmt.subject) + ' ' + this.anonymize(stmt.predicate) + ' ' + this.anonymize(stmt.object) + ' .';
238
238
  }
239
+ }, {
240
+ key: "nTriples",
241
+ value: function nTriples(stmt) {
242
+ return "".concat(stmt.subject.toNT(), " ").concat(stmt.predicate.toNT(), " ").concat(stmt.object.toNT(), " .");
243
+ }
239
244
  /**
240
245
  * Returns a list of all bnodes occurring in a statement
241
246
  * @private
@@ -437,17 +442,16 @@ var UpdateManager = /*#__PURE__*/function () {
437
442
  value: function fire(uri, query, callbackFunction) {
438
443
  var _this = this;
439
444
 
445
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
440
446
  return Promise.resolve().then(function () {
441
447
  if (!uri) {
442
448
  throw new Error('No URI given for remote editing operation: ' + query);
443
449
  } // console.log('UpdateManager: sending update to <' + uri + '>')
444
450
 
445
451
 
446
- var options = {
447
- noMeta: true,
448
- contentType: 'application/sparql-update',
449
- body: query
450
- };
452
+ options.noMeta = true;
453
+ options.contentType = 'application/sparql-update';
454
+ options.body = query;
451
455
  return _this.store.fetcher.webOperation('PATCH', uri, options);
452
456
  }).then(function (response) {
453
457
  if (!response.ok) {
@@ -812,6 +816,7 @@ var UpdateManager = /*#__PURE__*/function () {
812
816
  * @param insertions - Statement or statements to be inserted.
813
817
  * @param callback - called as callbackFunction(uri, success, errorbody)
814
818
  * OR returns a promise
819
+ * @param options - Options for the fetch call
815
820
  */
816
821
 
817
822
  }, {
@@ -819,6 +824,8 @@ var UpdateManager = /*#__PURE__*/function () {
819
824
  value: function update(deletions, insertions, callback, secondTry) {
820
825
  var _this3 = this;
821
826
 
827
+ var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
828
+
822
829
  if (!callback) {
823
830
  var thisUpdater = this;
824
831
  return new Promise(function (resolve, reject) {
@@ -829,7 +836,7 @@ var UpdateManager = /*#__PURE__*/function () {
829
836
  } else {
830
837
  resolve();
831
838
  }
832
- }); // callbackFunction
839
+ }, secondTry, options); // callbackFunction
833
840
  }); // promise
834
841
  } // if
835
842
 
@@ -895,11 +902,11 @@ var UpdateManager = /*#__PURE__*/function () {
895
902
 
896
903
 
897
904
  this.store.fetcher.load(doc).then(function (response) {
898
- _this3.update(deletions, insertions, callback, true);
905
+ _this3.update(deletions, insertions, callback, true, options);
899
906
  }, function (err) {
900
907
  if (err.response.status === 404) {
901
908
  // nonexistent files are fine
902
- _this3.update(deletions, insertions, callback, true);
909
+ _this3.update(deletions, insertions, callback, true, options);
903
910
  } else {
904
911
  throw new Error("Update: Can't get updatability status ".concat(doc, " before patching: ").concat(err));
905
912
  }
@@ -953,7 +960,7 @@ var UpdateManager = /*#__PURE__*/function () {
953
960
  query += 'INSERT DATA { ';
954
961
 
955
962
  for (var _i7 = 0; _i7 < is.length; _i7++) {
956
- query += this.anonymizeNT(is[_i7]) + '\n';
963
+ query += this.nTriples(is[_i7]) + '\n';
957
964
  }
958
965
 
959
966
  query += ' }\n';
@@ -995,13 +1002,13 @@ var UpdateManager = /*#__PURE__*/function () {
995
1002
 
996
1003
  downstreamAction(doc);
997
1004
  }
998
- });
1005
+ }, options);
999
1006
  } else if (protocol.indexOf('DAV') >= 0) {
1000
- this.updateDav(doc, ds, is, callback);
1007
+ this.updateDav(doc, ds, is, callback, options);
1001
1008
  } else {
1002
1009
  if (protocol.indexOf('LOCALFILE') >= 0) {
1003
1010
  try {
1004
- this.updateLocalFile(doc, ds, is, callback);
1011
+ this.updateLocalFile(doc, ds, is, callback, options);
1005
1012
  } catch (e) {
1006
1013
  callback(doc.value, false, 'Exception trying to write back file <' + doc.value + '>\n' // + tabulator.Util.stackString(e))
1007
1014
  );
@@ -1017,6 +1024,7 @@ var UpdateManager = /*#__PURE__*/function () {
1017
1024
  }, {
1018
1025
  key: "updateDav",
1019
1026
  value: function updateDav(doc, ds, is, callbackFunction) {
1027
+ var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
1020
1028
  var kb = this.store; // The code below is derived from Kenny's UpdateCenter.js
1021
1029
 
1022
1030
  var request = kb.any(doc, this.ns.link('request'));
@@ -1053,11 +1061,9 @@ var UpdateManager = /*#__PURE__*/function () {
1053
1061
  targetURI = (0, _uri.join)(candidateTarget.value, targetURI);
1054
1062
  }
1055
1063
 
1056
- var options = {
1057
- contentType: contentType,
1058
- noMeta: true,
1059
- body: documentString
1060
- };
1064
+ options.contentType = contentType;
1065
+ options.noMeta = true;
1066
+ options.body = documentString;
1061
1067
  return kb.fetcher.webOperation('PUT', targetURI, options).then(function (response) {
1062
1068
  if (!response.ok) {
1063
1069
  throw new Error(response.error);
@@ -1083,11 +1089,13 @@ var UpdateManager = /*#__PURE__*/function () {
1083
1089
  * @param ds
1084
1090
  * @param is
1085
1091
  * @param callbackFunction
1092
+ * @param options
1086
1093
  */
1087
1094
 
1088
1095
  }, {
1089
1096
  key: "updateLocalFile",
1090
1097
  value: function updateLocalFile(doc, ds, is, callbackFunction) {
1098
+ var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
1091
1099
  var kb = this.store; // console.log('Writing back to local file\n')
1092
1100
  // prepare contents of revised document
1093
1101
 
@@ -1115,11 +1123,9 @@ var UpdateManager = /*#__PURE__*/function () {
1115
1123
  throw new Error('File extension .' + ext + ' not supported for data write');
1116
1124
  }
1117
1125
 
1118
- var documentString = this.serialize(doc.value, newSts, contentType);
1119
- kb.fetcher.webOperation('PUT', doc.value, {
1120
- "body": documentString,
1121
- contentType: contentType
1122
- }).then(function (response) {
1126
+ options.body = this.serialize(doc.value, newSts, contentType);
1127
+ options.contentType = contentType;
1128
+ kb.fetcher.webOperation('PUT', doc.value, options).then(function (response) {
1123
1129
  if (!response.ok) return callbackFunction(doc.value, false, response.error);
1124
1130
 
1125
1131
  for (var _i13 = 0; _i13 < ds.length; _i13++) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rdflib",
3
3
  "description": "an RDF library for node.js. Suitable for client and server side.",
4
- "version": "2.2.19-c14dfd57",
4
+ "version": "2.2.19-e127c2a5",
5
5
  "private": false,
6
6
  "browserslist": [
7
7
  "> 0.5%"
package/src/fetcher.ts CHANGED
@@ -133,7 +133,7 @@ type UserCallback = (
133
133
  type HTTPMethods = 'GET' | 'PUT' | 'POST' | 'PATCH' | 'HEAD' | 'DELETE' | 'CONNECT' | 'TRACE' | 'OPTIONS'
134
134
 
135
135
  /** All valid inputs for initFetchOptions */
136
- type Options = Partial<AutoInitOptions>
136
+ export type Options = Partial<AutoInitOptions>
137
137
 
138
138
  /** Initiated by initFetchOptions, which runs on load */
139
139
  export interface AutoInitOptions extends RequestInit{
@@ -1571,8 +1571,8 @@ export default class Fetcher implements CallbackifyInterface {
1571
1571
  }
1572
1572
 
1573
1573
  /**
1574
- * A generic web opeation, at the fetch() level.
1575
- * does not invole the quadstore.
1574
+ * A generic web operation, at the fetch() level.
1575
+ * does not involve the quad store.
1576
1576
  *
1577
1577
  * Returns promise of Response
1578
1578
  * If data is returned, copies it to response.responseText before returning
package/src/serializer.js CHANGED
@@ -40,7 +40,7 @@ export class Serializer {
40
40
  this.keywords = ['a'] // The only one we generate at the moment
41
41
  this.prefixchars = 'abcdefghijklmnopqustuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
42
42
  this.incoming = null // Array not calculated yet
43
- this.formulas = [] // remebering original formulae from hashes
43
+ this.formulas = [] // remembering original formulae from hashes
44
44
  this.store = store
45
45
  this.rdfFactory = store.rdfFactory || CanonicalDataFactory
46
46
  this.xsd = createXSD(this.rdfFactory)
@@ -74,7 +74,7 @@ export class Serializer {
74
74
  }
75
75
 
76
76
  /**
77
- * Defines a set of [prefix, namespace] pairs to be uised by this Serializer instance.
77
+ * Defines a set of [prefix, namespace] pairs to be used by this Serializer instance.
78
78
  * Overrides previous prefixes if any
79
79
  * @param namespaces
80
80
  * @return {Serializer}
@@ -536,7 +536,7 @@ export class Serializer {
536
536
  case 'http://www.w3.org/2001/XMLSchema#integer':
537
537
  return val
538
538
 
539
- case 'http://www.w3.org/2001/XMLSchema#decimal': // In urtle must have dot
539
+ case 'http://www.w3.org/2001/XMLSchema#decimal': // In Turtle, must have dot
540
540
  if (val.indexOf('.') < 0) val += '.0'
541
541
  return val
542
542
 
@@ -561,6 +561,8 @@ export class Serializer {
561
561
  return str
562
562
  case 'NamedNode':
563
563
  return this.symbolToN3(expr)
564
+ case 'DefaultGraph':
565
+ return '';
564
566
  default:
565
567
  throw new Error('Internal: atomicTermToN3 cannot handle ' + expr + ' of termType: ' + expr.termType)
566
568
  }
@@ -1031,4 +1033,4 @@ function backslashUify (str) {
1031
1033
  }
1032
1034
  }
1033
1035
  return res
1034
- }
1036
+ }