public function testPublicAccess()
 {
     $instance = new RepositoryClient('Foo', 'Bar', 'Nu', 'Vim');
     $this->assertSame('Foo', $instance->getDefaultGraph());
     $this->assertSame('Bar', $instance->getQueryEndpoint());
     $this->assertSame('Nu', $instance->getUpdateEndpoint());
     $this->assertSame('Vim', $instance->getDataEndpoint());
 }
 /**
  * Execute a SPARQL query and return an RepositoryResult object
  * that contains the results. The method throws exceptions based on
  * GenericHttpDatabaseConnector::mapHttpRequestError(). If errors occur and this
  * method does not throw anything, then an empty result with an error
  * code is returned.
  *
  * @note This function sets the graph that is to be used as part of the
  * request. Queries should not include additional graph information.
  *
  * @param $sparql string with the complete SPARQL query (SELECT or ASK)
  *
  * @return RepositoryResult
  */
 public function doQuery($sparql)
 {
     if ($this->repositoryClient->getQueryEndpoint() === '') {
         throw new BadHttpDatabaseResponseException(BadHttpDatabaseResponseException::ERROR_NOSERVICE, $sparql, 'not specified');
     }
     $this->httpRequest->setOption(CURLOPT_URL, $this->repositoryClient->getQueryEndpoint());
     $this->httpRequest->setOption(CURLOPT_HTTPHEADER, array('Accept: application/sparql-results+xml,application/xml;q=0.8', 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8'));
     $this->httpRequest->setOption(CURLOPT_POST, true);
     $defaultGraph = $this->repositoryClient->getDefaultGraph();
     $parameterString = "query=" . urlencode($sparql) . ($defaultGraph !== '' ? '&default-graph-uri=' . urlencode($defaultGraph) : '');
     $this->httpRequest->setOption(CURLOPT_POSTFIELDS, $parameterString);
     $httpResponse = $this->httpRequest->execute();
     if ($this->httpRequest->getLastErrorCode() == 0) {
         $xmlResponseParser = new XmlResponseParser();
         return $xmlResponseParser->parse($httpResponse);
     }
     $this->mapHttpRequestError($this->repositoryClient->getQueryEndpoint(), $sparql);
     $repositoryResult = new RepositoryResult();
     $repositoryResult->setErrorCode(RepositoryResult::ERROR_UNREACHABLE);
     return $repositoryResult;
 }