rdflib 2.2.22-4e175603 → 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 (95) 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 +51 -31
  16. package/esm/jsonldparser.js +26 -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 -20
  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.js +87 -66
  58. package/lib/jsonldparser.js +26 -19
  59. package/lib/jsonparser.js +1 -1
  60. package/lib/lists.js +86 -54
  61. package/lib/literal.js +156 -120
  62. package/lib/log.js +7 -7
  63. package/lib/n3parser.js +1089 -1010
  64. package/lib/named-node.js +98 -69
  65. package/lib/namespace.js +4 -2
  66. package/lib/node-internal.js +96 -73
  67. package/lib/node.js +1 -1
  68. package/lib/parse.js +6 -5
  69. package/lib/patch-parser.js +1 -1
  70. package/lib/query.js +18 -19
  71. package/lib/rdfaparser.js +848 -783
  72. package/lib/rdfxmlparser.js +366 -350
  73. package/lib/serialize.d.ts +1 -1
  74. package/lib/serialize.js +4 -21
  75. package/lib/serializer.d.ts +1 -0
  76. package/lib/serializer.js +890 -825
  77. package/lib/statement.js +74 -54
  78. package/lib/store.d.ts +1 -1
  79. package/lib/store.js +926 -844
  80. package/lib/types.js +21 -21
  81. package/lib/update-manager.d.ts +1 -1
  82. package/lib/update-manager.js +959 -865
  83. package/lib/updates-via.js +134 -105
  84. package/lib/uri.js +3 -3
  85. package/lib/utils/default-graph-uri.js +2 -2
  86. package/lib/utils/terms.js +6 -4
  87. package/lib/utils-js.js +9 -8
  88. package/lib/utils.js +6 -6
  89. package/lib/variable.js +60 -34
  90. package/lib/xsd.js +2 -2
  91. package/package.json +6 -6
  92. package/src/jsonldparser.js +1 -1
  93. package/src/serialize.ts +4 -14
  94. package/src/serializer.js +24 -0
  95. package/src/update-manager.ts +8 -2
package/esm/index.js CHANGED
@@ -1,4 +1,12 @@
1
+ import _createClass from "@babel/runtime/helpers/createClass";
2
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
+ import _inherits from "@babel/runtime/helpers/inherits";
5
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
1
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
+ 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; } }
2
10
  import BlankNode from './blank-node';
3
11
  import Collection from './collection';
4
12
  import Empty from './empty';
@@ -31,30 +39,30 @@ import Variable from './variable';
31
39
  import DataFactory from './factories/rdflib-data-factory';
32
40
 
33
41
  // Prepare bound versions of data factory methods for export
