Improve SPARQLStore
type annotations and add optional (opt-in) tests against public endpoints
#3125
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of changes
This PR brings improvements to make
SPARQLStore
a better and more reliable option to execute SPARQL queries on remote endpoints (instead of using the SPARQLWrapper)Add tests of the
SPARQLStore
on public endpoints, taking inspiration from the SPARQLWrapper tests. Many popular SPARQL endpoints are tested in real world condition (graphdb, qlever, blazegraph, allegrograph, virtuoso...), which is really helpful to better know actually which features work, and which one are tricky--public-endpoints
when running pytest. We do not run those tests as part of the CI/CD, we expect maintainers would run them locally from time to time, or when they are working on improving theSPARQLStore
implementationMake the
method
param available directly on theSPARQLStore
constructor so that it is proposed with autocomplete in all IDEs (before it was passed as kwargs to theSPARQLConnector
, so users would not now about it unless they dive in theSPARQLConnector
code)Use
Literal
type annotations forreturnFormats
andmethod
at on theSPARQLConnector
andSPARQLStore
, this enable users to know exactly which values are possible just from basic autocomplete suggestions. Instead of having to dive in the code againImprove the
SPARQLStore
docstring documentation to provide a short, yet complete, working example for running a query: just copy/paste and it worksAlso fixed some small type checking errors that were already failing before these changes
Running the test on public endpoints right now might give some errors, all related to the Linked Open Vocabulary SPARQL endpoint being down since this morning. It will probably be back up soon
@nicholascar
Checklist
the same change.
./examples
.so maintainers can fix minor issues and keep your PR up to date.