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.<div>
<br></div><div>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!</div>
<div><br></div><div>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 -</div><div><br></div><div>ResourceWatcher * watcher = SomeObject->watchType( Nepomuk::Vocabulary::NAO::Tag() );</div>
<div><br></div><div>watcher would have its own statementAdded() and statementRemoved() signals which would only give you those statements. I was even thinking of watching by property.</div><div><br></div><div>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.</div>
<div><br></div><div><br><div class="gmail_quote">On Fri, Feb 18, 2011 at 5:25 PM, Laura Dragan <span dir="ltr"><<a href="mailto:aprilush@gmail.com">aprilush@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Thursday 17 February 2011 16:32:45 Christian Mollekopf wrote:<br>
> Hey Laura,<br>
><br>
> On Thursday 17 February 2011 14:10:58 Laura Dragan wrote:<br>
> > Hi Chris,<br>
> ><br>
> > On Thursday 17 February 2011 01:14:02 Christian Mollekopf wrote:<br>
> > > hi,<br>
> > ><br>
> > > Does anybody know how I can detect when a new Tag was added/removed<br>
> > > to/from Nepomuk? I.e. to update a Tag Cloud.<br>
> ><br>
> > do you need to update the tag cloud if any resource is tagged outside your<br>
> > app, or just inside your app?<br>
> ><br>
> I'd like to update it whenever new tags are available, not only from within my<br>
> app.<br>
><br>
> > In SemNotes for instance the tag cloud is built only with the tags used on<br>
> > the notes - you can find that code on gitorious.<br>
> ><br>
> > A long time ago I wrote a plasmoid that built the tagcloud for the entire<br>
> > desktop (not sure if it's in playground or not), and that one was<br>
> > listening to statementsAdded and statementsRemoved from the model, but I<br>
> > took the easy path and rebuilt the cloud every time instead of just<br>
> > updating it. It worked ok with up to 30 tags, without visible delays from<br>
> > all the repository querying.<br>
> ><br>
> > > Currently I listen to the statementAdded/statementRemoved signals of the<br>
> > > Soprano::Model, and I can also detect if an Item gets a new Tag, but I<br>
> > > don't know how I can see from the Statement when a new Tag was created<br>
> > > or a Tag was deleted.<br>
> ><br>
> > I think you can use the signals<br>
> ><br>
> > void statementAdded( const Soprano::Statement &statement)<br>
> > void statementRemoved( const Soprano::Statement &statement)<br>
> ><br>
> > to look into the statements that are affected with the functions:<br>
> > subject(), predicate() and object().<br>
> ><br>
> Thats what I'm trying to do, but I don't get what indicates that a tag is new<br>
> to the Nepomuk system (or that a tag was removed).<br>
<br>
</div></div>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.<br>
<font color="#888888"><br>
Laura<br>
</font><div><div></div><div class="h5"><br>
><br>
> Thanks for your help,<br>
><br>
> Chris<br>
> ><br>
> > Hope this helps<br>
> > Laura<br>
> ><br>
> > > Cheers,<br>
> > ><br>
> > > Chris<br>
> > > _______________________________________________<br>
> > > Nepomuk mailing list<br>
> > > <a href="mailto:Nepomuk@kde.org">Nepomuk@kde.org</a><br>
> > > <a href="https://mail.kde.org/mailman/listinfo/nepomuk" target="_blank">https://mail.kde.org/mailman/listinfo/nepomuk</a><br>
> ><br>
> > _______________________________________________<br>
> > Nepomuk mailing list<br>
> > <a href="mailto:Nepomuk@kde.org">Nepomuk@kde.org</a><br>
> > <a href="https://mail.kde.org/mailman/listinfo/nepomuk" target="_blank">https://mail.kde.org/mailman/listinfo/nepomuk</a><br>
> _______________________________________________<br>
> Nepomuk mailing list<br>
> <a href="mailto:Nepomuk@kde.org">Nepomuk@kde.org</a><br>
> <a href="https://mail.kde.org/mailman/listinfo/nepomuk" target="_blank">https://mail.kde.org/mailman/listinfo/nepomuk</a><br>
><br>
_______________________________________________<br>
Nepomuk mailing list<br>
<a href="mailto:Nepomuk@kde.org">Nepomuk@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/nepomuk" target="_blank">https://mail.kde.org/mailman/listinfo/nepomuk</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><font color="#999999">Vishesh Handa</font><br>
</div>