[redland-dev] querying using ruby bindings

Dave Beckett dave.beckett at bristol.ac.uk
Mon Aug 8 14:36:00 BST 2005


On Fri, 2005-08-05 at 12:37 +0100, Eyal Oren wrote:
> Hi,
> 
> I'm trying to query a model using the ruby bindings. I think there might be
> some errors in the bindings, or maybe I'm doing something wrong.
> 
> First of all, I get an error in the constructor of Redland::Query
> (query.rb). I think the bindings make an incorrect call to
> Redland.librdf_new_query: I get an error message saying that that method
> should be invoked with 5 instead of 4 parameters. 

Yeah, that's correct.  It takes 5:
http://librdf.org/docs/api/redland-query.html#librdf-new-query

It changed a few versions ago when I added the base URI into rasqal.
Looks like this wasn't tracking it.

> So I 'fixed' that by calling Redland.librdf_new_query with 5 parameters
> (passing nil for the base URI). Now I get this error message when executing
> the query on the model: "[http://www.w3.org/1999/02/22-rdf-syntax-ns#RDF]
> is not a class/module (TypeError)"

I've made the same fix in CVS.

> I don't know what this means. I'm not sure whether I should pass something
> as baseURI, and actually I was wondering whether the ruby bindings really
> work for querying (since I also couldn't find any tests related to queries,
> and the ruby API is quite unclear on how to access the query results).

The base URI could hypothetically be undefined but there are usually
relative URIs allowed in RDF query languages as they are grounded in
them - RDQL and SPARQL in this case -  so without giving a base URI,
it's impossible to execute some queries.

(Aside: There is a toy test query language in redland just for testing
the APIs that doesn't do relative URIs so for that one, nil is ok.)

The particular error you give above is very wierd.  What has rdf:RDF got
to do with a query language?  Can you please give the ruby stack trace?

Dave




More information about the redland-dev mailing list