resources in all activities on first run bug

Sebastian Trüg trueg at kde.org
Thu Oct 13 10:04:36 UTC 2011


check Resource::exists before querying. :)

On 10/12/2011 12:44 PM, Marco Martin wrote:
> Hi all,
> so, i did some digging about the problem of resources appearing on all 
> activities on the first run...
> here the interaction of different things (the plasma shell, activity manager 
> and nepomuk) is quite tricky, so better that i share the findings so maybe 
> someone can find the real why.
> 
> as i suspected, on the first run the nepomuk resources that identify 
> activities don't exist:
> a resource
> Nepomuk::Resource activityResource(id, Nepomuk::Vocabulary::KEXT::Activity());
> will have resource.exists() == false
> 
>  this makes the sparql query that fetches isrelated something from:
> 
> select distinct ?r where { <nepomuk:/res/47d7281f-dd5c-4162-8026-5bc069f91945> 
> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#isRelated> ?r . ?r 
> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#userVisible> ?v1 . 
> FILTER(?v1>0) . }
> 
> to:
> 
> select distinct ?r where { <> 
> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#isRelated> ?r . ?r 
> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#userVisible> ?v1 . 
> FILTER(?v1>0) . }
> 
> that means everything that has an isrelated property to anything will show up.
> 
> this means that on the first run while activities are correctly created in the 
> activity manager, they are not saved in nepomuk yet. so, in the activity 
> manager daemon
> void ActivityManagerPrivate::syncActivitiesWithNepomuk()
> 
> has not been executed yet when MobCorona::checkActivites() is executed.
> 
> is not just a problem of timing, because if i restart plasma-device the 
> resource are still not existent, i have to restart the whole session for the 
> resources being there.
> 
> if i in void MobCorona::checkActivities() i add
> 
> Nepomuk::Resource activityResource(id, Nepomuk::Vocabulary::KEXT::Activity());
> activityResource.setProperty(Nepomuk::Vocabulary::KEXT::activityIdentifier(), 
> id);
> 
> in the loop that popuplates activities, the problem gets fixed, because 
> setting that property makes the resource exist, but is a quite ugly workaround 
> on the activitymanager's back..
> 
> sooo..... ideas? ;)
> 
> Cheers,
> Marco Martin
> _______________________________________________
> Active mailing list
> Active at kde.org
> https://mail.kde.org/mailman/listinfo/active
> 


More information about the Active mailing list