rdflib 2.2.21 → 2.2.22

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 (106) hide show
  1. package/dist/rdflib.min.js +1 -1
  2. package/dist/rdflib.min.js.LICENSE.txt +9 -1
  3. package/dist/rdflib.min.js.map +1 -1
  4. package/esm/blank-node.js +61 -114
  5. package/esm/class-order.js +1 -1
  6. package/esm/collection.js +70 -128
  7. package/esm/convert.js +1 -2
  8. package/esm/default-graph.js +14 -48
  9. package/esm/empty.js +8 -39
  10. package/esm/factories/canonical-data-factory.js +33 -65
  11. package/esm/factories/extended-term-factory.js +18 -25
  12. package/esm/factories/factory-types.js +3 -2
  13. package/esm/factories/rdflib-data-factory.js +9 -19
  14. package/esm/fetcher.js +1341 -1854
  15. package/esm/formula.js +639 -846
  16. package/esm/index.js +40 -76
  17. package/esm/jsonldparser.js +24 -49
  18. package/esm/jsonparser.js +1 -8
  19. package/esm/lists.js +47 -110
  20. package/esm/literal.js +120 -189
  21. package/esm/log.js +7 -7
  22. package/esm/n3parser.js +1015 -1412
  23. package/esm/named-node.js +70 -119
  24. package/esm/namespace.js +2 -5
  25. package/esm/node-internal.js +73 -110
  26. package/esm/node.js +2 -7
  27. package/esm/parse.js +12 -19
  28. package/esm/patch-parser.js +10 -30
  29. package/esm/query-to-sparql.js +0 -18
  30. package/esm/query.js +63 -147
  31. package/esm/rdfaparser.js +794 -997
  32. package/esm/rdfxmlparser.js +347 -461
  33. package/esm/serialize.js +9 -27
  34. package/esm/serializer.js +820 -1049
  35. package/esm/sparql-to-query.js +44 -134
  36. package/esm/statement.js +54 -85
  37. package/esm/store.js +830 -1103
  38. package/esm/types.js +22 -21
  39. package/esm/update-manager.js +869 -1106
  40. package/esm/updates-via.js +104 -161
  41. package/esm/uri.js +9 -53
  42. package/esm/utils/default-graph-uri.js +3 -2
  43. package/esm/utils/termValue.js +0 -1
  44. package/esm/utils/terms.js +19 -21
  45. package/esm/utils-js.js +20 -61
  46. package/esm/utils.js +10 -21
  47. package/esm/variable.js +32 -78
  48. package/esm/xsd.js +2 -2
  49. package/lib/blank-node.js +60 -113
  50. package/lib/class-order.js +1 -2
  51. package/lib/collection.js +69 -131
  52. package/lib/convert.js +3 -9
  53. package/lib/default-graph.js +13 -52
  54. package/lib/empty.js +8 -43
  55. package/lib/factories/canonical-data-factory.js +35 -79
  56. package/lib/factories/extended-term-factory.js +18 -32
  57. package/lib/factories/factory-types.d.ts +6 -6
  58. package/lib/factories/factory-types.js +1 -4
  59. package/lib/factories/rdflib-data-factory.js +9 -23
  60. package/lib/fetcher.d.ts +6 -6
  61. package/lib/fetcher.js +1370 -1843
  62. package/lib/formula.js +640 -855
  63. package/lib/index.js +66 -152
  64. package/lib/jsonldparser.js +23 -53
  65. package/lib/jsonparser.js +1 -10
  66. package/lib/lists.js +55 -112
  67. package/lib/literal.js +120 -195
  68. package/lib/log.d.ts +0 -6
  69. package/lib/log.js +7 -8
  70. package/lib/n3parser.js +1030 -1436
  71. package/lib/named-node.js +69 -126
  72. package/lib/namespace.js +2 -7
  73. package/lib/node-internal.js +74 -107
  74. package/lib/node.js +2 -12
  75. package/lib/parse.d.ts +1 -1
  76. package/lib/parse.js +12 -32
  77. package/lib/patch-parser.js +11 -34
  78. package/lib/query-to-sparql.js +0 -23
  79. package/lib/query.js +62 -167
  80. package/lib/rdfaparser.js +796 -1009
  81. package/lib/rdfxmlparser.js +349 -466
  82. package/lib/serialize.js +11 -37
  83. package/lib/serializer.js +823 -1064
  84. package/lib/sparql-to-query.js +42 -167
  85. package/lib/statement.js +55 -91
  86. package/lib/store.d.ts +1 -1
  87. package/lib/store.js +850 -1112
  88. package/lib/tf-types.d.ts +4 -4
  89. package/lib/types.d.ts +8 -8
  90. package/lib/types.js +23 -23
  91. package/lib/update-manager.d.ts +1 -1
  92. package/lib/update-manager.js +865 -1103
  93. package/lib/updates-via.js +105 -164
  94. package/lib/uri.js +8 -61
  95. package/lib/utils/default-graph-uri.js +3 -5
  96. package/lib/utils/termValue.js +0 -2
  97. package/lib/utils/terms.js +19 -40
  98. package/lib/utils-js.js +23 -88
  99. package/lib/utils.js +10 -27
  100. package/lib/variable.js +34 -85
  101. package/lib/xsd-internal.js +0 -3
  102. package/lib/xsd.js +2 -6
  103. package/package.json +36 -36
  104. package/src/fetcher.ts +2 -2
  105. package/src/update-manager.ts +12 -7
  106. package/changes.txt +0 -59
