[Nepomuk] Issue with removing resources

Sebastian Trüg trueg at kde.org
Fri Aug 6 10:47:00 CEST 2010


On 08/05/2010 07:45 PM, George Goldberg wrote:
> I'm having a bit of a problem with Nepomuk::Resource. The context is this:
> 
> I have a query, using queryserviceclient (in this case, for all PIMO:Person).
> I also have a QList<PersonObject> where PersonObject is a class
> encapsulating a Nepomuk::Resource referencing a PIMO:Person.
> 
> Whenever the queryserviceclient query emits it's newEntries() signal,
> a new PersonObject is created using that Resource and appended to the
> list.
> 
> This is all fine so far.
> 
> However, when the queryserviceclient query emits entriesRemoved(), I
> iterate over the list of PersonObjects, getting the Nepomuk::Resource
> from each one and comparing its uri with the one from
> entriesRemoved().
> 
> This would be fine too, except that if the resource concerned has been
> removed altogether from the Nepomuk database, the Nepomuk::Resource
> instance for it in my list has magically had its uri property set to
> ""
> 
> This means that when doing the comparison, it never matches.
> 
> Is this a bug? If not, can anyone suggest how I should be doing this instead?

This is not a bug. It is a feature. :P
Seriously, that is why entriesRemoved does not return Result objects but
QUrls: the Resources are no longer valid after having been deleted.

One solution would be your own hash of resource uris to results. But you
are right that this is sub-optimal. One should be able to do that
matching by only using the information from the query service client.

I am, however, not sure how to solve that at the moment... :(


More information about the Nepomuk mailing list