Saturday, March 26, 2011

Semantic Desktop In Ubuntu With Nepomuk

There is an incredibly interesting feature in last KDE releases, called Nepomuk. There are many posts here and there about it. Basically, it enables what is called "Semantic Desktop". This means that all files on the file system are not just files, but they have some special meta-information about them and can be grouped and organized easily using this information.

There were some efforts before to do this for a limited category of files: ID3 tags in MP3, EXIF fields in images, author/date/words count/etc fields in office documents and so on. It's clear enough that it would be nearly impossible to work with audio library without ID3 tags.

Nepomuk tries to federate all the efforts and even give much more, being able to collect all existing information + index full text of documents + assign custom tags to any group of files + integrate with as many applications as possible, giving wholly new platform. You even don't need to know, where your file is actually stored. You just type key-words and all related files appear in one unified list.

The classical example is when you plan a trip, you buy tickets online, order hotels, collect articles about places you plan to see. After the trip you must have many photos, videos, maps. So when you type "paris holidays" you get all those things at once in one list, you should not collect them manually from different places.

All this is very helpful and Nepomuk is platform-independent and can be used in any environment. Unfortunately, the only useful implementation of Nepomuk I know is made for KDE. I'm not aware of any serious alternative designed for GNOME, which is ready for production. I'm used to use GNOME in Ubuntu and I'm not ready to switch to KDE, because it is too slow for my home PC, Kubuntu is much less supported, than Ubuntu, it cannot scale appropriately on my 50" TV and is buggy as hell. But I know that some soft from KDE works perfectly under GNOME, that's why I decided to try to run KDE-Nepomuk in GNOME. It may not give you such a big range of options, as it can do in KDE, but nevertheless it is still very, very useful.

Here is a short explanation of how you can use Nepomuk's features in Ubuntu/GNOME. To enable those features in GNOME, you basically need just 2 things: Dolphin file manager and Nepomuk server itself. Optionally you can install KDE System Settings application to be able to control Nepomuk's work as well as to be able to make Dolphin look similar to Nautilus and all other Ubuntu GTK-based apps. From my taste Dolphin is also much more useful than the default Nautilus. It is very fast compared to Nautilus (which may hang on my machine for 10 seconds just to open a folder with 100 files), is highly configurable, can display all information about selected file in a side panel and of course it has fantastic search based on Nepomuk.
Terminology:
Nepomuk - Semantic Desktop Platform.
Strigi - file search/indexing tool, which KDE-Nepomuk uses under the hood.
Virtuoso - RDF-based document-oriented non-relational database, where Nepomuk stores meta-information.

Installation Process

  1. Install Dolphin, Nepomuk and KDE System Settings (Dolphin already has all needed dependencies, including Nepomuk, so no need to specify explicitly):
    sudo apt-get install dolphin systemsettings gtk2-engines-qtcurve
  2. Try to call "nepomukserver" from terminal, just to make sure it is installed and works. It should give many outputs, which mean that it started indexing files.
  3. Add "nepomukserver" command to Startup Applications
  4. Restart Gnome session - Nepomuk will start automatically and run Strigi indexer
The indexing takes quite some time, depending on the number of files and folders under indexer. For my computer it took several hours, because I had large collection of music, films and books. There should appear and icon in the tray, which indicates the indexing process. You may open a menu on this icon, select "Configure File Indexer" and watch the current process of indexing. You can also choose, which folders Strigi must index, in the same dialog window. Another way to open this window is from KDE System Settings -> Desktop Search, which can be issued from terminal with "systemsettings" command. You may find useful to leave Desktop Search window open to watch the indexing process until it is finished.

In the meantime, run Dolphin, select some file (e.g. MP3) and press F11 - it will show a side panel with all meta-information about selected file. Until the indexing process is finished you may see strange incorrect information in Dolphin for imported file properties. For example, ID3 tags may contain something like ":aksdfh". This should change to normal when the indexing is over. You can control the indexing process from Desktop Search dialog described above.

The indexer also still contains some bugs. It may fail on some files. You can see, which file is problematic, by watching the indexing process in Desktop Search dialog. If you find that some folder with files cannot be indexed and Strigi fails on this folder, then you can exclude this folder from indexing from the same dialog, then click Apply and indexing process will start again (no worries, it will quickly skip all already indexed files and concentrate on not yet indexed ones).

Gnomifying Dolphin

While the search is going on, you can make Dolphin look more like a GNOME native GTK-based application (similar to how Nautilus looks like).


  1. Run in terminal: kbuildsycoca4 --noincremental
    Don't pay attention to warnings it will give you.
  2. Run systemsettings command from Terminal or from Alt-F2.
  3. Open Application Appearance.
  4. In section Style change Widget style to GTK+
  5. In section Icons select something related to the current Ubuntu theme in Gnome. For example, I chose "Ubuntu-Mono-Dark"
  6. Apply changes
  7. Open Dolphin and make sure it looks like other applications in Gnome
Making Dolphin A Default File Manager

Since we now use Dolphin, you can make it a default file manager in your Ubuntu desktop.
  1. Right click on Applications / Places / System menu, select "Edit Menus"
  2. In the section Other change commands in both "File Manager" and "Open Folder" items from what they currently have to just "dolphin"
  3. That's all. Open Places -> Home Folder to make sure it is now opened in Dolphin
After Indexing Is Finished

When the Desktop Search dialog shows that indexing finished, you may try Nepomuk in action.
  1. Open Dolphin, choose some file (e.g. MP3) and remember its properties. Then type the value of one property in the "Search..." box and see if the file appears in the list
  2. Assign several tags to a group of different files and search for the tags
  3. Search for text content in one of your PDF or office documents
Now you can organize your media collections using existing properties and custom tags, group files by their meaning, assign comment to files, rate them and so on. Potentially its possible to integrate different applications, not only Dolphin, with Nepomuk, but this is a topic for another post.