[redland-dev] Problem printing the rdf node to string

Andreas Gebhardt andreasgebhardt at web.de
Tue Oct 18 15:40:35 CEST 2011


Hello,

i hope this C++ snippet helps you ...

std::ostream& operator<< (std::ostream &out, const raptor_term* term)
{
        switch(term->type)
        {
                case RAPTOR_TERM_TYPE_UNKNOWN:
                        out << "[unknown]";
                        break;
                case RAPTOR_TERM_TYPE_URI:
                        out << "[uri]=" <<
raptor_uri_as_string(term->value.uri);
                        break;
                case RAPTOR_TERM_TYPE_LITERAL:
                        out << "[literal]=" << term->value.literal.string;
                        break;
                case RAPTOR_TERM_TYPE_BLANK:
                        out << "[blank]=" << term->value.blank.string;
                        break;
        }

        return out;
}

Best Regards,
Andreas

Am 18.10.2011 12:28, schrieb Derlis:
> Hello, i see that the librdf_node_to_string is deprecated in the newest version of redland-1.0.14. My problem is I have used previous versions of Redland that support the librdf_node_to_string, and now i want to upgrade to new version.
> 
> 
> unsigned char *subject_node=NULL, *object_node=NULL;
> 
> subject_type = librdf_node_get_type(subject);
> object_type = librdf_node_get_type(object);
> 
> subject_node= librdf_node_to_string(subject);
> object_node= librdf_node_to_string(object);
> 
> if(subject_type == LIBRDF_NODE_TYPE_UNKNOWN){
>     cout << subject_node << endl;  
>  }
> 
> if(object_type == LIBRDF_NODE_TYPE_UNKNOWN){
>     cout << object_node << endl;    
> }
> 
> How can i print in the newest  version  of redland the string??.. 
> 
> 
> Apreciate any help... 
> 
> Cheers..
> 
> 
> 
> _______________________________________________
> redland-dev mailing list
> redland-dev at lists.librdf.org
> http://lists.librdf.org/mailman/listinfo/redland-dev




More information about the redland-dev mailing list