rdflib 2.2.34 → 2.2.35-2bb9ed0b

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 (100) hide show
  1. package/dist/515.rdflib.min.js +3 -0
  2. package/dist/515.rdflib.min.js.map +1 -0
  3. package/dist/789.rdflib.min.js +1 -0
  4. package/dist/rdflib.min.js +1 -1
  5. package/dist/rdflib.min.js.LICENSE.txt +0 -2
  6. package/dist/rdflib.min.js.map +1 -1
  7. package/esm/blank-node.js +57 -85
  8. package/esm/class-order.js +1 -1
  9. package/esm/collection.js +70 -106
  10. package/esm/default-graph.js +13 -33
  11. package/esm/empty.js +8 -26
  12. package/esm/factories/canonical-data-factory.js +33 -30
  13. package/esm/factories/extended-term-factory.js +18 -14
  14. package/esm/factories/factory-types.js +1 -1
  15. package/esm/factories/rdflib-data-factory.js +9 -11
  16. package/esm/fetcher.js +1364 -1668
  17. package/esm/formula.js +631 -739
  18. package/esm/index.js +31 -51
  19. package/esm/jsonldparser.js +19 -26
  20. package/esm/jsonparser.js +1 -1
  21. package/esm/lists.js +41 -86
  22. package/esm/literal.js +120 -157
  23. package/esm/log.js +7 -7
  24. package/esm/n3parser.js +1008 -1090
  25. package/esm/named-node.js +69 -99
  26. package/esm/namespace.js +2 -4
  27. package/esm/node-internal.js +73 -97
  28. package/esm/node.js +1 -2
  29. package/esm/parse.js +3 -3
  30. package/esm/patch-parser.js +1 -2
  31. package/esm/query.js +15 -30
  32. package/esm/rdfaparser.js +775 -846
  33. package/esm/rdfxmlparser.js +348 -365
  34. package/esm/serialize.js +2 -3
  35. package/esm/serializer.js +834 -889
  36. package/esm/sparql-to-query.js +0 -2
  37. package/esm/statement.js +52 -72
  38. package/esm/store.js +852 -963
  39. package/esm/types.js +26 -21
  40. package/esm/update-manager.js +963 -1104
  41. package/esm/updates-via.js +104 -134
  42. package/esm/uri.js +3 -3
  43. package/esm/utils/default-graph-uri.js +2 -2
  44. package/esm/utils/terms.js +4 -5
  45. package/esm/utils-js.js +5 -6
  46. package/esm/utils.js +7 -6
  47. package/esm/variable.js +32 -58
  48. package/esm/xsd.js +2 -2
  49. package/lib/blank-node.js +56 -83
  50. package/lib/class-order.js +2 -3
  51. package/lib/collection.js +69 -104
  52. package/lib/default-graph.js +13 -32
  53. package/lib/empty.js +8 -25
  54. package/lib/factories/canonical-data-factory.js +36 -34
  55. package/lib/factories/extended-term-factory.js +19 -16
  56. package/lib/factories/factory-types.js +2 -3
  57. package/lib/factories/rdflib-data-factory.js +10 -13
  58. package/lib/fetcher.js +1394 -1693
  59. package/lib/formula.js +631 -738
  60. package/lib/index.js +66 -89
  61. package/lib/jsonldparser.js +21 -32
  62. package/lib/jsonparser.js +3 -4
  63. package/lib/lists.js +47 -87
  64. package/lib/literal.js +120 -156
  65. package/lib/log.js +8 -9
  66. package/lib/n3parser.js +1011 -1096
  67. package/lib/named-node.js +69 -98
  68. package/lib/namespace.js +2 -4
  69. package/lib/node-internal.js +72 -95
  70. package/lib/node.js +2 -4
  71. package/lib/parse.js +5 -6
  72. package/lib/patch-parser.js +1 -2
  73. package/lib/query.js +19 -32
  74. package/lib/rdfaparser.js +777 -849
  75. package/lib/rdfxmlparser.js +350 -366
  76. package/lib/serialize.js +2 -3
  77. package/lib/serializer.js +838 -892
  78. package/lib/sparql-to-query.js +0 -2
  79. package/lib/statement.js +54 -74
  80. package/lib/store.js +873 -978
  81. package/lib/types.js +22 -43
  82. package/lib/update-manager.js +972 -1111
  83. package/lib/updates-via.js +105 -134
  84. package/lib/uri.js +3 -3
  85. package/lib/utils/default-graph-uri.js +2 -4
  86. package/lib/utils/terms.js +4 -6
  87. package/lib/utils-js.js +11 -13
  88. package/lib/utils.js +6 -7
  89. package/lib/variable.js +34 -60
  90. package/lib/xsd-internal.js +2 -3
  91. package/lib/xsd.js +3 -4
  92. package/package.json +31 -31
  93. package/src/n3parser.js +1 -1
  94. package/src/rdfxmlparser.js +2 -1
  95. package/src/serializer.js +1 -1
  96. package/.babelrc +0 -20
  97. package/dist/670.rdflib.min.js +0 -1
  98. package/dist/730.rdflib.min.js +0 -3
  99. package/dist/730.rdflib.min.js.map +0 -1
  100. /package/dist/{730.rdflib.min.js.LICENSE.txt → 515.rdflib.min.js.LICENSE.txt} +0 -0
