[Nepomuk] Re: Using nfo:OperatingSystem

Sebastian Trüg trueg at kde.org
Tue May 3 11:26:03 CEST 2011


On 04/24/2011 05:13 PM, Matthias Fuchs wrote:
> Am Sonntag 24 April 2011, 15:45:10 schrieb Matthias Fuchs:
>> Hi there,
>>
>> I have another question regarding ontologies.
>> The Metalink specification supports OS fields, these contain the OS a file
>> is for.
>> E.g. "test.exe" could have "Windows XP", "Windows Vista", "Windows 7" ...
>> assigned to it. [1]
>>
>> Now I wonder how I should assign these oses to the downloaded file.
>>
>> Suppose we have a Nepomuk:Resource dest (the downloaded file), would the
>> following be ok?
>>
>> QList<Nepomuk::Resource> oses;
>> foreach (const QString &osString, osStrings) {
>>   Nepomuk::Resource os(osString, NFO::OperatingSystem);
>>   os.setLabel(osString); //or rather os.setProperty(NIE::title(),
>> osString)? }
>> dest.addProperty(NIE::hasLogicalPart(), oses);
>> //especially here I am not sure, how to correctly connect an
>> InformationElement with a DataObject. Basically I want to say the file
>> works on these oses.
>>
>> Thanks for reading! :)
>>
>>
>> [1] Which terms to use, e.g. rather Windows Nt ... is not that clear in the
>> spec.
>> _______________________________________________
>> Nepomuk mailing list
>> Nepomuk at kde.org
>> https://mail.kde.org/mailman/listinfo/nepomuk
> 
> Uah, now I just realised, that nie:title, nie:version, nie:language ... all 
> are in the domain of InformationElement.
> 
> Does that mean that
> Nepomuk::File file(url);
> file.setProperty(NIE::language, "de");
> would be wrong?

No, that is ok in Nepomuk since file resources are always double-typed:
they are a nie:DataObject and a nie:InformationElement. Conceptually
they are two things but in practice we merge them for simplicity. Thus,
the code above is correct.

> Should I rather use -- in the context of the first post:
> 
> Nepomuk::File file(url);
> Nepomuk::Resource res(url, NIE::Executable());

no, never do that.

> Nepomuk::Resource os("Linux X86", NFO::OperatingSystem());
> os.setLabel("Linux X86");
> 
> res.setProperty(NIE::language(), "de");
> res.setProperty(NIE::version(), "4.0");
> res.setProperty(NIE::description(), "Pretty cool file.");
> res.setProperty(?????, os);
> 
> file.setProperty(NIE::interpretedAs(), res);

this is something Nepomuk would do internally. You should never do that.

> If I should do it that way it would be quite complicated since I'd have to 
> figure what type the InformationElement should use.

Exactly. So no - forget about that. :)

Cheers,
Sebastian

> _______________________________________________
> Nepomuk mailing list
> Nepomuk at kde.org
> https://mail.kde.org/mailman/listinfo/nepomuk
> 


More information about the Nepomuk mailing list