#include #include #include using namespace std; int main( int, char** ) { librdf_world* world = librdf_new_world(); librdf_world_open(world); librdf_storage* storage = librdf_new_storage(world, "memory", "test", NULL); librdf_model* model = librdf_new_model(world, storage, NULL); librdf_statement* st = librdf_new_statement_from_nodes( world, librdf_new_node_from_uri_string(world, (const unsigned char*)"http://www.pants.com/"), librdf_new_node_from_uri_string(world, (const unsigned char*)"http://www.pants.com/current/position"), librdf_new_node_from_literal(world, (const unsigned char*)"On",NULL, 0) ); librdf_model_add_statement(model, st); librdf_free_statement(st); librdf_serializer* serializer = librdf_new_serializer( world, "rdfxml", 0, 0 ); librdf_uri* base_uri = 0; size_t data_sz = 0; unsigned char* data = librdf_serializer_serialize_model_to_counted_string ( serializer, base_uri, model, &data_sz ); cerr << "serializer:" << (void*)serializer << " data:" << (void*)data << " data_sz:" << data_sz << endl; cerr << "data follows..." << endl; cerr.write( (const char*)data, data_sz ); cerr << endl; free(data); librdf_free_serializer(serializer); librdf_free_world(world); cerr << "We did not crash! exiting normally now..." << endl; return 0; }