Skip to content

Commit

Permalink
fix: all variables in projection should be present in GROUP BY
Browse files Browse the repository at this point in the history
  • Loading branch information
vhf committed Sep 2, 2019
1 parent e909969 commit fcdf852
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/datasetquery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,16 @@ class DataSetQuery {
});
}
});
// all variables in projection should be present in GROUP BY
query.variables
.forEach((selected: any) => {
if (selected.hasOwnProperty("value") && !groupedOnBindingNames.includes(selected.value)) {
groupedOnBindingNames.push(selected.value);
query.group.push({
expression: variable(selected.value),
});
}
});
}

const generator = new SparqlGenerator({ allPrefixes: true });
Expand Down

0 comments on commit fcdf852

Please sign in to comment.