This page serves as a very simple overview to Nepomuk. It does not deal with Nepomuk internals and focuses on how you can start using Nepomuk in the fastest possible manner. Please keep in the mind that the processes described here are targeted to the general use case. If you have a more specialized use case in mind, this might not be the best way to use the Nepomuk libraries.

This page serves as a very simple overview to Nepomuk. It does not deal with Nepomuk internals and focuses on how you can start using Nepomuk in the fastest possible manner. Please keep in the mind that the processes described here are targeted to the general use case. If you have a more specialized use case in mind, this might not be the best way to use the Nepomuk libraries.

Revision as of 16:37, 1 August 2012

This page serves as a very simple overview to Nepomuk. It does not deal with Nepomuk internals and focuses on how you can start using Nepomuk in the fastest possible manner. Please keep in the mind that the processes described here are targeted to the general use case. If you have a more specialized use case in mind, this might not be the best way to use the Nepomuk libraries.

Contents

Basic Terminology

Nepomuk is centred around a main 'Resource' class. For simple, non-high performance access to Nepomuk, it is recommended that you use the Resource class.

Everything in Nepomuk is a Resource. Each Resource has a number of properties associated with it, which are stored as (key, value) pairs. They keys are referred to as properties or predicates, and the values are referred to as the objects.

Every file, folder, contact or tag is a Resource.

Dealing with Tags

Every tag in Nepomuk is a Resource. In fact the Tag class is also derived from the Resource class.

Setting Tags

The 'Nepomuk2::Tag' class will automatically look for for a tag called "Awesome-Tag-Name", it is finds it then Tag::exists() will return true. Otherwise, the tag will be saved the first time the tag is used. In our case, when we add the tag to the Resource via Resource::addTag(), the tag will be saved.

Retrieving Tags

Every resource has a predefined function for retrieving all the Tags any resource is tagged with - Resource::tags(). The Resource::genericLabel() function tries to find a presentable name for any resource. In the case of tags, it returns the tags name.

Listing all the Tags

The simplest way to list all the tags that are present in Nepomuk is via a static function - Tag::allTags(). You, however, need to be careful using this in a production environment as it executes a blocking query in the background. Depending on the number of tags on the system, it could take some time.

Dealing with files

Every file in Nepomuk is represented as a resource. Since dealing with files is very common, we provide a special File class which is derived from the Resource class. We also provide convenience functions for checking if a resource is a file.