You are here

protected function EasyRdf_Parser_Redland::nodeUriString in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Redland.php \EasyRdf_Parser_Redland::nodeUriString()

Convert the URI for a node into a string @ignore

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

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Redland.php, line 95

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);
  }
}