protected function EasyRdf_Parser_Redland::nodeUriString

Convert the URI for a node into a string @ignore

2 calls to EasyRdf_Parser_Redland::nodeUriString()
EasyRdf_Parser_Redland::nodeToArray in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Redland.php
Convert a node into an associate array @ignore
EasyRdf_Parser_Redland::parse in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Redland.php
Parse an RDF document into an EasyRdf_Graph

File

drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Redland.php, line 96

Class

EasyRdf_Parser_Redland
Class to parse RDF using Redland (librdf) C library.

Code

protected function nodeUriString($node) {
  $type = EasyRdf_Parser_Redland::nodeTypeString($node);
  if ($type == 'uri') {
    $uri = librdf_node_get_uri($node);
    if (!$uri) {
      throw new EasyRdf_Exception("Failed to get URI of node");
    }
    $str = librdf_uri_to_string($uri);
    if (!$str) {
      throw new EasyRdf_Exception("Failed to convert librdf_uri to string");
    }
    return $str;
  }
  elseif ($type == 'bnode') {
    return $this
      ->remapBnode(librdf_node_get_blank_identifier($node));
  }
  else {
    throw new EasyRdf_Exception("Unsupported type: " . $type);
  }
}