34
- const boundDataFactory = {};
35
- for (const name in DataFactory) {
42
+ var boundDataFactory = {};
43
+ for (var name in DataFactory) {
36
44
  if (typeof DataFactory[name] === 'function') boundDataFactory[name] = DataFactory[name].bind(DataFactory);
37
45
  }
38
- const {
39
- fetcher,
40
- graph,
41
- lit,
42
- st,
43
- namedNode,
44
- variable,
45
- blankNode,
46
- defaultGraph,
47
- literal,
48
- quad,
49
- triple
50
- } = boundDataFactory;
51
- const formula = new Formula();
52
- const fromNT = str => formula.fromNT(str);
53
- const term = Node.fromValue;
46
+ var fetcher = boundDataFactory.fetcher,
47
+ graph = boundDataFactory.graph,
48
+ lit = boundDataFactory.lit,
49
+ st = boundDataFactory.st,
50
+ namedNode = boundDataFactory.namedNode,
51
+ variable = boundDataFactory.variable,
52
+ blankNode = boundDataFactory.blankNode,
53
+ defaultGraph = boundDataFactory.defaultGraph,
54
+ literal = boundDataFactory.literal,
55
+ quad = boundDataFactory.quad,
56
+ triple = boundDataFactory.triple;
57
+ var formula = new Formula();
58
+ var fromNT = function fromNT(str) {
59
+ return formula.fromNT(str);
60
+ };
61
+ var term = Node.fromValue;
54
62
 
55
63
  // TODO: this export is broken;
56
64
  // it exports the _current_ value of nextId, which is always 0
57
- const NextId = BlankNode.nextId;
65
+ var NextId = BlankNode.nextId;
58
66
  export * from './utils/terms';
59
67
  export { BlankNode, Collection, DataFactory, Empty, Fetcher, Formula, Store, jsonParser, Literal, log, N3Parser, NamedNode, Namespace, Node, parse, Query, queryToSPARQL, RDFaProcessor, RDFParser, serialize, Serializer, SPARQLToQuery, sparqlUpdateParser, Statement, term, UpdateManager, UpdatesSocket, UpdatesVia, uri, Util, Variable, Store as IndexedFormula,
60
68
  // Alias
@@ -63,17 +71,29 @@ NextId, fromNT, fetcher, graph, lit, st, namedNode as sym,
63
71
  // RDFJS DataFactory interface
64
72
  blankNode, defaultGraph, literal, namedNode, quad, triple, variable };
65
73
  export { termValue } from './utils/termValue';
66
- export class ConnectedStore extends Store {
67
- constructor(features) {
68
- super(features);
69
- _defineProperty(this, "fetcher", void 0);
70
- this.fetcher = new Fetcher(this, {});
74
+ export var ConnectedStore = /*#__PURE__*/function (_Store) {
75
+ _inherits(ConnectedStore, _Store);
76
+ var _super = _createSuper(ConnectedStore);
77
+ function ConnectedStore(features) {
78
+ var _this;
79
+ _classCallCheck(this, ConnectedStore);
80
+ _this = _super.call(this, features);
81
+ _defineProperty(_assertThisInitialized(_this), "fetcher", void 0);
82
+ _this.fetcher = new Fetcher(_assertThisInitialized(_this), {});
83
+ return _this;
71
84
  }
72
- }
73
- export class LiveStore extends ConnectedStore {
74
- constructor(features) {
75
- super(features);
76
- _defineProperty(this, "updater", void 0);
77
- this.updater = new UpdateManager(this);
85
+ return _createClass(ConnectedStore);
86
+ }(Store);
87
+ export var LiveStore = /*#__PURE__*/function (_ConnectedStore) {
88
+ _inherits(LiveStore, _ConnectedStore);
89
+ var _super2 = _createSuper(LiveStore);
90
+ function LiveStore(features) {
91
+ var _this2;
92
+ _classCallCheck(this, LiveStore);
93
+ _this2 = _super2.call(this, features);
94
+ _defineProperty(_assertThisInitialized(_this2), "updater", void 0);
95
+ _this2.updater = new UpdateManager(_assertThisInitialized(_this2));
96
+ return _this2;
78
97
  }
79
- }
98
+ return _createClass(LiveStore);
99
+ }(ConnectedStore);
@@ -36,9 +36,11 @@ export function jsonldObjectToTerm(kb, obj) {
36
36
  * Adds the statements in a json-ld list object to {kb}.
37
37
  */
38
38
  function listToStatements(kb, obj) {
39
- const listId = obj['@id'] ? nodeType(kb, obj) : kb.rdfFactory.blankNode();
40
- const items = obj['@list'].map(listItem => jsonldObjectToTerm(kb, listItem));
41
- const statements = arrayToStatements(kb.rdfFactory, listId, items);
39
+ var listId = obj['@id'] ? nodeType(kb, obj) : kb.rdfFactory.blankNode();
40
+ var items = obj['@list'].map(function (listItem) {
41
+ return jsonldObjectToTerm(kb, listItem);
42
+ });
43
+ var statements = arrayToStatements(kb.rdfFactory, listId, items);
42
44
  kb.addAll(statements);
43
45
  return listId;
44
46
  }
@@ -46,7 +48,9 @@ function listToCollection(kb, obj) {
46
48
  if (!Array.isArray(obj)) {
47
49
  throw new TypeError("Object must be an array");
48
50
  }
49
- return kb.rdfFactory.collection(obj.map(o => jsonldObjectToTerm(kb, o)));
51
+ return kb.rdfFactory.collection(obj.map(function (o) {
52
+ return jsonldObjectToTerm(kb, o);
53
+ }));
50
54
  }
51
55
 
52
56
  /**
@@ -55,17 +59,19 @@ function listToCollection(kb, obj) {
55
59
  * Ensure that {kb.rdfFactory} is a DataFactory.
56
60
  */
57
61
  export default function jsonldParser(str, kb, base, callback) {
58
- const baseString = base && Object.prototype.hasOwnProperty.call(base, 'termType') ? base.value : base;
62
+ var baseString = base && Object.prototype.hasOwnProperty.call(base, 'termType') ? base.value : base;
59
63
  return jsonld.flatten(JSON.parse(str), null, {
60
64
  base: baseString
61
- }).then(flattened => flattened.reduce((store, flatResource) => {
62
- kb = processResource(kb, base, flatResource);
63
- return kb;
64
- }, kb)).then(callback).catch(callback);
65
+ }).then(function (flattened) {
66
+ return flattened.reduce(function (store, flatResource) {
67
+ kb = processResource(kb, base, flatResource);
68
+ return kb;
69
+ }, kb);
70
+ }).then(callback).catch(callback);
65
71
  }
66
72
  function nodeType(kb, obj) {
67
73
  if (obj['@id'].startsWith('_:')) {
68
- // This object is a Blank Node.. pass the id without the preceding _:
74
+ // This object is a Blank Node. Pass the id without the `_:` prefix
69
75
  return kb.rdfFactory.blankNode(obj['@id'].substring(2));
70
76
  } else {
71
77
  // This object is a Named Node
@@ -73,26 +79,27 @@ function nodeType(kb, obj) {
73
79
  }
74
80
  }
75
81
  function processResource(kb, base, flatResource) {
76
- const id = flatResource['@id'] ? nodeType(kb, flatResource) : kb.rdfFactory.blankNode();
77
- for (const property of Object.keys(flatResource)) {
82
+ var id = flatResource['@id'] ? nodeType(kb, flatResource) : kb.rdfFactory.blankNode();
83
+ for (var _i = 0, _Object$keys = Object.keys(flatResource); _i < _Object$keys.length; _i++) {
84
+ var property = _Object$keys[_i];
78
85
  if (property === '@id') {
79
86
  continue;
80
87
  } else if (property == '@graph') {
81
88
  // the JSON-LD flattened structure may contain nested graphs
82
89
  // the id value for this object is the new base (named graph id) for all nested flat resources
83
- const graphId = id;
90
+ var graphId = id;
84
91
  // this is an array of resources
85
- const nestedFlatResources = flatResource[property];
92
+ var nestedFlatResources = flatResource[property];
86
93
 
87
94
  // recursively process all flat resources in the array, but with the graphId as base.
88
- for (let i = 0; i < nestedFlatResources.length; i++) {
95
+ for (var i = 0; i < nestedFlatResources.length; i++) {
89
96
  kb = processResource(kb, graphId, nestedFlatResources[i]);
90
97
  }
91
98
  }
92
- const value = flatResource[property];
99
+ var value = flatResource[property];
93
100
  if (Array.isArray(value)) {
94
- for (let i = 0; i < value.length; i++) {
95
- kb.addStatement(createStatement(kb, id, property, value[i], base));
101
+ for (var _i2 = 0; _i2 < value.length; _i2++) {
102
+ kb.addStatement(createStatement(kb, id, property, value[_i2], base));
96
103
  }
97
104
  } else {
98
105
  kb.addStatement(createStatement(kb, id, property, value, base));
@@ -110,7 +117,7 @@ function processResource(kb, base, flatResource) {
110
117
  * @return quad statement
111
118
  */
112
119
  function createStatement(kb, id, property, value, base) {
113
- let predicate, object;
120
+ var predicate, object;
114
121
  if (property === "@type") {
115
122
  predicate = kb.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
116
123
  object = kb.rdfFactory.namedNode(value);
package/esm/jsonparser.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default (function () {
2
2
  return {
3
- parseJSON: function (data, source, store) {
3
+ parseJSON: function parseJSON(data, source, store) {
4
4
  var subject, predicate, object;
5
5
  var bnodes = {};
6
6
  var why = store.sym(source);
package/esm/lists.js CHANGED
@@ -1,3 +1,6 @@
1
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3
+ 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; }
1
4
  /* Lists form conversion
2
5
  */
3
6
 
@@ -18,7 +21,7 @@ import Statement from './statement';
18
21
  // import Formula from './formula'
19
22
 
20
23
  import Namespace from './namespace';
21
- const RDF = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#');
24
+ var RDF = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#');
22
25
 
23
26
  /* Replace a given node with another node throughout a given document
24
27
  *
@@ -26,38 +29,83 @@ const RDF = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#');
26
29
  */
27
30
  export function substituteInDoc(store, x, y, doc) {
28
31
  // console.log(`substituteInDoc put ${x} for ${y} in ${doc}}`)
29
- for (const quad of store.statementsMatching(y, null, null, doc)) {
30
- const newStatement = new Statement(x, quad.predicate, quad.object, doc);
31
- store.remove(quad);
32
- store.add(newStatement);
32
+ var _iterator = _createForOfIteratorHelper(store.statementsMatching(y, null, null, doc)),
33
+ _step;
34
+ try {
35
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
36
+ var quad = _step.value;
37
+ var newStatement = new Statement(x, quad.predicate, quad.object, doc);
38
+ store.remove(quad);
39
+ store.add(newStatement);
40
+ }
41
+ } catch (err) {
42
+ _iterator.e(err);
43
+ } finally {
44
+ _iterator.f();
33
45
  }
34
- for (const quad of store.statementsMatching(null, y, null, doc)) {
35
- store.remove(quad);
36
- // console.log(` substituteInDoc predicate ${x} in ${quad}}`)
37
- store.add(new Statement(quad.subject, x, quad.object, doc));
46
+ var _iterator2 = _createForOfIteratorHelper(store.statementsMatching(null, y, null, doc)),
47
+ _step2;
48
+ try {
49
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
50
+ var _quad = _step2.value;
51
+ store.remove(_quad);
52
+ // console.log(` substituteInDoc predicate ${x} in ${quad}}`)
53
+ store.add(new Statement(_quad.subject, x, _quad.object, doc));
54
+ }
55
+ } catch (err) {
56
+ _iterator2.e(err);
57
+ } finally {
58
+ _iterator2.f();
38
59
  }
39
- for (const quad of store.statementsMatching(null, null, y, doc)) {
40
- store.remove(quad);
41
- store.add(new Statement(quad.subject, quad.predicate, x, doc));
60
+ var _iterator3 = _createForOfIteratorHelper(store.statementsMatching(null, null, y, doc)),
61
+ _step3;
62
+ try {
63
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
64
+ var _quad2 = _step3.value;
65
+ store.remove(_quad2);
66
+ store.add(new Statement(_quad2.subject, _quad2.predicate, x, doc));
67
+ }
68
+ } catch (err) {
69
+ _iterator3.e(err);
70
+ } finally {
71
+ _iterator3.f();
42
72
  }
43
73
  }
44
74
 
45
75
  /* Change all lone rdf:nil nodes into empty Collections
46
76
  */
47
77
  export function substituteNillsInDoc(store, doc) {
48
- const x = RDF('nil');
49
- for (const quad of store.statementsMatching(x, null, null, doc)) {
50
- store.remove(quad);
51
- const y = new Collection();
52
- store.add(new Statement(y, quad.predicate, quad.object, doc));
53
- }
54
- for (const quad of store.statementsMatching(null, null, x, doc)) {
55
- if (!quad.predicate.sameTerm(RDF('rest'))) {
56
- // If not a tail
78
+ var x = RDF('nil');
79
+ var _iterator4 = _createForOfIteratorHelper(store.statementsMatching(x, null, null, doc)),
80
+ _step4;
81
+ try {
82
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
83
+ var quad = _step4.value;
57
84
  store.remove(quad);
58
- const y = new Collection();
59
- store.add(new Statement(quad.subject, quad.predicate, y, doc));
85
+ var y = new Collection();
86
+ store.add(new Statement(y, quad.predicate, quad.object, doc));
87
+ }
88
+ } catch (err) {
89
+ _iterator4.e(err);
90
+ } finally {
91
+ _iterator4.f();
92
+ }
93
+ var _iterator5 = _createForOfIteratorHelper(store.statementsMatching(null, null, x, doc)),
94
+ _step5;
95
+ try {
96
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
97
+ var _quad3 = _step5.value;
98
+ if (!_quad3.predicate.sameTerm(RDF('rest'))) {
99
+ // If not a tail
100
+ store.remove(_quad3);
101
+ var _y = new Collection();
102
+ store.add(new Statement(_quad3.subject, _quad3.predicate, _y, doc));
103
+ }
60
104
  }
105
+ } catch (err) {
106
+ _iterator5.e(err);
107
+ } finally {
108
+ _iterator5.f();
61
109
  }
62
110
  }
63
111
  /**
@@ -72,34 +120,34 @@ export function substituteNillsInDoc(store, doc) {
72
120
  export function convertFirstRestNil(store, doc // Do whole store?
73
121
  ) {
74
122
  function preceding(ele, listSoFar, trash) {
75
- const rests = store.statementsMatching(ele, RDF('rest'), null, doc);
76
- if (rests.length !== 1) throw new Error(`Bad list structure: no rest at ${ele}`);
77
- const firsts = store.statementsMatching(ele, RDF('first'), null, doc);
78
- if (firsts.length !== 1) throw new Error(`Bad list structure: rest but ${firsts.length} firsts at ${ele}`);
79
- const value = firsts[0].object;
80
- const total = [value].concat(listSoFar);
123
+ var rests = store.statementsMatching(ele, RDF('rest'), null, doc);
124
+ if (rests.length !== 1) throw new Error("Bad list structure: no rest at ".concat(ele));
125
+ var firsts = store.statementsMatching(ele, RDF('first'), null, doc);
126
+ if (firsts.length !== 1) throw new Error("Bad list structure: rest but ".concat(firsts.length, " firsts at ").concat(ele));
127
+ var value = firsts[0].object;
128
+ var total = [value].concat(listSoFar);
81
129
  // console.log(' List now is: ', total)
82
- const totalTrash = trash.concat(rests).concat(firsts);
83
- const pres = store.statementsMatching(null, RDF('rest'), ele, doc);
130
+ var totalTrash = trash.concat(rests).concat(firsts);
131
+ var pres = store.statementsMatching(null, RDF('rest'), ele, doc);
84
132
  if (pres.length === 0) {
85
133
  // Head of the list
86
- const newList = new Collection(total);
134
+ var newList = new Collection(total);
87
135
  store.remove(totalTrash);
88
136
  // Replace old list with new list:
89
137
  substituteInDoc(store, newList, ele, doc);
90
138
  return;
91
139
  }
92
- if (pres.length !== 1) throw new Error(`Bad list structure: ${pres.length} pres at ${ele}`);
93
- const pre = pres[0].subject;
94
- if (pre.termType !== 'BlankNode') throw new Error(`Bad list element node ${pre} type: ${pre.termType} `);
140
+ if (pres.length !== 1) throw new Error("Bad list structure: ".concat(pres.length, " pres at ").concat(ele));
141
+ var pre = pres[0].subject;
142
+ if (pre.termType !== 'BlankNode') throw new Error("Bad list element node ".concat(pre, " type: ").concat(pre.termType, " "));
95
143
  preceding(pre, total, totalTrash);
96
144
  return;
97
145
  }
98
146
  substituteNillsInDoc(store, doc); // lone ones only
99
147
 
100
- const tails = store.statementsMatching(null, RDF('rest'), RDF('nil'), doc);
101
- tails.forEach(tail => {
102
- if (tail.subject.termType !== 'BlankNode') throw new Error(`Bad list element node ${tail.subject} type: ${tail.subject.termType} `);
148
+ var tails = store.statementsMatching(null, RDF('rest'), RDF('nil'), doc);
149
+ tails.forEach(function (tail) {
150
+ if (tail.subject.termType !== 'BlankNode') throw new Error("Bad list element node ".concat(tail.subject, " type: ").concat(tail.subject.termType, " "));
103
151
  preceding(tail.subject, [], []);
104
152
  });
105
153
  }