Open white-gecko opened 5 months ago
@white-gecko this looks great, thanks. This addresses an issue I had only last month, I was trying to dynamically get the correct SPARQL result parser based on a mimetype, though the RDFLib plugin system, and I couldn't get it to work. Looks like now there is a way to do it.
@white-gecko I've clearned up the commit pipeline, so we don't have Dependabot conflicts, mypy issues, black updates and ruff updates in the loop to prevent the proper testing of PRs. I've just re-ran the test suite on your PR, and it is failing one real test:
test_example[sparqlstore_example.py]
@ashleysommer I'm sorry, I don't really understand the test output, since it is successful for some runs but the output of the other test doesn't show the failing test.
Ok, I got it, these are failing:
graph = Graph("SPARQLStore", identifier="http://dbpedia.org")
graph.open("http://dbpedia.org/sparql")
pop = graph.value(URIRef("http://dbpedia.org/resource/Berlin"), dbo.populationTotal)
This can be due to the content type, mimetype handling.
Weirdly I'm seeing that exact same test_example[sparqlstore_example.py]
failure on this unrelated PR: https://github.com/RDFLib/rdflib/pull/2818
Do you know what could be causing that?
Summary of changes
_response_mime_types
dict is replaced by a methodresponse_mime_types
that generates an Accept filed containing the supported mime types. Per default these are all mime types for which ResultParser plugins are registered.rdflib.plugins.sparql.results.graph.GraphResultParser
plugin for all names of the Parser plugins since it calls the Parsers internally.Eventually, these changes could be superseded by a more flexible plugin system, that would distinguish between plugin name, supported format, and supported mime-type.
The changes should maintain backward compatibility.
But this API is now more flexible. The
returnFormat
forSPARQLConnector
andSPARQLStore
is now optional andNone
per default. Also the default Accept header lists all mime-types supported by parsers. Maybe this should be mentioned in the change notes.Checklist