Skip to content

Commit

Permalink
fix: Improve CONSTRUCT performance by prepending URIs (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeboer authored Jun 26, 2024
1 parent dc33ca4 commit 71b837b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
3 changes: 2 additions & 1 deletion src/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}];

Expand Down

0 comments on commit 71b837b

Please sign in to comment.