From cb66af030b7de7e641f9ae5b4a2c3c231356d8ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Kl=C3=ADma?= Date: Sun, 19 Nov 2023 17:45:23 +0100 Subject: [PATCH] Fixed SPARQL query generator --- library/lens/query_builder.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/library/lens/query_builder.ts b/library/lens/query_builder.ts index 5988010..5343d38 100644 --- a/library/lens/query_builder.ts +++ b/library/lens/query_builder.ts @@ -114,7 +114,7 @@ export class QueryBuilder { } getQuery(where?: string | RDF.Quad[], limit = 1000) { - const selectSubQuery = SELECT` + const selectSubQuery = SELECT.DISTINCT` ${this.df.variable!("iri")} `.WHERE` ${this.getShape(false, true)} @@ -123,10 +123,8 @@ export class QueryBuilder { const query = CONSTRUCT` ${this.getResourceSignature()} - ${this.getTypesSignature()} ${this.getShape(true, false, true)} `.WHERE` - ${this.getTypesSignature()} ${this.getShape(true, true, true)} { ${selectSubQuery} @@ -139,11 +137,9 @@ export class QueryBuilder { getByIrisQuery(iris: Iri[]) { const query = CONSTRUCT` ${this.getResourceSignature()} - ${this.getTypesSignature()} ${this.getShape(true, false, true)} `.WHERE` - ${this.getTypesSignature()} - ${this.getShape(true, true, true)} + ${this.getShape(true, true, false)} VALUES ?iri { ${iris.map(this.df.namedNode)} }