protected function EasyRdf_Sparql_Result::newTerm

Create a new EasyRdf_Resource or EasyRdf_Literal depending on the type of data passed in.

@ignore

2 calls to EasyRdf_Sparql_Result::newTerm()
EasyRdf_Sparql_Result::parseJson in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Sparql/Result.php
Parse a SPARQL result in the JSON format into the object.
EasyRdf_Sparql_Result::parseXml in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Sparql/Result.php
Parse a SPARQL result in the XML format into the object.

File

drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Sparql/Result.php, line 244

Class

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

Code

protected function newTerm($data) {
  switch ($data['type']) {
    case 'bnode':
      return new EasyRdf_Resource('_:' . $data['value']);
    case 'uri':
      return new EasyRdf_Resource($data['value']);
    case 'literal':
    case 'typed-literal':
      return EasyRdf_Literal::create($data);
    default:
      throw new EasyRdf_Exception("Failed to parse SPARQL Query Results format, unknown term type: " . $data['type']);
  }
}