<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://techbase.kde.org/skins/common/feed.css?0.2"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://techbase.kde.org/index.php?title=Projects/Nepomuk/QuickStart/en&amp;feed=atom&amp;action=history</id>
		<title>Projects/Nepomuk/QuickStart/en - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://techbase.kde.org/index.php?title=Projects/Nepomuk/QuickStart/en&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Projects/Nepomuk/QuickStart/en&amp;action=history"/>
		<updated>2013-05-23T23:10:21Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.20.2</generator>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Projects/Nepomuk/QuickStart/en&amp;diff=78721&amp;oldid=prev</id>
		<title>FuzzyBot: Updating to match new version of source page</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Projects/Nepomuk/QuickStart/en&amp;diff=78721&amp;oldid=prev"/>
				<updated>2013-04-07T18:24:18Z</updated>
		
		<summary type="html">&lt;p&gt;Updating to match new version of source page&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 18:24, 7 April 2013&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 51:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 51:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The [http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk-core/html/classNepomuk2_1_1Tag.html &amp;lt;tt&amp;gt;Nepomuk2::Tag&amp;lt;/tt&amp;gt;] class will automatically look &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;for &lt;/del&gt;for a tag called &amp;quot;Awesome-Tag-Name&amp;quot;, it &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/del&gt;finds it then [http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk-core/html/classNepomuk2_1_1Resource.html#a3c58ca2096f8424e12f31ddd73369597 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 [http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk-core/html/classNepomuk2_1_1Resource.html#a649e935b3557d0c5015ab7728f623f66 Resource::addTag()], the tag will be saved.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The [http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk-core/html/classNepomuk2_1_1Tag.html &amp;lt;tt&amp;gt;Nepomuk2::Tag&amp;lt;/tt&amp;gt;] class will automatically look for a tag called &amp;quot;Awesome-Tag-Name&amp;quot;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;if &lt;/ins&gt;it finds it then [http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk-core/html/classNepomuk2_1_1Resource.html#a3c58ca2096f8424e12f31ddd73369597 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 [http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk-core/html/classNepomuk2_1_1Resource.html#a649e935b3557d0c5015ab7728f623f66 Resource::addTag()], the tag will be saved.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Retrieving Tags ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Retrieving Tags ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 84:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 84:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Tag tag(&amp;quot;Awesome-Tag-Name&amp;quot;);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Tag tag(&amp;quot;Awesome-Tag-Name&amp;quot;);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;QList&amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Resoruce&lt;/del&gt;&amp;gt; taggedResources = tag.tagOf();&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;QList&amp;lt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Resource&lt;/ins&gt;&amp;gt; taggedResources = tag.tagOf();&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;foreach(const Resource&amp;amp; res, taggedResources)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;foreach(const Resource&amp;amp; res, taggedResources)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>FuzzyBot</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Projects/Nepomuk/QuickStart/en&amp;diff=77187&amp;oldid=prev</id>
		<title>FuzzyBot: Updating to match new version of source page</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Projects/Nepomuk/QuickStart/en&amp;diff=77187&amp;oldid=prev"/>
				<updated>2012-12-10T17:25:12Z</updated>
		
		<summary type="html">&lt;p&gt;Updating to match new version of source page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;languages /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Scope of this page ==&lt;br /&gt;
&lt;br /&gt;
This page serves as a very simple overview to '''Nepomuk'''. It focuses on getting started with '''Nepomuk''' and tries not to deal with internal '''Nepomuk''' concepts. 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.&lt;br /&gt;
&lt;br /&gt;
==Libraries and Headers==&lt;br /&gt;
&lt;br /&gt;
Most of the non graphic parts of '''Nepomuk''' are present in the [https://projects.kde.org/projects/kde/kdelibs/nepomuk-core NepomukCore repository]. It is shipped with KDE 4.9, and should be provided by your distribution. When starting with '''Nepomuk''' development, it would be better to stick with your distribution version.&lt;br /&gt;
&lt;br /&gt;
With KDE 4.9, the '''Nepomuk''' libraries moved to the Nepomuk2 namespace. The headers also follow a similar convention.&lt;br /&gt;
&lt;br /&gt;
=== Headers ===&lt;br /&gt;
&lt;br /&gt;
All the '''Nepomuk''' headers in are preceded by Nepomuk2. Here are some common '''Nepomuk''' includes that are frequently used -&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;Nepomuk2/Tag&amp;gt;&lt;br /&gt;
#include &amp;lt;Nepomuk2/Resource&amp;gt;&lt;br /&gt;
#include &amp;lt;Nepomuk2/ResourceManager&amp;gt;&lt;br /&gt;
#include &amp;lt;Nepomuk2/File&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CMake ===&lt;br /&gt;
&lt;br /&gt;
KDE Projects generally use cmake as a build tool. '''Nepomuk''' is no different. In order to use '''Nepomuk''' you need to add the relevant macros for '''Nepomuk''' in your CMakeLists.txt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
find_package(NepomukCore REQUIRED)&lt;br /&gt;
target_link_libraries(myfile ${NEPOMUK_CORE_LIBRARY} )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Basic Terminology ==&lt;br /&gt;
&lt;br /&gt;
At the lowest level '''Nepomuk''' is just a database which many applications use to store data. The main difference is that the data is not stored in rows and columns like traditional relational databases. Instead '''Nepomuk''' can be viewed as something similar to an object or document store. We store a large number of objects, and each of these objects have (key, value) pairs attached to them.&lt;br /&gt;
&lt;br /&gt;
Each object in our database is called a Resource. Everything in '''Nepomuk''' revolves around resources. All the higher level concepts such as files, tags, contacts, music albums, actors, etc. they are all Resources. Each of these resources has a number of (key, value) pairs associated with it. In the '''Nepomuk''' world, the keys are called properties or predicates, and have already been defined.&lt;br /&gt;
&lt;br /&gt;
'''Nepomuk''' is also based around a concept called the Semantic Web. However, understanding the ideas and details behind the Semantic Web is not necessary.&lt;br /&gt;
&lt;br /&gt;
== Tags and Ratings ==&lt;br /&gt;
&lt;br /&gt;
Every tag in '''Nepomuk''' is a Resource. In fact the [http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk-core/html/classNepomuk2_1_1Tag.html Tag class] is also derived from the [http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk-core/html/classNepomuk2_1_1Resource.html Resource class].&lt;br /&gt;
&lt;br /&gt;
=== Setting Tags ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
Nepomuk2::Tag tag( &amp;quot;Awesome-Tag-Name&amp;quot; );&lt;br /&gt;
Nepomuk2::Resource res( url );&lt;br /&gt;
res.addTag( tag );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The [http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk-core/html/classNepomuk2_1_1Tag.html &amp;lt;tt&amp;gt;Nepomuk2::Tag&amp;lt;/tt&amp;gt;] class will automatically look for for a tag called &amp;quot;Awesome-Tag-Name&amp;quot;, it is finds it then [http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk-core/html/classNepomuk2_1_1Resource.html#a3c58ca2096f8424e12f31ddd73369597 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 [http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk-core/html/classNepomuk2_1_1Resource.html#a649e935b3557d0c5015ab7728f623f66 Resource::addTag()], the tag will be saved.&lt;br /&gt;
&lt;br /&gt;
=== Retrieving Tags ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
using namespace Nepomuk2;&lt;br /&gt;
&lt;br /&gt;
Resource res( url );&lt;br /&gt;
QList&amp;lt;Tag&amp;gt; tags = res.tags();&lt;br /&gt;
foreach(const Tag&amp;amp; tag, tags)&lt;br /&gt;
    kDebug() &amp;lt;&amp;lt; tag.genericLabel();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every resource has a predefined function for retrieving all the Tags any resource is tagged with - [http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk-core/html/classNepomuk2_1_1Resource.html#a286c2e37f975e58e38aaa83903040910 Resource::tags()]. The [http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk-core/html/classNepomuk2_1_1Resource.html#ad8d16485bdc9788de60bf5784141bcac Resource::genericLabel()] function tries to find a presentable name for any resource. In the case of tags, it returns the tags name.&lt;br /&gt;
&lt;br /&gt;
=== Listing Tags ===&lt;br /&gt;
&lt;br /&gt;
The simplest way to list all the tags that are present in '''Nepomuk''' is via a static function - [http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk-core/html/classNepomuk2_1_1Tag.html#a03bc6a42a14003aca17e8c3e02f43d17 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. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
using namespace Nepomuk2;&lt;br /&gt;
&lt;br /&gt;
QList&amp;lt;Tag&amp;gt; tags = Tag::allTags();&lt;br /&gt;
foreach(const Tag&amp;amp; tag, tags)&lt;br /&gt;
    kDebug() &amp;lt;&amp;lt; tag.genericLabel();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are also convenience functions to list all the resources that have been assigned a particular tag - [http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk-core/html/classNepomuk2_1_1Tag.html#a04256e4dda504e5b021afcab0ba4b714 Tag::tagOf]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
using namespace Nepomuk2;&lt;br /&gt;
&lt;br /&gt;
Tag tag(&amp;quot;Awesome-Tag-Name&amp;quot;);&lt;br /&gt;
QList&amp;lt;Resoruce&amp;gt; taggedResources = tag.tagOf();&lt;br /&gt;
&lt;br /&gt;
foreach(const Resource&amp;amp; res, taggedResources)&lt;br /&gt;
    kDebug() &amp;lt;&amp;lt; res.genericLabel();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ratings ===&lt;br /&gt;
&lt;br /&gt;
Every resource in Nepomuk can be given a numeric rating. It is generally done on a scale of 0-10.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
using namespace Nepomuk2;&lt;br /&gt;
&lt;br /&gt;
File fileRes( urlOfTheFile );&lt;br /&gt;
int rating = fileRes.rating();&lt;br /&gt;
&lt;br /&gt;
rating = rating + 1;&lt;br /&gt;
fileRes.setRating( rating );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dealing with files ==&lt;br /&gt;
&lt;br /&gt;
Every file in Nepomuk is represented as a resource. Since dealing with files is very common, we provide a special [http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk-core/html/classNepomuk2_1_1File.html File class] which is derived from the Resource class. We also provide convenience functions for checking if a resource is a file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
using namespace Nepomuk2;&lt;br /&gt;
&lt;br /&gt;
File fileRes( urlOfTheFile );&lt;br /&gt;
kDebug() &amp;lt;&amp;lt; fileRes.url();&lt;br /&gt;
&lt;br /&gt;
Resource res( urlOfTheFile );&lt;br /&gt;
if( res.isFile() )&lt;br /&gt;
    kDebug() &amp;lt;&amp;lt; res.toFile().url();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Internally Nepomuk Files are not very different from other Resources.&lt;br /&gt;
&lt;br /&gt;
== Working Example ==&lt;br /&gt;
&lt;br /&gt;
We understand that using a new framework such as '''Nepomuk''' can be quite intimidating at times. Therefore, we though it would be nice to have a working example for you to get started with - [http://quickgit.kde.org/index.php?p=kdeexamples.git&amp;amp;a=tree&amp;amp;h=eddcb1707a9e600db49fafdcb5ed8e8a195bcaba&amp;amp;hb=80a322af2bc5975c01c704173e937ccb8df605e3&amp;amp;f=nepomuk%2Ftest kdeexamples/nepomuk/test]. This example does nothing but it creates an executable called &amp;lt;code&amp;gt;nepomuk-test&amp;lt;/code&amp;gt;. It serves as a simple starting point to '''Nepomuk''' where all the boiler plate code has been taken care of.&lt;br /&gt;
&lt;br /&gt;
[[Category: Documentation]]&lt;br /&gt;
[[Category: Development]]&lt;br /&gt;
[[Category: Tutorials]]&lt;/div&gt;</summary>
		<author><name>FuzzyBot</name></author>	</entry>

	</feed>