rdflib 2.2.34 → 2.2.35-0ebb696c
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/515.rdflib.min.js +3 -0
- package/dist/515.rdflib.min.js.map +1 -0
- package/dist/789.rdflib.min.js +1 -0
- package/dist/rdflib.min.js +1 -1
- package/dist/rdflib.min.js.LICENSE.txt +0 -2
- package/dist/rdflib.min.js.map +1 -1
- package/esm/blank-node.js +57 -85
- package/esm/class-order.js +1 -1
- package/esm/collection.js +70 -106
- package/esm/default-graph.js +13 -33
- package/esm/empty.js +8 -26
- package/esm/factories/canonical-data-factory.js +33 -30
- package/esm/factories/extended-term-factory.js +18 -14
- package/esm/factories/factory-types.js +1 -1
- package/esm/factories/rdflib-data-factory.js +9 -11
- package/esm/fetcher.js +1364 -1668
- package/esm/formula.js +631 -739
- package/esm/index.js +31 -51
- package/esm/jsonldparser.js +19 -26
- package/esm/jsonparser.js +1 -1
- package/esm/lists.js +41 -86
- package/esm/literal.js +120 -157
- package/esm/log.js +7 -7
- package/esm/n3parser.js +1008 -1090
- package/esm/named-node.js +69 -99
- package/esm/namespace.js +2 -4
- package/esm/node-internal.js +73 -97
- package/esm/node.js +1 -2
- package/esm/parse.js +3 -3
- package/esm/patch-parser.js +1 -2
- package/esm/query.js +15 -30
- package/esm/rdfaparser.js +775 -846
- package/esm/rdfxmlparser.js +348 -365
- package/esm/serialize.js +2 -3
- package/esm/serializer.js +834 -889
- package/esm/sparql-to-query.js +0 -2
- package/esm/statement.js +52 -72
- package/esm/store.js +852 -963
- package/esm/types.js +26 -21
- package/esm/update-manager.js +964 -1104
- package/esm/updates-via.js +104 -134
- package/esm/uri.js +3 -3
- package/esm/utils/default-graph-uri.js +2 -2
- package/esm/utils/terms.js +4 -5
- package/esm/utils-js.js +5 -6
- package/esm/utils.js +7 -6
- package/esm/variable.js +32 -58
- package/esm/xsd.js +2 -2
- package/lib/blank-node.js +56 -83
- package/lib/class-order.js +2 -3
- package/lib/collection.js +69 -104
- package/lib/default-graph.js +13 -32
- package/lib/empty.js +8 -25
- package/lib/factories/canonical-data-factory.js +36 -34
- package/lib/factories/extended-term-factory.js +19 -16
- package/lib/factories/factory-types.js +2 -3
- package/lib/factories/rdflib-data-factory.js +10 -13
- package/lib/fetcher.js +1394 -1693
- package/lib/formula.js +631 -738
- package/lib/index.js +66 -89
- package/lib/jsonldparser.js +21 -32
- package/lib/jsonparser.js +3 -4
- package/lib/lists.js +47 -87
- package/lib/literal.js +120 -156
- package/lib/log.js +8 -9
- package/lib/n3parser.js +1011 -1096
- package/lib/named-node.js +69 -98
- package/lib/namespace.js +2 -4
- package/lib/node-internal.js +72 -95
- package/lib/node.js +2 -4
- package/lib/parse.js +5 -6
- package/lib/patch-parser.js +1 -2
- package/lib/query.js +19 -32
- package/lib/rdfaparser.js +777 -849
- package/lib/rdfxmlparser.js +350 -366
- package/lib/serialize.js +2 -3
- package/lib/serializer.js +838 -892
- package/lib/sparql-to-query.js +0 -2
- package/lib/statement.js +54 -74
- package/lib/store.js +873 -978
- package/lib/types.js +22 -43
- package/lib/update-manager.js +973 -1111
- package/lib/updates-via.js +105 -134
- package/lib/uri.js +3 -3
- package/lib/utils/default-graph-uri.js +2 -4
- package/lib/utils/terms.js +4 -6
- package/lib/utils-js.js +11 -13
- package/lib/utils.js +6 -7
- package/lib/variable.js +34 -60
- package/lib/xsd-internal.js +2 -3
- package/lib/xsd.js +3 -4
- package/package.json +31 -31
- package/src/n3parser.js +1 -1
- package/src/rdfxmlparser.js +2 -1
- package/src/serializer.js +1 -1
- package/src/update-manager.ts +2 -1
- package/.babelrc +0 -20
- package/dist/670.rdflib.min.js +0 -1
- package/dist/730.rdflib.min.js +0 -3
- package/dist/730.rdflib.min.js.map +0 -1
- /package/dist/{730.rdflib.min.js.LICENSE.txt → 515.rdflib.min.js.LICENSE.txt} +0 -0
package/lib/named-node.js
CHANGED
|
@@ -5,137 +5,108 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
9
|
var _classOrder = _interopRequireDefault(require("./class-order"));
|
|
16
10
|
var _nodeInternal = _interopRequireDefault(require("./node-internal"));
|
|
17
11
|
var _types = require("./types");
|
|
18
12
|
var _termValue = require("./utils/termValue");
|
|
19
13
|
var _terms = require("./utils/terms");
|
|
20
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
21
|
-
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; } }
|
|
22
14
|
/**
|
|
23
15
|
* A named (IRI) RDF node
|
|
24
16
|
*/
|
|
25
|
-
|
|
26
|
-
(0, _inherits2.default)(NamedNode, _Node);
|
|
27
|
-
var _super = _createSuper(NamedNode);
|
|
17
|
+
class NamedNode extends _nodeInternal.default {
|
|
28
18
|
/**
|
|
29
19
|
* Create a named (IRI) RDF Node
|
|
30
20
|
* @constructor
|
|
31
21
|
* @param iri - The IRI for this node
|
|
32
22
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
(0,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "classOrder", _classOrder.default.NamedNode);
|
|
39
|
-
if (!_this.value) {
|
|
23
|
+
constructor(iri) {
|
|
24
|
+
super((0, _termValue.termValue)(iri));
|
|
25
|
+
(0, _defineProperty2.default)(this, "termType", _types.NamedNodeTermType);
|
|
26
|
+
(0, _defineProperty2.default)(this, "classOrder", _classOrder.default.NamedNode);
|
|
27
|
+
if (!this.value) {
|
|
40
28
|
throw new Error('Missing IRI for NamedNode');
|
|
41
29
|
}
|
|
42
|
-
if (!
|
|
30
|
+
if (!this.value.includes(':')) {
|
|
43
31
|
throw new Error('NamedNode IRI "' + iri + '" must be absolute.');
|
|
44
32
|
}
|
|
45
|
-
if (
|
|
33
|
+
if (this.value.includes(' ')) {
|
|
46
34
|
var message = 'Error: NamedNode IRI "' + iri + '" must not contain unencoded spaces.';
|
|
47
35
|
throw new Error(message);
|
|
48
36
|
}
|
|
49
|
-
return _this;
|
|
50
37
|
}
|
|
51
38
|
|
|
52
39
|
/**
|
|
53
40
|
* Returns an $rdf node for the containing directory, ending in slash.
|
|
54
41
|
*/
|
|
55
|
-
(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return new NamedNode(str.slice(0, p + 1));
|
|
63
|
-
}
|
|
42
|
+
dir() {
|
|
43
|
+
var str = this.value.split('#')[0];
|
|
44
|
+
var p = str.slice(0, -1).lastIndexOf('/');
|
|
45
|
+
var q = str.indexOf('//');
|
|
46
|
+
if (q >= 0 && p < q + 2 || p < 0) return null;
|
|
47
|
+
return new NamedNode(str.slice(0, p + 1));
|
|
48
|
+
}
|
|
64
49
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
} else {
|
|
79
|
-
return new NamedNode(str.slice(0, q + 1));
|
|
80
|
-
}
|
|
50
|
+
/**
|
|
51
|
+
* Returns an NN for the whole web site, ending in slash.
|
|
52
|
+
* Contrast with the "origin" which does NOT have a trailing slash
|
|
53
|
+
*/
|
|
54
|
+
site() {
|
|
55
|
+
var str = this.value.split('#')[0];
|
|
56
|
+
var p = str.indexOf('//');
|
|
57
|
+
if (p < 0) throw new Error('This URI does not have a web site part (origin)');
|
|
58
|
+
var q = str.indexOf('/', p + 2);
|
|
59
|
+
if (q < 0) {
|
|
60
|
+
return new NamedNode(str.slice(0) + '/'); // Add slash to a bare origin
|
|
61
|
+
} else {
|
|
62
|
+
return new NamedNode(str.slice(0, q + 1));
|
|
81
63
|
}
|
|
64
|
+
}
|
|
82
65
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
} else {
|
|
93
|
-
return new NamedNode(this.value.split('#')[0]);
|
|
94
|
-
}
|
|
66
|
+
/**
|
|
67
|
+
* Creates the fetchable named node for the document.
|
|
68
|
+
* Removes everything from the # anchor tag.
|
|
69
|
+
*/
|
|
70
|
+
doc() {
|
|
71
|
+
if (this.value.indexOf('#') < 0) {
|
|
72
|
+
return this;
|
|
73
|
+
} else {
|
|
74
|
+
return new NamedNode(this.value.split('#')[0]);
|
|
95
75
|
}
|
|
76
|
+
}
|
|
96
77
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return '<' + this.value + '>';
|
|
104
|
-
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns the URI including <brackets>
|
|
80
|
+
*/
|
|
81
|
+
toString() {
|
|
82
|
+
return '<' + this.value + '>';
|
|
83
|
+
}
|
|
105
84
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return this.value.split('#')[1];
|
|
111
|
-
}
|
|
85
|
+
/** The local identifier with the document */
|
|
86
|
+
id() {
|
|
87
|
+
return this.value.split('#')[1];
|
|
88
|
+
}
|
|
112
89
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
this.value = uri;
|
|
121
|
-
}
|
|
90
|
+
/** Alias for value, favored by Tim */
|
|
91
|
+
get uri() {
|
|
92
|
+
return this.value;
|
|
93
|
+
}
|
|
94
|
+
set uri(uri) {
|
|
95
|
+
this.value = uri;
|
|
96
|
+
}
|
|
122
97
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (typeof value === 'undefined' || value === null) {
|
|
131
|
-
return value;
|
|
132
|
-
}
|
|
133
|
-
if ((0, _terms.isTerm)(value)) {
|
|
134
|
-
return value;
|
|
135
|
-
}
|
|
136
|
-
return new NamedNode(value);
|
|
98
|
+
/**
|
|
99
|
+
* Creates a named node from the specified input value
|
|
100
|
+
* @param value - An input value
|
|
101
|
+
*/
|
|
102
|
+
static fromValue(value) {
|
|
103
|
+
if (typeof value === 'undefined' || value === null) {
|
|
104
|
+
return value;
|
|
137
105
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
106
|
+
if ((0, _terms.isTerm)(value)) {
|
|
107
|
+
return value;
|
|
108
|
+
}
|
|
109
|
+
return new NamedNode(value);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
141
112
|
exports.default = NamedNode;
|
package/lib/namespace.js
CHANGED
|
@@ -12,10 +12,8 @@ var _namedNode = _interopRequireDefault(require("./named-node"));
|
|
|
12
12
|
* @param [factory] - The factory for creating named nodes with
|
|
13
13
|
*/
|
|
14
14
|
function Namespace(nsuri, factory) {
|
|
15
|
-
|
|
16
|
-
namedNode:
|
|
17
|
-
return new _namedNode.default(value);
|
|
18
|
-
}
|
|
15
|
+
const dataFactory = factory || {
|
|
16
|
+
namedNode: value => new _namedNode.default(value)
|
|
19
17
|
};
|
|
20
18
|
return function (ln) {
|
|
21
19
|
return dataFactory.namedNode(nsuri + (ln || ''));
|
package/lib/node-internal.js
CHANGED
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
9
|
/**
|
|
12
10
|
* The superclass of all RDF Statement objects, that is
|
|
@@ -16,9 +14,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
16
14
|
* @link https://rdf.js.org/data-model-spec/#term-interface
|
|
17
15
|
* @class Node
|
|
18
16
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(0, _classCallCheck2.default)(this, Node);
|
|
17
|
+
class Node {
|
|
18
|
+
constructor(value) {
|
|
22
19
|
/** The type of node */
|
|
23
20
|
(0, _defineProperty2.default)(this, "termType", void 0);
|
|
24
21
|
/** The class order for this node */
|
|
@@ -32,106 +29,86 @@ var Node = /*#__PURE__*/function () {
|
|
|
32
29
|
* Creates the substituted node for this one, according to the specified bindings
|
|
33
30
|
* @param bindings - Bindings of identifiers to nodes
|
|
34
31
|
*/
|
|
35
|
-
(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return this;
|
|
39
|
-
}
|
|
32
|
+
substitute(bindings) {
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
40
35
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (this.classOrder < other.classOrder) {
|
|
50
|
-
return -1;
|
|
51
|
-
}
|
|
52
|
-
if (this.classOrder > other.classOrder) {
|
|
53
|
-
return +1;
|
|
54
|
-
}
|
|
55
|
-
if (this.value < other.value) {
|
|
56
|
-
return -1;
|
|
57
|
-
}
|
|
58
|
-
if (this.value > other.value) {
|
|
59
|
-
return +1;
|
|
60
|
-
}
|
|
61
|
-
return 0;
|
|
36
|
+
/**
|
|
37
|
+
* Compares this node with another
|
|
38
|
+
* @see {equals} to check if two nodes are equal
|
|
39
|
+
* @param other - The other node
|
|
40
|
+
*/
|
|
41
|
+
compareTerm(other) {
|
|
42
|
+
if (this.classOrder < other.classOrder) {
|
|
43
|
+
return -1;
|
|
62
44
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
* Compares whether the two nodes are equal
|
|
66
|
-
* @param other The other node
|
|
67
|
-
*/
|
|
68
|
-
}, {
|
|
69
|
-
key: "equals",
|
|
70
|
-
value: function equals(other) {
|
|
71
|
-
if (!other) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
return this.termType === other.termType && this.value === other.value;
|
|
45
|
+
if (this.classOrder > other.classOrder) {
|
|
46
|
+
return +1;
|
|
75
47
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
* Creates a hash for this node
|
|
79
|
-
* @deprecated use {rdfFactory.id} instead if possible
|
|
80
|
-
*/
|
|
81
|
-
}, {
|
|
82
|
-
key: "hashString",
|
|
83
|
-
value: function hashString() {
|
|
84
|
-
return this.toCanonical();
|
|
48
|
+
if (this.value < other.value) {
|
|
49
|
+
return -1;
|
|
85
50
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
* Compares whether this node is the same as the other one
|
|
89
|
-
* @param other - Another node
|
|
90
|
-
*/
|
|
91
|
-
}, {
|
|
92
|
-
key: "sameTerm",
|
|
93
|
-
value: function sameTerm(other) {
|
|
94
|
-
return this.equals(other);
|
|
51
|
+
if (this.value > other.value) {
|
|
52
|
+
return +1;
|
|
95
53
|
}
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
96
56
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return
|
|
57
|
+
/**
|
|
58
|
+
* Compares whether the two nodes are equal
|
|
59
|
+
* @param other The other node
|
|
60
|
+
*/
|
|
61
|
+
equals(other) {
|
|
62
|
+
if (!other) {
|
|
63
|
+
return false;
|
|
104
64
|
}
|
|
65
|
+
return this.termType === other.termType && this.value === other.value;
|
|
66
|
+
}
|
|
105
67
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
68
|
+
/**
|
|
69
|
+
* Creates a hash for this node
|
|
70
|
+
* @deprecated use {rdfFactory.id} instead if possible
|
|
71
|
+
*/
|
|
72
|
+
hashString() {
|
|
73
|
+
return this.toCanonical();
|
|
74
|
+
}
|
|
114
75
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
76
|
+
/**
|
|
77
|
+
* Compares whether this node is the same as the other one
|
|
78
|
+
* @param other - Another node
|
|
79
|
+
*/
|
|
80
|
+
sameTerm(other) {
|
|
81
|
+
return this.equals(other);
|
|
82
|
+
}
|
|
123
83
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Creates a canonical string representation of this node
|
|
86
|
+
*/
|
|
87
|
+
toCanonical() {
|
|
88
|
+
return this.toNT();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Creates a n-triples string representation of this node
|
|
93
|
+
*/
|
|
94
|
+
toNT() {
|
|
95
|
+
return this.toString();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Creates a n-quads string representation of this node
|
|
100
|
+
*/
|
|
101
|
+
toNQ() {
|
|
102
|
+
return this.toNT();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Creates a string representation of this node
|
|
107
|
+
*/
|
|
108
|
+
toString() {
|
|
109
|
+
throw new Error('Node.toString() is abstract - see the subclasses instead');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
135
112
|
exports.default = Node;
|
|
136
113
|
// Specified in './node.ts' to prevent circular dependency
|
|
137
114
|
(0, _defineProperty2.default)(Node, "fromValue", void 0);
|
package/lib/node.js
CHANGED
|
@@ -21,9 +21,8 @@ var _terms = require("./utils/terms");
|
|
|
21
21
|
* @return {Node|Collection}
|
|
22
22
|
*/
|
|
23
23
|
_nodeInternal.default.fromValue = _collection.fromValue;
|
|
24
|
-
var _default = _nodeInternal.default;
|
|
25
|
-
|
|
26
|
-
var ns = {
|
|
24
|
+
var _default = exports.default = _nodeInternal.default;
|
|
25
|
+
const ns = {
|
|
27
26
|
xsd: (0, _namespace.default)('http://www.w3.org/2001/XMLSchema#')
|
|
28
27
|
};
|
|
29
28
|
|
|
@@ -35,7 +34,6 @@ _nodeInternal.default.toJS = function (term) {
|
|
|
35
34
|
if ((0, _terms.isCollection)(term)) {
|
|
36
35
|
return term.elements.map(_nodeInternal.default.toJS); // Array node (not standard RDFJS)
|
|
37
36
|
}
|
|
38
|
-
|
|
39
37
|
if (!(0, _terms.isLiteral)(term)) return term;
|
|
40
38
|
if (term.datatype.equals(ns.xsd('boolean'))) {
|
|
41
39
|
return term.value === '1' || term.value === 'true';
|
package/lib/parse.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -15,8 +14,8 @@ var _rdfxmlparser = _interopRequireDefault(require("./rdfxmlparser"));
|
|
|
15
14
|
var _patchParser = _interopRequireDefault(require("./patch-parser"));
|
|
16
15
|
var Util = _interopRequireWildcard(require("./utils-js"));
|
|
17
16
|
var _types = require("./types");
|
|
18
|
-
function _getRequireWildcardCache(
|
|
19
|
-
function _interopRequireWildcard(
|
|
17
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
19
|
// @ts-ignore is this injected?
|
|
21
20
|
// @@ Goal: remove this dependency
|
|
22
21
|
|
|
@@ -32,8 +31,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
32
31
|
* @param [callback] - The callback to call when the data has been loaded
|
|
33
32
|
*/
|
|
34
33
|
function parse(str, kb, base) {
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
let contentType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'text/turtle';
|
|
35
|
+
let callback = arguments.length > 4 ? arguments[4] : undefined;
|
|
37
36
|
contentType = contentType || _types.TurtleContentType;
|
|
38
37
|
contentType = contentType.split(';')[0];
|
|
39
38
|
try {
|
|
@@ -105,7 +104,7 @@ function parse(str, kb, base) {
|
|
|
105
104
|
if (callback) {
|
|
106
105
|
callback(e, kb);
|
|
107
106
|
} else {
|
|
108
|
-
|
|
107
|
+
let e2 = new Error('' + e + ' while trying to parse <' + base + '> as ' + contentType);
|
|
109
108
|
//@ts-ignore .cause is not a default error property
|
|
110
109
|
e2.cause = e;
|
|
111
110
|
throw e2;
|
package/lib/patch-parser.js
CHANGED
|
@@ -21,7 +21,7 @@ function sparqlUpdateParser(str, kb, base) {
|
|
|
21
21
|
var SQNS = (0, _namespace.default)('http://www.w3.org/ns/pim/patch#');
|
|
22
22
|
var p = (0, _n3parser.default)(kb, kb, base, base, null, null, '', null);
|
|
23
23
|
var clauses = {};
|
|
24
|
-
var badSyntax = function
|
|
24
|
+
var badSyntax = function (uri, lines, str, i, why) {
|
|
25
25
|
return 'Line ' + (lines + 1) + ' of <' + uri + '>: Bad syntax:\n ' + why + '\n at: "' + str.slice(i, i + 30) + '"';
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -47,7 +47,6 @@ function sparqlUpdateParser(str, kb, base) {
|
|
|
47
47
|
if (i < 0) {
|
|
48
48
|
return clauses; // Allow end in a
|
|
49
49
|
}
|
|
50
|
-
|
|
51
50
|
j = i;
|
|
52
51
|
}
|
|
53
52
|
var found = false;
|