[Nepomuk] NAO::Symbols and ResourceWatcher

David Narvaez david.narvaez at computer.org
Wed Apr 25 18:38:32 UTC 2012


Hi,

I'm working on bug 298684[0], and the problem seems to be as follows:

1) Nepomuk Storage Service is initialized
2) The Activity Manager Daemon signals all listeners that the
Activities have changed
3) All listeners query for information about all Activities
4) When these request the Activity Icon (NAO::Symbols in Nepomuk
terms) there are no symbols for any of the Activities

Later, if you request symbols for these very same activities, they all
have icons, so this looks like the hasSymbols property changes after
Nepomuk service has been started. When I thought that was odd, I saw
this code

        // Waiting for nepomuk. Not a really clean way, but we are making sure
        // queries work properly and that kext ontology is loaded
        // rdfs:subClassOf is reflective, so it needs to return at least one
        // item for the following query
        bool passNepomuk = false;
        while (!passNepomuk) {
            const QString & query = QString::fromLatin1("select ?r
where { ?r rdfs:subClassOf kext:Activity . }");
            Soprano::QueryResultIterator it
                =
Nepomuk::ResourceManager::instance()->mainModel()->executeQuery(query,
Soprano::Query::QueryLanguageSparql);

            if (it.next()) {
                kDebug() << it[0].uri();
                passNepomuk = true;
            } else
                sleep(5);
        }

so I guess it is very possible that properties are loaded by parts.
The question then was how to know when to query again for symbols, so
I tried setting up a ResourceWatcher yet it doesn't seem to be
signaling when the hasSymbol property changes:

connect(m_nepomukResourceWatcher,
SIGNAL(propertyAdded(Nepomuk::Resource,Nepomuk::Types::Property,QVariant)),
this, SLOT(nepomukOnline()));
m_nepomukResourceWatcher->addProperty(Nepomuk::Vocabulary::NAO::hasSymbol());
m_nepomukResourceWatcher->start();

m_nepomukResourceWatcher->addResource(res);

Am I doing something wrong? Any ideas? Thanks in advance.

David E. Narváez

[0] https://bugs.kde.org/show_bug.cgi?id=298684


More information about the Nepomuk mailing list