You are here

public function EasyRdf_GraphStore::delete in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/GraphStore.php \EasyRdf_GraphStore::delete()

Delete named graph content from the graph store

The URI can either be a full absolute URI or a URI relative to the URI of the graph store.

Parameters

string $uriRef The URI of graph to be added to:

Return value

EasyRdf_Http_Response The response from the graph store

Throws

EasyRdf_Exception

1 call to EasyRdf_GraphStore::delete()
EasyRdf_GraphStore::deleteDefault in vendor/easyrdf/easyrdf/lib/EasyRdf/GraphStore.php
Delete default graph content from the graph store

File

vendor/easyrdf/easyrdf/lib/EasyRdf/GraphStore.php, line 248

Class

EasyRdf_GraphStore
A class for fetching, saving and deleting graphs to a Graph Store. Implementation of the SPARQL 1.1 Graph Store HTTP Protocol.

Code

public function delete($uriRef) {
  if ($uriRef === self::DEFAULT_GRAPH) {
    $dataUrl = $this
      ->urlForGraph(self::DEFAULT_GRAPH);
  }
  else {
    $graphUri = $this->parsedUri
      ->resolve($uriRef)
      ->toString();
    $dataUrl = $this
      ->urlForGraph($graphUri);
  }
  $client = EasyRdf_Http::getDefaultHttpClient();
  $client
    ->resetParameters(true);
  $client
    ->setUri($dataUrl);
  $client
    ->setMethod('DELETE');
  $response = $client
    ->request();
  if (!$response
    ->isSuccessful()) {
    throw new EasyRdf_Exception("HTTP request to delete {$dataUrl} failed: " . $response
      ->getMessage());
  }
  return $response;
}