Projects/Nepomuk/Resources

Projects | Nepomuk
Revision as of 09:52, 23 August 2012 by Vishesh (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Nepomuk Resource class is undoubtedly the most user visible and used class. It serves as a very convenient abstraction over the statements.

= Nepomuk Resource Generator

While it is fairly convenient to use the setProperty and getProperty methods. It requires you to explicitly define the property which you need modify. This can get quite cumbersome and destroys readability of the code.

In order to improve this situation we have provided a resource generator, which generates custom Resource classes from the ontologies. It relies on a CMake macro to accomplish that.

nepomuk2_add_ontology_classes (SRCS
    ONTOLOGIES
    ${SHAREDDESKTOPONTOLOGIES_ROOT_DIR}/nie/nie.trig
    ${SHAREDDESKTOPONTOLOGIES_ROOT_DIR}/nie/nco.trig
    ${SHAREDDESKTOPONTOLOGIES_ROOT_DIR}/pimo/pimo.trig
)


This will generate a C++ class for each type defined in the mentioned ontologies.

#include "personcontact.h"
 
Nepomuk2::PersonContact spiderman;
spiderman.setFullName( QLatin1String("Peter Parker") );
QString name = spiderman.fullname();

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal