/** * Convert the URI for a node into a string * @ignore */ protected static 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; } else { if ($type == 'bnode') { return '_:' . librdf_node_get_blank_identifier($node); } else { throw new EasyRdf_Exception("Unsupported type: " . $object['type']); } } }
/** * Convert the URI for a node into a string * @ignore */ protected function nodeUriString($node) { $type = self::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); } }
function _node($node) { $r = array(); if (librdf_node_is_resource($node)) { $r['type'] = 'uri'; $r['value'] = librdf_uri_to_string(librdf_node_get_uri($node)); } elseif (librdf_node_is_literal($node)) { $r['type'] = 'literal'; $r['value'] = librdf_node_get_literal_value($node); $dt = librdf_node_get_literal_value_datatype_uri($node); if ($dt) { $r['datatype'] = librdf_uri_to_string($dt); } } elseif (librdf_node_is_blank($node)) { $r['type'] = 'bnode'; $r['value'] = librdf_node_get_blank_identifier($node); } return $r; }
/** * @return string */ public function getUri() { return librdf_uri_to_string(librdf_node_get_uri($this->redlandNode)); }