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

Christian Mollekopf chrigi_1 at fastmail.fm
Thu Feb 17 17:32:45 CET 2011


Hey Laura,

On Thursday 17 February 2011 14:10:58 Laura Dragan wrote:
> 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?
> 
I'd like to update it whenever new tags are available, not only from within my 
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().
> 
Thats what I'm trying to do, but I don't get what indicates that a tag is new 
to the Nepomuk system (or that a tag was removed).

Thanks for your help,

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


More information about the Nepomuk mailing list