You are here

public function EasyRdf_Sparql_Result::__construct in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/easyrdf/easyrdf/lib/EasyRdf/Sparql/Result.php \EasyRdf_Sparql_Result::__construct()

Create a new SPARQL Result object

You should not normally need to create a SPARQL result object directly - it will be constructed automatically for you by EasyRdf_Sparql_Client.

Parameters

string $data The SPARQL result body:

string $mimeType The MIME type of the result:

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Sparql/Result.php, line 66

Class

EasyRdf_Sparql_Result
Class for returned for SPARQL SELECT and ASK query responses.

Code

public function __construct($data, $mimeType) {
  if ($mimeType == 'application/sparql-results+xml') {
    return $this
      ->parseXml($data);
  }
  elseif ($mimeType == 'application/sparql-results+json') {
    return $this
      ->parseJson($data);
  }
  else {
    throw new EasyRdf_Exception("Unsupported SPARQL Query Results format: {$mimeType}");
  }
}