RDFLib/rdflib — Issue #149: Sparql Query Examples Broken
Author: gjhiggins
Created: 2012-02-20 08:33:52+00:00
State: closed

chrisspen@gmail.com, 2011-03-13T18:02:41.000Z

None of the Sparql query examples at http://code.google.com/p/rdflib/wiki/IntroSparql work anymore. There's a vague reference to this functionality being moved to rdfextras, but that project has no documentation. Easy_installing rdfextras does not fix the example sparql code.

Comment 1 by gromgull
I am sorry you are having problems - I went through all the wiki-pages a little while ago to make sure they were still current, and it worked fine for me.

However, I see now that if you easy_install rdfextras you get the hg-snapshot from 2010, and with this version the example does NOT run. For a quick fix you can try checking out the default branch of rdfextras, or try this snapshot: http://code.google.com/p/rdfextras/downloads/detail?name=rdfextras-hgsnapshot-20110225.zip&can=2&q=

I will try to make an rdfextras release now to make this easier.

(Another possible issue is whether you really are running version 3.0 (or the brand new as of today 3.1)?

try:

import rdflib
print rdflib.__version__

It should say 3.0 or 3.1 ?
)

Comment 2 by gromgull
I have released a rdfextras 1.0 - if you re-run easy_install you should be ok!

Comment 3 by chrisspen@gmail.com
Thanks for looking at this. Yes, I was using rdflib 2.4 and rdfextras 0.1a. I checked out rdflib and reinstalled, and now it's at 3.0. I couldn't find rdfextras 1.0, so I installed the most recent 0.1 release. Easy_install still installs 0.1a, so I downloaded the tarball. Now most of the examples run, except the queries, which give me the error:

TypeError: query() got an unexpected keyword argument 'initNs'

Comment 4 by MrLe...@gmail.com
Add parameters initNs and initBindigs in rdflib.graph.query()

def query(..., initNs={}, initBindings={})
and add the same in the return statement

return result(processor.query(query_object, initBindings, initNs))

Comment 5 by gromgull
This should all work fine with rdflib3.1 and new rdfextras - please start a new ticket if you still have problems.