[Kde-pim] Akonadi collections

Volker Krause vkrause at kde.org
Tue Sep 14 08:38:00 BST 2010


On Monday 13 September 2010 11:14:34 Tobias König wrote:
> On Saturday 11 September 2010 22:43:25 Robin Atwood wrote:
> Hej Robin,
>
> > > Thanks again Kevin, you are a mine of information! I have already found
> > > unnerving references to something called SPARQL! Onwards and upwards...
> >
> > I will change the subject since I can now find all the apidocs. My app is
> > launched when someone clicks on a phone number in the right-hand pane of
> > the address book. I now want to match the number to an addressee to get
> > their name, etc.
>
> So just use the Akonadi::ItemSearchJob as Kevin already suggested.
> The needed SparQL query is:
>
> SELECT ?person WHERE {
>   ?person
> <http://www.semanticdesktop.org/ontologies/2007/03/22/nco#hasPhoneNumber>
> ?number .
>   ?number
> <http://www.semanticdesktop.org/ontologies/2007/03/22/nco#phoneNumber>
> "%1"^^<http://www.w3.org/2001/XMLSchema#string> .
>  }
>
> where %1 must be replaced with the phone number you are looking for.

Seeing raw SPARQL and hard-coded ontology identifiers there, I think we should 
avoid that whereever possible.

Soprano has a code generator (which we already use in various places) to get 
rid of the ontology identifiers and replace them with C++ method calls, 
easier to read and breaks the build if you have a typo in there or if the 
ontologies change.

Since 4.4 IIRC, Nepomuk has a query API which can be used to generate SPARQL 
and is therefore useable as input for Akonadi search jobs. Besides the same 
benefits as noted above already, the resulting SPARQL is slightly more 
advanced than our hand-written version, since the query builder applies some 
optimizations it seems. We already use it in the feeder agents and KMail at 
least. 

We already had bugs about mis-quoting values in hand-written SPARQL queries 
etc, all this can easily be avoided.

regards
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20100914/504cf6a1/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list