convert() does different things for different formats, as per the code comments in convert():
in the case of :data:XML, a DOM top element is returned
in the case of :data:JSON, a json conversion will return a dictionary
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.
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.