rdflib 2.2.21 → 2.2.22-04669b23

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 (118) hide show
  1. package/dist/rdflib.min.js +1 -1
  2. package/dist/rdflib.min.js.LICENSE.txt +11 -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/default-graph.js +14 -48
  8. package/esm/empty.js +8 -39
  9. package/esm/factories/canonical-data-factory.js +33 -65
  10. package/esm/factories/extended-term-factory.js +18 -25
  11. package/esm/factories/factory-types.js +3 -2
  12. package/esm/factories/rdflib-data-factory.js +9 -19
  13. package/esm/fetcher.js +1341 -1854
  14. package/esm/formula.js +639 -846
  15. package/esm/index.js +40 -77
  16. package/esm/jsonldparser.js +34 -50
  17. package/esm/jsonparser.js +1 -8
  18. package/esm/lists.js +47 -110
  19. package/esm/literal.js +120 -189
  20. package/esm/log.js +7 -7
  21. package/esm/n3parser.js +1022 -1412
  22. package/esm/named-node.js +70 -119
  23. package/esm/namespace.js +2 -5
  24. package/esm/node-internal.js +73 -110
  25. package/esm/node.js +2 -7
  26. package/esm/parse.js +12 -19
  27. package/esm/patch-parser.js +10 -30
  28. package/esm/query-to-sparql.js +0 -18
  29. package/esm/query.js +63 -147
  30. package/esm/rdfaparser.js +794 -997
  31. package/esm/rdfxmlparser.js +347 -461
  32. package/esm/serialize.js +9 -34
  33. package/esm/serializer.js +842 -1048
  34. package/esm/sparql-to-query.js +44 -134
  35. package/esm/statement.js +54 -85
  36. package/esm/store.js +830 -1103
  37. package/esm/types.js +22 -21
  38. package/esm/update-manager.js +869 -1106
  39. package/esm/updates-via.js +104 -161
  40. package/esm/uri.js +9 -53
  41. package/esm/utils/default-graph-uri.js +3 -2
  42. package/esm/utils/termValue.js +0 -1
  43. package/esm/utils/terms.js +19 -21
  44. package/esm/utils-js.js +20 -61
  45. package/esm/utils.js +10 -21
  46. package/esm/variable.js +32 -78
  47. package/esm/xsd.js +2 -2
  48. package/lib/blank-node.js +60 -113
  49. package/lib/class-order.js +1 -2
  50. package/lib/collection.js +69 -131
  51. package/lib/default-graph.js +13 -52
  52. package/lib/empty.js +8 -43
  53. package/lib/factories/canonical-data-factory.js +35 -79
  54. package/lib/factories/extended-term-factory.js +18 -32
  55. package/lib/factories/factory-types.d.ts +6 -6
  56. package/lib/factories/factory-types.js +1 -4
  57. package/lib/factories/rdflib-data-factory.js +9 -23
  58. package/lib/fetcher.d.ts +6 -6
  59. package/lib/fetcher.js +1370 -1843
  60. package/lib/formula.d.ts +1 -1
  61. package/lib/formula.js +640 -855
  62. package/lib/index.d.ts +1 -2
  63. package/lib/index.js +67 -156
  64. package/lib/jsonldparser.js +33 -54
  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.d.ts +1 -0
  71. package/lib/n3parser.js +1023 -1422
  72. package/lib/named-node.js +69 -126
  73. package/lib/namespace.js +2 -7
  74. package/lib/node-internal.js +74 -107
  75. package/lib/node.js +2 -12
  76. package/lib/parse.d.ts +1 -1
  77. package/lib/parse.js +12 -32
  78. package/lib/patch-parser.js +11 -34
  79. package/lib/query-to-sparql.js +0 -23
  80. package/lib/query.js +62 -167
  81. package/lib/rdfaparser.js +796 -1009
  82. package/lib/rdfxmlparser.js +349 -466
  83. package/lib/serialize.d.ts +1 -1
  84. package/lib/serialize.js +9 -44
  85. package/lib/serializer.d.ts +1 -0
  86. package/lib/serializer.js +846 -1063
  87. package/lib/sparql-to-query.js +42 -167
  88. package/lib/statement.js +55 -91
  89. package/lib/store.d.ts +2 -2
  90. package/lib/store.js +850 -1112
  91. package/lib/tf-types.d.ts +4 -4
  92. package/lib/types.d.ts +8 -8
  93. package/lib/types.js +23 -23
  94. package/lib/update-manager.d.ts +1 -1
  95. package/lib/update-manager.js +865 -1103
  96. package/lib/updates-via.js +105 -164
  97. package/lib/uri.js +8 -61
  98. package/lib/utils/default-graph-uri.js +3 -5
  99. package/lib/utils/termValue.js +0 -2
  100. package/lib/utils/terms.js +19 -40
  101. package/lib/utils-js.js +23 -88
  102. package/lib/utils.js +10 -27
  103. package/lib/variable.js +34 -85
  104. package/lib/xsd-internal.js +0 -3
  105. package/lib/xsd.js +2 -6
  106. package/package.json +40 -39
  107. package/src/fetcher.ts +2 -2
  108. package/src/index.ts +0 -2
  109. package/src/jsonldparser.js +13 -4
  110. package/src/n3parser.js +12 -4
  111. package/src/serialize.ts +4 -11
  112. package/src/serializer.js +24 -0
  113. package/src/update-manager.ts +12 -7
  114. package/changes.txt +0 -59
  115. package/esm/convert.js +0 -61
  116. package/lib/convert.d.ts +0 -2
  117. package/lib/convert.js +0 -77
  118. package/src/convert.js +0 -70
