This is important because some SPARQL stores return IRI-based namespaces, which lxml and etree do not support. Using a JSON result type will circumvent these issues.
There are a number of issues that arise when you attempt this:
foo = SPARQLStore(..., returnFormat=SPARQLWrapper.JSON)
This causes an error because the returnFormat is also hard-coded as a parameter to the SPARQLWrapper function.
Setting the returnFormat (setReturnFormat()) after construction is insufficient because resetQuery() resets it to _defaultReturnFormat. Setting _defaultReturnFormat works for the actual wrapper, but sparqlstore.py:318 does not pass the format on to Result.parse():
should be:
return Result.parse(res, format=self.returnFormat)
This is important because some SPARQL stores return IRI-based namespaces, which lxml and etree do not support. Using a JSON result type will circumvent these issues.
There are a number of issues that arise when you attempt this:
This causes an error because the returnFormat is also hard-coded as a parameter to the SPARQLWrapper function.
Setting the returnFormat (
setReturnFormat()) after construction is insufficient because resetQuery() resets it to _defaultReturnFormat. Setting_defaultReturnFormatworks for the actual wrapper, but sparqlstore.py:318 does not pass the format on toResult.parse():should be: