/**
  * Convert a node into an associate array
  * @ignore
  */
 protected static function nodeToArray($node)
 {
     $object = array();
     $object['type'] = EasyRdf_Parser_Redland::nodeTypeString($node);
     if ($object['type'] == 'uri') {
         $object['value'] = EasyRdf_Parser_Redland::nodeUriString($node);
     } else {
         if ($object['type'] == 'bnode') {
             $object['value'] = '_:' . librdf_node_get_blank_identifier($node);
         } else {
             if ($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;
 }
Example #2
0
File: Node.php Project: bakulf/raop
 /**
  * Return the language of this literal or NULL if the literal has no
  * language.
  *
  * @return  string  The literal's language
  * @access  public
  */
 public function getLanguage()
 {
     return librdf_node_get_literal_value_language($this->node);
 }