server/src/app/Libraries/Sparql/SparqlClient.php
changeset 277 bd4bc1db4f40
parent 158 366509ae2f37
child 307 07b44a378ad8
--- a/server/src/app/Libraries/Sparql/SparqlClient.php	Thu Sep 08 19:15:46 2016 +0200
+++ b/server/src/app/Libraries/Sparql/SparqlClient.php	Thu Sep 22 12:38:24 2016 +0200
@@ -130,15 +130,19 @@
 
     public function deleteWhere($whereClauses, string $graphUri = null) {
 
-        if(is_array($whereClause)) {
-            $whereClause = implode(" .", $whereClause);
+        if(empty($whereClauses)) {
+            return;
         }
+        if(is_array($whereClauses)) {
+            $whereClauses = implode(" .", $whereClauses);
+        }
+
+        $query = "DELETE { ?s ?p ?o } WHERE { $whereClauses }";
 
         if($graphUri) {
-            $whereClause = "GRAPH <$graphUri> { $whereClause }";
+            $query = "WITH <$graphUri> $query";
         }
 
-        $query = "DELETE WHERE { $whereClause }";
 
         // doc : http://rdf4j.org/doc/4/articles/REST-API/transaction-operations.docbook?view
         // cf. bug : https://openrdf.atlassian.net/browse/SES-2295