@rdfc/sparql-ingest-processor-ts 2.1.4 → 2.1.5
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/SPARQLQueries.js +2 -35
- package/lib/Utils.js +0 -1
- package/package.json +1 -1
package/lib/SPARQLQueries.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SHACL } from "@treecg/types";
|
|
2
2
|
import { Writer as N3Writer, Parser } from "n3";
|
|
3
3
|
import { RdfStore } from "rdf-stores";
|
|
4
4
|
import { DataFactory } from "rdf-data-factory";
|
|
5
|
-
import { getObjects,
|
|
5
|
+
import { getObjects, splitStoreOnSize, splitStorePerNamedGraph } from "./Utils.js";
|
|
6
6
|
const df = new DataFactory();
|
|
7
7
|
export const CREATE = (store, forVirtuoso) => {
|
|
8
8
|
const queries = [];
|
|
@@ -123,36 +123,3 @@ function formatQuery(memberStore, memberIRI, memberShape, indexStart = 0) {
|
|
|
123
123
|
return [queryBuilder.join("\n"), deleteQueryBuilder.join("\n")];
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
function extractMainTargetClass(store) {
|
|
127
|
-
const nodeShapes = getSubjects(store, RDF.terms.type, SHACL.terms.NodeShape, null);
|
|
128
|
-
let mainNodeShape = null;
|
|
129
|
-
if (nodeShapes && nodeShapes.length > 0) {
|
|
130
|
-
for (const ns of nodeShapes) {
|
|
131
|
-
const isNotReferenced = getSubjects(store, null, ns, null).length === 0;
|
|
132
|
-
if (isNotReferenced) {
|
|
133
|
-
if (!mainNodeShape) {
|
|
134
|
-
mainNodeShape = ns;
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
throw new Error("There are multiple main node shapes in a given shape."
|
|
138
|
-
+ " Unrelated shapes must be given as separate member shapes");
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
if (mainNodeShape) {
|
|
143
|
-
const tcq = getObjects(store, mainNodeShape, SHACL.terms.targetClass, null)[0];
|
|
144
|
-
if (tcq) {
|
|
145
|
-
return tcq;
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
throw new Error("No target class found in main SHACL Node Shapes");
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
throw new Error("No main SHACL Node Shapes found in given member shape");
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
throw new Error("No SHACL Node Shapes found in given member shape");
|
|
157
|
-
}
|
|
158
|
-
}
|
package/lib/Utils.js
CHANGED
|
@@ -118,7 +118,6 @@ 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);
|
|
122
121
|
logger.debug(`[doSPARQLRequest] Executing SPARQL query: \n${q}`);
|
|
123
122
|
const res = await fetch(config.graphStoreUrl, {
|
|
124
123
|
method: "POST",
|