[Nepomuk] Tagging from an outside application - effects not showing in Dolphin

Sebastian Trüg trueg at kde.org
Mon Sep 20 14:28:52 CEST 2010


On 09/20/2010 12:21 PM, Luca Beltrame wrote:
> In data lunedì 20 settembre 2010 11:51:07, hai scritto:
>> Your code looks good. So we need to debug the problem.
>> could you please use the "dumpres" utility from the nepomuk
>> playground[1] to list properties of the files you tagged.
> 
> Tagging this dummy file with "test" and label "test" produces the following:
> 
> lb_work at baley:~$ dumpres "nepomuk:/res/46759a87-7956-4000-a171-ccb754ef239e"
> Resource: <nepomuk:/res/46759a87-7956-4000-a171-ccb754ef239e>
> Types:    <http://www.w3.org/2000/01/rdf-schema#Resource>
> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#lastModified> 
> "2010-09-20T10:17:17.714Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>
> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#identifier>   
> "Password.txt"^^<http://www.w3.org/2001/XMLSchema#string>
> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#hasTag>       
> <nepomuk:/res/bda40a79-bf37-4000-a115-261dea66cdf3>
>                                                                         <nepomuk:/res/baacee48-1409-4000-8fed-0be2ff3add46>
> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#created>      
> "2010-09-20T10:15:53.361Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>
> 
> I had to use the resourceUri() to get the URI  because if I gave the file name 
> I got
> 
> lb_work at baley:~$ dumpres Password.txt 
> Resource does not exist: file:///home/lb_work/Password.txt

That is because this file is actually not present in Nepomuk. All you
have is a resource with an identifier "Password.txt".
This happens if you do the following:

Nepomuk::Resource res("Password.txt");

since there is no relation between the string and a file.
Using

Nepomuk::Resource res(KUrl(QFileInfo("Password.txt").absolutePath()));

would be a safe bet in case there is a file "Password.txt" in the
current folder.
You have to keep in mind that KUrl does not automatically resolve
relative paths. Your application needs to take care of that.

Cheers,
Sebastian


More information about the Nepomuk mailing list