@rdfc/sparql-ingest-processor-ts 2.1.3 → 2.1.4
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/lib/SPARQLIngest.js +8 -8
- package/lib/SPARQLQueries.js +4 -4
- package/lib/Utils.d.ts +1 -1
- package/lib/Utils.js +1 -0
- package/package.json +3 -3
package/lib/SPARQLIngest.js
CHANGED
|
@@ -159,7 +159,7 @@ export class SPARQLIngest extends Processor {
|
|
|
159
159
|
if (this.config.graphStoreUrl) {
|
|
160
160
|
try {
|
|
161
161
|
const t0 = Date.now();
|
|
162
|
-
await doSPARQLRequest(query, this.config, this.
|
|
162
|
+
await doSPARQLRequest(query, this.config, this.logger);
|
|
163
163
|
const reqTime = Date.now() - t0;
|
|
164
164
|
if (this.config.measurePerformance) {
|
|
165
165
|
this.requestsPerformance.push(reqTime);
|
|
@@ -185,7 +185,7 @@ export class SPARQLIngest extends Processor {
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
else {
|
|
188
|
-
await this.sparqlWriter.string(query.join("
|
|
188
|
+
await this.sparqlWriter.string(query.join(";\n"));
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
}
|
|
@@ -193,7 +193,7 @@ export class SPARQLIngest extends Processor {
|
|
|
193
193
|
if (this.config.operationMode === OperationMode.REPLICATION) {
|
|
194
194
|
try {
|
|
195
195
|
const t0 = Date.now();
|
|
196
|
-
await doSPARQLRequest(this.memberBatch, this.config, this.
|
|
196
|
+
await doSPARQLRequest(this.memberBatch, this.config, this.logger);
|
|
197
197
|
const reqTime = Date.now() - t0;
|
|
198
198
|
if (this.config.measurePerformance) {
|
|
199
199
|
this.requestsPerformance.push(reqTime);
|
|
@@ -222,7 +222,7 @@ export class SPARQLIngest extends Processor {
|
|
|
222
222
|
if (this.config.operationMode === OperationMode.REPLICATION && this.memberBatch.length > 0) {
|
|
223
223
|
try {
|
|
224
224
|
const t0 = Date.now();
|
|
225
|
-
await doSPARQLRequest(this.memberBatch, this.config, this.
|
|
225
|
+
await doSPARQLRequest(this.memberBatch, this.config, this.logger);
|
|
226
226
|
const reqTime = Date.now() - t0;
|
|
227
227
|
if (this.config.measurePerformance) {
|
|
228
228
|
this.requestsPerformance.push(reqTime);
|
|
@@ -292,16 +292,16 @@ export class SPARQLIngest extends Processor {
|
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
if (createStore.size > 0) {
|
|
295
|
-
transactionQueryBuilder.push(CREATE(createStore, config.forVirtuoso)
|
|
295
|
+
transactionQueryBuilder.push(...CREATE(createStore, config.forVirtuoso));
|
|
296
296
|
}
|
|
297
297
|
if (updateStore.size > 0) {
|
|
298
|
-
transactionQueryBuilder.push(UPDATE(updateStore, config.forVirtuoso)
|
|
298
|
+
transactionQueryBuilder.push(...UPDATE(updateStore, config.forVirtuoso));
|
|
299
299
|
}
|
|
300
300
|
if (deleteStore.size > 0) {
|
|
301
301
|
deleteMembers.forEach(dm => {
|
|
302
|
-
transactionQueryBuilder.push(DELETE(deleteStore, dm, config.memberShape)
|
|
302
|
+
transactionQueryBuilder.push(...DELETE(deleteStore, dm, config.memberShape));
|
|
303
303
|
});
|
|
304
304
|
}
|
|
305
|
-
return transactionQueryBuilder.join("
|
|
305
|
+
return transactionQueryBuilder.join(";\n");
|
|
306
306
|
}
|
|
307
307
|
}
|
package/lib/SPARQLQueries.js
CHANGED
|
@@ -17,7 +17,7 @@ export const CREATE = (store, forVirtuoso) => {
|
|
|
17
17
|
return df.quad(q.subject, q.predicate, q.object, df.defaultGraph());
|
|
18
18
|
}))}
|
|
19
19
|
${graph.equals(df.defaultGraph()) ? "" : `}`}
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
21
|
`);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -36,7 +36,7 @@ export const UPDATE = (store, forVirtuoso) => {
|
|
|
36
36
|
}
|
|
37
37
|
WHERE {
|
|
38
38
|
${formattedQuery[0]}
|
|
39
|
-
}
|
|
39
|
+
}
|
|
40
40
|
`];
|
|
41
41
|
subStores.forEach((s, i) => {
|
|
42
42
|
deleteInsertQuery.push(`
|
|
@@ -46,7 +46,7 @@ export const UPDATE = (store, forVirtuoso) => {
|
|
|
46
46
|
return df.quad(q.subject, q.predicate, q.object, df.defaultGraph());
|
|
47
47
|
}))}
|
|
48
48
|
${graph.equals(df.defaultGraph()) ? "" : `}`}
|
|
49
|
-
}
|
|
49
|
+
}
|
|
50
50
|
`);
|
|
51
51
|
});
|
|
52
52
|
queries.push(...deleteInsertQuery);
|
|
@@ -66,7 +66,7 @@ export const DELETE = (store, memberIRI, memberShape) => {
|
|
|
66
66
|
${deleteBuilder}
|
|
67
67
|
} WHERE {
|
|
68
68
|
${whereBuilder}
|
|
69
|
-
}
|
|
69
|
+
}
|
|
70
70
|
`);
|
|
71
71
|
}
|
|
72
72
|
return queries;
|
package/lib/Utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RdfStore } from "rdf-stores";
|
|
2
|
+
import { Logger } from "winston";
|
|
2
3
|
import type { Term, Quad_Subject, Quad_Object, Quad, Quad_Graph } from "@rdfjs/types";
|
|
3
4
|
import type { IngestConfig } from "./SPARQLIngest.js";
|
|
4
|
-
import { Logger } from "winston";
|
|
5
5
|
export declare function getSubjects(store: RdfStore, predicate: Term | null, object: Term | null, graph?: Term | null): Quad_Subject[];
|
|
6
6
|
export declare function getObjects(store: RdfStore, subject: Term | null, predicate: Term | null, graph?: Term | null): Quad_Object[];
|
|
7
7
|
export declare function splitStorePerNamedGraph(store: RdfStore): {
|
package/lib/Utils.js
CHANGED
|
@@ -118,6 +118,7 @@ export async function doSPARQLRequest(query, config, logger) {
|
|
|
118
118
|
queries.push(jointQuery);
|
|
119
119
|
}
|
|
120
120
|
for (const q of queries) {
|
|
121
|
+
logger.error(q);
|
|
121
122
|
logger.debug(`[doSPARQLRequest] Executing SPARQL query: \n${q}`);
|
|
122
123
|
const res = await fetch(config.graphStoreUrl, {
|
|
123
124
|
method: "POST",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rdfc/sparql-ingest-processor-ts",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "SPARQL Update function to be within RDF-Connect pipelines",
|
|
5
5
|
"author": "Julián Rojas",
|
|
6
6
|
"contributors": [
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@rdfjs/types": "^2.0.1",
|
|
41
41
|
"@types/n3": "^1.26.1",
|
|
42
42
|
"@types/node": "^25.2.2",
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
44
|
-
"@typescript-eslint/parser": "^8.
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^8.55.0",
|
|
44
|
+
"@typescript-eslint/parser": "^8.55.0",
|
|
45
45
|
"@vitest/coverage-v8": "^4.0.18",
|
|
46
46
|
"eslint": "^9.39.2",
|
|
47
47
|
"eslint-config-prettier": "^10.1.8",
|