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)} }