From 71b837b4c8bb96a217b9873d12dfe36360996863 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Wed, 26 Jun 2024 20:32:43 +0200 Subject: [PATCH] fix: Improve CONSTRUCT performance by prepending URIs (#92) --- jest.config.js | 6 +++--- src/generator.ts | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/jest.config.js b/jest.config.js index 243a948..0e1ecfd 100644 --- a/jest.config.js +++ b/jest.config.js @@ -11,10 +11,10 @@ export default { coverageReporters: ['json-summary', 'text'], coverageThreshold: { global: { - lines: 67.89, - statements: 68.24, + lines: 68.16, + statements: 68.5, branches: 64.36, - functions: 74.4, + functions: 75, }, }, transform: { diff --git a/src/generator.ts b/src/generator.ts index 392b728..51a1547 100644 --- a/src/generator.ts +++ b/src/generator.ts @@ -131,12 +131,13 @@ export class Query extends BaseQuery { public withIris(iris: NamedNode[]) { const query = clonedeep(this.query); + // Increase Comunica query performance by inserting the VALUES as the first element in the query’s WHERE clause. const patterns: Pattern[] = [ - ...(query.where ?? []), { type: 'values', values: iris.map($this => ({'?this': $this})), }, + ...(query.where ?? []), ]; query.where = [{type: 'group', patterns}];