[Nepomuk] AsyncQuery in Python
Stéphane Laurière
slauriere at mandriva.com
Tue May 11 10:54:34 CEST 2010
Hi everyone,
I'm trying to execute an AsyncQuery using the Python bindings with the
snippet below taken from [1] but I get the following error: "Soprano"
Error in thread "Invalid iterator ID.", and the query slot is never
called. Any idea why? The same query executed in sync mode works fine.
[1]
svn://anonsvn.kde.org/home/kde/trunk/playground/base/nepomuk-kde/nepomukshell/asyncloadingresourcemodel.cpp
==========
from PyKDE4.nepomuk import Nepomuk
from PyKDE4.soprano import Soprano
from PyQt4.QtCore import *
class AsyncResourceLoadingModel:
def __init__(self, sparql):
self.sparql = sparql
def query(self):
query = Soprano.Util.AsyncQuery.executeQuery(model, self.sparql,
Soprano.Query.QueryLanguageSparql)
QObject.connect( query, SIGNAL("nextReady(Soprano.Util.AsyncQuery*
) "), self.queryNextReadySlot)
def queryNextReadySlot(self, query):
print "getting next"
query.next()
if __name__ == "__main__":
nepomukType = Nepomuk.Types.Class(Soprano.Vocabulary.RDFS.Resource())
term = Nepomuk.Query.ResourceTypeTerm(nepomukType)
query = Nepomuk.Query.Query(term)
sparql = query.toSparqlQuery()
asyncmodel = AsyncResourceLoadingModel(sparql)
asyncmodel.query()
=========
Cheers
Stéphane
--
Stéphane Laurière
Mandriva http://mandriva.com
More information about the Nepomuk
mailing list