[Nepomuk] Re: Correct usage of ontologies?

Sebastian Trüg trueg at kde.org
Mon Apr 4 18:26:39 CEST 2011


On 04/04/2011 05:34 PM, Matthias Fuchs wrote:
> Am Montag 04 April 2011, 15:38:39 schrieb Sebastian Trüg:
>> It is a bit weird. Soon Nepomuk will check ranges and domains. Then you
>> will get an error if you try to use a class as a property or use an
>> invalid property value.
> 
> Indeed, I often have a page to the ontologies open, to see how they should be 
> used. But not always.
> 
> In this regard is the code [1] finally correct? ;)
> Using comic as an own tag is kinda redundant there, as it is the super topic 
> of the specific comic anyway. Yet accessing the comics via their super tag 
> does not work yet in Dolphin.
> 
>>>>
>>>> I thought about a generic base like:
>>>>
>>>> nmm:Series
>>>> nmm:TVSeries subclass of nmm:Series
>>>> nmm:ComicSeries subclass of nmm:Series
>>>>
>>>> nmm:Episode
>>>> nmm:TVShow subclassof nmm:Episode
>>>>
>>>> and then we change the range and domain of nmm:series to the base
>>>> classes.
>>>>
>>>> This way we could either add something like nmm:ComicEpisode or just use
>>>> the base class with a nie:title and no numbering and no season
>>>> information.
>>>
>>> Ah I see.
>>> There is still one problem with comics. Meaning that there is no rule.
>>> Some comics are organised liked books into chapters, then into episodes
>>> and then into the strips of the episodes. [1]
>>
>> This is comparable to show, season, episode
>>
>>> At the same time others are organised into volumes, then chapters, then
>>> pages. [2]
>>
>> same as above - only the naming differs really.
>>
>>> Simple ones like Garfiled or XKCD are only "organised" via their number
>>> or date.
>>
>> Here we could have only one "season".
>>
>> So maybe this could work after all - in case the naming of the
>> categorization is not really important we could use the same approach
>> for all.
>>
>> The only question then would be: how to name the base class for Season?
> 
> I am afraid I am not good with terms.
> So what I thought of for a very general case would be something like 
> SeriesItems. Ok, as I said, not good in that. :D
> 
> 
> 
> [1]
> Nepomuk::Resource res(destUrl, NFO::FileDataObject());

the nfo:FileDataObject type is redundant. Nepomuk does handle that
automatically. But it does no harm. You could also use Nepomuk::File.

> Nepomuk::Resource comicTopic("Comic", PIMO::Topic());
> comicTopic.setLabel(i18n("Comic"));
> res.addTag(comicTopic);
> 
> if (!mAdditionalText.isEmpty() ) {
>     res.setProperty(NIE::description(), mAdditionalText);
> }
> if ((mSuffixType == "Date") && !mShownIdentifierSuffix.isEmpty()) {
>     res.setProperty(NIE::contentCreated(), 
> Nepomuk::Variant(QDate::fromString(mShownIdentifierSuffix, Qt::ISODate)));

technically the range of contentCreated is dateTime. But that is ok as
it will soon be converted automatically.

> }
> if (!mComicTitle.isEmpty()) {
>     Nepomuk::Resource topic(mComicTitle, PIMO::Topic());
>     topic.setLabel(mComicTitle);
>     topic.setProperty(PIMO::superTopic(), comicTopic);
>     res.addTag(topic);
> }
> if (!mStripTitle.isEmpty()) {
>     res.setProperty(NIE::title(), mStripTitle);
> }
> if (!mWebsiteUrl.isEmpty()) {
>     Nepomuk::Resource website(mWebsiteUrl, 
> Nepomuk::Vocabulary::NFO::Website());
>     website.setProperty(NIE::url(), mWebsiteUrl);

remove this line. nie:url is handled automatically.

>     res.setProperty(NDO::referrer(), website);

Hm, this is not correct as the domain of ndo:referrer is ndo:DownloadEvent.
You could either create a download event through
Nepomuk::Utils::createCopyEvent[1] or simply use nao:isRelated which
might be simpler but is less correct.

> }
> 
> const QStringList authors = mComicAuthor.split(',', QString::SkipEmptyParts);
> foreach (QString author, authors) {
>     author = author.trimmed();
>     Nepomuk::Resource authorRes(author, NCO::PersonContact());
>     authorRes.setProperty(NCO::fullname(), author);
>     res.addProperty(NAO::creator(), authorRes);
> }

looks good otherwise. :)

Cheers,
Sebastian

[1]
http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk/html/namespaceNepomuk_1_1Utils.html#a8786cf980fcb3139bbedcdf0f8cf6e6f


More information about the Nepomuk mailing list