Parse a SPARQL result in the JSON format into the object.
@ignore
protected function parseJson($data) {
// Decode JSON to an array
$data = json_decode($data, true);
if (isset($data['boolean'])) {
$this->type = 'boolean';
$this->boolean = $data['boolean'];
}
elseif (isset($data['results'])) {
$this->type = 'bindings';
if (isset($data['head']['vars'])) {
$this->fields = $data['head']['vars'];
}
foreach ($data['results']['bindings'] as $row) {
$t = new stdClass();
foreach ($row as $key => $value) {
$t->{$key} = $this
->newTerm($value);
}
$this[] = $t;
}
}
else {
throw new EasyRdf_Exception("Failed to parse SPARQL JSON Query Results format");
}
}