[Nepomuk] Re: Question regarding usage of Nepomuk::Vocabulary::PIMO::hasPart ()

Sebastian Trüg trueg at kde.org
Sun Oct 31 08:46:46 CET 2010


On 10/30/2010 06:48 PM, Christian Mollekopf wrote:
> On Friday 29 October 2010 15:47:54 Sebastian Trüg wrote:
>> Hi Christian,
>>
>> On 10/29/2010 10:38 AM, Christian Mollekopf wrote:
>>> Instead of adding an note to a topic with the isPart relation, i added
>>> now the topic as property to the note.
>>>
>>> The Topic is a Nepomuk::Thing("MyTopic",
>>> Nepomuk::Vocabulary::PIMO::Topic())
>>
>> this is correct.
>>
>>> The note is a Nepomuk::Resource(akonadiItemUri)
>>
>> this is ok, too.
>>
>>> and i add the property like this:
>>> setProperty(Nepomuk::Vocabulary::PIMO::Topic(), Nepomuk::Thing("MyTopic",
>>> Nepomuk::Vocabulary::PIMO::Topic()));
>>
>> this is completely wrong. You cannot use a class as a property.
>> Instead you should use pimo:isRelated() to relate a note to a topic and
>> pimo:groundingOccurrence() to relate the note to the akonadi resource.
>> Thus, that gives us:
>>
>> Nepomuk::Thing note( QUrl(), Nepomuk::Vocabulary::PIMO::Note() );
>> Nepomuk::Thing topic( "My topic", Nepomuk::Vocabulary::PIMO::Topic() );
>> Nepomuk::Resource akonadiRes(akonadiItemUri);
>> note.addGroundingOccurrence(akonadiRes);
>> note.addProperty(Nepomuk::Vocabulary::PIMO::isRelated(), topic);
> 
> But isn't the Nepomuk::Thing unique for each type?
> I mean there are many notes (the grounding occurrences) but only one 
> Nepomuk::Thing of the type PIMO::Note().
> So if i set then the Nepomuk::Thing related to the topic, this would mean that 
> all notes are related to the topic, but I want to relate only one single note 
> to the topic.

Basically each akonadi res (the note data) should have its own
pimo:Thing. The simplest way to get that is via Resource::pimoThing(). I
forgot to mention that before:

Nepomuk::Thing topic( "My topic", Nepomuk::Vocabulary::PIMO::Topic() );
Nepomuk::Resource akonadiRes(akonadiItemUri);
Nepomuk::Thing note = akonadiRes.pimoThing();
note.addType(Nepomuk::Vocabulary::PIMO::Note());
note.addProperty(Nepomuk::Vocabulary::PIMO::isRelated(), topic);

> so can i just do
> akonadiRes..addProperty(Nepomuk::Vocabulary::PIMO::isRelated(), topic); 
> above code?

no, please add it to the note.

Cheers,
Sebastian

>>
>> I suppose pimo:isPartOf can be used to model a hierarchy between notes
>> or topics. But a note is not actually part of a topic. IMHO that would
>> not make sense.
> 
> Agreed, i will use it only for the hierarchy then.
> 
> Thanks for your help,
> 
> Christian
> 
>>
>> maybe Leo (the author of PIMO) can tell me if I got the details right.
>>
>> Cheers,
>> Sebastian
>>
>>> I did not yet create the hiarchy of topics, but plan to do so with the
>>> isPart relation (could not yet figure out how that works).
>>>
>>> The solution i have now works for me, but I wonder if this is the correct
>>> way to do things, or if it would make more sense to use the isPart
>>> relation.
>>>
>>> Cheers,
>>>
>>> Christian
>>>
>>> On Thursday 28 October 2010 13:53:59 Christian Mollekopf wrote:
>>>> Hi,
>>>>
>>>> I'm currently prototyping an application for handling
>>>> Notes/Tasks/Events. While i use akonadi items for storing the notes,
>>>> and the existing akonadi classes is want to use nepomuk to model the
>>>> relations between them.
>>>>
>>>> I know there are already other efforts in this direction namely kjots,
>>>> basket, semnotes, and i will eventually see how to integrate, share
>>>> code, merge, or whatever =)
>>>>
>>>> For manual organisation I want to use "Topics". I.e this will allow a
>>>> treestructure like the notes in kjots, but also allow notes to be in
>>>> several "Topics" at the same time.
>>>>
>>>> So my understanding of how that should work (i will talk only about
>>>> notes for simplicity):
>>>> -I create a Pimo::Note resource for each note and set the akonadi uri as
>>>> identifier
>>>> -I create a Pimo::Thing of the type Nepomuk::Vocabulary::PIMO::Topic()
>>>> for each topic
>>>>
>>>> For the relation between topics (hiarchy), and adding items to a topic,
>>>> i want to use the Nepomuk::Vocabulary::PIMO::hasPart() relation
>>>> (respectively isPart() but that is not existing).
>>>>
>>>> So for an example hiarchy:
>>>>
>>>> "Topic1->Subtopic1->Note1"
>>>>
>>>> which would read as:
>>>>
>>>> "Note1 isPartOf Subtopic1 isPartOf Topic1"
>>>>
>>>> I hope this is the correct way to do things, but my problem is, i don't
>>>> understand how to use the Nepomuk::Vocabulary::PIMO::hasPart() relation.
>>>>
>>>> Specifically, how can i set Note1 to be part of Subtopic1, and how can i
>>>> check if Note1 is part of Subtopic1.
>>>>
>>>> A Codeexample would be greatly appreceated.
>>>>
>>>> In case it matters:
>>>> i found Nepomuk::Vocabulary::PIMO::hasPart() and
>>>> Nepomuk::Vocabulary::PIMO::Topic() in pimo.h which i believe is the
>>>> ontology?
>>>>
>>>> Thanks for you help,
>>>>
>>>> Christian
>>>> _______________________________________________
>>>> 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
> 


More information about the Nepomuk mailing list