Fix: query over empty optional aggregate; added test and fix for issue #2229 by WhiteGobo · Pull Request #2448 · RDFLib/rdflib (original) (raw)
testing counting of optional nodes. Zero optional nodes may throw a NotBoundError
Added fix for NotBoundError, for this test.
Summary of changes
As stated in issue 2229 a sparql query fails, if you count over an aggregate of optional values and zero values where found.
This patch catches the resulting NotBoundError and enables with that the count over the empty value-list. Also added the reason for the catch as comment.
Also added a test, that makes such a query.
- Fixes Serializing SPARQL Query Results with Aggregates over Variables from Optional Graph Pattern #2229
Checklist
- Checked that there aren't other open pull requests for
the same change. - Checked that all tests and type checking passes.
- If the change adds new features or changes the RDFLib public API:
- If the change has a potential impact on users of this project:
- Added or updated tests that fail without the change.
- Considered granting push permissions to the PR branch,
so maintainers can fix minor issues and keep your PR up to date.