rdflib 2.2.35 → 2.2.36
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 +0 -2
- package/dist/rdflib.min.js.map +1 -1
- package/esm/blank-node.js +57 -82
- package/esm/class-order.js +1 -1
- package/esm/collection.js +70 -103
- package/esm/default-graph.js +13 -30
- package/esm/empty.js +8 -23
- package/esm/factories/canonical-data-factory.js +33 -29
- package/esm/factories/extended-term-factory.js +18 -13
- package/esm/factories/factory-types.js +1 -1
- package/esm/factories/rdflib-data-factory.js +9 -11
- package/esm/fetcher.js +1366 -1651
- package/esm/formula.js +631 -736
- package/esm/index.js +31 -48
- package/esm/jsonldparser.js +19 -26
- package/esm/jsonparser.js +1 -1
- package/esm/lists.js +38 -86
- package/esm/literal.js +120 -154
- package/esm/log.js +7 -7
- package/esm/n3parser.js +1009 -1086
- package/esm/named-node.js +69 -96
- package/esm/namespace.js +2 -4
- package/esm/node-internal.js +73 -96
- package/esm/node.js +1 -1
- package/esm/parse.js +3 -3
- package/esm/patch-parser.js +1 -1
- package/esm/query.js +15 -16
- package/esm/rdfaparser.js +775 -841
- package/esm/rdfxmlparser.js +348 -364
- package/esm/serialize.js +2 -2
- package/esm/serializer.js +835 -877
- package/esm/statement.js +52 -71
- package/esm/store.js +853 -957
- package/esm/types.js +21 -21
- package/esm/update-manager.js +965 -1100
- package/esm/updates-via.js +104 -132
- 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 -5
- package/esm/utils.js +6 -6
- package/esm/variable.js +32 -55
- package/esm/xsd.js +2 -2
- package/lib/blank-node.js +57 -80
- package/lib/class-order.js +1 -1
- package/lib/collection.js +70 -101
- package/lib/default-graph.js +14 -29
- package/lib/empty.js +9 -22
- package/lib/factories/canonical-data-factory.js +35 -31
- package/lib/factories/extended-term-factory.js +18 -13
- package/lib/factories/factory-types.js +1 -1
- package/lib/factories/rdflib-data-factory.js +9 -11
- package/lib/fetcher.js +1375 -1654
- package/lib/formula.js +632 -735
- package/lib/index.js +80 -84
- package/lib/jsonldparser.js +21 -32
- package/lib/jsonparser.js +1 -1
- package/lib/lists.js +47 -87
- package/lib/literal.js +121 -153
- package/lib/log.js +7 -7
- package/lib/n3parser.js +1012 -1090
- package/lib/named-node.js +70 -95
- package/lib/namespace.js +2 -4
- package/lib/node-internal.js +73 -94
- package/lib/node.js +1 -1
- package/lib/parse.js +5 -6
- package/lib/patch-parser.js +1 -1
- package/lib/query.js +20 -18
- package/lib/rdfaparser.js +778 -843
- package/lib/rdfxmlparser.js +351 -365
- package/lib/serialize.js +2 -2
- package/lib/serializer.js +840 -880
- package/lib/statement.js +55 -73
- package/lib/store.js +860 -958
- package/lib/types.js +21 -21
- package/lib/update-manager.js +970 -1102
- package/lib/updates-via.js +107 -132
- package/lib/uri.js +3 -3
- package/lib/utils/default-graph-uri.js +2 -2
- package/lib/utils/terms.js +4 -6
- package/lib/utils-js.js +8 -9
- package/lib/utils.js +6 -6
- package/lib/variable.js +35 -57
- package/lib/xsd.js +2 -2
- package/package.json +2 -2
- package/src/n3parser.js +1 -1
- package/src/serializer.js +1 -1
- package/src/update-manager.ts +2 -1
- package/.babelrc +0 -20
package/esm/named-node.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
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; })(); }
|
|
9
2
|
import ClassOrder from './class-order';
|
|
10
3
|
import Node from './node-internal';
|
|
11
4
|
import { NamedNodeTermType } from './types';
|
|
@@ -15,118 +8,98 @@ import { isTerm } from './utils/terms';
|
|
|
15
8
|
/**
|
|
16
9
|
* A named (IRI) RDF node
|
|
17
10
|
*/
|
|
18
|
-
|
|
11
|
+
export default class NamedNode extends Node {
|
|
19
12
|
/**
|
|
20
13
|
* Create a named (IRI) RDF Node
|
|
21
14
|
* @constructor
|
|
22
15
|
* @param iri - The IRI for this node
|
|
23
16
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
_defineProperty(_this, "classOrder", ClassOrder.NamedNode);
|
|
30
|
-
if (!_this.value) {
|
|
17
|
+
constructor(iri) {
|
|
18
|
+
super(termValue(iri));
|
|
19
|
+
_defineProperty(this, "termType", NamedNodeTermType);
|
|
20
|
+
_defineProperty(this, "classOrder", ClassOrder.NamedNode);
|
|
21
|
+
if (!this.value) {
|
|
31
22
|
throw new Error('Missing IRI for NamedNode');
|
|
32
23
|
}
|
|
33
|
-
if (!
|
|
24
|
+
if (!this.value.includes(':')) {
|
|
34
25
|
throw new Error('NamedNode IRI "' + iri + '" must be absolute.');
|
|
35
26
|
}
|
|
36
|
-
if (
|
|
27
|
+
if (this.value.includes(' ')) {
|
|
37
28
|
var message = 'Error: NamedNode IRI "' + iri + '" must not contain unencoded spaces.';
|
|
38
29
|
throw new Error(message);
|
|
39
30
|
}
|
|
40
|
-
return _this;
|
|
41
31
|
}
|
|
42
32
|
|
|
43
33
|
/**
|
|
44
34
|
* Returns an $rdf node for the containing directory, ending in slash.
|
|
45
35
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (q >= 0 && p < q + 2 || p < 0) return null;
|
|
54
|
-
return new NamedNode(str.slice(0, p + 1));
|
|
55
|
-
}
|
|
36
|
+
dir() {
|
|
37
|
+
var str = this.value.split('#')[0];
|
|
38
|
+
var p = str.slice(0, -1).lastIndexOf('/');
|
|
39
|
+
var q = str.indexOf('//');
|
|
40
|
+
if (q >= 0 && p < q + 2 || p < 0) return null;
|
|
41
|
+
return new NamedNode(str.slice(0, p + 1));
|
|
42
|
+
}
|
|
56
43
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
} else {
|
|
71
|
-
return new NamedNode(str.slice(0, q + 1));
|
|
72
|
-
}
|
|
44
|
+
/**
|
|
45
|
+
* Returns an NN for the whole web site, ending in slash.
|
|
46
|
+
* Contrast with the "origin" which does NOT have a trailing slash
|
|
47
|
+
*/
|
|
48
|
+
site() {
|
|
49
|
+
var str = this.value.split('#')[0];
|
|
50
|
+
var p = str.indexOf('//');
|
|
51
|
+
if (p < 0) throw new Error('This URI does not have a web site part (origin)');
|
|
52
|
+
var q = str.indexOf('/', p + 2);
|
|
53
|
+
if (q < 0) {
|
|
54
|
+
return new NamedNode(str.slice(0) + '/'); // Add slash to a bare origin
|
|
55
|
+
} else {
|
|
56
|
+
return new NamedNode(str.slice(0, q + 1));
|
|
73
57
|
}
|
|
58
|
+
}
|
|
74
59
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
} else {
|
|
85
|
-
return new NamedNode(this.value.split('#')[0]);
|
|
86
|
-
}
|
|
60
|
+
/**
|
|
61
|
+
* Creates the fetchable named node for the document.
|
|
62
|
+
* Removes everything from the # anchor tag.
|
|
63
|
+
*/
|
|
64
|
+
doc() {
|
|
65
|
+
if (this.value.indexOf('#') < 0) {
|
|
66
|
+
return this;
|
|
67
|
+
} else {
|
|
68
|
+
return new NamedNode(this.value.split('#')[0]);
|
|
87
69
|
}
|
|
70
|
+
}
|
|
88
71
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return '<' + this.value + '>';
|
|
96
|
-
}
|
|
72
|
+
/**
|
|
73
|
+
* Returns the URI including <brackets>
|
|
74
|
+
*/
|
|
75
|
+
toString() {
|
|
76
|
+
return '<' + this.value + '>';
|
|
77
|
+
}
|
|
97
78
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return this.value.split('#')[1];
|
|
103
|
-
}
|
|
79
|
+
/** The local identifier with the document */
|
|
80
|
+
id() {
|
|
81
|
+
return this.value.split('#')[1];
|
|
82
|
+
}
|
|
104
83
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
this.value = uri;
|
|
113
|
-
}
|
|
84
|
+
/** Alias for value, favored by Tim */
|
|
85
|
+
get uri() {
|
|
86
|
+
return this.value;
|
|
87
|
+
}
|
|
88
|
+
set uri(uri) {
|
|
89
|
+
this.value = uri;
|
|
90
|
+
}
|
|
114
91
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (typeof value === 'undefined' || value === null) {
|
|
123
|
-
return value;
|
|
124
|
-
}
|
|
125
|
-
if (isTerm(value)) {
|
|
126
|
-
return value;
|
|
127
|
-
}
|
|
128
|
-
return new NamedNode(value);
|
|
92
|
+
/**
|
|
93
|
+
* Creates a named node from the specified input value
|
|
94
|
+
* @param value - An input value
|
|
95
|
+
*/
|
|
96
|
+
static fromValue(value) {
|
|
97
|
+
if (typeof value === 'undefined' || value === null) {
|
|
98
|
+
return value;
|
|
129
99
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
100
|
+
if (isTerm(value)) {
|
|
101
|
+
return value;
|
|
102
|
+
}
|
|
103
|
+
return new NamedNode(value);
|
|
104
|
+
}
|
|
105
|
+
}
|
package/esm/namespace.js
CHANGED
|
@@ -5,10 +5,8 @@ import RDFlibNamedNode from './named-node';
|
|
|
5
5
|
* @param [factory] - The factory for creating named nodes with
|
|
6
6
|
*/
|
|
7
7
|
export default function Namespace(nsuri, factory) {
|
|
8
|
-
|
|
9
|
-
namedNode:
|
|
10
|
-
return new RDFlibNamedNode(value);
|
|
11
|
-
}
|
|
8
|
+
const dataFactory = factory || {
|
|
9
|
+
namedNode: value => new RDFlibNamedNode(value)
|
|
12
10
|
};
|
|
13
11
|
return function (ln) {
|
|
14
12
|
return dataFactory.namedNode(nsuri + (ln || ''));
|
package/esm/node-internal.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
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
|
/**
|
|
5
3
|
* The superclass of all RDF Statement objects, that is
|
|
@@ -9,9 +7,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
9
7
|
* @link https://rdf.js.org/data-model-spec/#term-interface
|
|
10
8
|
* @class Node
|
|
11
9
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
_classCallCheck(this, Node);
|
|
10
|
+
export default class Node {
|
|
11
|
+
constructor(value) {
|
|
15
12
|
/** The type of node */
|
|
16
13
|
_defineProperty(this, "termType", void 0);
|
|
17
14
|
/** The class order for this node */
|
|
@@ -25,107 +22,87 @@ var Node = /*#__PURE__*/function () {
|
|
|
25
22
|
* Creates the substituted node for this one, according to the specified bindings
|
|
26
23
|
* @param bindings - Bindings of identifiers to nodes
|
|
27
24
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
25
|
+
substitute(bindings) {
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
33
28
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (this.classOrder < other.classOrder) {
|
|
43
|
-
return -1;
|
|
44
|
-
}
|
|
45
|
-
if (this.classOrder > other.classOrder) {
|
|
46
|
-
return +1;
|
|
47
|
-
}
|
|
48
|
-
if (this.value < other.value) {
|
|
49
|
-
return -1;
|
|
50
|
-
}
|
|
51
|
-
if (this.value > other.value) {
|
|
52
|
-
return +1;
|
|
53
|
-
}
|
|
54
|
-
return 0;
|
|
29
|
+
/**
|
|
30
|
+
* Compares this node with another
|
|
31
|
+
* @see {equals} to check if two nodes are equal
|
|
32
|
+
* @param other - The other node
|
|
33
|
+
*/
|
|
34
|
+
compareTerm(other) {
|
|
35
|
+
if (this.classOrder < other.classOrder) {
|
|
36
|
+
return -1;
|
|
55
37
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
* Compares whether the two nodes are equal
|
|
59
|
-
* @param other The other node
|
|
60
|
-
*/
|
|
61
|
-
}, {
|
|
62
|
-
key: "equals",
|
|
63
|
-
value: function equals(other) {
|
|
64
|
-
if (!other) {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
return this.termType === other.termType && this.value === other.value;
|
|
38
|
+
if (this.classOrder > other.classOrder) {
|
|
39
|
+
return +1;
|
|
68
40
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
* Creates a hash for this node
|
|
72
|
-
* @deprecated use {rdfFactory.id} instead if possible
|
|
73
|
-
*/
|
|
74
|
-
}, {
|
|
75
|
-
key: "hashString",
|
|
76
|
-
value: function hashString() {
|
|
77
|
-
return this.toCanonical();
|
|
41
|
+
if (this.value < other.value) {
|
|
42
|
+
return -1;
|
|
78
43
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
* Compares whether this node is the same as the other one
|
|
82
|
-
* @param other - Another node
|
|
83
|
-
*/
|
|
84
|
-
}, {
|
|
85
|
-
key: "sameTerm",
|
|
86
|
-
value: function sameTerm(other) {
|
|
87
|
-
return this.equals(other);
|
|
44
|
+
if (this.value > other.value) {
|
|
45
|
+
return +1;
|
|
88
46
|
}
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
89
49
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return
|
|
50
|
+
/**
|
|
51
|
+
* Compares whether the two nodes are equal
|
|
52
|
+
* @param other The other node
|
|
53
|
+
*/
|
|
54
|
+
equals(other) {
|
|
55
|
+
if (!other) {
|
|
56
|
+
return false;
|
|
97
57
|
}
|
|
58
|
+
return this.termType === other.termType && this.value === other.value;
|
|
59
|
+
}
|
|
98
60
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
61
|
+
/**
|
|
62
|
+
* Creates a hash for this node
|
|
63
|
+
* @deprecated use {rdfFactory.id} instead if possible
|
|
64
|
+
*/
|
|
65
|
+
hashString() {
|
|
66
|
+
return this.toCanonical();
|
|
67
|
+
}
|
|
107
68
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
69
|
+
/**
|
|
70
|
+
* Compares whether this node is the same as the other one
|
|
71
|
+
* @param other - Another node
|
|
72
|
+
*/
|
|
73
|
+
sameTerm(other) {
|
|
74
|
+
return this.equals(other);
|
|
75
|
+
}
|
|
116
76
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Creates a canonical string representation of this node
|
|
79
|
+
*/
|
|
80
|
+
toCanonical() {
|
|
81
|
+
return this.toNT();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Creates a n-triples string representation of this node
|
|
86
|
+
*/
|
|
87
|
+
toNT() {
|
|
88
|
+
return this.toString();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Creates a n-quads string representation of this node
|
|
93
|
+
*/
|
|
94
|
+
toNQ() {
|
|
95
|
+
return this.toNT();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Creates a string representation of this node
|
|
100
|
+
*/
|
|
101
|
+
toString() {
|
|
102
|
+
throw new Error('Node.toString() is abstract - see the subclasses instead');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
127
105
|
// Specified in './node.ts' to prevent circular dependency
|
|
128
106
|
_defineProperty(Node, "fromValue", void 0);
|
|
129
107
|
// Specified in './node.ts' to prevent circular dependency
|
|
130
|
-
_defineProperty(Node, "toJS", void 0);
|
|
131
|
-
export { Node as default };
|
|
108
|
+
_defineProperty(Node, "toJS", void 0);
|
package/esm/node.js
CHANGED
package/esm/parse.js
CHANGED
|
@@ -20,8 +20,8 @@ import { TurtleContentType, N3ContentType, RDFXMLContentType, XHTMLContentType,
|
|
|
20
20
|
* @param [callback] - The callback to call when the data has been loaded
|
|
21
21
|
*/
|
|
22
22
|
export default function parse(str, kb, base) {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
let contentType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'text/turtle';
|
|
24
|
+
let callback = arguments.length > 4 ? arguments[4] : undefined;
|
|
25
25
|
contentType = contentType || TurtleContentType;
|
|
26
26
|
contentType = contentType.split(';')[0];
|
|
27
27
|
try {
|
|
@@ -93,7 +93,7 @@ export default function parse(str, kb, base) {
|
|
|
93
93
|
if (callback) {
|
|
94
94
|
callback(e, kb);
|
|
95
95
|
} else {
|
|
96
|
-
|
|
96
|
+
let e2 = new Error('' + e + ' while trying to parse <' + base + '> as ' + contentType);
|
|
97
97
|
//@ts-ignore .cause is not a default error property
|
|
98
98
|
e2.cause = e;
|
|
99
99
|
throw e2;
|
package/esm/patch-parser.js
CHANGED
|
@@ -13,7 +13,7 @@ export default function sparqlUpdateParser(str, kb, base) {
|
|
|
13
13
|
var SQNS = Namespace('http://www.w3.org/ns/pim/patch#');
|
|
14
14
|
var p = N3Parser(kb, kb, base, base, null, null, '', null);
|
|
15
15
|
var clauses = {};
|
|
16
|
-
var badSyntax = function
|
|
16
|
+
var badSyntax = function (uri, lines, str, i, why) {
|
|
17
17
|
return 'Line ' + (lines + 1) + ' of <' + uri + '>: Bad syntax:\n ' + why + '\n at: "' + str.slice(i, i + 30) + '"';
|
|
18
18
|
};
|
|
19
19
|
|
package/esm/query.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
1
|
// Matching a formula against another formula
|
|
4
2
|
// Assync as well as Synchronously
|
|
5
3
|
//
|
|
@@ -27,14 +25,15 @@ import { docpart } from './uri';
|
|
|
27
25
|
/**
|
|
28
26
|
* Query class, for tracking queries the user has in the UI.
|
|
29
27
|
*/
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
28
|
+
export class Query {
|
|
29
|
+
constructor(name, id) {
|
|
30
|
+
this.pat = new IndexedFormula(); // The pattern to search for
|
|
31
|
+
this.vars = []; // Used by UI code but not in query.js
|
|
32
|
+
// this.orderBy = [] // Not used yet
|
|
33
|
+
this.name = name;
|
|
34
|
+
this.id = id;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
38
37
|
|
|
39
38
|
/**
|
|
40
39
|
* This function will match a pattern to the current Store
|
|
@@ -258,7 +257,7 @@ export function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
|
|
|
258
257
|
};
|
|
259
258
|
|
|
260
259
|
// An optional branch hoards its results.
|
|
261
|
-
var OptionalBranch = function
|
|
260
|
+
var OptionalBranch = function (junction) {
|
|
262
261
|
this.count = 0;
|
|
263
262
|
this.done = false;
|
|
264
263
|
this.results = [];
|
|
@@ -297,7 +296,7 @@ export function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
|
|
|
297
296
|
terms = [item.subject, item.predicate, item.object, item.why];
|
|
298
297
|
ind = [f.subjectIndex, f.predicateIndex, f.objectIndex, f.whyIndex];
|
|
299
298
|
for (i = 0; i < 4; i++) {
|
|
300
|
-
|
|
299
|
+
let t = terms[i];
|
|
301
300
|
// console.log(" Prepare (" + t + ") "+(t in bindings))
|
|
302
301
|
if (t.uri && t.uri === defaultDocumentURI) {// chrome:session
|
|
303
302
|
// console.log(' query: Ignoring slot ' + i)
|
|
@@ -349,7 +348,7 @@ export function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
|
|
|
349
348
|
*
|
|
350
349
|
* Will fetch linked data from the web iff the knowledge base an associated source fetcher (f.fetcher)
|
|
351
350
|
***/
|
|
352
|
-
var match = function
|
|
351
|
+
var match = function (f, g, bindingsSoFar, level, fetcher, localCallback, branch) {
|
|
353
352
|
log.debug('Match begins, Branch count now: ' + branch.count + ' for ' + branch.pattern_debug);
|
|
354
353
|
|
|
355
354
|
// log.debug("match: f has "+f.statements.length+", g has "+g.statements.length)
|
|
@@ -386,7 +385,7 @@ export function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
|
|
|
386
385
|
if (fetcher) {
|
|
387
386
|
// Fetcher is used to fetch URIs, function first term is a URI term, second is the requester
|
|
388
387
|
var id = 'match' + matchIndex++;
|
|
389
|
-
var fetchResource = function
|
|
388
|
+
var fetchResource = function (requestedTerm, id) {
|
|
390
389
|
var docuri = requestedTerm.uri.split('#')[0];
|
|
391
390
|
fetcher.nowOrWhenFetched(docuri, undefined, function (ok, body, xhr) {
|
|
392
391
|
if (!ok) {
|
|
@@ -413,7 +412,7 @@ export function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
|
|
|
413
412
|
match2(f, g, bindingsSoFar, level, fetcher, localCallback, branch);
|
|
414
413
|
}; // match
|
|
415
414
|
|
|
416
|
-
var constraintsSatisfied = function
|
|
415
|
+
var constraintsSatisfied = function (bindings, constraints) {
|
|
417
416
|
var res = true;
|
|
418
417
|
var x;
|
|
419
418
|
var test;
|
|
@@ -431,7 +430,7 @@ export function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {
|
|
|
431
430
|
};
|
|
432
431
|
|
|
433
432
|
/** match2 -- stuff after the fetch **/
|
|
434
|
-
var match2 = function
|
|
433
|
+
var match2 = function (f, g, bindingsSoFar, level, fetcher, callback, branch) {
|
|
435
434
|
// post fetch
|
|
436
435
|
var pattern = g.statements;
|
|
437
436
|
var n = pattern.length;
|