[Nepomuk] Re: Loading Baskets from the command line

Amir Pakdel pakdel at gmail.com
Wed Oct 6 15:54:30 CEST 2010


Hi Sebastian,

On Wed, Oct 6, 2010 at 4:16 PM, Sebastian Trüg <trueg at kde.org> wrote:
> Hi Amir,
>
> On 10/02/2010 02:16 PM, Amir Pakdel wrote:
>> Hi Sebastian,
>>
>> On Thu, Sep 23, 2010 at 11:11 AM, Amir Pakdel <pakdel at gmail.com> wrote:
>>> On Tue, Sep 21, 2010 at 2:21 PM, Sebastian Trüg <trueg at kde.org> wrote:
>>>>
>>>> On 09/21/2010 12:34 PM, Laura Dragan wrote:
>>>>> On Tuesday 21 September 2010 09:30:19 Sebastian Trüg wrote:
>>>>>> Hi Amir,
>>>>>>
>>>>>> looks like I missed this one. So here goes.
>>>>>>
>>>>>> On 09/14/2010 06:50 PM, Amir Pakdel wrote:
>>>>>>> The last prombems were:
>>>>>>>
>>>>>>>    1.
>>>>>>>
>>>>>>>       I havd to update Krunner Nepomuk plugin to the last version
>>>>>>>
>>>>>>>    2.
>>>>>>>
>>>>>>>       There is a /22rdfsyntaxnsmetadata/ function in /rdf/ which I had
>>>>>>>       to comment out
>>>>>>
>>>>>> Is this something Nepomuk-related? Something that did not work or might
>>>>>> need fixing from my part?
>>>>>>
>>>>>>> I have attached latest version of /src/nepomukintegration.h/ and
>>>>>>> /src/nepomukintegration.cpp/ and I would be greateful if you could
>>>>>>> take
>>>>>>> look and inform me of any error, bug or requred features.
>>>>>>
>>>>>> Some comments:
>>>>>> - It is recommended to use KUrl(path) instead of
>>>>>>   QUrl::fromLocalFile(path)
>>>>>> - setProperty( "a" ) is very very wrong. :) What you want to do is
>>>>>>   calling addType()
>>>>>> - there is no need to add nfo:FileDataObject type manually. That is
>>>>>>   already handled by strigi and Resource. The same goes for nie:url
>>>>>> - nfo:fileUrl is deprecated in favor of nie:url.
>>>>>> - Please do not use DC. Rather use nie:title.
>>>>>> - use setLabel() instead of setProperty( NAO::prefLabel(),
>>>>>>
>>>>>>> Here is the updated and reformatted testing procedure:
>>>>>>
>>>>>> I am not sure what to do with the explanations below. Is that for
>>>>>> manual
>>>>>> testing?
>>>>>>
>>>>>>
>>>>>>> Trüg, do you know why I cannot find tags?
>>>>>>> Laura, what metadata do you suggest to add next?
>>>>>
>>>>> Hi Amir,
>>>>>
>>>>> There are some things which are not completely clear to me.
>>>>> From what I see in the code, you consider a .basket as a note.
>>>>> I see the basket as a container of multiple notes, each distinct
>>>>> instances of pimo:Note, each with it's own creation/modification times and
>>>>> tags. I'm not sure about the title, as I don't know if you can set the title
>>>>> of an individual note in any other way as through formatting in the text.
>>>>> And then there are the groups of notes, which I think would make sense to
>>>>> capture as RDF as they are structured info as well.
>>>>>
>>>>> @nepomuk What vocabulary offers support for this kinds of containers of
>>>>> Things already?
>>>>> As a last resort, you could even make up your own small vocabulary for
>>>>> it.
>>>>
>>>> Well, we do have pimo:isPartOf, right?
>>>>
>>>> Cheers,
>>>> Sebastian
>>>
>>> Hi Laura,
>>> Hi Sebastian,
>>>
>>> You are completely right: .basket files represent groups of notes (called
>>> basket) and they contain everything except the notes. The actual notes are
>>> individual files of a variety of types (Image, Text, HTML) in the same
>>> directory and they are addressed in the .basket file.
>>> Nonetheless, I could not define a MIME-Type for the files that really
>>> containing notes, because they already have one! and I could not find a way
>>> to include path of a file as part of the MIME-Type specification. In other
>>> words, what makes an HTML file, a note in "Basket Note Pads" is the
>>> directory that this file resides in.
>>> Consequently, the only solution I could think of, is assigning all the
>>> metadata in the Nepomuk to the .basket file. In fact, the .basket files
>>> contains all this metadata in XML format. Afterwords, as Sebastian said, we
>>> could link notes and baskets in Nepomuk using pimo:isPartOf.
>>> Significance of the MIME-Type is related to the fact that with the right
>>> MIME-Type being set, the search result (in this case the .basket file) is
>>> opened using the appropriate application (Basket Note Pads).
>>> However, I have not tested the effect of pimo:isPartOf! I do not know if a
>>> single note (an HTML file for example) that is a part of a .basket is found
>>> (as a search result) running the note using KRun will open the .basket
>>> (which the note is part of) using the Basket Note Pads or the note file
>>> (using Firefox in tis case).
>>>
>>> Any idea or suggestion?
>>>
>>> Thanks,
>>> Amir
>>>
>>
>> As you may know, Basket Note Pads uses a directory hierarchy like this
>> under ~/.kde/share/apps/basket/baskets/:
>> basket[0-9]+/
>>                    |
>>                    \__ .basket               <- the XML file that
>> contains the metadata
>>                    \__ note[0-9]+.html    <- the actual notes
>> referenced inside the .basket file
>>                    \__ note[0-9]+.html
>>                    \......
>>
>> Thanks to your help, the new nepomukintegration::updateMetadata
>> function in the Basket Note Pads, now can update the metadata of the
>> .basket file in the Nepomuk. As a result, one can search for the title
>> or the tags of the basket in the KRunner and when clicking on the
>> search result, the basket would be opened in the Basket Note Pads
>> (thanks to Brian).
>>
>> The next thing would be adding the actual note into the Nepomuk, so
>> that we could search for the note contents.
>>
>> I thought it could be done by indexing the note file and then adding
>> an nie:isPartOf to it, but it seems that I am wrong.
>> I have attached the source code of the nepomukintegration.cpp and the
>> result is something like the following:
>>
>> $ nepomukcmd query "select ?r where { ?r nie:url
>> <file:///home/amir/.kde/share/apps/basket/baskets/basket106/note1.html>
>> . }"
>>
>> <nepomuk:/res/18f7977b-86ca-4161-8b03-b31727e269df>
>> Total results: 1
>> Execution time: 00:00:00.3
>>
>> $ nepomukcmd query "select ?a ?b where {
>> <nepomuk:/res/18f7977b-86ca-4161-8b03-b31727e269df> ?a ?b . }"
>>
>> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
>> <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject>
>> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#lastModified>
>> "2010-10-02T10:22:53.727Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>
>> <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#wordCount>
>> "37"^^<http://www.w3.org/2001/XMLSchema#int>
>> <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName>
>> "note1.html"^^<http://www.w3.org/2001/XMLSchema#string>
>> <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#characterCount>
>> "498"^^<http://www.w3.org/2001/XMLSchema#int>
>> <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#isPartOf>
>> <nepomuk:/res/549cbd4e-22c4-4552-a0f7-4f6503511023>
>> <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#lineCount>
>> "5"^^<http://www.w3.org/2001/XMLSchema#int>
>> <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#lastModified>
>> "2010-08-25T04:18:14Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>
>> <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url>
>> <file:///home/amir/.kde/share/apps/basket/baskets/basket106/note1.html>
>> <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#plainTextContent>
>> "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"
>> \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n<html><head><meta
>> name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\np, li {
>> white-space: pre-wrap; }\n</style></head><body style=\"
>> font-family:\'Sans Serif\'; font-size:9pt; font-weight:400;
>> font-style:normal;\">\n<p style=\" margin-top:0px; margin-bottom:0px;
>> margin-left:0px; margin-right:0px; -qt-block-indent:0;
>> text-indent:0px;\">Can be indexed in
>> basketview.cpp/BasketView::closeEditor</p></body></html>"^^<http://www.w3.org/2001/XMLSchema#string>
>> <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#mimeType>
>> "text/html"^^<http://www.w3.org/2001/XMLSchema#string>
>> <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentSize>
>> "502"^^<http://www.w3.org/2001/XMLSchema#int>
>> Total results: 12
>> Execution time: 00:00:00.1
>>
>> $ nepomukcmd query "select ?a ?b where {
>> <nepomuk:/res/18f7977b-86ca-4161-8b03-b31727e269df> nie:isPartOf ?t .
>> ?t ?a ?b . }"
>>
>> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
>> <http://www.semanticdesktop.org/ontologies/2007/11/01/pimo#Note>
>> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#lastModified>
>> "2010-10-02T10:23:07.004Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>
>> <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName>
>> ".basket"^^<http://www.w3.org/2001/XMLSchema#string>
>> <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url>
>> <file:///home/amir/.kde/share/apps/basket/baskets/basket106/.basket>
>> <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#title>
>> "Basket Note Pads
>> development"^^<http://www.w3.org/2001/XMLSchema#string>
>> <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#mimeType>
>> "application/x-basket-item"^^<http://www.w3.org/2001/XMLSchema#string>
>> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#prefLabel>
>> "Basket Note Pads
>> development"^^<http://www.w3.org/2001/XMLSchema#string>
>> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#hasTag>
>> <nepomuk:/res/2085289f-3366-4d3c-a9c5-0064ce6630f9>
>> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#hasTag>
>> <nepomuk:/res/d06217ba-b63c-48f5-9c31-78d93a155e2c>
>> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#hasTag>
>> <nepomuk:/res/e2642122-636f-44fc-8f5e-fed579aff6f9>
>> Total results: 10
>> Execution time: 00:00:00.3
>>
>>
>>
>>
>> But, unfortunately, when searching for some text in the note using
>> KRunner, it finds the .html file and opens it using a Web Browser.
>>
>> Any suggestions?
>
> I see one very simple solution as a quick-fix:
> Create your own .basket mimetype and store notes in foobar.basket files,
> one note per file. Then the mimetype can be associated with your
> application directly and finding the notes would open them accordingly.
> This would be in par with how applications typically handle files.
>
It is a good idea; I like it very much. Does anyone have anything against it?

> The second solution would be to go the clean way and store the notes in
> Nepomuk only. But that requires the type/application system I mentioned.
> Maybe it is time to create that.
>
> Cheers,
> Sebastian
>

The second solution is more appealing, but I would rather get a
working version with what we have got now. Therefore, I will go with
the first suggestion.

If nobody disagrees, I will start coding soon.

Thanks again Sebastian.


Cheers,
Amir


More information about the Nepomuk mailing list