[redland-dev] librdf_model_to_string only works for rdf+xml? (repost)

Einar Poke einarpeak at yahoo.com
Fri Jul 13 16:01:20 BST 2007


(Sorry but my previous posting was unreadable due to
rich formatting that my web mail doesn't allow to turn
off, thus I'm sending it again from another
account...)

---

It seems function librdf_model_to_string (and
similars) only works for converting from model as
"rdf+xml", but it doesn't work as "rss", "atom" and
others. Or maybe I'm doing something wrong? Please
advise!
 
I have created a very simple program to isolate this
problem:
 
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <redland.h>
int main(int argc, char *argv[]) {
  librdf_world* world;
  librdf_storage* storage;
  librdf_parser* parser;
  librdf_model* model;
  librdf_uri *uri;
  char *str = NULL;
  world=librdf_new_world();
  librdf_world_open(world);
  uri=librdf_new_uri(world, (const unsigned
char*)argv[1]);
  if(!uri) { return 1; }
  storage=librdf_new_storage(world, "memory", "test",
NULL);
  if(!storage) { return 1; }
  model=librdf_new_model(world, storage, NULL);
  if(!model) { return 1; }
  parser=librdf_new_parser(world, "rss-tag-soup",
NULL, NULL);
  if(!parser) { return 1; }
  if(librdf_parser_parse_into_model(parser, uri, uri,
model)) {
    fprintf(stderr, "Failed to parse RDF into
model\n");
    return 1;
  }
  str = librdf_model_to_string(model, uri, "",
"application/rss", 0);
  if(!str) {
    fprintf(stderr, "Failed to convert to string\n");
    return 1 ;
  }
  //...
  fprintf(stdout, "Resulting model is: %s\n", str);
  return 0;
}

Running the program above with parameter
"http://scripts.gamespy.com/rss/gamespy.all.2.0.xml"
results in "Failed to convert to string". But if we
change the program to use instead
"application/rdf+xml", it works.
 
I have also tried initializing storage with different
options (mainly
"hash-type='memory',new='yes',context='yes'") but it
made no difference.
 
Is there anything I'm missing? Please help!



 
____________________________________________________________________________________
It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/


      ____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 



More information about the redland-dev mailing list