[Nepomuk] Can't mainModel()->executeQuery

Vishesh Handa me at vhanda.in
Sun May 6 15:20:17 UTC 2012


On Sat, May 5, 2012 at 3:22 PM, Christian Mollekopf <chrigi_1 at fastmail.fm>wrote:

> Hey,
> I'm trying to write a little helper application to check the status of the
> akonadi indexing, but ran into a problem:
>
> If I'm running this query:
>
> Soprano::QueryResultIterator result = Nepomuk::ResourceManager::instance()-
> >mainModel()->executeQuery(QString::fromLatin1("select ?compatLevel where
> { ?r
> nie:url <akonadi:?item=191> . ?r aneo:akonadiIndexCompatLevel ?compatLevel
> .
> }"), Soprano::Query::QueryLanguageSparql);
>
> I get back a binding for compatLevel, but the node is always empty
> (result.binding(0).isEmpty() == true).
>

    QString query("select ?compatLevel where { ?r
aneo:akonadiIndexCompatLevel ?compatLevel .}");
    Soprano::Model* model =
Nepomuk::ResourceManager::instance()->mainModel();

    Soprano::QueryResultIterator it = model->executeQuery( query,
Soprano::Query::QueryLanguageSparql );
    if( it.next() ) {
        kDebug() << it.binding(0).isEmpty();
        kDebug() << it[0].literal().toInt();
    }


Soprano Iterators behave similar to java style iterators. You'll need to
call it.next() for it to iterate over the first element.



> On the server-side I can see this:
> chrigi ~ $[/usr/bin/nepomukservicestub] virtual void
> Soprano::Server::LocalServer::incomingConnection(quintptr)
> [/usr/bin/nepomukservicestub] void
>
> Soprano::Server::ServerCorePrivate::addConnection(Soprano::Server::ServerConnection*)
> New connection. New count: 12
> [/usr/bin/nepomukservicestub] Soprano::ODBC::Connection::Connection()
> Soprano::Server::ServerConnection(0x863190)
> [/usr/bin/nepomukservicestub] "/usr/bin/nepomukservicestub(25707)" Soprano:
> "SQLGetData for data length failed (iODBC Error: [iODBC][Driver
> Manager]Invalid cursor state)"
> "/usr/bin/nepomukservicestub(25707)" Soprano: "SQLGetData for data length
> failed (iODBC Error: [iODBC][Driver Manager]Invalid cursor state)"
> [/usr/bin/nepomukservicestub] "/usr/bin/nepomukservicestub(25707)" Soprano:
> "SQLGetData for data length failed (iODBC Error: [iODBC][Driver
> Manager]Invalid cursor state)"
> [/usr/bin/nepomukservicestub] "/usr/bin/nepomukservicestub(25707)" Soprano:
> "SQLGetData for data length failed (iODBC Error: [iODBC][Driver
> Manager]Invalid cursor state)"
>
> I have no clue how to debug that as there are no error messages at all on
> the
> client-side. Note that the exact same query works in nepomukshell and
> returns
> the correct result of "3".
> Any ideas?
>
> Cheers,
> Christian
> _______________________________________________
> Nepomuk mailing list
> Nepomuk at kde.org
> https://mail.kde.org/mailman/listinfo/nepomuk
>



-- 
Vishesh Handa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/nepomuk/attachments/20120506/1eabf89a/attachment.html>


More information about the Nepomuk mailing list