[redland-dev] Query Issues

Dave Beckett dave.beckett at bristol.ac.uk
Wed Feb 9 11:11:04 GMT 2005


On Wed, 2005-02-09 at 00:26 -0500, Christopher Schmidt wrote:
> With the newest Redland installed, there are some issues related to, I 
> believe, confusion in what the creation of an RDF Query object is in the 
> Python bindings. Each of the following assumes that the Model is set up 
> as follows:

One replies

> import RDF
> m = RDF.Model()

(this is using the implicit MemoryStorage)

> p = RDF.Parser()
> p.parse_into_model(m, "http://crschmidt.net/foaf.rdf")
> 
> Unexepcted Identifier:
> 
> The following code produces a RedlandError:
> 
> q = RDF.Query("""PREFIX foaf: <http://xmlns.com/foaf/0.1/>
> SELECT ?name
> WHERE
>   (?x rdf:type foaf:Person)
>   (?x foaf:name ?name)
> """)
> i = q.execute(m)
> for j in i:
> 	print j
> RDF.RedlandError: 'syntax error, unexpected IDENTIFIER, expecting SELECT'
> 
> This is confirmed on OS X 10.3.7, Gentoo Linux 2004.0.

You are trying to run a SPARQL query as RDQL.  Hence the syntax error.
Try RDF.SPARQLQuery("query string") and it all works.

the rest will have to wait.

<snip/>

Dave




More information about the redland-dev mailing list