@rdfc/sparql-ingest-processor-ts 2.1.0 → 2.1.1

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.
@@ -34,6 +34,7 @@ export class SPARQLIngest extends Processor {
34
34
  }
35
35
  async transform() {
36
36
  for await (const rawQuads of this.memberStream.strings()) {
37
+ this.logger.debug(`Raw member data received: \n${rawQuads}`);
37
38
  const quads = new Parser().parse(rawQuads);
38
39
  this.logger.verbose(`Parsed ${quads.length} quads from received member data`);
39
40
  const store = RdfStore.createDefault();
@@ -45,6 +46,7 @@ export class SPARQLIngest extends Processor {
45
46
  store.addQuad(q);
46
47
  }
47
48
  });
49
+ sanitizeQuads(store);
48
50
  let query;
49
51
  const memberIRI = getObjects(store, null, SDS.terms.payload, SDS.terms.custom("DataDescription"))[0];
50
52
  if (memberIRI) {
@@ -99,7 +101,6 @@ export class SPARQLIngest extends Processor {
99
101
  }
100
102
  else {
101
103
  const ctv = store.getQuads(null, df.namedNode(this.config.changeSemantics.changeTypePath))[0];
102
- sanitizeQuads(store);
103
104
  if (ctv.object.value === this.config.changeSemantics.createValue) {
104
105
  this.logger.info(`Preparing 'INSERT DATA {}' SPARQL query for member ${memberIRI.value}`);
105
106
  query = CREATE(store, this.config.forVirtuoso);
@@ -128,12 +129,7 @@ export class SPARQLIngest extends Processor {
128
129
  }
129
130
  else {
130
131
  if (this.config.operationMode === OperationMode.REPLICATION) {
131
- this.memberBatch.push(...store.getQuads().map(q => {
132
- if (q.graph.equals(df.defaultGraph()) && this.config.targetNamedGraph) {
133
- q.graph = df.namedNode(this.config.targetNamedGraph);
134
- }
135
- return q;
136
- }));
132
+ this.memberBatch.push(...store.getQuads());
137
133
  this.batchCount++;
138
134
  if (this.batchCount < this.config.memberBatchSize) {
139
135
  continue;
package/lib/Utils.js CHANGED
@@ -87,7 +87,8 @@ export async function doSPARQLRequest(query, config, logger) {
87
87
  if (config.accessToken) {
88
88
  url.searchParams.append("access-token", config.accessToken);
89
89
  }
90
- logger.debug(`Executing SPARQL Graph Store request (POST) with ${quads.length} quads.`);
90
+ logger.verbose(`[doSPARQLRequest] Executing SPARQL Graph Store request (POST) with ${quads.length} quads.`);
91
+ logger.debug(`[doSPARQLRequest] POSTing the following RDF quads:\n${serialized}`);
91
92
  const res = await fetch(url.toString(), {
92
93
  method: "POST",
93
94
  headers: {
@@ -113,6 +114,7 @@ export async function doSPARQLRequest(query, config, logger) {
113
114
  queries.push(jointQuery);
114
115
  }
115
116
  for (const q of queries) {
117
+ logger.debug(`[doSPARQLRequest] Executing SPARQL query: \n${q}`);
116
118
  const res = await fetch(config.graphStoreUrl, {
117
119
  method: "POST",
118
120
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rdfc/sparql-ingest-processor-ts",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "SPARQL Update function to be within RDF-Connect pipelines",
5
5
  "author": "Julián Rojas",
6
6
  "contributors": [
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@treecg/types": "^0.4.6",
31
- "n3": "^2.0.1",
31
+ "n3": "^1.26.0",
32
32
  "rdf-data-factory": "^2.0.2",
33
33
  "rdf-stores": "^2.1.1",
34
34
  "undici": "^7.21.0",