[redland-dev] setting parser feature through ruby api

Eyal Oren eyal.oren at deri.org
Mon Dec 4 14:44:56 UTC 2006


Hi,

I'm trying to use rapper through the ruby API. I've got it to work 
successfully (and great, thanks!) over command-line, but I have the feeling 
that the API documentation is not completely up-to-date?

The following works:

model = Redland::Model.new
parser = Redland::Parser.new('rdfxml')
parser.parse_into_model(model, url)
triples = Redland.librdf_model_to_string(model.model, nil, 'ntriples', '', nil)

Calling model.to_string('ntriples'), which should have worked according to 
the docs [1] didn't actually work.

Now I'm trying to set the parser to scan for rdf:RDF fragments (rapper 
--scan) but can't figure out how to use parser.feature. I've tried 
Redland::librdf_parser_set_feature(@parser,uri.uri,value.node) but didn't 
know which uri and value to use exactly. I found 
http://lists.usefulinc.com/pipermail/redland-dev/2005-July/001037.html but 
couldn't make it work.

Does anybody know how to enable this parsing feature in the Ruby API?

And a bonus question: does rapper do content-negotiation (e.g. asking for 
application/rdf+xml for sites that serve both html and rdf on the same URI) 
or is there a way to enable it?

 -eyal

[1] http://librdf.org/docs/rdoc/classes/Redland/Parser.html


More information about the redland-dev mailing list