server/src/app/Libraries/Sparql/SparqlClient.php
changeset 277 bd4bc1db4f40
parent 158 366509ae2f37
child 307 07b44a378ad8
equal deleted inserted replaced
276:ef32bf573d9c 277:bd4bc1db4f40
   128         return $this->updateData('DELETE', $graph);
   128         return $this->updateData('DELETE', $graph);
   129     }
   129     }
   130 
   130 
   131     public function deleteWhere($whereClauses, string $graphUri = null) {
   131     public function deleteWhere($whereClauses, string $graphUri = null) {
   132 
   132 
   133         if(is_array($whereClause)) {
   133         if(empty($whereClauses)) {
   134             $whereClause = implode(" .", $whereClause);
   134             return;
       
   135         }
       
   136         if(is_array($whereClauses)) {
       
   137             $whereClauses = implode(" .", $whereClauses);
   135         }
   138         }
   136 
   139 
       
   140         $query = "DELETE { ?s ?p ?o } WHERE { $whereClauses }";
       
   141 
   137         if($graphUri) {
   142         if($graphUri) {
   138             $whereClause = "GRAPH <$graphUri> { $whereClause }";
   143             $query = "WITH <$graphUri> $query";
   139         }
   144         }
   140 
   145 
   141         $query = "DELETE WHERE { $whereClause }";
       
   142 
   146 
   143         // 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
   144         // cf. bug : https://openrdf.atlassian.net/browse/SES-2295
   148         // cf. bug : https://openrdf.atlassian.net/browse/SES-2295
   145         // and PR https://bitbucket.org/openrdf/sesame/commits/62b680d8650caca7bc1673f6aaac48a5b6e85d23?at=2.8.x
   149         // and PR https://bitbucket.org/openrdf/sesame/commits/62b680d8650caca7bc1673f6aaac48a5b6e85d23?at=2.8.x
   146         // 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 sesame http client