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

Einar Poke einarpoke at hotmail.com
Fri Jul 13 15:24:02 BST 2007


 =

It seems function librdf_model_to_string (and similars) only works for conv=
erting from model as "rdf+xml", but it doesn't work as "rss", "atom" and ot=
hers. 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* s=
torage;  librdf_parser* parser;  librdf_model* model;  librdf_uri *uri;  ch=
ar *str =3D NULL;
  world=3Dlibrdf_new_world();  librdf_world_open(world);
  uri=3Dlibrdf_new_uri(world, (const unsigned char*)argv[1]);  if(!uri) { r=
eturn 1; }
  storage=3Dlibrdf_new_storage(world, "memory", "test", NULL);  if(!storage=
) { return 1; }
  model=3Dlibrdf_new_model(world, storage, NULL);  if(!model) { return 1; }
  parser=3Dlibrdf_new_parser(world, "rss-tag-soup", NULL, NULL);  if(!parse=
r) { return 1; }
  if(librdf_parser_parse_into_model(parser, uri, uri, model)) {    fprintf(=
stderr, "Failed to parse RDF into model\n");    return 1;  }
  str =3D 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/ga=
mespy.all.2.0.xml" results in "Failed to convert to string". But if we chan=
ge the program to use instead "application/rdf+xml", it works.
 =

I have also tried initializing storage with different options (mainly "hash=
-type=3D'memory',new=3D'yes',context=3D'yes'") but it made no difference.
 =

Is there anything I'm missing? Please help!
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.usefulinc.com/pipermail/redland-dev/attachments/20070713/=
1d607282/attachment.htm


More information about the redland-dev mailing list