[Nepomuk] Re: How to detect new/removed tags from a Soprano::Statement?

Laura Dragan aprilush at gmail.com
Thu Feb 17 14:10:58 CET 2011


Hi Chris, 

On Thursday 17 February 2011 01:14:02 Christian Mollekopf wrote:
> hi,
> 
> Does anybody know how I can detect when a new Tag was added/removed to/from 
> Nepomuk? I.e. to update a Tag Cloud.

do you need to update the tag cloud if any resource is tagged outside your app, or just inside your app?

In SemNotes for instance the tag cloud is built only with the tags used on the notes - you can find that code on gitorious.

A long time ago I wrote a plasmoid that built the tagcloud for the entire desktop (not sure if it's in playground or not), and that one was listening to statementsAdded and statementsRemoved from the model, but I took the easy path and rebuilt the cloud every time instead of just updating it. It worked ok with up to 30 tags, without visible delays from all the repository querying.

> 
> Currently I listen to the statementAdded/statementRemoved signals of the 
> Soprano::Model, and I can also detect if an Item gets a new Tag, but I don't 
> know how I can see from the Statement when a new Tag was created or a Tag was 
> deleted.

I think you can use the signals

void statementAdded( const Soprano::Statement &statement) 
void statementRemoved( const Soprano::Statement &statement) 

to look into the statements that are affected with the functions: subject(), predicate() and object().


Hope this helps
Laura

> 
> Cheers,
> 
> Chris
> _______________________________________________
> Nepomuk mailing list
> Nepomuk at kde.org
> https://mail.kde.org/mailman/listinfo/nepomuk
> 


More information about the Nepomuk mailing list