Send some graph data to the graph store
This method is used by insert() and replace()
@ignore
protected function sendGraph($method, $graph, $uriRef, $format) {
if (is_object($graph) and $graph instanceof EasyRdf_Graph) {
if ($uriRef == null) {
$uriRef = $graph
->getUri();
}
$data = $graph
->serialise($format);
}
else {
$data = $graph;
}
$formatObj = EasyRdf_Format::getFormat($format);
$mimeType = $formatObj
->getDefaultMimeType();
$graphUri = $this->parsedUri
->resolve($uriRef)
->toString();
$dataUrl = $this
->urlForGraph($graphUri);
$client = EasyRdf_Http::getDefaultHttpClient();
$client
->resetParameters(true);
$client
->setUri($dataUrl);
$client
->setMethod($method);
$client
->setRawData($data);
$client
->setHeaders('Content-Type', $mimeType);
$client
->setHeaders('Content-Length', strlen($data));
$response = $client
->request();
if (!$response
->isSuccessful()) {
throw new EasyRdf_Exception("HTTP request for {$dataUrl} failed: " . $response
->getMessage());
}
return $response;
}