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