package/esm/statement.js CHANGED
@@ -1,13 +1,11 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
2
  import Node from './node-internal';
5
3
  import { DefaultGraphTermType } from './types';
6
4
  import DefaultGraphNode, { isDefaultGraph } from './default-graph';
7
- var defaultGraph = new DefaultGraphNode();
8
- /** A Statement represents an RDF Triple or Quad. */
5
+ const defaultGraph = new DefaultGraphNode();
9
6
 
10
- var Statement = /*#__PURE__*/function () {
7
+ /** A Statement represents an RDF Triple or Quad. */
8
+ export default class Statement {
11
9
  /** The subject of the triple. What the Statement is about. */
12
10
 
13
11
  /** The relationship which is asserted between the subject and object */
@@ -36,100 +34,71 @@ var Statement = /*#__PURE__*/function () {
36
34
  * and give the document you are patching. In future, we may have a more
37
35
  * powerful update() which can update more than one document.
38
36
  */
39
- function Statement(subject, predicate, object, graph) {
40
- _classCallCheck(this, Statement);
41
-
37
+ constructor(subject, predicate, object, graph) {
42
38
  _defineProperty(this, "subject", void 0);
43
-
44
39
  _defineProperty(this, "predicate", void 0);
45
-
46
40
  _defineProperty(this, "object", void 0);
47
-
48
41
  _defineProperty(this, "graph", void 0);
49
-
50
42
  this.subject = Node.fromValue(subject);
51
43
  this.predicate = Node.fromValue(predicate);
52
44
  this.object = Node.fromValue(object);
53
45
  this.graph = graph == undefined ? defaultGraph : Node.fromValue(graph); // property currently used by rdflib
54
46
  }
55
- /** Alias for graph, favored by Tim */
56
-
57
-
58
- _createClass(Statement, [{
59
- key: "why",
60
- get: function get() {
61
- return this.graph;
62
- },
63
- set: function set(g) {
64
- this.graph = g;
65
- }
66
- /**
67
- * Checks whether two statements are the same
68
- * @param other - The other statement
69
- */
70
-
71
- }, {
72
- key: "equals",
73
- value: function equals(other) {
74
- return other.subject.equals(this.subject) && other.predicate.equals(this.predicate) && other.object.equals(this.object) && other.graph.equals(this.graph);
75
- }
76
- /**
77
- * Creates a statement with the bindings substituted
78
- * @param bindings The bindings
79
- */
80
-
81
- }, {
82
- key: "substitute",
83
- value: function substitute(bindings) {
84
- var y = new Statement(this.subject.substitute(bindings), this.predicate.substitute(bindings), this.object.substitute(bindings), isDefaultGraph(this.graph) ? this.graph : this.graph.substitute(bindings)); // 2016
85
-
86
- console.log('@@@ statement substitute:' + y);
87
- return y;
88
- }
89
- /** Creates a canonical string representation of this statement. */
90
-
91
- }, {
92
- key: "toCanonical",
93
- value: function toCanonical() {
94
- var terms = [this.subject.toCanonical(), this.predicate.toCanonical(), this.object.toCanonical()];
95
47
 
96
- if (this.graph && this.graph.termType !== DefaultGraphTermType) {
97
- terms.push(this.graph.toCanonical());
98
- }
48
+ /** Alias for graph, favored by Tim */
49
+ get why() {
50
+ return this.graph;
51
+ }
52
+ set why(g) {
53
+ this.graph = g;
54
+ }
99
55
 
100
- return terms.join(' ') + ' .';
101
- }
102
- /** Creates a n-triples string representation of this statement */
56
+ /**
57
+ * Checks whether two statements are the same
58
+ * @param other - The other statement
59
+ */
60
+ equals(other) {
61
+ return other.subject.equals(this.subject) && other.predicate.equals(this.predicate) && other.object.equals(this.object) && other.graph.equals(this.graph);
62
+ }
103
63
 
104
- }, {
105
- key: "toNT",
106
- value: function toNT() {
107
- return [this.subject.toNT(), this.predicate.toNT(), this.object.toNT()].join(' ') + ' .';
108
- }
109
- /** Creates a n-quads string representation of this statement */
64
+ /**
65
+ * Creates a statement with the bindings substituted
66
+ * @param bindings The bindings
67
+ */
68
+ substitute(bindings) {
69
+ const y = new Statement(this.subject.substitute(bindings), this.predicate.substitute(bindings), this.object.substitute(bindings), isDefaultGraph(this.graph) ? this.graph : this.graph.substitute(bindings)); // 2016
70
+ console.log('@@@ statement substitute:' + y);
71
+ return y;
72
+ }
110
73
 
111
- }, {
112
- key: "toNQ",
113
- value: function toNQ() {
114
- return [this.subject.toNT(), this.predicate.toNT(), this.object.toNT(), isDefaultGraph(this.graph) ? '' : this.graph.toNT()].join(' ') + ' .';
74
+ /** Creates a canonical string representation of this statement. */
75
+ toCanonical() {
76
+ let terms = [this.subject.toCanonical(), this.predicate.toCanonical(), this.object.toCanonical()];
77
+ if (this.graph && this.graph.termType !== DefaultGraphTermType) {
78
+ terms.push(this.graph.toCanonical());
115
79
  }
116
- /** Creates a string representation of this statement */
80
+ return terms.join(' ') + ' .';
81
+ }
117
82
 
118
- }, {
119
- key: "toString",
120
- value: function toString() {
121
- /*
122
- return [
123
- this.subject.toString(),
124
- this.predicate.toString(),
125
- this.object.toString(),
126
- ].join(' ') + ' .'
127
- */
128
- return this.toNT();
129
- }
130
- }]);
83
+ /** Creates a n-triples string representation of this statement */
84
+ toNT() {
85
+ return [this.subject.toNT(), this.predicate.toNT(), this.object.toNT()].join(' ') + ' .';
86
+ }
131
87
 
132
- return Statement;
133
- }();
88
+ /** Creates a n-quads string representation of this statement */
89
+ toNQ() {
90
+ return [this.subject.toNT(), this.predicate.toNT(), this.object.toNT(), isDefaultGraph(this.graph) ? '' : this.graph.toNT()].join(' ') + ' .';
91
+ }
134
92
 
135
- export { Statement as default };
93
+ /** Creates a string representation of this statement */
94
+ toString() {
95
+ /*
96
+ return [
97
+ this.subject.toString(),
98
+ this.predicate.toString(),
99
+ this.object.toString(),
100
+ ].join(' ') + ' .'
101
+ */
102
+ return this.toNT();
103
+ }
104
+ }