rdflib 2.2.34 → 2.2.35
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.map +1 -1
- package/esm/blank-node.js +10 -13
- package/esm/collection.js +12 -15
- package/esm/default-graph.js +9 -12
- package/esm/empty.js +7 -10
- package/esm/factories/canonical-data-factory.js +1 -2
- package/esm/factories/extended-term-factory.js +3 -4
- package/esm/factories/rdflib-data-factory.js +2 -2
- package/esm/fetcher.js +34 -53
- package/esm/formula.js +12 -15
- package/esm/index.js +12 -15
- package/esm/lists.js +3 -0
- package/esm/literal.js +11 -14
- package/esm/n3parser.js +1 -6
- package/esm/named-node.js +8 -11
- package/esm/node-internal.js +1 -2
- package/esm/node.js +0 -1
- package/esm/patch-parser.js +0 -1
- package/esm/query.js +0 -14
- package/esm/rdfaparser.js +1 -6
- package/esm/rdfxmlparser.js +3 -4
- package/esm/serialize.js +0 -1
- package/esm/serializer.js +1 -14
- package/esm/sparql-to-query.js +0 -2
- package/esm/statement.js +1 -2
- package/esm/store.js +25 -32
- package/esm/types.js +5 -0
- package/esm/update-manager.js +3 -8
- package/esm/updates-via.js +2 -4
- package/esm/utils-js.js +0 -1
- package/esm/utils.js +1 -0
- package/esm/variable.js +11 -14
- package/lib/blank-node.js +11 -15
- package/lib/class-order.js +1 -2
- package/lib/collection.js +13 -17
- package/lib/default-graph.js +10 -14
- package/lib/empty.js +9 -13
- package/lib/factories/canonical-data-factory.js +2 -4
- package/lib/factories/extended-term-factory.js +4 -6
- package/lib/factories/factory-types.js +2 -3
- package/lib/factories/rdflib-data-factory.js +3 -4
- package/lib/fetcher.js +60 -80
- package/lib/formula.js +14 -18
- package/lib/index.js +30 -49
- package/lib/jsonldparser.js +2 -2
- package/lib/jsonparser.js +2 -3
- package/lib/lists.js +1 -1
- package/lib/literal.js +13 -17
- package/lib/log.js +1 -2
- package/lib/n3parser.js +5 -12
- package/lib/named-node.js +10 -14
- package/lib/node-internal.js +2 -4
- package/lib/node.js +1 -3
- package/lib/parse.js +2 -2
- package/lib/patch-parser.js +0 -1
- package/lib/query.js +1 -16
- package/lib/rdfaparser.js +5 -12
- package/lib/rdfxmlparser.js +6 -8
- package/lib/serialize.js +0 -1
- package/lib/serializer.js +4 -18
- package/lib/sparql-to-query.js +0 -2
- package/lib/statement.js +5 -7
- package/lib/store.js +42 -49
- package/lib/types.js +22 -43
- package/lib/update-manager.js +12 -18
- package/lib/updates-via.js +5 -9
- package/lib/utils/default-graph-uri.js +2 -4
- package/lib/utils-js.js +6 -7
- package/lib/utils.js +1 -2
- package/lib/variable.js +15 -19
- package/lib/xsd-internal.js +2 -3
- package/lib/xsd.js +1 -2
- package/package.json +31 -31
- package/src/rdfxmlparser.js +2 -1
- 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/esm/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
3
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
4
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
6
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
function
|
|
9
|
-
function _isNativeReflectConstruct() {
|
|
7
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
9
|
import BlankNode from './blank-node';
|
|
11
10
|
import Collection from './collection';
|
|
12
11
|
import Empty from './empty';
|
|
@@ -72,28 +71,26 @@ NextId, fromNT, fetcher, graph, lit, st, namedNode as sym,
|
|
|
72
71
|
blankNode, defaultGraph, literal, namedNode, quad, triple, variable };
|
|
73
72
|
export { termValue } from './utils/termValue';
|
|
74
73
|
export var ConnectedStore = /*#__PURE__*/function (_Store) {
|
|
75
|
-
_inherits(ConnectedStore, _Store);
|
|
76
|
-
var _super = _createSuper(ConnectedStore);
|
|
77
74
|
function ConnectedStore(features) {
|
|
78
75
|
var _this;
|
|
79
76
|
_classCallCheck(this, ConnectedStore);
|
|
80
|
-
_this =
|
|
81
|
-
_defineProperty(
|
|
82
|
-
_this.fetcher = new Fetcher(
|
|
77
|
+
_this = _callSuper(this, ConnectedStore, [features]);
|
|
78
|
+
_defineProperty(_this, "fetcher", void 0);
|
|
79
|
+
_this.fetcher = new Fetcher(_this, {});
|
|
83
80
|
return _this;
|
|
84
81
|
}
|
|
82
|
+
_inherits(ConnectedStore, _Store);
|
|
85
83
|
return _createClass(ConnectedStore);
|
|
86
84
|
}(Store);
|
|
87
|
-
export var LiveStore = /*#__PURE__*/function (
|
|
88
|
-
_inherits(LiveStore, _ConnectedStore);
|
|
89
|
-
var _super2 = _createSuper(LiveStore);
|
|
85
|
+
export var LiveStore = /*#__PURE__*/function (_ConnectedStore2) {
|
|
90
86
|
function LiveStore(features) {
|
|
91
87
|
var _this2;
|
|
92
88
|
_classCallCheck(this, LiveStore);
|
|
93
|
-
_this2 =
|
|
94
|
-
_defineProperty(
|
|
95
|
-
_this2.updater = new UpdateManager(
|
|
89
|
+
_this2 = _callSuper(this, LiveStore, [features]);
|
|
90
|
+
_defineProperty(_this2, "updater", void 0);
|
|
91
|
+
_this2.updater = new UpdateManager(_this2);
|
|
96
92
|
return _this2;
|
|
97
93
|
}
|
|
94
|
+
_inherits(LiveStore, _ConnectedStore2);
|
|
98
95
|
return _createClass(LiveStore);
|
|
99
96
|
}(ConnectedStore);
|
package/esm/lists.js
CHANGED
|
@@ -13,6 +13,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
13
13
|
// import RDFParser from './rdfxmlparser'
|
|
14
14
|
// import sparqlUpdateParser from './patch-parser'
|
|
15
15
|
// import * as Util from './utils-js'
|
|
16
|
+
|
|
16
17
|
// import BlankNode from './blank-node'
|
|
17
18
|
// import NamedNode from './named-node'
|
|
18
19
|
import Collection from './collection';
|
|
@@ -20,7 +21,9 @@ import Statement from './statement';
|
|
|
20
21
|
// import Formula from './formula'
|
|
21
22
|
|
|
22
23
|
// import { ContentType, TurtleContentType, N3ContentType, RDFXMLContentType, XHTMLContentType, HTMLContentType, SPARQLUpdateContentType, SPARQLUpdateSingleMatchContentType, JSONLDContentType, NQuadsContentType, NQuadsAltContentType } from './types'
|
|
24
|
+
|
|
23
25
|
// import { Quad } from './tf-types'
|
|
26
|
+
|
|
24
27
|
import Namespace from './namespace';
|
|
25
28
|
var RDF = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#');
|
|
26
29
|
|
package/esm/literal.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
function
|
|
10
|
-
function _isNativeReflectConstruct() {
|
|
8
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
9
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
10
|
import ClassOrder from './class-order';
|
|
12
11
|
import RDFlibNamedNode from './named-node';
|
|
13
12
|
import Node from './node-internal';
|
|
@@ -19,8 +18,6 @@ import XSD from './xsd-internal';
|
|
|
19
18
|
* @link https://rdf.js.org/data-model-spec/#literal-interface
|
|
20
19
|
*/
|
|
21
20
|
var Literal = /*#__PURE__*/function (_Node) {
|
|
22
|
-
_inherits(Literal, _Node);
|
|
23
|
-
var _super = _createSuper(Literal);
|
|
24
21
|
/**
|
|
25
22
|
* Initializes a literal
|
|
26
23
|
* @param value - The literal's lexical value
|
|
@@ -30,18 +27,18 @@ var Literal = /*#__PURE__*/function (_Node) {
|
|
|
30
27
|
function Literal(value, language, datatype) {
|
|
31
28
|
var _this;
|
|
32
29
|
_classCallCheck(this, Literal);
|
|
33
|
-
_this =
|
|
34
|
-
_defineProperty(
|
|
35
|
-
_defineProperty(
|
|
30
|
+
_this = _callSuper(this, Literal, [value]);
|
|
31
|
+
_defineProperty(_this, "termType", LiteralTermType);
|
|
32
|
+
_defineProperty(_this, "classOrder", ClassOrder.Literal);
|
|
36
33
|
/**
|
|
37
34
|
* The literal's datatype as a named node
|
|
38
35
|
*/
|
|
39
|
-
_defineProperty(
|
|
40
|
-
_defineProperty(
|
|
36
|
+
_defineProperty(_this, "datatype", XSD.string);
|
|
37
|
+
_defineProperty(_this, "isVar", 0);
|
|
41
38
|
/**
|
|
42
39
|
* The language for the literal
|
|
43
40
|
*/
|
|
44
|
-
_defineProperty(
|
|
41
|
+
_defineProperty(_this, "language", '');
|
|
45
42
|
if (language) {
|
|
46
43
|
_this.language = language;
|
|
47
44
|
_this.datatype = XSD.langString;
|
|
@@ -56,7 +53,8 @@ var Literal = /*#__PURE__*/function (_Node) {
|
|
|
56
53
|
/**
|
|
57
54
|
* Gets a copy of this literal
|
|
58
55
|
*/
|
|
59
|
-
|
|
56
|
+
_inherits(Literal, _Node);
|
|
57
|
+
return _createClass(Literal, [{
|
|
60
58
|
key: "copy",
|
|
61
59
|
value: function copy() {
|
|
62
60
|
return new Literal(this.value, this.lang, this.datatype);
|
|
@@ -197,6 +195,5 @@ var Literal = /*#__PURE__*/function (_Node) {
|
|
|
197
195
|
throw new Error("Can't make literal from " + value + ' of type ' + _typeof(value));
|
|
198
196
|
}
|
|
199
197
|
}]);
|
|
200
|
-
return Literal;
|
|
201
198
|
}(Node);
|
|
202
199
|
export { Literal as default };
|
package/esm/n3parser.js
CHANGED
|
@@ -80,7 +80,6 @@ var pyjslib_slice = function pyjslib_slice(str, i, j) {
|
|
|
80
80
|
if (typeof j == 'undefined' || j == null) return str.slice(i);
|
|
81
81
|
return str.slice(i, j); // @ exactly the same spec?
|
|
82
82
|
};
|
|
83
|
-
|
|
84
83
|
var StopIteration = Error('dummy error stop iteration');
|
|
85
84
|
var pyjslib_Iterator = function pyjslib_Iterator(theList) {
|
|
86
85
|
this.last = 0;
|
|
@@ -117,7 +116,6 @@ String.prototype.decode = function (encoding) {
|
|
|
117
116
|
var uripath_join = function uripath_join(base, given) {
|
|
118
117
|
return Uri.join(given, base); // sad but true
|
|
119
118
|
};
|
|
120
|
-
|
|
121
119
|
var becauseSubexpression = null; // No reason needed
|
|
122
120
|
var diag_tracking = 0;
|
|
123
121
|
var diag_chatty_flag = 0;
|
|
@@ -266,7 +264,7 @@ export var SinkParser = /*#__PURE__*/function () {
|
|
|
266
264
|
this._context = this._formula;
|
|
267
265
|
this._parentContext = null;
|
|
268
266
|
}
|
|
269
|
-
_createClass(SinkParser, [{
|
|
267
|
+
return _createClass(SinkParser, [{
|
|
270
268
|
key: "here",
|
|
271
269
|
value: function here(i) {
|
|
272
270
|
return this._genPrefix + "_L" + this.lines + "C" + (i - this.startOfLine + 1);
|
|
@@ -1119,7 +1117,6 @@ export var SinkParser = /*#__PURE__*/function () {
|
|
|
1119
1117
|
if (j === str.length) {
|
|
1120
1118
|
return -1; // EOF
|
|
1121
1119
|
}
|
|
1122
|
-
|
|
1123
1120
|
if (str.charAt(j) === '\n') {
|
|
1124
1121
|
this.lines = this.lines + 1;
|
|
1125
1122
|
break;
|
|
@@ -1328,7 +1325,6 @@ export var SinkParser = /*#__PURE__*/function () {
|
|
|
1328
1325
|
;
|
|
1329
1326
|
return j; // Where we have got up to
|
|
1330
1327
|
}
|
|
1331
|
-
|
|
1332
1328
|
if (str.charAt(i) == "\"") {
|
|
1333
1329
|
if (str.slice(i, i + 3) == "\"\"\"") {
|
|
1334
1330
|
var delim = "\"\"\"";
|
|
@@ -1482,7 +1478,6 @@ export var SinkParser = /*#__PURE__*/function () {
|
|
|
1482
1478
|
return new pyjslib_Tuple([j, uch]);
|
|
1483
1479
|
}
|
|
1484
1480
|
}]);
|
|
1485
|
-
return SinkParser;
|
|
1486
1481
|
}();
|
|
1487
1482
|
function OLD_BadSyntax(uri, lines, str, i, why) {
|
|
1488
1483
|
return new __OLD_BadSyntax(uri, lines, str, i, why);
|
package/esm/named-node.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
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
3
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
4
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
6
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
function
|
|
9
|
-
function _isNativeReflectConstruct() {
|
|
7
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
9
|
import ClassOrder from './class-order';
|
|
11
10
|
import Node from './node-internal';
|
|
12
11
|
import { NamedNodeTermType } from './types';
|
|
@@ -17,8 +16,6 @@ import { isTerm } from './utils/terms';
|
|
|
17
16
|
* A named (IRI) RDF node
|
|
18
17
|
*/
|
|
19
18
|
var NamedNode = /*#__PURE__*/function (_Node) {
|
|
20
|
-
_inherits(NamedNode, _Node);
|
|
21
|
-
var _super = _createSuper(NamedNode);
|
|
22
19
|
/**
|
|
23
20
|
* Create a named (IRI) RDF Node
|
|
24
21
|
* @constructor
|
|
@@ -27,9 +24,9 @@ var NamedNode = /*#__PURE__*/function (_Node) {
|
|
|
27
24
|
function NamedNode(iri) {
|
|
28
25
|
var _this;
|
|
29
26
|
_classCallCheck(this, NamedNode);
|
|
30
|
-
_this =
|
|
31
|
-
_defineProperty(
|
|
32
|
-
_defineProperty(
|
|
27
|
+
_this = _callSuper(this, NamedNode, [termValue(iri)]);
|
|
28
|
+
_defineProperty(_this, "termType", NamedNodeTermType);
|
|
29
|
+
_defineProperty(_this, "classOrder", ClassOrder.NamedNode);
|
|
33
30
|
if (!_this.value) {
|
|
34
31
|
throw new Error('Missing IRI for NamedNode');
|
|
35
32
|
}
|
|
@@ -46,7 +43,8 @@ var NamedNode = /*#__PURE__*/function (_Node) {
|
|
|
46
43
|
/**
|
|
47
44
|
* Returns an $rdf node for the containing directory, ending in slash.
|
|
48
45
|
*/
|
|
49
|
-
|
|
46
|
+
_inherits(NamedNode, _Node);
|
|
47
|
+
return _createClass(NamedNode, [{
|
|
50
48
|
key: "dir",
|
|
51
49
|
value: function dir() {
|
|
52
50
|
var str = this.value.split('#')[0];
|
|
@@ -130,6 +128,5 @@ var NamedNode = /*#__PURE__*/function (_Node) {
|
|
|
130
128
|
return new NamedNode(value);
|
|
131
129
|
}
|
|
132
130
|
}]);
|
|
133
|
-
return NamedNode;
|
|
134
131
|
}(Node);
|
|
135
132
|
export { NamedNode as default };
|
package/esm/node-internal.js
CHANGED
|
@@ -25,7 +25,7 @@ var Node = /*#__PURE__*/function () {
|
|
|
25
25
|
* Creates the substituted node for this one, according to the specified bindings
|
|
26
26
|
* @param bindings - Bindings of identifiers to nodes
|
|
27
27
|
*/
|
|
28
|
-
_createClass(Node, [{
|
|
28
|
+
return _createClass(Node, [{
|
|
29
29
|
key: "substitute",
|
|
30
30
|
value: function substitute(bindings) {
|
|
31
31
|
return this;
|
|
@@ -123,7 +123,6 @@ var Node = /*#__PURE__*/function () {
|
|
|
123
123
|
throw new Error('Node.toString() is abstract - see the subclasses instead');
|
|
124
124
|
}
|
|
125
125
|
}]);
|
|
126
|
-
return Node;
|
|
127
126
|
}();
|
|
128
127
|
// Specified in './node.ts' to prevent circular dependency
|
|
129
128
|
_defineProperty(Node, "fromValue", void 0);
|
package/esm/node.js
CHANGED
|
@@ -26,7 +26,6 @@ Node.toJS = function (term) {
|
|
|
26
26
|
if (isCollection(term)) {
|
|
27
27
|
return term.elements.map(Node.toJS); // Array node (not standard RDFJS)
|
|
28
28
|
}
|
|
29
|
-
|
|
30
29
|
if (!isLiteral(term)) return term;
|
|
31
30
|
if (term.datatype.equals(ns.xsd('boolean'))) {
|
|
32
31
|
return term.value === '1' || term.value === 'true';
|
package/esm/patch-parser.js
CHANGED
package/esm/query.js
CHANGED
|
@@ -90,7 +90,6 @@ export function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
|
|
|
90
90
|
b[self] = other;
|
|
91
91
|
return [[b, null]]; // Match
|
|
92
92
|
}
|
|
93
|
-
|
|
94
93
|
actual = self;
|
|
95
94
|
}
|
|
96
95
|
if (!actual.complexType) {
|
|
@@ -122,11 +121,9 @@ export function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
|
|
|
122
121
|
if (self.length !== other.length) {
|
|
123
122
|
return []; // no way
|
|
124
123
|
}
|
|
125
|
-
|
|
126
124
|
if (!self.length) {
|
|
127
125
|
return [[[], null]]; // Success
|
|
128
126
|
}
|
|
129
|
-
|
|
130
127
|
var nbs = unifyTerm(self[0], other[0], bindings, formula);
|
|
131
128
|
if (nbs.length === 0) {
|
|
132
129
|
return nbs;
|
|
@@ -149,13 +146,11 @@ export function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
|
|
|
149
146
|
bindings2[v] = nb[v]; // copy
|
|
150
147
|
}
|
|
151
148
|
}
|
|
152
|
-
|
|
153
149
|
for (v in bindings) {
|
|
154
150
|
if (bindings.hasOwnProperty(v)) {
|
|
155
151
|
bindings2[v] = bindings[v]; // copy
|
|
156
152
|
}
|
|
157
153
|
}
|
|
158
|
-
|
|
159
154
|
nbs2 = unifyContents(self.slice(1), other.slice(1), bindings2, formula);
|
|
160
155
|
m = nbs2.length;
|
|
161
156
|
for (j = 0; j < m; j++) {
|
|
@@ -314,13 +309,11 @@ export function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
|
|
|
314
309
|
if (f.redirections[f.id(t)]) {
|
|
315
310
|
t = f.redirections[f.id(t)]; // redirect
|
|
316
311
|
}
|
|
317
|
-
|
|
318
312
|
termIndex = ind[i][f.id(t)];
|
|
319
313
|
if (!termIndex) {
|
|
320
314
|
item.index = [];
|
|
321
315
|
return false; // Query line cannot match
|
|
322
316
|
}
|
|
323
|
-
|
|
324
317
|
if (item.index === null || item.index.length > termIndex.length) {
|
|
325
318
|
// Find smallest index
|
|
326
319
|
item.index = termIndex;
|
|
@@ -375,7 +368,6 @@ export function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
|
|
|
375
368
|
br[b] = new OptionalBranch(junction); // Allocate branches to prevent premature ending
|
|
376
369
|
br[b].pattern_debug = g.optional[b]; // for diagnotics only
|
|
377
370
|
}
|
|
378
|
-
|
|
379
371
|
for (b = 0; b < g.optional.length; b++) {
|
|
380
372
|
br[b].count = br[b].count + 1; // Count how many matches we have yet to complete
|
|
381
373
|
match(f, g.optional[b], bindingsSoFar, '', fetcher, callback, br[b]);
|
|
@@ -385,7 +377,6 @@ export function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
|
|
|
385
377
|
log.debug('Match ends -- success , Branch count now: ' + branch.count + ' for ' + branch.pattern_debug);
|
|
386
378
|
return; // Success
|
|
387
379
|
}
|
|
388
|
-
|
|
389
380
|
var item;
|
|
390
381
|
var i;
|
|
391
382
|
var n = pattern.length;
|
|
@@ -413,7 +404,6 @@ export function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
|
|
|
413
404
|
fetchResource(bindingsSoFar[item.subject], id);
|
|
414
405
|
return; // only look up one per line this time, but we will come back again though match
|
|
415
406
|
}
|
|
416
|
-
|
|
417
407
|
if (bindingsSoFar[item.object] !== undefined && bindingsSoFar[item.object].uri && fetcher && fetcher.getState(docpart(bindingsSoFar[item.object].uri)) === 'unrequested') {
|
|
418
408
|
fetchResource(bindingsSoFar[item.object], id);
|
|
419
409
|
return;
|
|
@@ -459,7 +449,6 @@ export function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
|
|
|
459
449
|
prepare(f, item, bindingsSoFar);
|
|
460
450
|
// if (item.index) console.log(' item.index.length ' + item.index.length)
|
|
461
451
|
}
|
|
462
|
-
|
|
463
452
|
pattern.sort(easiestQuery);
|
|
464
453
|
item = pattern[0];
|
|
465
454
|
// log.debug("Sorted pattern:\n"+pattern)
|
|
@@ -496,20 +485,17 @@ export function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
|
|
|
496
485
|
bindings2[v] = newBindings1[v]; // copy
|
|
497
486
|
}
|
|
498
487
|
}
|
|
499
|
-
|
|
500
488
|
for (v in bindingsSoFar) {
|
|
501
489
|
if (bindingsSoFar.hasOwnProperty(v)) {
|
|
502
490
|
bindings2[v] = bindingsSoFar[v]; // copy
|
|
503
491
|
}
|
|
504
492
|
}
|
|
505
|
-
|
|
506
493
|
branch.count++; // Count how many matches we have yet to complete
|
|
507
494
|
onward++;
|
|
508
495
|
match(f, rest, bindings2, level + ' ', fetcher, callback, branch); // call match
|
|
509
496
|
}
|
|
510
497
|
}
|
|
511
498
|
}
|
|
512
|
-
|
|
513
499
|
branch.count--;
|
|
514
500
|
if (onward === 0) {
|
|
515
501
|
log.debug('Match2 fails completely on ' + item);
|
package/esm/rdfaparser.js
CHANGED
|
@@ -68,7 +68,7 @@ var RDFaProcessor = /*#__PURE__*/function () {
|
|
|
68
68
|
this.finishedHandlers = [];
|
|
69
69
|
this.init();
|
|
70
70
|
}
|
|
71
|
-
_createClass(RDFaProcessor, [{
|
|
71
|
+
return _createClass(RDFaProcessor, [{
|
|
72
72
|
key: "addTriple",
|
|
73
73
|
value: function addTriple(origin, subject, predicate, object) {
|
|
74
74
|
var su, ob, pr, or;
|
|
@@ -277,7 +277,6 @@ var RDFaProcessor = /*#__PURE__*/function () {
|
|
|
277
277
|
if (node.baseURI && !options.baseURI) {
|
|
278
278
|
options.baseURI = node.baseURI; // be defensive as DOM implementations vary
|
|
279
279
|
}
|
|
280
|
-
|
|
281
280
|
base = node.baseURI;
|
|
282
281
|
node = node.documentElement;
|
|
283
282
|
if (!node.baseURI) {
|
|
@@ -330,7 +329,6 @@ var RDFaProcessor = /*#__PURE__*/function () {
|
|
|
330
329
|
bnodes.push(this.newBlankNode());
|
|
331
330
|
// this.newSubject(item.parent,bnodes[i])
|
|
332
331
|
}
|
|
333
|
-
|
|
334
332
|
for (var _i2 = 0; _i2 < bnodes.length; _i2++) {
|
|
335
333
|
this.addTriple(item.parent, bnodes[_i2], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', list[_i2]);
|
|
336
334
|
this.addTriple(item.parent, bnodes[_i2], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', {
|
|
@@ -630,7 +628,6 @@ var RDFaProcessor = /*#__PURE__*/function () {
|
|
|
630
628
|
currentObjectResource = this.newBlankNode();
|
|
631
629
|
// alert(current.tagName+": generated blank node, newSubject="+newSubject+" currentObjectResource="+currentObjectResource)
|
|
632
630
|
}
|
|
633
|
-
|
|
634
631
|
if (relAtt && inlistAtt) {
|
|
635
632
|
for (var _i10 = 0; _i10 < relAttPredicates.length; _i10++) {
|
|
636
633
|
var _list2 = listMapping[relAttPredicates[_i10]];
|
|
@@ -999,7 +996,6 @@ var RDFaProcessor = /*#__PURE__*/function () {
|
|
|
999
996
|
// Note this became a read-only attribute some time before 2018
|
|
1000
997
|
dom.baseURI = base; // oinly set if not already set
|
|
1001
998
|
}
|
|
1002
|
-
|
|
1003
999
|
p.process(dom, {
|
|
1004
1000
|
baseURI: base
|
|
1005
1001
|
});
|
|
@@ -1015,7 +1011,6 @@ var RDFaProcessor = /*#__PURE__*/function () {
|
|
|
1015
1011
|
return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
|
|
1016
1012
|
}
|
|
1017
1013
|
}]);
|
|
1018
|
-
return RDFaProcessor;
|
|
1019
1014
|
}();
|
|
1020
1015
|
export { RDFaProcessor as default };
|
|
1021
1016
|
RDFaProcessor.XMLLiteralURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral';
|
package/esm/rdfxmlparser.js
CHANGED
|
@@ -77,7 +77,7 @@ var RDFParser = /*#__PURE__*/function () {
|
|
|
77
77
|
/** Standard namespaces that we know how to handle @final
|
|
78
78
|
* @member RDFParser
|
|
79
79
|
*/
|
|
80
|
-
_createClass(RDFParser, [{
|
|
80
|
+
return _createClass(RDFParser, [{
|
|
81
81
|
key: "frameFactory",
|
|
82
82
|
value:
|
|
83
83
|
/**
|
|
@@ -236,7 +236,6 @@ var RDFParser = /*#__PURE__*/function () {
|
|
|
236
236
|
throw new Error("RDFParser: can't find root in " + base + '. Halting. ');
|
|
237
237
|
// return false
|
|
238
238
|
}
|
|
239
|
-
|
|
240
239
|
this.why = why; // our topmost frame
|
|
241
240
|
var f = this.frameFactory(this);
|
|
242
241
|
this.base = base;
|
|
@@ -346,7 +345,8 @@ var RDFParser = /*#__PURE__*/function () {
|
|
|
346
345
|
frame.datatype = RDFParser.ns.RDF + 'XMLLiteral';
|
|
347
346
|
frame = this.buildFrame(frame);
|
|
348
347
|
// Don't include the literal node, only its children
|
|
349
|
-
|
|
348
|
+
// see https://github.com/linkeddata/rdflib.js/issues/75
|
|
349
|
+
frame.addLiteral(dom.innerHTML || dom.childNodes);
|
|
350
350
|
dig = false;
|
|
351
351
|
} else if (nv === 'Resource') {
|
|
352
352
|
frame = this.buildFrame(frame, frame.element);
|
|
@@ -468,7 +468,6 @@ var RDFParser = /*#__PURE__*/function () {
|
|
|
468
468
|
return frame;
|
|
469
469
|
}
|
|
470
470
|
}]);
|
|
471
|
-
return RDFParser;
|
|
472
471
|
}();
|
|
473
472
|
_defineProperty(RDFParser, "ns", {
|
|
474
473
|
'RDF': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
|
package/esm/serialize.js
CHANGED
package/esm/serializer.js
CHANGED
|
@@ -52,7 +52,7 @@ export var Serializer = /*#__PURE__*/function () {
|
|
|
52
52
|
this.rdfFactory = store.rdfFactory || CanonicalDataFactory;
|
|
53
53
|
this.xsd = createXSD(this.rdfFactory);
|
|
54
54
|
}
|
|
55
|
-
_createClass(Serializer, [{
|
|
55
|
+
return _createClass(Serializer, [{
|
|
56
56
|
key: "setBase",
|
|
57
57
|
value: function setBase(base) {
|
|
58
58
|
this.base = base;
|
|
@@ -71,7 +71,6 @@ export var Serializer = /*#__PURE__*/function () {
|
|
|
71
71
|
if (x.termType === 'Graph') {
|
|
72
72
|
this.formulas[s] = x; // remember as reverse does not work
|
|
73
73
|
}
|
|
74
|
-
|
|
75
74
|
return s;
|
|
76
75
|
}
|
|
77
76
|
}, {
|
|
@@ -202,7 +201,6 @@ export var Serializer = /*#__PURE__*/function () {
|
|
|
202
201
|
if (!this.validPrefix.test(p)) {
|
|
203
202
|
p = 'n'; // Otherwise the loop below may never termimnate
|
|
204
203
|
}
|
|
205
|
-
|
|
206
204
|
for (var j = 0;; j++) if (canUse(p.slice(0, 3) + j)) return p.slice(0, 3) + j;
|
|
207
205
|
}
|
|
208
206
|
}, {
|
|
@@ -225,7 +223,6 @@ export var Serializer = /*#__PURE__*/function () {
|
|
|
225
223
|
if (!incoming.hasOwnProperty(x)) incoming[x] = [];
|
|
226
224
|
incoming[x].push(st.subject); // List of things which will cause this to be printed
|
|
227
225
|
};
|
|
228
|
-
|
|
229
226
|
var st2 = [st.subject, st.predicate, st.object];
|
|
230
227
|
st2.map(function (y) {
|
|
231
228
|
if (y.termType === 'BlankNode') {
|
|
@@ -236,14 +233,12 @@ export var Serializer = /*#__PURE__*/function () {
|
|
|
236
233
|
});
|
|
237
234
|
}
|
|
238
235
|
});
|
|
239
|
-
|
|
240
236
|
checkMentions(sts[i].object);
|
|
241
237
|
var ss = subjects[this.toStr(st.subject)]; // Statements with this as subject
|
|
242
238
|
if (!ss) ss = [];
|
|
243
239
|
ss.push(st);
|
|
244
240
|
subjects[this.toStr(st.subject)] = ss; // Make hash. @@ too slow for formula?
|
|
245
241
|
}
|
|
246
|
-
|
|
247
242
|
var roots = [];
|
|
248
243
|
for (var xNT in subjects) {
|
|
249
244
|
if (!subjects.hasOwnProperty(xNT)) continue;
|
|
@@ -377,7 +372,6 @@ export var Serializer = /*#__PURE__*/function () {
|
|
|
377
372
|
str += ' '; // separate from previous token
|
|
378
373
|
}
|
|
379
374
|
}
|
|
380
|
-
|
|
381
375
|
str += s2;
|
|
382
376
|
}
|
|
383
377
|
return str;
|
|
@@ -434,7 +428,6 @@ export var Serializer = /*#__PURE__*/function () {
|
|
|
434
428
|
}
|
|
435
429
|
}
|
|
436
430
|
}
|
|
437
|
-
|
|
438
431
|
return str;
|
|
439
432
|
};
|
|
440
433
|
|
|
@@ -457,7 +450,6 @@ export var Serializer = /*#__PURE__*/function () {
|
|
|
457
450
|
if (subject.termType === 'BlankNode' && !stats.incoming[subject]) {
|
|
458
451
|
return objectTree(subject, stats, true).concat(['.']); // Anonymous bnode subject
|
|
459
452
|
}
|
|
460
|
-
|
|
461
453
|
return [termToN3(subject, stats)].concat([propertyTree(subject, stats)]).concat(['.']);
|
|
462
454
|
}
|
|
463
455
|
// The property tree for a single subject or anonymous node
|
|
@@ -686,7 +678,6 @@ export var Serializer = /*#__PURE__*/function () {
|
|
|
686
678
|
// Fall though if can't do qname
|
|
687
679
|
}
|
|
688
680
|
}
|
|
689
|
-
|
|
690
681
|
return this.explicitURI(uri);
|
|
691
682
|
}
|
|
692
683
|
|
|
@@ -820,7 +811,6 @@ export var Serializer = /*#__PURE__*/function () {
|
|
|
820
811
|
}
|
|
821
812
|
});
|
|
822
813
|
}
|
|
823
|
-
|
|
824
814
|
function relURIMethod(term) {
|
|
825
815
|
return escapeForXML(this.base ? Util.uri.refTo(this.base, term.uri) : term.uri);
|
|
826
816
|
}
|
|
@@ -903,7 +893,6 @@ export var Serializer = /*#__PURE__*/function () {
|
|
|
903
893
|
throw new Error("Can't serialize object of type " + st.object.termType + ' into XML');
|
|
904
894
|
} // switch
|
|
905
895
|
}
|
|
906
|
-
|
|
907
896
|
var tag = type ? qname(type) : 'rdf:Description';
|
|
908
897
|
var attrs = '';
|
|
909
898
|
if (subject.termType === 'BlankNode') {
|
|
@@ -955,7 +944,6 @@ export var Serializer = /*#__PURE__*/function () {
|
|
|
955
944
|
throw new Error("Can't serialize object of type " + st.object.termType + ' into XML');
|
|
956
945
|
} // switch
|
|
957
946
|
}
|
|
958
|
-
|
|
959
947
|
return results;
|
|
960
948
|
}
|
|
961
949
|
var propertyXMLTree = propertyXMLTreeMethod.bind(this);
|
|
@@ -1023,7 +1011,6 @@ export var Serializer = /*#__PURE__*/function () {
|
|
|
1023
1011
|
return JSON.stringify(jsonldObj, null, 2);
|
|
1024
1012
|
}
|
|
1025
1013
|
}]);
|
|
1026
|
-
return Serializer;
|
|
1027
1014
|
}();
|
|
1028
1015
|
|
|
1029
1016
|
// String escaping utilities
|
package/esm/sparql-to-query.js
CHANGED
|
@@ -118,7 +118,6 @@ export default function SPARQLToQuery(SPARQL, testMode, kb) {
|
|
|
118
118
|
log.info('Literal found: ' + res[1]);
|
|
119
119
|
res = res.concat(parseLiterals(str.slice(end + ind + 2))); // finds any other literals
|
|
120
120
|
}
|
|
121
|
-
|
|
122
121
|
return res;
|
|
123
122
|
}
|
|
124
123
|
function spaceDelimit(str) {
|
|
@@ -346,7 +345,6 @@ export default function SPARQLToQuery(SPARQL, testMode, kb) {
|
|
|
346
345
|
// log.warn("I don't know how to handle the constraint: "+input)
|
|
347
346
|
// alert("length: "+input.length+" input 0 type: "+input[0].termType+" input 1: "+input[1]+" input[2] type: "+input[2].termType)
|
|
348
347
|
}
|
|
349
|
-
|
|
350
348
|
function setOptional(terms, pat) {
|
|
351
349
|
log.debug('Optional query: ' + terms + ' not yet implemented.');
|
|
352
350
|
var opt = kb.formula();
|
package/esm/statement.js
CHANGED
|
@@ -45,7 +45,7 @@ var Statement = /*#__PURE__*/function () {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/** Alias for graph, favored by Tim */
|
|
48
|
-
_createClass(Statement, [{
|
|
48
|
+
return _createClass(Statement, [{
|
|
49
49
|
key: "why",
|
|
50
50
|
get: function get() {
|
|
51
51
|
return this.graph;
|
|
@@ -115,6 +115,5 @@ var Statement = /*#__PURE__*/function () {
|
|
|
115
115
|
return this.toNT();
|
|
116
116
|
}
|
|
117
117
|
}]);
|
|
118
|
-
return Statement;
|
|
119
118
|
}();
|
|
120
119
|
export { Statement as default };
|