Nepomuk(語義桌面)

From KDE Wiki Sandbox
Revision as of 08:29, 27 August 2012 by FuzzyBot (talk | contribs) (Updating to match new version of source page)

Nepomuk

這個頁面的目的不是詳細解釋Nepomuk技術及其每個細節,而是作簡短的概述,舉一些例子,分享其背後的設想和給予指向網上相關資訊的鏈接。

簡短說明

術語提到的,Nepomuk有關數據的分類,組織和表達。它並非是一個應用程序,而是可以被開發人員應用在程序中的組件。

試用

舉例來說,Dolphin採用了 Nepomuk。對於後面例舉的必須保證系統設置-> 桌面搜索 的 Nepomuk 和 Strigi 都已經開啟。 Dolphin的信息側面板允許你給文件打上標籤,評分和評論。這些信息隨後存儲在 Nepomuk 並且被 Strigi 編入索引。然後你可以在 Dolphin 裡用導航欄搜索元數據(metadata)。輸入"nepomuksearch:/",隨後是搜索詞。


功能

Nepomuk 提供數'層'功能給應用程序。第一個也是其中最簡單的是手動標記(manual tagging),評分(rating)和註釋(commenting),如使用在Dolphin中。這有助於你更快的找到你的文件,但這種做法太耗費精力。

為了使得搜索包含文本的文件更容易,Nepomuk 提供了第二個功能:索引(indexing)文件中的文本。它使用一種被稱作Strigi 的技術來實現。現在你也能通過輸入你所已知的其中某些詞語,或僅僅(部分)它們的標題來搜索到文件。

第三層非常複雜,是Nepomuk 被視為歐盟(European union)多個公司和大學研究項目的原因。這部分你會遇到很難理解的詞組像是'語義桌面(semantic desktop)'和'本體論(ontologies)'。基本上,它涉及到語境(context)和關係(relationships)。

Indexing files

Strigi does not index every file on the hard drive. Its default configuration in most Linux distributions excludes some common patterns for backup files and configuration directories, and it only indexes certain directories in your home folder. You can change this in System Settings -> Desktop Search -> Desktop Query -> Customize index folders… -> Folders to index.

