rdflib 2.2.22 → 2.2.23-6384f9a2
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/dist/rdflib.min.js +1 -1
- package/dist/rdflib.min.js.LICENSE.txt +4 -0
- package/dist/rdflib.min.js.map +1 -1
- package/esm/blank-node.js +90 -61
- package/esm/class-order.js +1 -1
- package/esm/collection.js +106 -70
- package/esm/default-graph.js +33 -13
- package/esm/empty.js +26 -8
- package/esm/factories/canonical-data-factory.js +30 -33
- package/esm/factories/extended-term-factory.js +14 -18
- package/esm/factories/factory-types.js +1 -1
- package/esm/factories/rdflib-data-factory.js +11 -9
- package/esm/fetcher.js +1644 -1355
- package/esm/formula.js +740 -632
- package/esm/index.js +52 -33
- package/esm/jsonldparser.js +35 -19
- package/esm/jsonparser.js +1 -1
- package/esm/lists.js +86 -38
- package/esm/literal.js +157 -120
- package/esm/log.js +7 -7
- package/esm/n3parser.js +1088 -1004
- package/esm/named-node.js +99 -69
- package/esm/namespace.js +4 -2
- package/esm/node-internal.js +98 -74
- package/esm/node.js +1 -1
- package/esm/parse.js +3 -3
- package/esm/patch-parser.js +1 -1
- package/esm/query.js +16 -15
- package/esm/rdfaparser.js +846 -781
- package/esm/rdfxmlparser.js +365 -348
- package/esm/serialize.js +4 -11
- package/esm/serializer.js +886 -821
- package/esm/statement.js +72 -52
- package/esm/store.js +924 -822
- package/esm/types.js +21 -21
- package/esm/update-manager.js +983 -882
- package/esm/updates-via.js +134 -104
- package/esm/uri.js +3 -3
- package/esm/utils/default-graph-uri.js +2 -2
- package/esm/utils/terms.js +5 -4
- package/esm/utils-js.js +5 -5
- package/esm/utils.js +6 -6
- package/esm/variable.js +58 -32
- package/esm/xsd.js +2 -2
- package/lib/blank-node.js +88 -60
- package/lib/class-order.js +1 -1
- package/lib/collection.js +104 -69
- package/lib/default-graph.js +32 -13
- package/lib/empty.js +25 -8
- package/lib/factories/canonical-data-factory.js +32 -35
- package/lib/factories/extended-term-factory.js +14 -18
- package/lib/factories/factory-types.js +1 -1
- package/lib/factories/rdflib-data-factory.js +11 -9
- package/lib/fetcher.js +1646 -1385
- package/lib/formula.d.ts +1 -1
- package/lib/formula.js +739 -632
- package/lib/index.d.ts +1 -2
- package/lib/index.js +88 -70
- package/lib/jsonldparser.js +35 -19
- package/lib/jsonparser.js +1 -1
- package/lib/lists.js +86 -54
- package/lib/literal.js +156 -120
- package/lib/log.js +7 -7
- package/lib/n3parser.d.ts +1 -0
- package/lib/n3parser.js +1092 -1006
- package/lib/named-node.js +98 -69
- package/lib/namespace.js +4 -2
- package/lib/node-internal.js +96 -73
- package/lib/node.js +1 -1
- package/lib/parse.js +6 -5
- package/lib/patch-parser.js +1 -1
- package/lib/query.js +18 -19
- package/lib/rdfaparser.js +848 -783
- package/lib/rdfxmlparser.js +366 -350
- package/lib/serialize.d.ts +1 -1
- package/lib/serialize.js +4 -13
- package/lib/serializer.d.ts +1 -0
- package/lib/serializer.js +890 -825
- package/lib/statement.js +74 -54
- package/lib/store.d.ts +1 -1
- package/lib/store.js +926 -844
- package/lib/types.js +21 -21
- package/lib/update-manager.d.ts +1 -1
- package/lib/update-manager.js +959 -865
- package/lib/updates-via.js +134 -105
- package/lib/uri.js +3 -3
- package/lib/utils/default-graph-uri.js +2 -2
- package/lib/utils/terms.js +6 -4
- package/lib/utils-js.js +9 -8
- package/lib/utils.js +6 -6
- package/lib/variable.js +60 -34
- package/lib/xsd.js +2 -2
- package/package.json +20 -19
- package/src/index.ts +0 -2
- package/src/jsonldparser.js +13 -4
- package/src/n3parser.js +12 -4
- package/src/serialize.ts +4 -11
- package/src/serializer.js +24 -0
- package/src/update-manager.ts +8 -2
- package/esm/convert.js +0 -60
- package/lib/convert.d.ts +0 -2
- package/lib/convert.js +0 -71
- package/src/convert.js +0 -70
package/lib/statement.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
12
|
var _nodeInternal = _interopRequireDefault(require("./node-internal"));
|
|
10
13
|
var _types = require("./types");
|
|
11
14
|
var _defaultGraph = _interopRequireWildcard(require("./default-graph"));
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
14
|
-
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
var defaultGraph = new _defaultGraph.default();
|
|
15
18
|
|
|
16
19
|
/** A Statement represents an RDF Triple or Quad. */
|
|
17
|
-
|
|
20
|
+
var Statement = /*#__PURE__*/function () {
|
|
18
21
|
/** The subject of the triple. What the Statement is about. */
|
|
19
22
|
|
|
20
23
|
/** The relationship which is asserted between the subject and object */
|
|
@@ -43,7 +46,8 @@ class Statement {
|
|
|
43
46
|
* and give the document you are patching. In future, we may have a more
|
|
44
47
|
* powerful update() which can update more than one document.
|
|
45
48
|
*/
|
|
46
|
-
|
|
49
|
+
function Statement(subject, predicate, object, graph) {
|
|
50
|
+
(0, _classCallCheck2.default)(this, Statement);
|
|
47
51
|
(0, _defineProperty2.default)(this, "subject", void 0);
|
|
48
52
|
(0, _defineProperty2.default)(this, "predicate", void 0);
|
|
49
53
|
(0, _defineProperty2.default)(this, "object", void 0);
|
|
@@ -55,60 +59,76 @@ class Statement {
|
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
/** Alias for graph, favored by Tim */
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
(0, _createClass2.default)(Statement, [{
|
|
63
|
+
key: "why",
|
|
64
|
+
get: function get() {
|
|
65
|
+
return this.graph;
|
|
66
|
+
},
|
|
67
|
+
set: function set(g) {
|
|
68
|
+
this.graph = g;
|
|
69
|
+
}
|
|
64
70
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Checks whether two statements are the same
|
|
73
|
+
* @param other - The other statement
|
|
74
|
+
*/
|
|
75
|
+
}, {
|
|
76
|
+
key: "equals",
|
|
77
|
+
value: function equals(other) {
|
|
78
|
+
return other.subject.equals(this.subject) && other.predicate.equals(this.predicate) && other.object.equals(this.object) && other.graph.equals(this.graph);
|
|
79
|
+
}
|
|
72
80
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Creates a statement with the bindings substituted
|
|
83
|
+
* @param bindings The bindings
|
|
84
|
+
*/
|
|
85
|
+
}, {
|
|
86
|
+
key: "substitute",
|
|
87
|
+
value: function substitute(bindings) {
|
|
88
|
+
var y = new Statement(this.subject.substitute(bindings), this.predicate.substitute(bindings), this.object.substitute(bindings), (0, _defaultGraph.isDefaultGraph)(this.graph) ? this.graph : this.graph.substitute(bindings)); // 2016
|
|
89
|
+
console.log('@@@ statement substitute:' + y);
|
|
90
|
+
return y;
|
|
91
|
+
}
|
|
82
92
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
terms.
|
|
93
|
+
/** Creates a canonical string representation of this statement. */
|
|
94
|
+
}, {
|
|
95
|
+
key: "toCanonical",
|
|
96
|
+
value: function toCanonical() {
|
|
97
|
+
var terms = [this.subject.toCanonical(), this.predicate.toCanonical(), this.object.toCanonical()];
|
|
98
|
+
if (this.graph && this.graph.termType !== _types.DefaultGraphTermType) {
|
|
99
|
+
terms.push(this.graph.toCanonical());
|
|
100
|
+
}
|
|
101
|
+
return terms.join(' ') + ' .';
|
|
88
102
|
}
|
|
89
|
-
return terms.join(' ') + ' .';
|
|
90
|
-
}
|
|
91
103
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
104
|
+
/** Creates a n-triples string representation of this statement */
|
|
105
|
+
}, {
|
|
106
|
+
key: "toNT",
|
|
107
|
+
value: function toNT() {
|
|
108
|
+
return [this.subject.toNT(), this.predicate.toNT(), this.object.toNT()].join(' ') + ' .';
|
|
109
|
+
}
|
|
96
110
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
111
|
+
/** Creates a n-quads string representation of this statement */
|
|
112
|
+
}, {
|
|
113
|
+
key: "toNQ",
|
|
114
|
+
value: function toNQ() {
|
|
115
|
+
return [this.subject.toNT(), this.predicate.toNT(), this.object.toNT(), (0, _defaultGraph.isDefaultGraph)(this.graph) ? '' : this.graph.toNT()].join(' ') + ' .';
|
|
116
|
+
}
|
|
101
117
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
118
|
+
/** Creates a string representation of this statement */
|
|
119
|
+
}, {
|
|
120
|
+
key: "toString",
|
|
121
|
+
value: function toString() {
|
|
122
|
+
/*
|
|
123
|
+
return [
|
|
124
|
+
this.subject.toString(),
|
|
125
|
+
this.predicate.toString(),
|
|
126
|
+
this.object.toString(),
|
|
127
|
+
].join(' ') + ' .'
|
|
128
|
+
*/
|
|
129
|
+
return this.toNT();
|
|
130
|
+
}
|
|
131
|
+
}]);
|
|
132
|
+
return Statement;
|
|
133
|
+
}();
|
|
114
134
|
exports.default = Statement;
|
package/lib/store.d.ts
CHANGED
|
@@ -299,5 +299,5 @@ export default class IndexedFormula extends Formula {
|
|
|
299
299
|
* @param term
|
|
300
300
|
*/
|
|
301
301
|
uris(term: Quad_Subject): string[];
|
|
302
|
-
serialize(base: any, contentType: any, provenance: any, options?: any): string | undefined;
|
|
302
|
+
serialize(base: any, contentType: any, provenance: any, options?: any): string | Promise<string> | undefined;
|
|
303
303
|
}
|