package/esm/blank-node.js CHANGED
@@ -1,137 +1,84 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
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";
7
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
- 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); }; }
10
-
11
- 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; } }
12
-
13
2
  import ClassOrder from './class-order';
14
3
  import Node from './node-internal';
15
4
  import { BlankNodeTermType } from './types';
16
-
17
5
  /**
18
6
  * An RDF blank node is a Node without a URI
19
7
  * @link https://rdf.js.org/data-model-spec/#blanknode-interface
20
8
  */
21
- var BlankNode = /*#__PURE__*/function (_Node) {
22
- _inherits(BlankNode, _Node);
23
-
24
- var _super = _createSuper(BlankNode);
9
+ export default class BlankNode extends Node {
10
+ /**
11
+ * The next unique identifier for blank nodes
12
+ */
25
13
 
14
+ static getId(id) {
15
+ if (id) {
16
+ if (typeof id !== 'string') {
17
+ console.log('Bad blank id:', id);
18
+ throw new Error('Bad id argument to new blank node: ' + id);
19
+ }
20
+ if (id.includes('#')) {
21
+ // Is a URI with hash fragment
22
+ let fragments = id.split('#');
23
+ return fragments[fragments.length - 1];
24
+ }
25
+ return id;
26
+ }
27
+ return 'n' + BlankNode.nextId++;
28
+ }
26
29
  /**
27
30
  * Initializes this node
28
31
  * @param [id] The identifier for the blank node
29
32
  */
30
- function BlankNode(id) {
31
- var _this;
32
-
33
- _classCallCheck(this, BlankNode);
34
-
35
- _this = _super.call(this, BlankNode.getId(id));
36
-
37
- _defineProperty(_assertThisInitialized(_this), "termType", BlankNodeTermType);
38
-
39
- _defineProperty(_assertThisInitialized(_this), "classOrder", ClassOrder.BlankNode);
40
-
41
- _defineProperty(_assertThisInitialized(_this), "isBlank", 1);
42
-
43
- _defineProperty(_assertThisInitialized(_this), "isVar", 1);
44
-
45
- return _this;
33
+ constructor(id) {
34
+ super(BlankNode.getId(id));
35
+ _defineProperty(this, "termType", BlankNodeTermType);
36
+ _defineProperty(this, "classOrder", ClassOrder.BlankNode);
37
+ _defineProperty(this, "isBlank", 1);
38
+ _defineProperty(this, "isVar", 1);
46
39
  }
40
+
47
41
  /**
48
42
  * The identifier for the blank node
49
43
  */
50
-
51
-
52
- _createClass(BlankNode, [{
53
- key: "id",
54
- get: function get() {
55
- return this.value;
56
- },
57
- set: function set(value) {
58
- this.value = value;
59
- }
60
- }, {
61
- key: "compareTerm",
62
- value: function compareTerm(other) {
63
- if (this.classOrder < other.classOrder) {
64
- return -1;
65
- }
66
-
67
- if (this.classOrder > other.classOrder) {
68
- return +1;
69
- }
70
-
71
- if (this.id < other.id) {
72
- return -1;
73
- }
74
-
75
- if (this.id > other.id) {
76
- return +1;
77
- }
78
-
79
- return 0;
44
+ get id() {
45
+ return this.value;
46
+ }
47
+ set id(value) {
48
+ this.value = value;
49
+ }
50
+ compareTerm(other) {
51
+ if (this.classOrder < other.classOrder) {
52
+ return -1;
80
53
  }
81
- /**
82
- * Gets a copy of this blank node in the specified formula
83
- * @param formula The formula
84
- */
85
-
86
- }, {
87
- key: "copy",
88
- value: function copy(formula) {
89
- // depends on the formula
90
- var bnodeNew = new BlankNode();
91
- formula.copyTo(this, bnodeNew);
92
- return bnodeNew;
54
+ if (this.classOrder > other.classOrder) {
55
+ return +1;
93
56
  }
94
- }, {
95
- key: "toCanonical",
96
- value: function toCanonical() {
97
- return BlankNode.NTAnonymousNodePrefix + this.value;
57
+ if (this.id < other.id) {
58
+ return -1;
98
59
  }
99
- }, {
100
- key: "toString",
101
- value: function toString() {
102
- return BlankNode.NTAnonymousNodePrefix + this.id;
60
+ if (this.id > other.id) {
61
+ return +1;
103
62
  }
104
- }], [{
105
- key: "getId",
106
- value:
107
- /**
108
- * The next unique identifier for blank nodes
109
- */
110
- function getId(id) {
111
- if (id) {
112
- if (typeof id !== 'string') {
113
- console.log('Bad blank id:', id);
114
- throw new Error('Bad id argument to new blank node: ' + id);
115
- }
116
-
117
- if (id.includes('#')) {
118
- // Is a URI with hash fragment
119
- var fragments = id.split('#');
120
- return fragments[fragments.length - 1];
121
- }
122
-
123
- return id;
124
- }
125
-
126
- return 'n' + BlankNode.nextId++;
127
- }
128
- }]);
129
-
130
- return BlankNode;
131
- }(Node);
63
+ return 0;
64
+ }
132
65
 
66
+ /**
67
+ * Gets a copy of this blank node in the specified formula
68
+ * @param formula The formula
69
+ */
70
+ copy(formula) {
71
+ // depends on the formula
72
+ var bnodeNew = new BlankNode();
73
+ formula.copyTo(this, bnodeNew);
74
+ return bnodeNew;
75
+ }
76
+ toCanonical() {
77
+ return BlankNode.NTAnonymousNodePrefix + this.value;
78
+ }
79
+ toString() {
80
+ return BlankNode.NTAnonymousNodePrefix + this.id;
81
+ }
82
+ }
133
83
  _defineProperty(BlankNode, "nextId", 0);
134
-
135
- _defineProperty(BlankNode, "NTAnonymousNodePrefix", '_:');
136
-
137
- export { BlankNode as default };
84
+ _defineProperty(BlankNode, "NTAnonymousNodePrefix", '_:');
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Class orders
3
3
  */
4
- var ClassOrder = {
4
+ const ClassOrder = {
5
5
  'Literal': 1,
6
6
  'Collection': 3,
7
7
  'Graph': 4,
package/esm/collection.js CHANGED
@@ -1,22 +1,10 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
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";
7
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
- 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); }; }
10
-
11
- 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; } }
12
-
13
2
  import RdflibBlankNode from './blank-node';
14
3
  import ClassOrder from './class-order';
15
4
  import Literal from './literal';
16
5
  import Node from './node-internal';
17
6
  import { CollectionTermType } from './types';
18
7
  import { isTerm } from './utils/terms';
19
-
20
8
  /**
21
9
  * Creates an RDF Node from a native javascript value.
22
10
  * RDF Nodes are returned unchanged, undefined returned as itself.
@@ -29,147 +17,101 @@ export function fromValue(value) {
29
17
  if (typeof value === 'undefined' || value === null) {
30
18
  return value;
31
19
  }
32
-
33
20
  if (isTerm(value)) {
34
21
  // a Node subclass or a Collection
35
22
  return value;
36
23
  }
37
-
38
24
  if (Array.isArray(value)) {
39
25
  return new Collection(value);
40
26
  }
41
-
42
27
  return Literal.fromValue(value);
43
28
  }
29
+
44
30
  /**
45
31
  * A collection of other RDF nodes
46
32
  *
47
33
  * Use generic T to control the contents of the array.
48
34
  */
49
-
50
- var Collection = /*#__PURE__*/function (_Node) {
51
- _inherits(Collection, _Node);
52
-
53
- var _super = _createSuper(Collection);
54
-
35
+ export default class Collection extends Node {
55
36
  /**
56
37
  * The nodes in this collection
57
38
  */
58
- function Collection(initial) {
59
- var _this;
60
-
61
- _classCallCheck(this, Collection);
62
-
63
- _this = _super.call(this, (RdflibBlankNode.nextId++).toString());
64
-
65
- _defineProperty(_assertThisInitialized(_this), "termType", CollectionTermType);
66
-
67
- _defineProperty(_assertThisInitialized(_this), "classOrder", ClassOrder.Collection);
68
-
69
- _defineProperty(_assertThisInitialized(_this), "closed", false);
70
-
71
- _defineProperty(_assertThisInitialized(_this), "compareTerm", RdflibBlankNode.prototype.compareTerm);
72
-
73
- _defineProperty(_assertThisInitialized(_this), "elements", []);
74
-
75
- _defineProperty(_assertThisInitialized(_this), "isVar", 0);
76
39
 
40
+ constructor(initial) {
41
+ super((RdflibBlankNode.nextId++).toString());
42
+ _defineProperty(this, "termType", CollectionTermType);
43
+ _defineProperty(this, "classOrder", ClassOrder.Collection);
44
+ _defineProperty(this, "closed", false);
45
+ _defineProperty(this, "compareTerm", RdflibBlankNode.prototype.compareTerm);
46
+ _defineProperty(this, "elements", []);
47
+ _defineProperty(this, "isVar", 0);
77
48
  if (initial && initial.length > 0) {
78
- initial.forEach(function (element) {
79
- _this.elements.push(fromValue(element));
49
+ initial.forEach(element => {
50
+ this.elements.push(fromValue(element));
80
51
  });
81
52
  }
82
-
83
- return _this;
53
+ }
54
+ get id() {
55
+ return this.value;
56
+ }
57
+ set id(value) {
58
+ this.value = value;
84
59
  }
85
60
 
86
- _createClass(Collection, [{
87
- key: "id",
88
- get: function get() {
89
- return this.value;
90
- },
91
- set: function set(value) {
92
- this.value = value;
93
- }
94
- /**
95
- * Appends an element to this collection
96
- * @param element - The new element
97
- */
98
-
99
- }, {
100
- key: "append",
101
- value: function append(element) {
102
- return this.elements.push(element);
103
- }
104
- /**
105
- * Closes this collection
106
- */
107
-
108
- }, {
109
- key: "close",
110
- value: function close() {
111
- this.closed = true;
112
- return this.closed;
113
- }
114
- /**
115
- * Removes the first element from the collection (and return it)
116
- */
117
-
118
- }, {
119
- key: "shift",
120
- value: function shift() {
121
- return this.elements.shift();
122
- }
123
- /**
124
- * Creates a new Collection with the substituting bindings applied
125
- * @param bindings - The bindings to substitute
126
- */
61
+ /**
62
+ * Appends an element to this collection
63
+ * @param element - The new element
64
+ */
65
+ append(element) {
66
+ return this.elements.push(element);
67
+ }
127
68
 
128
- }, {
129
- key: "substitute",
130
- value: function substitute(bindings) {
131
- var elementsCopy = this.elements.map(function (ea) {
132
- return ea.substitute(bindings);
133
- });
134
- return new Collection(elementsCopy);
135
- }
136
- }, {
137
- key: "toNT",
138
- value: function toNT() {
139
- return Collection.toNT(this);
140
- }
141
- }, {
142
- key: "toString",
143
- value:
144
- /**
145
- * Serializes the collection to a string.
146
- * Surrounded by (parentheses) and separated by spaces.
147
- */
148
- function toString() {
149
- return '(' + this.elements.join(' ') + ')';
150
- }
151
- /**
152
- * Prepends the specified element to the collection's front
153
- * @param element - The element to prepend
154
- */
69
+ /**
70
+ * Closes this collection
71
+ */
72
+ close() {
73
+ this.closed = true;
74
+ return this.closed;
75
+ }
155
76
 
156
- }, {
157
- key: "unshift",
158
- value: function unshift(element) {
159
- return this.elements.unshift(element);
160
- }
161
- }], [{
162
- key: "toNT",
163
- value: function toNT(collection) {
164
- // return '(' + collection.elements.map(x => x.toNT()).join(' ') + ')'
165
- // As lists are not in NT and toNT() must be a reversible function, we kludge it for a list
166
- return RdflibBlankNode.NTAnonymousNodePrefix + collection.id;
167
- }
168
- }]);
77
+ /**
78
+ * Removes the first element from the collection (and return it)
79
+ */
80
+ shift() {
81
+ return this.elements.shift();
82
+ }
169
83
 
170
- return Collection;
171
- }(Node);
84
+ /**
85
+ * Creates a new Collection with the substituting bindings applied
86
+ * @param bindings - The bindings to substitute
87
+ */
88
+ substitute(bindings) {
89
+ const elementsCopy = this.elements.map(ea => ea.substitute(bindings));
90
+ return new Collection(elementsCopy);
91
+ }
92
+ toNT() {
93
+ return Collection.toNT(this);
94
+ }
95
+ static toNT(collection) {
96
+ // return '(' + collection.elements.map(x => x.toNT()).join(' ') + ')'
97
+ // As lists are not in NT and toNT() must be a reversible function, we kludge it for a list
98
+ return RdflibBlankNode.NTAnonymousNodePrefix + collection.id;
99
+ }
172
100
 
173
- _defineProperty(Collection, "termType", CollectionTermType);
101
+ /**
102
+ * Serializes the collection to a string.
103
+ * Surrounded by (parentheses) and separated by spaces.
104
+ */
105
+ toString() {
106
+ return '(' + this.elements.join(' ') + ')';
107
+ }
174
108
 
175
- export { Collection as default };
109
+ /**
110
+ * Prepends the specified element to the collection's front
111
+ * @param element - The element to prepend
112
+ */
113
+ unshift(element) {
114
+ return this.elements.unshift(element);
115
+ }
116
+ }
117
+ _defineProperty(Collection, "termType", CollectionTermType);
package/esm/convert.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import asyncLib from 'async'; // @@ Goal: remove this dependency
2
-
3
2
  import jsonld from 'jsonld';
4
3
  import { Parser, Writer } from 'n3'; // @@ Goal: remove this dependency
5
4
 
@@ -23,7 +22,7 @@ export function convertToJson(n3String, jsonCallback) {
23
22
  try {
24
23
  jsonld.fromRDF(result, {
25
24
  format: 'application/nquads'
26
- }).then(function (result) {
25
+ }).then(result => {
27
26
  callback(null, result);
28
27
  });
29
28
  } catch (err) {
@@ -1,57 +1,23 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
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";
7
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
- 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); }; }
10
-
11
- 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; } }
12
-
13
2
  import Node from './node-internal';
14
3
  import { DefaultGraphTermType } from './types';
15
4
  import { defaultGraphURI } from './utils/default-graph-uri';
16
- /** The RDF default graph */
17
-
18
- var DefaultGraph = /*#__PURE__*/function (_Node) {
19
- _inherits(DefaultGraph, _Node);
20
-
21
- var _super = _createSuper(DefaultGraph);
22
-
23
- function DefaultGraph() {
24
- var _this;
25
-
26
- _classCallCheck(this, DefaultGraph);
27
-
28
- _this = _super.call(this, '');
29
5
 
30
- _defineProperty(_assertThisInitialized(_this), "value", '');
31
-
32
- _defineProperty(_assertThisInitialized(_this), "termType", DefaultGraphTermType);
33
-
34
- _defineProperty(_assertThisInitialized(_this), "uri", defaultGraphURI);
35
-
36
- return _this;
6
+ /** The RDF default graph */
7
+ export default class DefaultGraph extends Node {
8
+ constructor() {
9
+ super('');
10
+ _defineProperty(this, "value", '');
11
+ _defineProperty(this, "termType", DefaultGraphTermType);
12
+ _defineProperty(this, "uri", defaultGraphURI);
37
13
  }
38
-
39
- _createClass(DefaultGraph, [{
40
- key: "toCanonical",
41
- value: function toCanonical() {
42
- return this.value;
43
- }
44
- }, {
45
- key: "toString",
46
- value: function toString() {
47
- return 'DefaultGraph';
48
- }
49
- }]);
50
-
51
- return DefaultGraph;
52
- }(Node);
53
-
54
- export { DefaultGraph as default };
14
+ toCanonical() {
15
+ return this.value;
16
+ }
17
+ toString() {
18
+ return 'DefaultGraph';
19
+ }
20
+ }
55
21
  export function isDefaultGraph(object) {
56
22
  return !!object && object.termType === DefaultGraphTermType;
57
23
  }
package/esm/empty.js CHANGED
@@ -1,46 +1,15 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
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";
7
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
- 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); }; }
10
-
11
- 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; } }
12
-
13
2
  import Node from './node-internal';
14
3
  import { EmptyTermType } from './types';
15
-
16
4
  /**
17
5
  * An empty node
18
6
  */
19
- var Empty = /*#__PURE__*/function (_Node) {
20
- _inherits(Empty, _Node);
21
-
22
- var _super = _createSuper(Empty);
23
-
24
- function Empty() {
25
- var _this;
26
-
27
- _classCallCheck(this, Empty);
28
-
29
- _this = _super.call(this, '');
30
-
31
- _defineProperty(_assertThisInitialized(_this), "termType", EmptyTermType);
32
-
33
- return _this;
7
+ export default class Empty extends Node {
8
+ constructor() {
9
+ super('');
10
+ _defineProperty(this, "termType", EmptyTermType);
34
11
  }
35
-
36
- _createClass(Empty, [{
37
- key: "toString",
38
- value: function toString() {
39
- return '()';
40
- }
41
- }]);
42
-
43
- return Empty;
44
- }(Node);
45
-
46
- export { Empty as default };
12
+ toString() {
13
+ return '()';
14
+ }
15
+ }