Skip to content

Commit

Permalink
Fixed SPARQL query generator
Browse files Browse the repository at this point in the history
  • Loading branch information
karelklima committed Nov 19, 2023
1 parent a3960e8 commit cb66af0
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions library/lens/query_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
Expand All @@ -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}
Expand All @@ -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)}
}
Expand Down

0 comments on commit cb66af0

Please sign in to comment.