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

Vishesh Handa handa.vish at gmail.com
Sat Feb 19 13:02:20 CET 2011


The method Laura described is the correct one as of now. Though, we would
prefer it if you didn't use it. The reason is that you get notified for all
the statements that have been added/removed - and those can be quite a lot.

Especially if files or emails are being indexed. That causes the entire
system to slow down. I had to monitor everything for Nepomuk
synchronization, and it caused Nepomuk to slow down so much that in 4.6 RC1,
I finally had to disable it!

We are working on a better way for you to watch changes in the Nepomuk
Repository. The current API that I have planned is something like this -

ResourceWatcher * watcher = SomeObject->watchType(
Nepomuk::Vocabulary::NAO::Tag() );

watcher would have its own statementAdded() and statementRemoved() signals
which would only give you those statements. I was even thinking of watching
by property.

Would this solve your use case? Any comments on the API? None of this has
been implemented so feel free to comment - we can change anything at this
point.


On Fri, Feb 18, 2011 at 5:25 PM, Laura Dragan <aprilush at gmail.com> wrote:

> On Thursday 17 February 2011 16:32:45 Christian Mollekopf wrote:
> > 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).
>
> I'd do that by checking if the statement added or removed has the predicate
> "rdf:type" and the object "nao:Tag". The subject of the statement is then
> the uri of the tag that was created or deleted.
>
> Laura
>
> >
> > 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
> > _______________________________________________
> > 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
>



-- 
Vishesh Handa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/nepomuk/attachments/20110219/cb3c4e1b/attachment.htm 


More information about the Nepomuk mailing list