Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: GroupBy only contain first and last item #407

Closed
jiatao99 opened this issue Aug 11, 2021 · 0 comments · Fixed by #595
Closed

Bug: GroupBy only contain first and last item #407

jiatao99 opened this issue Aug 11, 2021 · 0 comments · Fixed by #595
Milestone

Comments

@jiatao99
Copy link

jiatao99 commented Aug 11, 2021

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);
@kal kal added this to the 3.2 milestone Sep 10, 2023
kal added a commit that referenced this issue Sep 17, 2023
@kal kal closed this as completed in #595 Sep 17, 2023
kal added a commit that referenced this issue Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants