server/src/app/Libraries/Sparql/SparqlClient.php
changeset 405 f239c8c5bb94
parent 387 7fba86fa8604
equal deleted inserted replaced
404:0a5eef6ad2fe 405:f239c8c5bb94
    36         if(!is_null($this->currentTransactionUrl)) {
    36         if(!is_null($this->currentTransactionUrl)) {
    37             // We just continue the current transaction
    37             // We just continue the current transaction
    38             return false;
    38             return false;
    39         }
    39         }
    40         //Log::debug('http_client base uri: ' . $this->getHttpClient()->getConfig('base_uri'));
    40         //Log::debug('http_client base uri: ' . $this->getHttpClient()->getConfig('base_uri'));
    41         $sesameRepository = config('corpusparole.sesame_repository');
    41         $rdf4jRepository = config('corpusparole.rdf4j_repository');
    42         $resp = $this->getHttpClient()->post("$sesameRepository/transactions", ['query' => ['isolation-level' => 'http://www.openrdf.org/schema/sesame#SNAPSHOT_READ']]);
    42         $resp = $this->getHttpClient()->post("$rdf4jRepository/transactions", ['query' => ['isolation-level' => 'http://www.openrdf.org/schema/sesame#SNAPSHOT_READ']]);
    43         //$resp = $this->getHttpClient()->post('transactions');
    43         //$resp = $this->getHttpClient()->post('transactions');
    44         //TODO check errors
    44         //TODO check errors
    45         if($resp->getStatusCode() != 201) {
    45         if($resp->getStatusCode() != 201) {
    46             throw new CorpusParoleException("Error when starting transaction : "
    46             throw new CorpusParoleException("Error when starting transaction : "
    47                 . $resp->getStatusCode() . " - "
    47                 . $resp->getStatusCode() . " - "
   106         $query = "$operation DATA { $query }";
   106         $query = "$operation DATA { $query }";
   107 
   107 
   108 
   108 
   109         // doc : http://rdf4j.org/doc/4/articles/REST-API/transaction-operations.docbook?view
   109         // doc : http://rdf4j.org/doc/4/articles/REST-API/transaction-operations.docbook?view
   110         // cf. bug : https://openrdf.atlassian.net/browse/SES-2295
   110         // cf. bug : https://openrdf.atlassian.net/browse/SES-2295
   111         // and PR https://bitbucket.org/openrdf/sesame/commits/62b680d8650caca7bc1673f6aaac48a5b6e85d23?at=2.8.x
   111         // and PR https://bitbucket.org/openrdf/rdf4j/commits/62b680d8650caca7bc1673f6aaac48a5b6e85d23?at=2.8.x
   112         // The put form has been chosen over the post, because it seems that this is the form choosed in the sesame http client
   112         // The put form has been chosen over the post, because it seems that this is the form choosed in the rdf4j http client
   113         $resp = $this->getHttpClient()->put(
   113         $resp = $this->getHttpClient()->put(
   114             $this->currentTransactionUrl, [
   114             $this->currentTransactionUrl, [
   115                 'headers' => ["Content-Type" => "application/sparql-update; charset=utf-8"],
   115                 'headers' => ["Content-Type" => "application/sparql-update; charset=utf-8"],
   116                 'query' => ['action' => 'UPDATE'],
   116                 'query' => ['action' => 'UPDATE'],
   117                 'body' => $query,
   117                 'body' => $query,
   144         }
   144         }
   145 
   145 
   146 
   146 
   147         // doc : http://rdf4j.org/doc/4/articles/REST-API/transaction-operations.docbook?view
   147         // doc : http://rdf4j.org/doc/4/articles/REST-API/transaction-operations.docbook?view
   148         // cf. bug : https://openrdf.atlassian.net/browse/SES-2295
   148         // cf. bug : https://openrdf.atlassian.net/browse/SES-2295
   149         // and PR https://bitbucket.org/openrdf/sesame/commits/62b680d8650caca7bc1673f6aaac48a5b6e85d23?at=2.8.x
   149         // and PR https://bitbucket.org/openrdf/rdf4j/commits/62b680d8650caca7bc1673f6aaac48a5b6e85d23?at=2.8.x
   150         // The put form has been chosen over the post, because it seems that this is the form choosed in the sesame http client
   150         // The put form has been chosen over the post, because it seems that this is the form choosed in the rdf4j http client
   151         $resp = $this->getHttpClient()->put(
   151         $resp = $this->getHttpClient()->put(
   152             $this->currentTransactionUrl, [
   152             $this->currentTransactionUrl, [
   153                 'headers' => ["Content-Type" => "application/sparql-update; charset=utf-8"],
   153                 'headers' => ["Content-Type" => "application/sparql-update; charset=utf-8"],
   154                 'query' => ['action' => 'UPDATE'],
   154                 'query' => ['action' => 'UPDATE'],
   155                 'body' => $query,
   155                 'body' => $query,