protected function EasyRdf_Parser_Redland::nodeToRdfPhp in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Redland.php \EasyRdf_Parser_Redland::nodeToRdfPhp()
Convert a node into an associate array @ignore
1 call to EasyRdf_Parser_Redland::nodeToRdfPhp()
- 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 123
Class
- EasyRdf_Parser_Redland
- Class to parse RDF using Redland (librdf) C library.
Code
protected function nodeToRdfPhp($node) {
$object = array();
$object['type'] = EasyRdf_Parser_Redland::nodeTypeString($node);
if ($object['type'] == 'uri') {
$object['value'] = EasyRdf_Parser_Redland::nodeUriString($node);
}
elseif ($object['type'] == 'bnode') {
$object['value'] = '_:' . librdf_node_get_blank_identifier($node);
}
elseif ($object['type'] == 'literal') {
$object['value'] = librdf_node_get_literal_value($node);
$lang = librdf_node_get_literal_value_language($node);
if ($lang) {
$object['lang'] = $lang;
}
$datatype = librdf_node_get_literal_value_datatype_uri($node);
if ($datatype) {
$object['datatype'] = librdf_uri_to_string($datatype);
}
}
else {
throw new EasyRdf_Exception("Unsupported type: " . $object['type']);
}
return $object;
}