-
Notifications
You must be signed in to change notification settings - Fork 560
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
SPARQL result parsing #2796
base: main
Are you sure you want to change the base?
SPARQL result parsing #2796
Conversation
…et=UTF-8" Remove ResultParser plugin registration with the name "application/sparql-results+xml; charset=UTF-8" since it is never called in internal code. The only place where ResultParser plugins are requested is in "rdflib/query.py:276" ``` if format: plugin_key = format elif content_type: plugin_key = content_type.split(";", 1)[0] else: plugin_key = "xml" parser = plugin.get(plugin_key, ResultParser)() ``` In case of a content-type the charset is split off already.
…r _response_mime_types in sparqlconnector
@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:
|
@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:
This can be due to the content type, mimetype handling. |
Weirdly I'm seeing that exact same |
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
the same change.
so maintainers can fix minor issues and keep your PR up to date.