dotnetrdf
dotnetrdf copied to clipboard
Bug: GroupBy only contain first and last item
In QueryBuilder.cs, as you can see, rootGroup = lastGroup, therefore, after the loop, the rootGroup only contains the first item and one child (last item).
private void BuildGroupByClauses(SparqlQuery query)
{
ISparqlGroupBy rootGroup = null;
ISparqlGroupBy lastGroup = null;
foreach (var buildGroup in _buildGroups)
{
if (rootGroup == null)
{
rootGroup = lastGroup = buildGroup(Prefixes);
}
else
{
lastGroup.Child = buildGroup(Prefixes);
}
}
query.GroupBy = rootGroup;
}
All the middle items have been over written by lastGroup.Child =buildGroup(Prefixes);
Should be patched like this:
lastGroup = lastGroup.Child =buildGroup(Prefixes);