rdflib 2.2.37-d88af7be → 2.2.37-e1458833
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.map +1 -1
- package/esm/store.js +14 -8
- package/lib/formula.d.ts +1 -0
- package/lib/store.d.ts +4 -1
- package/lib/store.js +14 -8
- package/package.json +1 -1
- package/src/formula.ts +1 -0
- package/src/store.ts +15 -8
package/esm/store.js
CHANGED
|
@@ -129,7 +129,9 @@ export default class IndexedFormula extends Formula {
|
|
|
129
129
|
/** Function to remove quads from the store arrays with */
|
|
130
130
|
_defineProperty(this, "rdfArrayRemove", void 0);
|
|
131
131
|
/** Callbacks which are triggered after a statement has been added to the store */
|
|
132
|
-
_defineProperty(this, "dataCallbacks",
|
|
132
|
+
_defineProperty(this, "dataCallbacks", []);
|
|
133
|
+
/** Callbacks which are triggered after a statement has been removed from the store */
|
|
134
|
+
_defineProperty(this, "dataRemovalCallbacks", []);
|
|
133
135
|
this.propertyActions = {};
|
|
134
136
|
this.classActions = {};
|
|
135
137
|
this.redirections = [];
|
|
@@ -151,6 +153,9 @@ export default class IndexedFormula extends Formula {
|
|
|
151
153
|
if (opts.dataCallback) {
|
|
152
154
|
this.dataCallbacks = [opts.dataCallback];
|
|
153
155
|
}
|
|
156
|
+
if (opts.dataRemovalCallback) {
|
|
157
|
+
this.dataRemovalCallbacks = [opts.dataRemovalCallback];
|
|
158
|
+
}
|
|
154
159
|
this.initPropertyActions(this.features);
|
|
155
160
|
}
|
|
156
161
|
|
|
@@ -179,11 +184,11 @@ export default class IndexedFormula extends Formula {
|
|
|
179
184
|
* @param cb
|
|
180
185
|
*/
|
|
181
186
|
addDataCallback(cb) {
|
|
182
|
-
if (!this.dataCallbacks) {
|
|
183
|
-
this.dataCallbacks = [];
|
|
184
|
-
}
|
|
185
187
|
this.dataCallbacks.push(cb);
|
|
186
188
|
}
|
|
189
|
+
addDataRemovalCallback(cb) {
|
|
190
|
+
this.dataRemovalCallbacks.push(cb);
|
|
191
|
+
}
|
|
187
192
|
|
|
188
193
|
/**
|
|
189
194
|
* Apply a set of statements to be deleted and to be inserted
|
|
@@ -397,10 +402,8 @@ export default class IndexedFormula extends Formula {
|
|
|
397
402
|
|
|
398
403
|
// log.debug("ADDING {"+subj+" "+pred+" "+objNode+"} "+why)
|
|
399
404
|
this.statements.push(st);
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
callback(st);
|
|
403
|
-
}
|
|
405
|
+
for (const callback of this.dataCallbacks) {
|
|
406
|
+
callback(st);
|
|
404
407
|
}
|
|
405
408
|
return st;
|
|
406
409
|
}
|
|
@@ -850,6 +853,9 @@ export default class IndexedFormula extends Formula {
|
|
|
850
853
|
}
|
|
851
854
|
}
|
|
852
855
|
this.rdfArrayRemove(this.statements, st);
|
|
856
|
+
for (const callback of this.dataRemovalCallbacks) {
|
|
857
|
+
callback(st);
|
|
858
|
+
}
|
|
853
859
|
return this;
|
|
854
860
|
}
|
|
855
861
|
|
package/lib/formula.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import BlankNode from './blank-node';
|
|
|
12
12
|
import NamedNode from './named-node';
|
|
13
13
|
export interface FormulaOpts {
|
|
14
14
|
dataCallback?: (q: Quad) => void;
|
|
15
|
+
dataRemovalCallback?: (q: Quad) => void;
|
|
15
16
|
rdfArrayRemove?: (arr: Quad[], q: Quad) => void;
|
|
16
17
|
rdfFactory?: RdfJsDataFactory;
|
|
17
18
|
}
|
package/lib/store.d.ts
CHANGED
|
@@ -61,7 +61,9 @@ export default class IndexedFormula extends Formula {
|
|
|
61
61
|
/** Function to remove quads from the store arrays with */
|
|
62
62
|
private rdfArrayRemove;
|
|
63
63
|
/** Callbacks which are triggered after a statement has been added to the store */
|
|
64
|
-
private dataCallbacks
|
|
64
|
+
private dataCallbacks;
|
|
65
|
+
/** Callbacks which are triggered after a statement has been removed from the store */
|
|
66
|
+
private dataRemovalCallbacks;
|
|
65
67
|
/**
|
|
66
68
|
* Creates a new formula
|
|
67
69
|
* @param features - What sort of automatic processing to do? Array of string
|
|
@@ -86,6 +88,7 @@ export default class IndexedFormula extends Formula {
|
|
|
86
88
|
* @param cb
|
|
87
89
|
*/
|
|
88
90
|
addDataCallback(cb: (q: Quad) => void): void;
|
|
91
|
+
addDataRemovalCallback(cb: (q: Quad) => void): void;
|
|
89
92
|
/**
|
|
90
93
|
* Apply a set of statements to be deleted and to be inserted
|
|
91
94
|
*
|
package/lib/store.js
CHANGED
|
@@ -137,7 +137,9 @@ class IndexedFormula extends _formula.default {
|
|
|
137
137
|
/** Function to remove quads from the store arrays with */
|
|
138
138
|
(0, _defineProperty2.default)(this, "rdfArrayRemove", void 0);
|
|
139
139
|
/** Callbacks which are triggered after a statement has been added to the store */
|
|
140
|
-
(0, _defineProperty2.default)(this, "dataCallbacks",
|
|
140
|
+
(0, _defineProperty2.default)(this, "dataCallbacks", []);
|
|
141
|
+
/** Callbacks which are triggered after a statement has been removed from the store */
|
|
142
|
+
(0, _defineProperty2.default)(this, "dataRemovalCallbacks", []);
|
|
141
143
|
this.propertyActions = {};
|
|
142
144
|
this.classActions = {};
|
|
143
145
|
this.redirections = [];
|
|
@@ -159,6 +161,9 @@ class IndexedFormula extends _formula.default {
|
|
|
159
161
|
if (opts.dataCallback) {
|
|
160
162
|
this.dataCallbacks = [opts.dataCallback];
|
|
161
163
|
}
|
|
164
|
+
if (opts.dataRemovalCallback) {
|
|
165
|
+
this.dataRemovalCallbacks = [opts.dataRemovalCallback];
|
|
166
|
+
}
|
|
162
167
|
this.initPropertyActions(this.features);
|
|
163
168
|
}
|
|
164
169
|
|
|
@@ -187,11 +192,11 @@ class IndexedFormula extends _formula.default {
|
|
|
187
192
|
* @param cb
|
|
188
193
|
*/
|
|
189
194
|
addDataCallback(cb) {
|
|
190
|
-
if (!this.dataCallbacks) {
|
|
191
|
-
this.dataCallbacks = [];
|
|
192
|
-
}
|
|
193
195
|
this.dataCallbacks.push(cb);
|
|
194
196
|
}
|
|
197
|
+
addDataRemovalCallback(cb) {
|
|
198
|
+
this.dataRemovalCallbacks.push(cb);
|
|
199
|
+
}
|
|
195
200
|
|
|
196
201
|
/**
|
|
197
202
|
* Apply a set of statements to be deleted and to be inserted
|
|
@@ -405,10 +410,8 @@ class IndexedFormula extends _formula.default {
|
|
|
405
410
|
|
|
406
411
|
// log.debug("ADDING {"+subj+" "+pred+" "+objNode+"} "+why)
|
|
407
412
|
this.statements.push(st);
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
callback(st);
|
|
411
|
-
}
|
|
413
|
+
for (const callback of this.dataCallbacks) {
|
|
414
|
+
callback(st);
|
|
412
415
|
}
|
|
413
416
|
return st;
|
|
414
417
|
}
|
|
@@ -858,6 +861,9 @@ class IndexedFormula extends _formula.default {
|
|
|
858
861
|
}
|
|
859
862
|
}
|
|
860
863
|
this.rdfArrayRemove(this.statements, st);
|
|
864
|
+
for (const callback of this.dataRemovalCallbacks) {
|
|
865
|
+
callback(st);
|
|
866
|
+
}
|
|
861
867
|
return this;
|
|
862
868
|
}
|
|
863
869
|
|
package/package.json
CHANGED
package/src/formula.ts
CHANGED
package/src/store.ts
CHANGED
|
@@ -168,7 +168,9 @@ export default class IndexedFormula extends Formula { // IN future - allow pass
|
|
|
168
168
|
/** Function to remove quads from the store arrays with */
|
|
169
169
|
private rdfArrayRemove: (arr: Quad[], q: Quad) => void
|
|
170
170
|
/** Callbacks which are triggered after a statement has been added to the store */
|
|
171
|
-
private dataCallbacks
|
|
171
|
+
private dataCallbacks: Array<(q: Quad) => void> = []
|
|
172
|
+
/** Callbacks which are triggered after a statement has been removed from the store */
|
|
173
|
+
private dataRemovalCallbacks: Array<(q: Quad) => void> = []
|
|
172
174
|
|
|
173
175
|
/**
|
|
174
176
|
* Creates a new formula
|
|
@@ -208,6 +210,9 @@ export default class IndexedFormula extends Formula { // IN future - allow pass
|
|
|
208
210
|
if (opts.dataCallback) {
|
|
209
211
|
this.dataCallbacks = [opts.dataCallback]
|
|
210
212
|
}
|
|
213
|
+
if (opts.dataRemovalCallback) {
|
|
214
|
+
this.dataRemovalCallbacks = [opts.dataRemovalCallback]
|
|
215
|
+
}
|
|
211
216
|
|
|
212
217
|
this.initPropertyActions(this.features)
|
|
213
218
|
}
|
|
@@ -237,12 +242,13 @@ export default class IndexedFormula extends Formula { // IN future - allow pass
|
|
|
237
242
|
* @param cb
|
|
238
243
|
*/
|
|
239
244
|
addDataCallback(cb: (q: Quad) => void): void {
|
|
240
|
-
if (!this.dataCallbacks) {
|
|
241
|
-
this.dataCallbacks = []
|
|
242
|
-
}
|
|
243
245
|
this.dataCallbacks.push(cb)
|
|
244
246
|
}
|
|
245
247
|
|
|
248
|
+
addDataRemovalCallback(cb: (q: Quad) => void): void {
|
|
249
|
+
this.dataRemovalCallbacks.push(cb)
|
|
250
|
+
}
|
|
251
|
+
|
|
246
252
|
/**
|
|
247
253
|
* Apply a set of statements to be deleted and to be inserted
|
|
248
254
|
*
|
|
@@ -486,10 +492,8 @@ export default class IndexedFormula extends Formula { // IN future - allow pass
|
|
|
486
492
|
// log.debug("ADDING {"+subj+" "+pred+" "+objNode+"} "+why)
|
|
487
493
|
this.statements.push(st)
|
|
488
494
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
callback(st)
|
|
492
|
-
}
|
|
495
|
+
for (const callback of this.dataCallbacks) {
|
|
496
|
+
callback(st)
|
|
493
497
|
}
|
|
494
498
|
|
|
495
499
|
return st
|
|
@@ -987,6 +991,9 @@ export default class IndexedFormula extends Formula { // IN future - allow pass
|
|
|
987
991
|
}
|
|
988
992
|
}
|
|
989
993
|
this.rdfArrayRemove(this.statements, st)
|
|
994
|
+
for (const callback of this.dataRemovalCallbacks) {
|
|
995
|
+
callback(st)
|
|
996
|
+
}
|
|
990
997
|
return this
|
|
991
998
|
}
|
|
992
999
|
|