package/esm/blank-node.js CHANGED
@@ -1,12 +1,4 @@
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
- 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; } }
10
2
  import ClassOrder from './class-order';
11
3
  import Node from './node-internal';
12
4
  import { BlankNodeTermType } from './types';
@@ -14,103 +6,83 @@ import { BlankNodeTermType } from './types';
14
6
  * An RDF blank node is a Node without a URI
15
7
  * @link https://rdf.js.org/data-model-spec/#blanknode-interface
16
8
  */
17
- var BlankNode = /*#__PURE__*/function (_Node) {
18
- _inherits(BlankNode, _Node);
19
- var _super = _createSuper(BlankNode);
9
+ export default class BlankNode extends Node {
10
+ static getId(id) {
11
+ if (id) {
12
+ if (typeof id !== 'string') {
13
+ throw new Error('Bad id argument to new blank node: ' + id);
14
+ }
15
+ if (id.includes('#')) {
16
+ // Is a URI with hash fragment
17
+ let fragments = id.split('#');
18
+ return fragments[fragments.length - 1];
19
+ }
20
+ return id;
21
+ }
22
+ return 'n' + BlankNode.nextId++;
23
+ }
20
24
  /**
21
25
  * Initializes this node
22
26
  * @param [id] The identifier for the blank node
23
27
  */
24
- function BlankNode(id) {
25
- var _this;
26
- _classCallCheck(this, BlankNode);
27
- _this = _super.call(this, BlankNode.getId(id));
28
- _defineProperty(_assertThisInitialized(_this), "termType", BlankNodeTermType);
29
- _defineProperty(_assertThisInitialized(_this), "classOrder", ClassOrder.BlankNode);
28
+ constructor(id) {
29
+ super(BlankNode.getId(id));
30
+ _defineProperty(this, "termType", BlankNodeTermType);
31
+ _defineProperty(this, "classOrder", ClassOrder.BlankNode);
30
32
  /** Whether this is a blank node */
31
- _defineProperty(_assertThisInitialized(_this), "isBlank", 1);
33
+ _defineProperty(this, "isBlank", 1);
32
34
  /**
33
35
  * This type of node is a variable.
34
36
  *
35
37
  * Note that the existence of this property already indicates that it is a variable.
36
38
  */
37
- _defineProperty(_assertThisInitialized(_this), "isVar", 1);
38
- return _this;
39
+ _defineProperty(this, "isVar", 1);
39
40
  }
40
41
 
41
42
  /**
42
43
  * The identifier for the blank node
43
44
  */
44
- _createClass(BlankNode, [{
45
- key: "id",
46
- get: function get() {
47
- return this.value;
48
- },
49
- set: function set(value) {
50
- this.value = value;
51
- }
52
- }, {
53
- key: "compareTerm",
54
- value: function compareTerm(other) {
55
- if (this.classOrder < other.classOrder) {
56
- return -1;
57
- }
58
- if (this.classOrder > other.classOrder) {
59
- return +1;
60
- }
61
- if (this.id < other.id) {
62
- return -1;
63
- }
64
- if (this.id > other.id) {
65
- return +1;
66
- }
67
- return 0;
68
- }
69
-
70
- /**
71
- * Gets a copy of this blank node in the specified formula
72
- * @param formula The formula
73
- */
74
- }, {
75
- key: "copy",
76
- value: function copy(formula) {
77
- // depends on the formula
78
- var bnodeNew = new BlankNode();
79
- formula.copyTo(this, bnodeNew);
80
- return bnodeNew;
45
+ get id() {
46
+ return this.value;
47
+ }
48
+ set id(value) {
49
+ this.value = value;
50
+ }
51
+ compareTerm(other) {
52
+ if (this.classOrder < other.classOrder) {
53
+ return -1;
81
54
  }
82
- }, {
83
- key: "toCanonical",
84
- value: function toCanonical() {
85
- return BlankNode.NTAnonymousNodePrefix + this.value;
55
+ if (this.classOrder > other.classOrder) {
56
+ return +1;
86
57
  }
87
- }, {
88
- key: "toString",
89
- value: function toString() {
90
- return BlankNode.NTAnonymousNodePrefix + this.id;
58
+ if (this.id < other.id) {
59
+ return -1;
91
60
  }
92
- }], [{
93
- key: "getId",
94
- value: function getId(id) {
95
- if (id) {
96
- if (typeof id !== 'string') {
97
- throw new Error('Bad id argument to new blank node: ' + id);
98
- }
99
- if (id.includes('#')) {
100
- // Is a URI with hash fragment
101
- var fragments = id.split('#');
102
- return fragments[fragments.length - 1];
103
- }
104
- return id;
105
- }
106
- return 'n' + BlankNode.nextId++;
61
+ if (this.id > other.id) {
62
+ return +1;
107
63
  }
108
- }]);
109
- return BlankNode;
110
- }(Node);
64
+ return 0;
65
+ }
66
+
67
+ /**
68
+ * Gets a copy of this blank node in the specified formula
69
+ * @param formula The formula
70
+ */
71
+ copy(formula) {
72
+ // depends on the formula
73
+ var bnodeNew = new BlankNode();
74
+ formula.copyTo(this, bnodeNew);
75
+ return bnodeNew;
76
+ }
77
+ toCanonical() {
78
+ return BlankNode.NTAnonymousNodePrefix + this.value;
79
+ }
80
+ toString() {
81
+ return BlankNode.NTAnonymousNodePrefix + this.id;
82
+ }
83
+ }
111
84
  /**
112
85
  * The next unique identifier for blank nodes
113
86
  */
114
87
  _defineProperty(BlankNode, "nextId", 0);
115
- _defineProperty(BlankNode, "NTAnonymousNodePrefix", '_:');
116
- export { BlankNode as default };
88
+ _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,12 +1,4 @@
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
- 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; } }
10
2
  import RdflibBlankNode from './blank-node';
11
3
  import ClassOrder from './class-order';
12
4
  import Literal from './literal';
@@ -40,113 +32,85 @@ export function fromValue(value) {
40
32
  *
41
33
  * Use generic T to control the contents of the array.
42
34
  */
43
- var Collection = /*#__PURE__*/function (_Node) {
44
- _inherits(Collection, _Node);
45
- var _super = _createSuper(Collection);
46
- function Collection(initial) {
47
- var _this;
48
- _classCallCheck(this, Collection);
49
- _this = _super.call(this, (RdflibBlankNode.nextId++).toString());
50
- _defineProperty(_assertThisInitialized(_this), "termType", CollectionTermType);
51
- _defineProperty(_assertThisInitialized(_this), "classOrder", ClassOrder.Collection);
52
- _defineProperty(_assertThisInitialized(_this), "closed", false);
53
- _defineProperty(_assertThisInitialized(_this), "compareTerm", RdflibBlankNode.prototype.compareTerm);
35
+ export default class Collection extends Node {
36
+ constructor(initial) {
37
+ super((RdflibBlankNode.nextId++).toString());
38
+ _defineProperty(this, "termType", CollectionTermType);
39
+ _defineProperty(this, "classOrder", ClassOrder.Collection);
40
+ _defineProperty(this, "closed", false);
41
+ _defineProperty(this, "compareTerm", RdflibBlankNode.prototype.compareTerm);
54
42
  /**
55
43
  * The nodes in this collection
56
44
  */
57
- _defineProperty(_assertThisInitialized(_this), "elements", []);
58
- _defineProperty(_assertThisInitialized(_this), "isVar", 0);
45
+ _defineProperty(this, "elements", []);
46
+ _defineProperty(this, "isVar", 0);
59
47
  if (initial && initial.length > 0) {
60
- initial.forEach(function (element) {
61
- _this.elements.push(fromValue(element));
48
+ initial.forEach(element => {
49
+ this.elements.push(fromValue(element));
62
50
  });
63
51
  }
64
- return _this;
65
52
  }
66
- _createClass(Collection, [{
67
- key: "id",
68
- get: function get() {
69
- return this.value;
70
- },
71
- set: function set(value) {
72
- this.value = value;
73
- }
53
+ get id() {
54
+ return this.value;
55
+ }
56
+ set id(value) {
57
+ this.value = value;
58
+ }
74
59
 
75
- /**
76
- * Appends an element to this collection
77
- * @param element - The new element
78
- */
79
- }, {
80
- key: "append",
81
- value: function append(element) {
82
- return this.elements.push(element);
83
- }
60
+ /**
61
+ * Appends an element to this collection
62
+ * @param element - The new element
63
+ */
64
+ append(element) {
65
+ return this.elements.push(element);
66
+ }
84
67
 
85
- /**
86
- * Closes this collection
87
- */
88
- }, {
89
- key: "close",
90
- value: function close() {
91
- this.closed = true;
92
- return this.closed;
93
- }
68
+ /**
69
+ * Closes this collection
70
+ */
71
+ close() {
72
+ this.closed = true;
73
+ return this.closed;
74
+ }
94
75
 
95
- /**
96
- * Removes the first element from the collection (and return it)
97
- */
98
- }, {
99
- key: "shift",
100
- value: function shift() {
101
- return this.elements.shift();
102
- }
76
+ /**
77
+ * Removes the first element from the collection (and return it)
78
+ */
79
+ shift() {
80
+ return this.elements.shift();
81
+ }
103
82
 
104
- /**
105
- * Creates a new Collection with the substituting bindings applied
106
- * @param bindings - The bindings to substitute
107
- */
108
- }, {
109
- key: "substitute",
110
- value: function substitute(bindings) {
111
- var elementsCopy = this.elements.map(function (ea) {
112
- return ea.substitute(bindings);
113
- });
114
- return new Collection(elementsCopy);
115
- }
116
- }, {
117
- key: "toNT",
118
- value: function toNT() {
119
- return Collection.toNT(this);
120
- }
121
- }, {
122
- key: "toString",
123
- value:
124
- /**
125
- * Serializes the collection to a string.
126
- * Surrounded by (parentheses) and separated by spaces.
127
- */
128
- function toString() {
129
- return '(' + this.elements.join(' ') + ')';
130
- }
83
+ /**
84
+ * Creates a new Collection with the substituting bindings applied
85
+ * @param bindings - The bindings to substitute
86
+ */
87
+ substitute(bindings) {
88
+ const elementsCopy = this.elements.map(ea => ea.substitute(bindings));
89
+ return new Collection(elementsCopy);
90
+ }
91
+ toNT() {
92
+ return Collection.toNT(this);
93
+ }
94
+ static toNT(collection) {
95
+ // return '(' + collection.elements.map(x => x.toNT()).join(' ') + ')'
96
+ // As lists are not in NT and toNT() must be a reversible function, we kludge it for a list
97
+ return RdflibBlankNode.NTAnonymousNodePrefix + collection.id;
98
+ }
131
99
 
132
- /**
133
- * Prepends the specified element to the collection's front
134
- * @param element - The element to prepend
135
- */
136
- }, {
137
- key: "unshift",
138
- value: function unshift(element) {
139
- return this.elements.unshift(element);
140
- }
141
- }], [{
142
- key: "toNT",
143
- value: function toNT(collection) {
144
- // return '(' + collection.elements.map(x => x.toNT()).join(' ') + ')'
145
- // As lists are not in NT and toNT() must be a reversible function, we kludge it for a list
146
- return RdflibBlankNode.NTAnonymousNodePrefix + collection.id;
147
- }
148
- }]);
149
- return Collection;
150
- }(Node);
151
- _defineProperty(Collection, "termType", CollectionTermType);
152
- export { Collection as default };
100
+ /**
101
+ * Serializes the collection to a string.
102
+ * Surrounded by (parentheses) and separated by spaces.
103
+ */
104
+ toString() {
105
+ return '(' + this.elements.join(' ') + ')';
106
+ }
107
+
108
+ /**
109
+ * Prepends the specified element to the collection's front
110
+ * @param element - The element to prepend
111
+ */
112
+ unshift(element) {
113
+ return this.elements.unshift(element);
114
+ }
115
+ }
116
+ _defineProperty(Collection, "termType", CollectionTermType);
@@ -1,43 +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
- 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; } }
10
2
  import Node from './node-internal';
11
3
  import { DefaultGraphTermType } from './types';
12
4
  import { defaultGraphURI } from './utils/default-graph-uri';
13
5
 
14
6
  /** The RDF default graph */
15
- var DefaultGraph = /*#__PURE__*/function (_Node) {
16
- _inherits(DefaultGraph, _Node);
17
- var _super = _createSuper(DefaultGraph);
18
- function DefaultGraph() {
19
- var _this;
20
- _classCallCheck(this, DefaultGraph);
21
- _this = _super.call(this, '');
22
- _defineProperty(_assertThisInitialized(_this), "value", '');
23
- _defineProperty(_assertThisInitialized(_this), "termType", DefaultGraphTermType);
24
- _defineProperty(_assertThisInitialized(_this), "uri", defaultGraphURI);
25
- return _this;
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);
26
13
  }
27
- _createClass(DefaultGraph, [{
28
- key: "toCanonical",
29
- value: function toCanonical() {
30
- return this.value;
31
- }
32
- }, {
33
- key: "toString",
34
- value: function toString() {
35
- return 'DefaultGraph';
36
- }
37
- }]);
38
- return DefaultGraph;
39
- }(Node);
40
- export { DefaultGraph as default };
14
+ toCanonical() {
15
+ return this.value;
16
+ }
17
+ toString() {
18
+ return 'DefaultGraph';
19
+ }
20
+ }
41
21
  export function isDefaultGraph(object) {
42
22
  return !!object && object.termType === DefaultGraphTermType;
43
23
  }
package/esm/empty.js CHANGED
@@ -1,33 +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
- 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; } }
10
2
  import Node from './node-internal';
11
3
  import { EmptyTermType } from './types';
12
4
  /**
13
5
  * An empty node
14
6
  */
15
- var Empty = /*#__PURE__*/function (_Node) {
16
- _inherits(Empty, _Node);
17
- var _super = _createSuper(Empty);
18
- function Empty() {
19
- var _this;
20
- _classCallCheck(this, Empty);
21
- _this = _super.call(this, '');
22
- _defineProperty(_assertThisInitialized(_this), "termType", EmptyTermType);
23
- return _this;
7
+ export default class Empty extends Node {
8
+ constructor() {
9
+ super('');
10
+ _defineProperty(this, "termType", EmptyTermType);
24
11
  }
25
- _createClass(Empty, [{
26
- key: "toString",
27
- value: function toString() {
28
- return '()';
29
- }
30
- }]);
31
- return Empty;
32
- }(Node);
33
- export { Empty as default };
12
+ toString() {
13
+ return '()';
14
+ }
15
+ }
@@ -1,5 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- var _supports;
3
1
  import BlankNode from '../blank-node';
4
2
  import Literal from '../literal';
5
3
  import NamedNode from '../named-node';
@@ -14,25 +12,31 @@ export { defaultGraphURI } from '../utils/default-graph-uri';
14
12
  /**
15
13
  * Gets the default graph
16
14
  */
17
- var _defaultGraph = new DefaultGraph();
15
+ const defaultGraph = new DefaultGraph();
18
16
 
19
17
  /** A basic internal RDFlib datafactory, which does not support Collections */
20
- var CanonicalDataFactory = {
21
- supports: (_supports = {}, _defineProperty(_supports, Feature.collections, false), _defineProperty(_supports, Feature.defaultGraphType, false), _defineProperty(_supports, Feature.equalsMethod, true), _defineProperty(_supports, Feature.identity, false), _defineProperty(_supports, Feature.id, true), _defineProperty(_supports, Feature.reversibleId, false), _defineProperty(_supports, Feature.variableType, true), _supports),
18
+ const CanonicalDataFactory = {
19
+ supports: {
20
+ [Feature.collections]: false,
21
+ [Feature.defaultGraphType]: false,
22
+ [Feature.equalsMethod]: true,
23
+ [Feature.identity]: false,
24
+ [Feature.id]: true,
25
+ [Feature.reversibleId]: false,
26
+ [Feature.variableType]: true
27
+ },
22
28
  /**
23
29
  * Creates a new blank node
24
30
  * @param value - The blank node's identifier
25
31
  */
26
- blankNode: function blankNode(value) {
32
+ blankNode(value) {
27
33
  return new BlankNode(value);
28
34
  },
29
- defaultGraph: function defaultGraph() {
30
- return _defaultGraph;
31
- },
35
+ defaultGraph: () => defaultGraph,
32
36
  /**
33
37
  * Compares to (rdf) objects for equality.
34
38
  */
35
- equals: function equals(a, b) {
39
+ equals(a, b) {
36
40
  if (a === b || !a || !b) {
37
41
  return true;
38
42
  }
@@ -55,7 +59,7 @@ var CanonicalDataFactory = {
55
59
  * @example Use this to associate data with a term in an object
56
60
  * { obj[id(term)] = "myData" }
57
61
  */
58
- id: function id(term) {
62
+ id(term) {
59
63
  if (!term) {
60
64
  return 'undefined';
61
65
  }
@@ -68,14 +72,14 @@ var CanonicalDataFactory = {
68
72
  case VariableTermType:
69
73
  return Variable.toString(term);
70
74
  default:
71
- var nq = this.termToNQ(term);
75
+ const nq = this.termToNQ(term);
72
76
  if (nq) {
73
77
  return nq;
74
78
  }
75
- throw new Error("Can't id term with type '".concat(term.termType, "'"));
79
+ throw new Error(`Can't id term with type '${term.termType}'`);
76
80
  }
77
81
  },
78
- isQuad: function isQuad(obj) {
82
+ isQuad(obj) {
79
83
  return obj instanceof Statement;
80
84
  },
81
85
  /**
@@ -83,11 +87,11 @@ var CanonicalDataFactory = {
83
87
  * @param value - The lexical value
84
88
  * @param languageOrDatatype - Either the language or the datatype
85
89
  */
86
- literal: function literal(value, languageOrDatatype) {
90
+ literal(value, languageOrDatatype) {
87
91
  if (typeof value !== "string" && !languageOrDatatype) {
88
92
  return Literal.fromValue(value);
89
93
  }
90
- var strValue = typeof value === 'string' ? value : '' + value;
94
+ const strValue = typeof value === 'string' ? value : '' + value;
91
95
  if (typeof languageOrDatatype === 'string') {
92
96
  if (languageOrDatatype.indexOf(':') === -1) {
93
97
  return new Literal(strValue, languageOrDatatype);
@@ -102,7 +106,7 @@ var CanonicalDataFactory = {
102
106
  * Creates a new named node
103
107
  * @param value - The new named node
104
108
  */
105
- namedNode: function namedNode(value) {
109
+ namedNode(value) {
106
110
  return new NamedNode(value);
107
111
  },
108
112
  /**
@@ -112,8 +116,8 @@ var CanonicalDataFactory = {
112
116
  * @param object - The object
113
117
  * @param graph - The containing graph
114
118
  */
115
- quad: function quad(subject, predicate, object, graph) {
116
- return new Statement(subject, predicate, object, graph || _defaultGraph);
119
+ quad(subject, predicate, object, graph) {
120
+ return new Statement(subject, predicate, object, graph || defaultGraph);
117
121
  },
118
122
  /**
119
123
  * Creates a new statement
@@ -122,14 +126,14 @@ var CanonicalDataFactory = {
122
126
  * @param object - The object
123
127
  * @param graph - The containing graph
124
128
  */
125
- triple: function triple(subject, predicate, object, graph) {
129
+ triple(subject, predicate, object, graph) {
126
130
  return this.quad(subject, predicate, object, graph);
127
131
  },
128
- quadToNQ: function quadToNQ(q) {
129
- return "".concat(this.termToNQ(q.subject), " ").concat(this.termToNQ(q.predicate), " ").concat(this.termToNQ(q.object), " ").concat(this.termToNQ(q.graph), " .");
132
+ quadToNQ(q) {
133
+ return `${this.termToNQ(q.subject)} ${this.termToNQ(q.predicate)} ${this.termToNQ(q.object)} ${this.termToNQ(q.graph)} .`;
130
134
  },
131
- /** Stringify a {term} to n-quads serialization. */termToNQ: function termToNQ(term) {
132
- var _this = this;
135
+ /** Stringify a {term} to n-quads serialization. */
136
+ termToNQ(term) {
133
137
  switch (term.termType) {
134
138
  case BlankNodeTermType:
135
139
  return '_:' + term.value;
@@ -143,14 +147,13 @@ var CanonicalDataFactory = {
143
147
  case NamedNodeTermType:
144
148
  return '<' + term.value + '>';
145
149
  case CollectionTermType:
146
- return '(' + term.elements.map(function (t) {
147
- return _this.termToNQ(t);
148
- }).join(' ') + ')';
150
+ return '(' + term.elements.map(t => this.termToNQ(t)).join(' ') + ')';
149
151
  default:
150
- throw new Error("Can't serialize nonstandard term type (was '".concat(term.termType, "')"));
152
+ throw new Error(`Can't serialize nonstandard term type (was '${term.termType}')`);
151
153
  }
152
154
  },
153
- /** Convert an rdf object (term or quad) to n-quads serialization. */toNQ: function toNQ(term) {
155
+ /** Convert an rdf object (term or quad) to n-quads serialization. */
156
+ toNQ(term) {
154
157
  if (this.isQuad(term)) {
155
158
  return this.quadToNQ(term);
156
159
  }
@@ -160,7 +163,7 @@ var CanonicalDataFactory = {
160
163
  * Creates a new variable
161
164
  * @param name - The name for the variable
162
165
  */
163
- variable: function variable(name) {
166
+ variable(name) {
164
167
  return new Variable(name);
165
168
  }
166
169
  };