The method doQuery in SMW_SparqlDatabase.php executes a HTTP request to perform a SPARQL query at a remote endpoint. However, it currently does not set a correct Accept-header in the HTTP request, which means that the server receives:
Which means that it is left up to the server to pick a response format.
This is a bug, because doQuery, when processing the result, assumes that the response format will always be in SPARQL XML Results format. If that is the assumption, this should be made clear in the Accept header, because otherwise a servers implementing several kinds of query result formats may send back a format that SMW does not know how to parse.
As a case in point, when using the Sesame framework as an endpoint, this is precisely what happens: Sesame, upon receiving the request from SMW, sends back the query result in a binary format that SMW is unable to parse.
To fix, the following should be added to doQuery:
curl_setopt( $this->m_curlhandle, CURLOPT_HTTPHEADER,
array('Accept: application/sparql-results+xml,application/xml;q=0.8' ));
This sets the Accept header to indicate that the only acceptable format for SMW is SPARQL XML Results format (and adds some flexibility in case an endpoint does not use the correct mime type but instead uses application/xml).
I have personally tested this fix against a Sesame-based endpoint and it solves the issue.