@undefineds.co/drizzle-solid 0.2.13 → 0.3.0
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/README.md +141 -250
- package/dist/core/ast-to-sparql.d.ts +1 -1
- package/dist/core/ast-to-sparql.js +1 -1
- package/dist/core/comunica-patch.d.ts +1 -6
- package/dist/core/comunica-patch.d.ts.map +1 -1
- package/dist/core/comunica-patch.js +16 -19
- package/dist/core/comunica-patch.js.map +1 -1
- package/dist/core/execution/sparql-strategy.d.ts +9 -37
- package/dist/core/execution/sparql-strategy.d.ts.map +1 -1
- package/dist/core/execution/sparql-strategy.js +44 -148
- package/dist/core/execution/sparql-strategy.js.map +1 -1
- package/dist/core/execution/strategy-factory.d.ts +7 -20
- package/dist/core/execution/strategy-factory.d.ts.map +1 -1
- package/dist/core/execution/strategy-factory.js +2 -17
- package/dist/core/execution/strategy-factory.js.map +1 -1
- package/dist/core/pod-database.d.ts +3 -3
- package/dist/core/pod-database.d.ts.map +1 -1
- package/dist/core/pod-database.js +37 -37
- package/dist/core/pod-database.js.map +1 -1
- package/dist/core/pod-dialect.d.ts +2 -0
- package/dist/core/pod-dialect.d.ts.map +1 -1
- package/dist/core/pod-dialect.js +4 -2
- package/dist/core/pod-dialect.js.map +1 -1
- package/dist/core/query-builders/select-query-builder.d.ts +2 -2
- package/dist/core/query-builders/select-query-builder.d.ts.map +1 -1
- package/dist/core/query-builders/select-query-builder.js +10 -10
- package/dist/core/query-builders/select-query-builder.js.map +1 -1
- package/dist/core/schema/columns.d.ts +6 -6
- package/dist/core/schema/columns.d.ts.map +1 -1
- package/dist/core/schema/columns.js +18 -18
- package/dist/core/schema/columns.js.map +1 -1
- package/dist/core/schema/defs.d.ts +4 -4
- package/dist/core/schema/defs.d.ts.map +1 -1
- package/dist/core/schema/pod-table.js +2 -2
- package/dist/core/schema/pod-table.js.map +1 -1
- package/dist/core/services/pod-services.d.ts +7 -5
- package/dist/core/services/pod-services.d.ts.map +1 -1
- package/dist/core/services/pod-services.js +7 -5
- package/dist/core/services/pod-services.js.map +1 -1
- package/dist/core/shape/generator.js +3 -3
- package/dist/core/shape/generator.js.map +1 -1
- package/dist/core/shape/manager.js +5 -5
- package/dist/core/shape/manager.js.map +1 -1
- package/dist/core/sparql/builder/expression-builder.d.ts +5 -5
- package/dist/core/sparql/builder/expression-builder.d.ts.map +1 -1
- package/dist/core/sparql/builder/expression-builder.js +15 -15
- package/dist/core/sparql/builder/expression-builder.js.map +1 -1
- package/dist/core/sparql/builder/select-builder.d.ts +1 -1
- package/dist/core/sparql/builder/select-builder.js +1 -1
- package/dist/core/sparql/builder/update-builder.d.ts +1 -1
- package/dist/core/sparql/builder/update-builder.d.ts.map +1 -1
- package/dist/core/sparql/builder/update-builder.js +4 -4
- package/dist/core/sparql/builder/update-builder.js.map +1 -1
- package/dist/core/sparql/helpers.js +3 -3
- package/dist/core/sparql/helpers.js.map +1 -1
- package/dist/core/sparql-engine.d.ts +16 -0
- package/dist/core/sparql-engine.d.ts.map +1 -0
- package/dist/core/sparql-engine.js +128 -0
- package/dist/core/sparql-engine.js.map +1 -0
- package/dist/core/sparql-executor.d.ts +3 -1
- package/dist/core/sparql-executor.d.ts.map +1 -1
- package/dist/core/sparql-executor.js +3 -4
- package/dist/core/sparql-executor.js.map +1 -1
- package/dist/core/triple/handlers/inverse.js +4 -4
- package/dist/core/triple/handlers/inverse.js.map +1 -1
- package/dist/core/triple/handlers/uri.d.ts +1 -1
- package/dist/core/triple/handlers/uri.js +3 -3
- package/dist/core/triple/handlers/uri.js.map +1 -1
- package/dist/core/uri/resolver.d.ts +9 -9
- package/dist/core/uri/resolver.d.ts.map +1 -1
- package/dist/core/uri/resolver.js +51 -51
- package/dist/core/uri/resolver.js.map +1 -1
- package/dist/core/uri/types.d.ts +10 -10
- package/dist/core/uri/types.d.ts.map +1 -1
- package/dist/driver.d.ts +10 -1
- package/dist/driver.d.ts.map +1 -1
- package/dist/driver.js +1 -5
- package/dist/driver.js.map +1 -1
- package/dist/esm/core/ast-to-sparql.d.ts +1 -1
- package/dist/esm/core/ast-to-sparql.js +1 -1
- package/dist/esm/core/comunica-patch.d.ts +1 -6
- package/dist/esm/core/comunica-patch.d.ts.map +1 -1
- package/dist/esm/core/comunica-patch.js +13 -20
- package/dist/esm/core/comunica-patch.js.map +1 -1
- package/dist/esm/core/execution/sparql-strategy.d.ts +9 -37
- package/dist/esm/core/execution/sparql-strategy.d.ts.map +1 -1
- package/dist/esm/core/execution/sparql-strategy.js +44 -148
- package/dist/esm/core/execution/sparql-strategy.js.map +1 -1
- package/dist/esm/core/execution/strategy-factory.d.ts +7 -20
- package/dist/esm/core/execution/strategy-factory.d.ts.map +1 -1
- package/dist/esm/core/execution/strategy-factory.js +2 -17
- package/dist/esm/core/execution/strategy-factory.js.map +1 -1
- package/dist/esm/core/pod-database.d.ts +3 -3
- package/dist/esm/core/pod-database.d.ts.map +1 -1
- package/dist/esm/core/pod-database.js +37 -37
- package/dist/esm/core/pod-database.js.map +1 -1
- package/dist/esm/core/pod-dialect.d.ts +2 -0
- package/dist/esm/core/pod-dialect.d.ts.map +1 -1
- package/dist/esm/core/pod-dialect.js +4 -2
- package/dist/esm/core/pod-dialect.js.map +1 -1
- package/dist/esm/core/query-builders/select-query-builder.d.ts +2 -2
- package/dist/esm/core/query-builders/select-query-builder.d.ts.map +1 -1
- package/dist/esm/core/query-builders/select-query-builder.js +10 -10
- package/dist/esm/core/query-builders/select-query-builder.js.map +1 -1
- package/dist/esm/core/schema/columns.d.ts +6 -6
- package/dist/esm/core/schema/columns.d.ts.map +1 -1
- package/dist/esm/core/schema/columns.js +18 -18
- package/dist/esm/core/schema/columns.js.map +1 -1
- package/dist/esm/core/schema/defs.d.ts +4 -4
- package/dist/esm/core/schema/defs.d.ts.map +1 -1
- package/dist/esm/core/schema/pod-table.js +2 -2
- package/dist/esm/core/schema/pod-table.js.map +1 -1
- package/dist/esm/core/services/pod-services.d.ts +7 -5
- package/dist/esm/core/services/pod-services.d.ts.map +1 -1
- package/dist/esm/core/services/pod-services.js +7 -5
- package/dist/esm/core/services/pod-services.js.map +1 -1
- package/dist/esm/core/shape/generator.js +3 -3
- package/dist/esm/core/shape/generator.js.map +1 -1
- package/dist/esm/core/shape/manager.js +5 -5
- package/dist/esm/core/shape/manager.js.map +1 -1
- package/dist/esm/core/sparql/builder/expression-builder.d.ts +5 -5
- package/dist/esm/core/sparql/builder/expression-builder.d.ts.map +1 -1
- package/dist/esm/core/sparql/builder/expression-builder.js +15 -15
- package/dist/esm/core/sparql/builder/expression-builder.js.map +1 -1
- package/dist/esm/core/sparql/builder/select-builder.d.ts +1 -1
- package/dist/esm/core/sparql/builder/select-builder.js +1 -1
- package/dist/esm/core/sparql/builder/update-builder.d.ts +1 -1
- package/dist/esm/core/sparql/builder/update-builder.d.ts.map +1 -1
- package/dist/esm/core/sparql/builder/update-builder.js +4 -4
- package/dist/esm/core/sparql/builder/update-builder.js.map +1 -1
- package/dist/esm/core/sparql/helpers.js +3 -3
- package/dist/esm/core/sparql/helpers.js.map +1 -1
- package/dist/esm/core/sparql-engine.d.ts +16 -0
- package/dist/esm/core/sparql-engine.d.ts.map +1 -0
- package/dist/esm/core/sparql-engine.js +89 -0
- package/dist/esm/core/sparql-engine.js.map +1 -0
- package/dist/esm/core/sparql-executor.d.ts +3 -1
- package/dist/esm/core/sparql-executor.d.ts.map +1 -1
- package/dist/esm/core/sparql-executor.js +3 -4
- package/dist/esm/core/sparql-executor.js.map +1 -1
- package/dist/esm/core/triple/handlers/inverse.js +4 -4
- package/dist/esm/core/triple/handlers/inverse.js.map +1 -1
- package/dist/esm/core/triple/handlers/uri.d.ts +1 -1
- package/dist/esm/core/triple/handlers/uri.js +3 -3
- package/dist/esm/core/triple/handlers/uri.js.map +1 -1
- package/dist/esm/core/uri/resolver.d.ts +9 -9
- package/dist/esm/core/uri/resolver.d.ts.map +1 -1
- package/dist/esm/core/uri/resolver.js +51 -51
- package/dist/esm/core/uri/resolver.js.map +1 -1
- package/dist/esm/core/uri/types.d.ts +10 -10
- package/dist/esm/core/uri/types.d.ts.map +1 -1
- package/dist/esm/driver.d.ts +10 -1
- package/dist/esm/driver.d.ts.map +1 -1
- package/dist/esm/driver.js +1 -5
- package/dist/esm/driver.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/pod.d.ts +68 -0
- package/dist/esm/pod.d.ts.map +1 -0
- package/dist/esm/pod.js +146 -0
- package/dist/esm/pod.js.map +1 -0
- package/dist/esm/utils/webid-resolver.d.ts +1 -2
- package/dist/esm/utils/webid-resolver.d.ts.map +1 -1
- package/dist/esm/utils/webid-resolver.js +36 -30
- package/dist/esm/utils/webid-resolver.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/pod.d.ts +68 -0
- package/dist/pod.d.ts.map +1 -0
- package/dist/pod.js +153 -0
- package/dist/pod.js.map +1 -0
- package/dist/utils/webid-resolver.d.ts +1 -2
- package/dist/utils/webid-resolver.d.ts.map +1 -1
- package/dist/utils/webid-resolver.js +36 -30
- package/dist/utils/webid-resolver.js.map +1 -1
- package/package.json +11 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sparql-strategy.d.ts","sourceRoot":"","sources":["../../../../src/core/execution/sparql-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"sparql-strategy.d.ts","sourceRoot":"","sources":["../../../../src/core/execution/sparql-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAe,MAAM,kBAAkB,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBA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ps.uriResolver;
|
|
10
|
+
this.createQueryEngine = deps.createQueryEngine;
|
|
10
11
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Resolve target graph based on resource mode
|
|
13
|
-
* - Document Mode SELECT: undefined (let CSS auto-query container and all sub-graphs)
|
|
14
|
-
* - Document Mode INSERT/UPDATE/DELETE: container path as graph
|
|
15
|
-
* - Fragment Mode: base file path
|
|
16
|
-
*/
|
|
17
12
|
resolveTargetGraph(table, forSelect = false) {
|
|
18
13
|
if (!table)
|
|
19
14
|
return undefined;
|
|
20
|
-
// Determine resource mode to choose correct graph
|
|
21
15
|
const isDocumentMode = this.uriResolver.getResourceMode(table) === 'document';
|
|
22
16
|
if (isDocumentMode) {
|
|
23
|
-
// Document Mode:
|
|
24
|
-
// - For SELECT: no graph specified (CSS will auto-query container and all sub-graphs)
|
|
25
|
-
// - For INSERT/UPDATE/DELETE: use container path as graph
|
|
26
17
|
if (forSelect) {
|
|
27
|
-
return undefined;
|
|
18
|
+
return undefined;
|
|
28
19
|
}
|
|
29
20
|
return table.config?.containerPath ?? table.getContainerPath?.();
|
|
30
21
|
}
|
|
31
|
-
// Fragment Mode: graph = base file
|
|
32
|
-
// e.g., /data/tags.ttl (all fragments in this file share the same graph)
|
|
33
22
|
return table.config?.base;
|
|
34
23
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Get the appropriate fetch function for a SPARQL endpoint
|
|
37
|
-
*/
|
|
38
24
|
getFetchForEndpoint(endpoint) {
|
|
39
25
|
return getFetchForOrigin(endpoint, this.podUrl, this.sessionFetch);
|
|
40
26
|
}
|
|
41
|
-
|
|
42
|
-
* Execute SELECT query via SPARQL endpoint
|
|
43
|
-
*/
|
|
44
|
-
async executeSelect(plan, _containerUrl, resourceUrl // In SPARQL mode, this is the endpoint URL
|
|
45
|
-
) {
|
|
27
|
+
async executeSelect(plan, _containerUrl, resourceUrl) {
|
|
46
28
|
const table = plan.baseTable;
|
|
47
|
-
|
|
48
|
-
// - Document Mode: no graph (CSS will auto-query container and all sub-graphs)
|
|
49
|
-
// - Fragment Mode: graph = base file
|
|
50
|
-
const targetGraph = this.resolveTargetGraph(table, true /* forSelect */);
|
|
51
|
-
// Convert plan to SPARQL - check for simple select options or SQL
|
|
52
|
-
let sparqlQuery;
|
|
29
|
+
const targetGraph = this.resolveTargetGraph(table, true);
|
|
53
30
|
const extendedPlan = plan;
|
|
54
|
-
|
|
55
|
-
// because the endpoint is a federated query interface that automatically queries
|
|
56
|
-
// all documents under the container. Using GRAPH ?g can cause issues with some endpoints.
|
|
57
|
-
// Only use GRAPH when we have a specific targetGraph.
|
|
31
|
+
let sparqlQuery;
|
|
58
32
|
const useGraphVariable = targetGraph !== undefined;
|
|
59
33
|
if (extendedPlan._simpleSelectOptions) {
|
|
60
34
|
sparqlQuery = this.sparqlConverter.convertSimpleSelect(extendedPlan._simpleSelectOptions, targetGraph, undefined, useGraphVariable);
|
|
@@ -68,28 +42,21 @@ export class SparqlStrategy {
|
|
|
68
42
|
}
|
|
69
43
|
console.log('DEBUG: Generated SPARQL Query for SELECT:', sparqlQuery.query);
|
|
70
44
|
console.log('DEBUG: resourceUrl =', resourceUrl);
|
|
71
|
-
// Fast path: Direct fetch to SPARQL endpoint (bypass Comunica for speed)
|
|
72
|
-
// This is much faster than Comunica which does extra processing
|
|
73
45
|
if (resourceUrl.includes('/-/sparql')) {
|
|
74
46
|
return await this.executeDirectSparqlSelect(resourceUrl, sparqlQuery, plan);
|
|
75
47
|
}
|
|
76
|
-
// Fallback to Comunica for non-endpoint sources
|
|
77
48
|
if (isSameOrigin(resourceUrl, this.podUrl)) {
|
|
78
49
|
return await this.sparqlExecutor.executeQueryWithSource(sparqlQuery, resourceUrl);
|
|
79
50
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
51
|
+
const { ComunicaSPARQLExecutor } = await import('../sparql-executor');
|
|
52
|
+
const unauthExecutor = new ComunicaSPARQLExecutor({
|
|
53
|
+
sources: [resourceUrl],
|
|
54
|
+
fetch: fetch,
|
|
55
|
+
logging: false,
|
|
56
|
+
createQueryEngine: this.createQueryEngine,
|
|
57
|
+
});
|
|
58
|
+
return await unauthExecutor.executeQueryWithSource(sparqlQuery, resourceUrl);
|
|
89
59
|
}
|
|
90
|
-
/**
|
|
91
|
-
* Execute SPARQL SELECT directly via fetch (fast path, bypasses Comunica)
|
|
92
|
-
*/
|
|
93
60
|
async executeDirectSparqlSelect(endpoint, sparqlQuery, plan) {
|
|
94
61
|
const fetchFn = this.getFetchForEndpoint(endpoint);
|
|
95
62
|
console.log('[SparqlStrategy] Direct fetch to SPARQL endpoint:', endpoint);
|
|
@@ -106,118 +73,47 @@ export class SparqlStrategy {
|
|
|
106
73
|
throw new Error(`SPARQL SELECT failed: ${response.status} ${response.statusText} - ${text}`);
|
|
107
74
|
}
|
|
108
75
|
const json = await response.json();
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Parse SPARQL Results JSON format into row objects
|
|
113
|
-
*/
|
|
114
|
-
parseSparqlResultsJson(json, plan) {
|
|
115
|
-
const bindings = json?.results?.bindings || [];
|
|
116
|
-
return bindings.map((binding) => {
|
|
76
|
+
const rows = (json.results?.bindings || []).map((binding) => {
|
|
117
77
|
const row = {};
|
|
118
|
-
for (const [
|
|
119
|
-
|
|
120
|
-
continue;
|
|
121
|
-
// Convert SPARQL result term to JS value
|
|
122
|
-
row[varName] = this.convertSparqlTerm(termObj);
|
|
123
|
-
}
|
|
124
|
-
// Extract ID from subject URI if present
|
|
125
|
-
if (row.subject && plan.baseTable) {
|
|
126
|
-
const subjectUri = row.subject;
|
|
127
|
-
// Preserve the full subject URI in @id for downstream processing
|
|
128
|
-
// (hydrateInlineColumns needs full URI, not just the ID)
|
|
129
|
-
row['@id'] = subjectUri;
|
|
130
|
-
// Use UriResolver to properly extract ID from subject URI
|
|
131
|
-
const parsed = this.uriResolver.parseSubject(subjectUri, plan.baseTable);
|
|
132
|
-
if (parsed && parsed.id) {
|
|
133
|
-
row.id = parsed.id;
|
|
134
|
-
}
|
|
135
|
-
// Fallback to simple extraction if resolver parsing failed
|
|
136
|
-
if (!row.id) {
|
|
137
|
-
const hashIndex = subjectUri.lastIndexOf('#');
|
|
138
|
-
if (hashIndex !== -1) {
|
|
139
|
-
row.id = subjectUri.substring(hashIndex + 1);
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
// Or from "http://pod/path/id.ttl" -> "id"
|
|
143
|
-
const lastSlash = subjectUri.lastIndexOf('/');
|
|
144
|
-
const filename = subjectUri.substring(lastSlash + 1);
|
|
145
|
-
if (filename.endsWith('.ttl')) {
|
|
146
|
-
row.id = filename.slice(0, -4);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
delete row.subject;
|
|
78
|
+
for (const [key, value] of Object.entries(binding)) {
|
|
79
|
+
row[key] = this.parseSparqlValue(value);
|
|
151
80
|
}
|
|
152
81
|
return row;
|
|
153
82
|
});
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
* Convert a SPARQL result term to a JavaScript value
|
|
157
|
-
*/
|
|
158
|
-
convertSparqlTerm(term) {
|
|
159
|
-
if (!term || !term.type)
|
|
160
|
-
return null;
|
|
161
|
-
const { type, value, datatype } = term;
|
|
162
|
-
if (type === 'uri') {
|
|
163
|
-
return value;
|
|
164
|
-
}
|
|
165
|
-
if (type === 'bnode') {
|
|
166
|
-
return `_:${value}`;
|
|
167
|
-
}
|
|
168
|
-
if (type === 'literal' || type === 'typed-literal') {
|
|
169
|
-
const effectiveDatatype = datatype || this.extractDatatypeFromValue(value);
|
|
170
|
-
if (effectiveDatatype) {
|
|
171
|
-
return this.convertTypedLiteral(value, effectiveDatatype);
|
|
172
|
-
}
|
|
173
|
-
return this.extractLiteralValue(value);
|
|
83
|
+
if (plan.limit !== undefined && rows.length > plan.limit) {
|
|
84
|
+
return rows.slice(0, plan.limit);
|
|
174
85
|
}
|
|
175
|
-
return
|
|
86
|
+
return rows;
|
|
176
87
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if (datatype === 'http://www.w3.org/2001/XMLSchema#integer' ||
|
|
183
|
-
datatype === 'http://www.w3.org/2001/XMLSchema#int') {
|
|
184
|
-
return parseInt(literalValue, 10);
|
|
185
|
-
}
|
|
186
|
-
if (datatype === 'http://www.w3.org/2001/XMLSchema#decimal' ||
|
|
187
|
-
datatype === 'http://www.w3.org/2001/XMLSchema#float' ||
|
|
188
|
-
datatype === 'http://www.w3.org/2001/XMLSchema#double') {
|
|
189
|
-
return parseFloat(literalValue);
|
|
190
|
-
}
|
|
191
|
-
if (datatype === 'http://www.w3.org/2001/XMLSchema#boolean') {
|
|
192
|
-
return literalValue === 'true' || literalValue === '1';
|
|
193
|
-
}
|
|
194
|
-
if (datatype === 'http://www.w3.org/2001/XMLSchema#dateTime' ||
|
|
195
|
-
datatype === 'http://www.w3.org/2001/XMLSchema#date') {
|
|
196
|
-
return new Date(literalValue);
|
|
197
|
-
}
|
|
198
|
-
return literalValue;
|
|
88
|
+
async executeInsert() {
|
|
89
|
+
throw new Error('SPARQL mode INSERT is not supported directly; writes should route through LDP strategy');
|
|
90
|
+
}
|
|
91
|
+
async executeUpdate() {
|
|
92
|
+
throw new Error('SPARQL mode UPDATE is not supported directly; writes should route through LDP strategy');
|
|
199
93
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
*/
|
|
203
|
-
extractDatatypeFromValue(value) {
|
|
204
|
-
const match = value.match(/\^\^<?([^>]+)>?$/);
|
|
205
|
-
return match ? match[1] : undefined;
|
|
94
|
+
async executeDelete() {
|
|
95
|
+
throw new Error('SPARQL mode DELETE is not supported directly; writes should route through LDP strategy');
|
|
206
96
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
if (match) {
|
|
214
|
-
return match[1];
|
|
97
|
+
parseSparqlValue(value) {
|
|
98
|
+
if (!value || typeof value !== 'object') {
|
|
99
|
+
return value;
|
|
100
|
+
}
|
|
101
|
+
if (value.type === 'uri') {
|
|
102
|
+
return value.value;
|
|
215
103
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
104
|
+
if (value.type === 'literal') {
|
|
105
|
+
if (value.datatype?.includes('#integer') || value.datatype?.includes('#int')) {
|
|
106
|
+
return Number.parseInt(value.value, 10);
|
|
107
|
+
}
|
|
108
|
+
if (value.datatype?.includes('#decimal') || value.datatype?.includes('#double')) {
|
|
109
|
+
return Number.parseFloat(value.value);
|
|
110
|
+
}
|
|
111
|
+
if (value.datatype?.includes('#boolean')) {
|
|
112
|
+
return value.value === 'true';
|
|
113
|
+
}
|
|
114
|
+
return value.value;
|
|
219
115
|
}
|
|
220
|
-
return value;
|
|
116
|
+
return value.value ?? value;
|
|
221
117
|
}
|
|
222
118
|
}
|
|
223
119
|
//# sourceMappingURL=sparql-strategy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sparql-strategy.js","sourceRoot":"","sources":["../../../../src/core/execution/sparql-strategy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sparql-strategy.js","sourceRoot":"","sources":["../../../../src/core/execution/sparql-strategy.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAYvE,MAAM,OAAO,cAAc;IAUzB,YAAY,IAAgC;QATnC,SAAI,GAAG,QAAiB,CAAC;QAUhC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,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AAE,CAAC;gBACzC,OAAO,KAAK,CAAC,KAAK,KAAK,MAAM,CAAC;YAChC,CAAC;YACD,OAAO,KAAK,CAAC,KAAK,CAAC;QACrB,CAAC;QAED,OAAO,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -5,20 +5,22 @@
|
|
|
5
5
|
* - Tables with sparqlEndpoint -> SparqlStrategy
|
|
6
6
|
* - Tables without sparqlEndpoint -> LdpStrategy
|
|
7
7
|
*/
|
|
8
|
-
import type { PodTable } from '../schema';
|
|
9
|
-
import type { ComunicaSPARQLExecutor } from '../sparql-executor';
|
|
10
8
|
import type { ASTToSPARQLConverter } from '../ast-to-sparql';
|
|
11
|
-
import type { ResourceResolver } from '../resource-resolver';
|
|
12
9
|
import type { QueryCondition } from '../query-conditions';
|
|
13
|
-
import type {
|
|
10
|
+
import type { ResourceResolver } from '../resource-resolver';
|
|
11
|
+
import type { PodTable } from '../schema';
|
|
12
|
+
import type { ComunicaSPARQLExecutor } from '../sparql-executor';
|
|
13
|
+
import type { SPARQLQueryEngineFactory } from '../sparql-engine';
|
|
14
|
+
import type { UriResolver } from '../uri';
|
|
14
15
|
import { LdpStrategy } from './ldp-strategy';
|
|
15
16
|
import type { LdpExecutor } from './ldp-executor';
|
|
16
|
-
import type {
|
|
17
|
+
import type { ExecutionStrategy, ExecutionStrategyFactory } from './types';
|
|
17
18
|
export interface StrategyFactoryDependencies {
|
|
18
19
|
sparqlExecutor: ComunicaSPARQLExecutor;
|
|
19
20
|
sparqlConverter: ASTToSPARQLConverter;
|
|
20
21
|
sessionFetch: typeof fetch;
|
|
21
22
|
podUrl: string;
|
|
23
|
+
createQueryEngine?: SPARQLQueryEngineFactory;
|
|
22
24
|
ldpExecutor: LdpExecutor;
|
|
23
25
|
uriResolver: UriResolver;
|
|
24
26
|
getResolver: (table: PodTable) => ResourceResolver;
|
|
@@ -30,25 +32,10 @@ export declare class ExecutionStrategyFactoryImpl implements ExecutionStrategyFa
|
|
|
30
32
|
private ldpStrategy;
|
|
31
33
|
private sparqlStrategy;
|
|
32
34
|
constructor(deps: StrategyFactoryDependencies);
|
|
33
|
-
/**
|
|
34
|
-
* Get the appropriate execution strategy for a table
|
|
35
|
-
*/
|
|
36
35
|
getStrategy(table: PodTable): ExecutionStrategy;
|
|
37
|
-
/**
|
|
38
|
-
* Get LDP strategy explicitly (used for write operations in SPARQL mode)
|
|
39
|
-
*/
|
|
40
36
|
getLdpStrategy(): LdpStrategy;
|
|
41
|
-
/**
|
|
42
|
-
* Get or create LDP strategy (singleton)
|
|
43
|
-
*/
|
|
44
37
|
private getLdpStrategyInternal;
|
|
45
|
-
/**
|
|
46
|
-
* Get or create SPARQL strategy (singleton)
|
|
47
|
-
*/
|
|
48
38
|
private getSparqlStrategy;
|
|
49
|
-
/**
|
|
50
|
-
* Determine execution mode for a table
|
|
51
|
-
*/
|
|
52
39
|
static getMode(table: PodTable): 'ldp' | 'sparql';
|
|
53
40
|
}
|
|
54
41
|
//# sourceMappingURL=strategy-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strategy-factory.d.ts","sourceRoot":"","sources":["../../../../src/core/execution/strategy-factory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"strategy-factory.d.ts","sourceRoot":"","sources":["../../../../src/core/execution/strategy-factory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KA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,10 @@ import { LdpStrategy } from './ldp-strategy';
|
|
|
9
9
|
import { SparqlStrategy } from './sparql-strategy';
|
|
10
10
|
export class ExecutionStrategyFactoryImpl {
|
|
11
11
|
constructor(deps) {
|
|
12
|
-
// Cache strategies by mode to avoid recreating them
|
|
13
12
|
this.ldpStrategy = null;
|
|
14
13
|
this.sparqlStrategy = null;
|
|
15
14
|
this.deps = deps;
|
|
16
15
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Get the appropriate execution strategy for a table
|
|
19
|
-
*/
|
|
20
16
|
getStrategy(table) {
|
|
21
17
|
const endpoint = table.getSparqlEndpoint?.();
|
|
22
18
|
if (endpoint) {
|
|
@@ -24,15 +20,9 @@ export class ExecutionStrategyFactoryImpl {
|
|
|
24
20
|
}
|
|
25
21
|
return this.getLdpStrategy();
|
|
26
22
|
}
|
|
27
|
-
/**
|
|
28
|
-
* Get LDP strategy explicitly (used for write operations in SPARQL mode)
|
|
29
|
-
*/
|
|
30
23
|
getLdpStrategy() {
|
|
31
24
|
return this.getLdpStrategyInternal();
|
|
32
25
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Get or create LDP strategy (singleton)
|
|
35
|
-
*/
|
|
36
26
|
getLdpStrategyInternal() {
|
|
37
27
|
if (!this.ldpStrategy) {
|
|
38
28
|
const ldpDeps = {
|
|
@@ -48,9 +38,6 @@ export class ExecutionStrategyFactoryImpl {
|
|
|
48
38
|
}
|
|
49
39
|
return this.ldpStrategy;
|
|
50
40
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Get or create SPARQL strategy (singleton)
|
|
53
|
-
*/
|
|
54
41
|
getSparqlStrategy() {
|
|
55
42
|
if (!this.sparqlStrategy) {
|
|
56
43
|
const sparqlDeps = {
|
|
@@ -58,15 +45,13 @@ export class ExecutionStrategyFactoryImpl {
|
|
|
58
45
|
sparqlConverter: this.deps.sparqlConverter,
|
|
59
46
|
sessionFetch: this.deps.sessionFetch,
|
|
60
47
|
podUrl: this.deps.podUrl,
|
|
61
|
-
uriResolver: this.deps.uriResolver
|
|
48
|
+
uriResolver: this.deps.uriResolver,
|
|
49
|
+
createQueryEngine: this.deps.createQueryEngine,
|
|
62
50
|
};
|
|
63
51
|
this.sparqlStrategy = new SparqlStrategy(sparqlDeps);
|
|
64
52
|
}
|
|
65
53
|
return this.sparqlStrategy;
|
|
66
54
|
}
|
|
67
|
-
/**
|
|
68
|
-
* Determine execution mode for a table
|
|
69
|
-
*/
|
|
70
55
|
static getMode(table) {
|
|
71
56
|
return table.getSparqlEndpoint?.() ? 'sparql' : 'ldp';
|
|
72
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strategy-factory.js","sourceRoot":"","sources":["../../../../src/core/execution/strategy-factory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"strategy-factory.js","sourceRoot":"","sources":["../../../../src/core/execution/strategy-factory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,EAAE,WAAW,EAAgC,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAmC,MAAM,mBAAmB,CAAC;AAqBpF,MAAM,OAAO,4BAA4B;IAMvC,YAAY,IAAiC;QAHrC,gBAAW,GAAuB,IAAI,CAAC;QACvC,mBAAc,GAA0B,IAAI,CAAC;QAGnD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,WAAW,CAAC,KAAe;QACzB,MAAM,QAAQ,GAAG,KAAK,CAAC,iBAAiB,EAAE,EAAE,CAAC;QAE7C,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAClC,CAAC;QAED,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC;IAC/B,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,sBAAsB,EAAE,CAAC;IACvC,CAAC;IAEO,sBAAsB;QAC5B,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CA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@ export declare class PodDatabase<TSchema extends Record<string, unknown> = Recor
|
|
|
375
375
|
private resolveIdFromRow;
|
|
376
376
|
private resolveParentKey;
|
|
377
377
|
private resolveIriFromRow;
|
|
378
|
-
private
|
|
379
|
-
private
|
|
378
|
+
private collectLinkLookupKeys;
|
|
379
|
+
private normalizeLinkValue;
|
|
380
380
|
private normalizeLiteralValue;
|
|
381
|
-
private
|
|
381
|
+
private collectInverseLinkValues;
|
|
382
382
|
private groupRowsByIri;
|
|
383
383
|
private extractFragment;
|
|
384
384
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pod-database.d.ts","sourceRoot":"","sources":["../../../src/core/pod-database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,KAAK,cAAc,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAiB,KAAK,cAAc,EAAE,aAAa,EAA2B,KAAK,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAG3J,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EAGlB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,oBAAoB;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,WAAW,CAAC,OAAO,SAAS,MAAM,CAAC,M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,qBAAqB;IAa7B,OAAO,CAAC,wBAAwB;IAyBhC,OAAO,CAAC,cAAc;IAgBtB,OAAO,CAAC,eAAe;CAQxB"}
|
|
@@ -88,7 +88,7 @@ export class PodDatabase {
|
|
|
88
88
|
if (options.hooks) {
|
|
89
89
|
table.config.hooks = options.hooks;
|
|
90
90
|
}
|
|
91
|
-
// Store
|
|
91
|
+
// Store db handle in table for hook context
|
|
92
92
|
// This allows hooks to access db when invoked
|
|
93
93
|
table._db = this;
|
|
94
94
|
return table;
|
|
@@ -986,29 +986,29 @@ export class PodDatabase {
|
|
|
986
986
|
const candidateColumns = relationDef?.fields && relationDef.fields.length > 0
|
|
987
987
|
? relationDef.fields
|
|
988
988
|
: Object.values(targetPodTable.columns ?? {});
|
|
989
|
-
const
|
|
990
|
-
col.options?.
|
|
991
|
-
col.
|
|
992
|
-
const
|
|
993
|
-
col.options?.
|
|
994
|
-
col.
|
|
995
|
-
const
|
|
989
|
+
const matchesParentLink = (col) => Boolean(col && (col.options?.linkTarget === parentTable.config.type ||
|
|
990
|
+
col.options?.linkTable === parentTable ||
|
|
991
|
+
col.getLinkTable?.() === parentTable));
|
|
992
|
+
const matchesTargetLink = (col) => Boolean(col && (col.options?.linkTarget === targetType ||
|
|
993
|
+
col.options?.linkTable === targetPodTable ||
|
|
994
|
+
col.getLinkTable?.() === targetPodTable));
|
|
995
|
+
const linkColumns = relationDef?.fields && relationDef.fields.length > 0
|
|
996
996
|
? candidateColumns
|
|
997
|
-
: candidateColumns.filter((col) =>
|
|
998
|
-
if (
|
|
999
|
-
const
|
|
1000
|
-
const explicitInverse =
|
|
997
|
+
: candidateColumns.filter((col) => matchesParentLink(col) && !col.isInverse?.());
|
|
998
|
+
if (linkColumns.length === 0) {
|
|
999
|
+
const relationReferenceFields = relationDef?.references ?? [];
|
|
1000
|
+
const explicitInverse = relationReferenceFields.filter((col) => Boolean(col &&
|
|
1001
1001
|
typeof col.isInverse === 'function' &&
|
|
1002
1002
|
col.isInverse() &&
|
|
1003
|
-
|
|
1003
|
+
matchesTargetLink(col)));
|
|
1004
1004
|
const parentColumns = Object.values(parentTable.columns ?? {});
|
|
1005
1005
|
const inverseCandidates = (explicitInverse.length > 0 ? explicitInverse : parentColumns).filter((col) => typeof col.isInverse === 'function' &&
|
|
1006
1006
|
col.isInverse() &&
|
|
1007
|
-
|
|
1007
|
+
matchesTargetLink(col));
|
|
1008
1008
|
if (inverseCandidates.length === 0) {
|
|
1009
1009
|
continue;
|
|
1010
1010
|
}
|
|
1011
|
-
const inverseValuesPerRow = dedupedRows.map((row) => this.
|
|
1011
|
+
const inverseValuesPerRow = dedupedRows.map((row) => this.collectInverseLinkValues(row, inverseCandidates));
|
|
1012
1012
|
const uniqueIris = Array.from(new Set(inverseValuesPerRow
|
|
1013
1013
|
.flat()
|
|
1014
1014
|
.filter((iri) => typeof iri === 'string' && iri.length > 0)));
|
|
@@ -1035,17 +1035,17 @@ export class PodDatabase {
|
|
|
1035
1035
|
});
|
|
1036
1036
|
continue;
|
|
1037
1037
|
}
|
|
1038
|
-
const refColumn =
|
|
1039
|
-
const
|
|
1040
|
-
const
|
|
1038
|
+
const refColumn = linkColumns[0];
|
|
1039
|
+
const linkColumn = relationDef?.references && relationDef.references[0];
|
|
1040
|
+
const useLinkIri = refColumn.isLink();
|
|
1041
1041
|
const parentKeys = dedupedRows
|
|
1042
|
-
.map((row) => this.resolveParentKey(row,
|
|
1042
|
+
.map((row) => this.resolveParentKey(row, linkColumn, useLinkIri))
|
|
1043
1043
|
.filter((value) => typeof value === 'string' && value.length > 0);
|
|
1044
1044
|
if (parentKeys.length === 0) {
|
|
1045
1045
|
continue;
|
|
1046
1046
|
}
|
|
1047
1047
|
let childBuilder = this.session.select().from(targetPodTable);
|
|
1048
|
-
if (
|
|
1048
|
+
if (useLinkIri) {
|
|
1049
1049
|
childBuilder = childBuilder.where(inArray(refColumn, parentKeys));
|
|
1050
1050
|
}
|
|
1051
1051
|
else {
|
|
@@ -1055,8 +1055,8 @@ export class PodDatabase {
|
|
|
1055
1055
|
const grouped = new Map();
|
|
1056
1056
|
for (const child of childRows) {
|
|
1057
1057
|
const fkValue = child[refColumn.name];
|
|
1058
|
-
const lookupKeys =
|
|
1059
|
-
? this.
|
|
1058
|
+
const lookupKeys = useLinkIri
|
|
1059
|
+
? this.collectLinkLookupKeys(fkValue)
|
|
1060
1060
|
: (this.normalizeLiteralValue(fkValue) ? [this.normalizeLiteralValue(fkValue)] : []);
|
|
1061
1061
|
for (const lookupKey of lookupKeys) {
|
|
1062
1062
|
const arr = grouped.get(lookupKey) ?? [];
|
|
@@ -1065,12 +1065,12 @@ export class PodDatabase {
|
|
|
1065
1065
|
}
|
|
1066
1066
|
}
|
|
1067
1067
|
dedupedRows.forEach((row) => {
|
|
1068
|
-
const parentKeys =
|
|
1068
|
+
const parentKeys = useLinkIri
|
|
1069
1069
|
? Array.from(new Set([
|
|
1070
|
-
this.resolveParentKey(row,
|
|
1070
|
+
this.resolveParentKey(row, linkColumn, true),
|
|
1071
1071
|
this.resolveIdFromRow(row),
|
|
1072
1072
|
].filter((value) => typeof value === 'string' && value.length > 0)))
|
|
1073
|
-
: [this.resolveParentKey(row,
|
|
1073
|
+
: [this.resolveParentKey(row, linkColumn, false)].filter((value) => typeof value === 'string' && value.length > 0);
|
|
1074
1074
|
const related = [];
|
|
1075
1075
|
for (const parentKey of parentKeys) {
|
|
1076
1076
|
const matches = grouped.get(parentKey) ?? [];
|
|
@@ -1134,12 +1134,12 @@ export class PodDatabase {
|
|
|
1134
1134
|
}
|
|
1135
1135
|
return undefined;
|
|
1136
1136
|
}
|
|
1137
|
-
resolveParentKey(row,
|
|
1138
|
-
if (
|
|
1139
|
-
const value = row[
|
|
1140
|
-
return
|
|
1137
|
+
resolveParentKey(row, linkColumn, useLinkIri) {
|
|
1138
|
+
if (linkColumn) {
|
|
1139
|
+
const value = row[linkColumn.name];
|
|
1140
|
+
return useLinkIri ? this.normalizeLinkValue(value) : this.normalizeLiteralValue(value);
|
|
1141
1141
|
}
|
|
1142
|
-
return
|
|
1142
|
+
return useLinkIri ? this.resolveIriFromRow(row) : this.resolveIdFromRow(row);
|
|
1143
1143
|
}
|
|
1144
1144
|
resolveIriFromRow(row) {
|
|
1145
1145
|
if (!row)
|
|
@@ -1152,9 +1152,9 @@ export class PodDatabase {
|
|
|
1152
1152
|
}
|
|
1153
1153
|
return undefined;
|
|
1154
1154
|
}
|
|
1155
|
-
|
|
1155
|
+
collectLinkLookupKeys(value) {
|
|
1156
1156
|
const keys = [];
|
|
1157
|
-
const normalized = this.
|
|
1157
|
+
const normalized = this.normalizeLinkValue(value) ?? this.normalizeLiteralValue(value);
|
|
1158
1158
|
if (normalized) {
|
|
1159
1159
|
keys.push(normalized);
|
|
1160
1160
|
const fragment = this.extractFragment(normalized);
|
|
@@ -1164,7 +1164,7 @@ export class PodDatabase {
|
|
|
1164
1164
|
}
|
|
1165
1165
|
return keys;
|
|
1166
1166
|
}
|
|
1167
|
-
|
|
1167
|
+
normalizeLinkValue(value) {
|
|
1168
1168
|
if (!value)
|
|
1169
1169
|
return undefined;
|
|
1170
1170
|
if (typeof value === 'string') {
|
|
@@ -1187,7 +1187,7 @@ export class PodDatabase {
|
|
|
1187
1187
|
}
|
|
1188
1188
|
return undefined;
|
|
1189
1189
|
}
|
|
1190
|
-
|
|
1190
|
+
collectInverseLinkValues(row, columns) {
|
|
1191
1191
|
if (!columns.length) {
|
|
1192
1192
|
return [];
|
|
1193
1193
|
}
|
|
@@ -1198,7 +1198,7 @@ export class PodDatabase {
|
|
|
1198
1198
|
continue;
|
|
1199
1199
|
}
|
|
1200
1200
|
const appendValue = (entry) => {
|
|
1201
|
-
const normalized = this.
|
|
1201
|
+
const normalized = this.normalizeLinkValue(entry) ?? (typeof entry === 'string' ? entry : undefined);
|
|
1202
1202
|
if (normalized) {
|
|
1203
1203
|
collected.push(normalized);
|
|
1204
1204
|
}
|
|
@@ -1215,8 +1215,8 @@ export class PodDatabase {
|
|
|
1215
1215
|
groupRowsByIri(rows) {
|
|
1216
1216
|
const grouped = new Map();
|
|
1217
1217
|
for (const row of rows) {
|
|
1218
|
-
const iri = this.
|
|
1219
|
-
this.
|
|
1218
|
+
const iri = this.normalizeLinkValue(row['@id']) ??
|
|
1219
|
+
this.normalizeLinkValue(row.uri) ??
|
|
1220
1220
|
(typeof row['@id'] === 'string' ? row['@id'] : undefined);
|
|
1221
1221
|
if (!iri) {
|
|
1222
1222
|
continue;
|