RDFLib / sparqlwrapper

A wrapper for a remote SPARQL endpoint
https://sparqlwrapper.readthedocs.io/
Other
513 stars 121 forks source link

JSON & XML outputs handled differently by `convert()` #156

Open nicholascar opened 4 years ago

nicholascar commented 4 years ago

convert() does different things for different formats, as per the code comments in convert():

Why? Surely a "wrapper" would hide the lower-level stuff, e.g. the return format.

I never noticed this for years of use as I always asked for, and received, JSON which got instantly converted to a Python dict. However, I've encountered a triplestore that only returns application/sparql-results+xml and thus ended up with a crappy minidom Document.

I have written code to convert the minidom Doc to a Python dict and this could be used to return a dict for application/sparql-results+xml, indistinguishable from the JSOn converted results.

If this is a desired improvement, I will create a PR, with tests.

situx commented 2 years ago

Hi @nicholascar I stumbled across the same issue today when I tried an rdf+xml only endpoint. The pull request would be greatly appreciated!