Note that Strigi as of KDE 4.7 does not follow symbolic links (bug #208602), even if you select folders under the symbolic link for indexing (bug #287593) for index. (A symbolic link is a file that "points" to another file or directory; Dolphin displays symbolic links in italic .) You must find the path to the actual directory (in Dolphin, select the file, choose Properties -> General -> Points to) and tell Strigi to index that.

In System Settings you can also control whether Strigi indexes files on removable media such as USB drives and CD-ROMs.

例子

讓我試著用兩個例子解釋Nepomuk 提供了什麼。

關係(Relationship)

假設你2週前從你的某個好友手上收到一張照片。你隨後保存照片到電腦的某個地方。現在你如何找到那個文件哪?如果你不記得保存的位置,你就杯具了(人生是個茶几,你是個杯具)。

現在 Nepomuk 旨在幫助你。你知道這個文件是你朋友發給你的,但你電腦不知道。然而,Nepomuk 能夠記得這個關係。搜索你朋友的名字,隨後便會出現照片哦!

另一個潛在的關係是在你複製出來文本的網頁和你粘貼文本進去的文檔之間,抑或顯示同一輛車的兩幅圖片之間。這樣的關係有時能從文件本身上獲得(你能夠分辨照片,看出誰或什麼東西在那上面)或由關聯的程序(上面E-mail 的例子)提供。 Nepomuk 的這部分還是加緊開發中,需要整合進應用程序,所以你可以期望這功能花費更多年真正實現。切~~( ﹁ ﹁ )

總之,Nepomuk 的這部分是有關使得搜索智能。試想下Google 是如何智能化你的搜索:當你搜索旅店和城市名,它在網站搜索結果之上顯示google 地圖顯示你提到的那個城市中的各家旅店!它甚至可能推荐一個更適合的名稱以免你犯了拼寫錯誤。 Google 對網站之間的關係(鏈接)使用複雜計算,試著將最相關的信息放置在搜索結果的頂部。 Nepomuk 會能夠提供那樣智能的搜索結果,並用關聯信息根據相關性調整搜索結果。

語境(Context)

這些關係(relationships)不但能幫你搜索文件,也會影響到應用程序及它們提供的信息。注意這種使用Nepomuk 的方式說是設想更恰當而非現實!當中很多組件已經做好,但總體上看都還沒整合進應用程序和桌面。

這裡有個例子講把語境認知(context awareness)帶到桌面上助你工作更有效率。

比如說你正在整理會議上摘的筆記。這時手機響了,某人問你要帶報價的電子表格,還要你根據客戶要求進行修改。再多來幾個打擾後,你會發現整個桌面全是文件和窗口...

如果能更好的組織這一切會非常棒,對嗎?

進入'活動'。之前有在Plasma 中介紹過,當前提供了另類的'桌面'。它們有點像虛擬桌面,但改變的是桌面本身,不是程序集。不同的部件,壁紙之類的東西。當然,自 KDE SC 4.3 後,每個虛擬桌面能夠擁有自個的活動,虛擬桌面和活動是同步的。

如果程序和桌面認識活動,你可以根據經常工作的任務創建活動。所以如果你經常不得不修改帶報價的電子表格,你創建這樣一個活動:擺放一個「文件夾視圖」(或多個)部件到桌面上,添加一個計算器和一個todo 部件來記錄還需要修改的東西。可能需要一個「郵件文件夾」部件來顯示有關報價表問題的郵件!

一旦有人問報價問題,你就切換到這個活動。打開表格程序。表格程序認識你的活動,它的最近打開列表顯示的是報價表格,不是你在另外一個活動工作的存貨清單! Kopete,這個聊天程序顯示著某個知道有關價格的同事,因為她是你經常在當前這個活動聊天的對象。

等你完成後,你回到另外一個活動,所有程序再一次調整它們的行為來適應你當前的工作。

這樣一個基於活動的工作流程的收益會遠遠超越你最初的期望。它不但能幫你找到文件和聯繫人,還有助於切換任務本身。人腦不擅長多任務-人類切換任務後需要花費幾分鐘來達到正常速度。改變'環境'能大大加快反應,即使只是屏幕上的。把它跟你假日收拾包裹時的情緒對比下!

當然,上面所述很大程度與電腦後頭工作的人是在辦公室還是在家有關。遊戲玩家或臨時用戶可能不太會用到這些活動。

注意上面描述的情節仍舊離現實很遠。基礎的東西在 KDE 中已經有了,但其他部分缺很大。

Frequently Asked Questions

The following is taken from a KDE forums post. Please feel free to add/remove/modify details if you have the time!

Q. What is the Nepomuk Semantic Desktop, and the Strigi Desktop File Indexer?

A. The Nepomuk Semantic Desktop is the foundation of the all the other modules of the Nepomuk infrastructure. It provides a way to organize, annotate and build relationships among the data (not only file name and content, but for example which applications used a certain file, or how it is tagged). A number of KDE applications and workspaces use this basic infrastructure to deliver features such as email tagging (KMail) or activity setup (Plasma).

On the other hand, the Strigi Desktop File Indexer is a system to index files so that they can be added to the main Nepomuk repository, a convenient way to use them within Nepomuk without adding any file manually. Also, applications such as Dolphin can then search for files basing on content, name, or other meta-data (e.g. tags) associated to indexed files. Such an indexer can also index non-text files, such as PDFs, by accessing the meta-data contained in these files (author, publication information, etc.). Some KDE components ship additional "analyzers" for more file types. Nepomuk can be fully functional without the use of the File Indexer, which is an additional (and optional) component.

Q. How can I tell if Strigi has indexed a file?

A. In Dolphin, select the file. If the Information panel displays "Created at" and "Has hash", then the file was indexed by Strigi.

Q. How can I disable the semantic desktop?

A. Most of the times, the easiest way is to disable file indexing, which is usually, among the Nepomuk components, the heavier in resource usage (although many optimizations have been included in the 4.7 release which reduce resource usage). This is done by unchecking Enable Strigi Desktop File Indexer in the Desktop Search section of System Settings. In case you want to turn off all semantic features, uncheck Enable Nepomuk semantic desktop. Notice that this will turn off search in Dolphin as well.

Notice that with the latter option some programs who use Nepomuk for meta-data will offer reduced functionality: for example KMail will not be able to tag mail, or Plasma activities will not offer additional features such as icons, or program data information.

Q. Why do I have nepomukservicestub processes even though I've disabled Nepomuk?

A. It may be a bug. Please file a bug report with a complete description of your problem and the steps to trigger it.

Q. File indexing of PDF/some other file types doesn't work.

A. PDF indexing is a known issue and it's being tracked in bug #231936. If you have issues with other files, open a bug, preferably adding a sample file that shows the problem.

Q. The program nepomukservicestub crashes at startup.

A. A large number of fixes for crashes has been fixed for the 4.7.2 release of the KDE Workspaces and Applications. If you encounter more, please file bugs report with detailed instructions on how to reproduce the problem, as sometimes the developers are unable to trigger them in their test setups.

Q. The virtuoso-t process hangs at 100% CPU.

A. Virtuoso-t is a key component of the Nepomuk infrastructure and in some occasions the commands sent by the other components end up taking too much time (hence showing the effect of 100% CPU). Sebastian Trüg (the lead developer of Nepomuk) has fixed most of these problems in 4.7.1 or newer.

Q. Sometimes Nepomuk consumes too much RAM.

A. Many of these problems have been fixed, in other cases however the developers are unable to reproduce the issues correctly. In this case, providing examples and test cases to bug reports increase the chances to get these bugs fixed.

Q. Nepomuk re-indexes files at startup.

A. This bug has been fixed in 4.7.0 versions. Now Nepomuk just "scans" for changes, without indexing anything.

Q. Nepomuk accesses the disk too much on startup.

A. In 4.7 and newer this problem has been lessened thanks to a throttling mechanism implemented in the file indexer.

Q. My Nepomuk database has been corrupted. How do I clean it?

A. In the extreme case your database is really corrupted and all other attempts have failed, you can delete the $KDEHOME/share/apps/nepomuk directory (where $KDEHOME is usually .kde or .kde4) while Nepomuk is not running. The database will be cleared, but you will also lose existing information such as tags, ratings and comments.

Advanced troubleshooting

If Nepomuk has trouble indexing a file, in a terminal try running

nepomukindexer /path/to/file

and see if there's any useful output. You can compare the output to a similar file that is successfully indexed.

xmlindexer /path/to/file > /tmp/test.xml

generates an XML representation of some of the information extracted from a file. You can view this in an XML viewer, such as your browser, and again compare it to the output for a similar file. (xmlindexer may be in a different and optional package in your Linux distribution; for example in Ubuntu it is in the strigi-utils package.)

This blog post explains how to turn on debugging output from the Nepomuk service. It also shows how to debug the CPU usage of Nepomuk and its storage backend.

This blog post explains how to extract useful information for bug reports about the CPU usage of the Virtuoso backend.

共享和隱私

在給出其它鏈接前我要指出的是:共享Nepomuk 數據。如果你的標記(tags),評分(ratings)和註釋(comments)能夠在你發送文件給其他人時同時共享給他會很棒。但是,要是你給一個聯繫人打上了“麻煩”的標籤('在床上煩人'),然後發送這個聯繫人的信息給一個共同的好友,但你又不希望這個標籤也一併發送過去...

這個問題當然在考慮之中,是Nepomuk 研究的一個重要課題。由於這些隱私顧慮,外加技術挑戰,所以暫時Nepomuk 內容是私有的。放心,Nepomuk 團隊盡其可能尊重你的隱私。

更多信息
Wikipedia - Semantic Desktop
Wikipedia - NEPOMUK Framework
NEPOMUK website
NEPOMUK KDE site
article explaining Nepomuk on the DOT