[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepim-runtime] agents/nepomukfeeder/dms-copy: updated dms-copy
From:       Christian Mollekopf <chrigi_1 () fastmail ! fm>
Date:       2011-11-30 23:04:40
Message-ID: 20111130230440.CE5D5A60C9 () git ! kde ! org
[Download RAW message or body]

Git commit 9a319d9ee6ff74273eb6e8a7ac8af69dadc7fc1f by Christian Mollekopf.
Committed on 30/11/2011 at 23:00.
Pushed by cmollekopf into branch 'master'.

updated dms-copy (to make use of the bigger timeout)

M  +7    -23   agents/nepomukfeeder/dms-copy/CMakeLists.txt
M  +2    -2    agents/nepomukfeeder/dms-copy/README
A  +42   -0    agents/nepomukfeeder/dms-copy/abstracttimeoutdbusinterface.cpp     \
[License: LGPL] A  +41   -0    \
agents/nepomukfeeder/dms-copy/abstracttimeoutdbusinterface.h     [License: LGPL] M  \
+2    -1    agents/nepomukfeeder/dms-copy/createresourcejob.cpp M  +0    -1    \
agents/nepomukfeeder/dms-copy/createresourcejob.h M  +12   -13   \
agents/nepomukfeeder/dms-copy/datamanagement.cpp M  +86   -3    \
agents/nepomukfeeder/dms-copy/datamanagement.h R  +2    -2    \
agents/nepomukfeeder/dms-copy/datamanagementinterface.cpp [from: \
agents/nepomukfeeder/dms-copy/interfaces/datamanagementinterface.cpp - 078% \
similarity] R  +33   -26   agents/nepomukfeeder/dms-copy/datamanagementinterface.h \
[from: agents/nepomukfeeder/dms-copy/interfaces/datamanagementinterface.h - 084% \
similarity] M  +3    -0    agents/nepomukfeeder/dms-copy/dbustypes.cpp
M  +6    -2    agents/nepomukfeeder/dms-copy/dbustypes.h
M  +6    -3    agents/nepomukfeeder/dms-copy/describeresourcesjob.cpp
M  +5    -3    agents/nepomukfeeder/dms-copy/describeresourcesjob.h
M  +2    -1    agents/nepomukfeeder/dms-copy/genericdatamanagementjob.cpp
D  +0    -8    agents/nepomukfeeder/dms-copy/interfaces/CMakeLists.txt
D  +0    -121  agents/nepomukfeeder/dms-copy/interfaces/org.kde.nepomuk.DataManagement.xml
 A  +68   -0    agents/nepomukfeeder/dms-copy/kdbusconnectionpool.cpp     [License: \
LGPL (v2+)] A  +39   -0    agents/nepomukfeeder/dms-copy/kdbusconnectionpool.h     \
[License: LGPL (v2+)] D  +0    -395  \
agents/nepomukfeeder/dms-copy/nepomuk-simpleresource-rcgen.py M  +1    -1    \
agents/nepomukfeeder/dms-copy/nepomukdatamanagement_export.h M  +0    -1    \
agents/nepomukfeeder/dms-copy/resourcewatcher.cpp M  +24   -4    \
agents/nepomukfeeder/dms-copy/simpleresource.cpp M  +8    -2    \
agents/nepomukfeeder/dms-copy/simpleresource.h M  +26   -8    \
agents/nepomukfeeder/dms-copy/simpleresourcegraph.cpp M  +26   -4    \
agents/nepomukfeeder/dms-copy/simpleresourcegraph.h A  +107  -0    \
agents/nepomukfeeder/dms-copy/storeresourcesjob.cpp     [License: LGPL] A  +63   -0   \
agents/nepomukfeeder/dms-copy/storeresourcesjob.h     [License: LGPL]

http://commits.kde.org/kdepim-runtime/9a319d9ee6ff74273eb6e8a7ac8af69dadc7fc1f

diff --git a/agents/nepomukfeeder/dms-copy/CMakeLists.txt \
b/agents/nepomukfeeder/dms-copy/CMakeLists.txt index 93e97f0..cfdaf39 100644
--- a/agents/nepomukfeeder/dms-copy/CMakeLists.txt
+++ b/agents/nepomukfeeder/dms-copy/CMakeLists.txt
@@ -9,33 +9,17 @@ set(datamanagement_SRC
   genericdatamanagementjob.cpp
   createresourcejob.cpp
   describeresourcesjob.cpp
+  storeresourcesjob.cpp
   dbustypes.cpp
   datamanagement.cpp
   resourcewatcher.cpp
+  abstracttimeoutdbusinterface.cpp
+  datamanagementinterface.cpp
+  kdbusconnectionpool.cpp
 )
 
-# set(datamanagementservice_dbus_desc interfaces/org.kde.nepomuk.DataManagement.xml)
-# 
-# set_source_files_properties(
-#   ${datamanagementservice_dbus_desc}
-#   PROPERTIES
-#   INCLUDE "dbustypes.h")
-
 #the interfaces are directly copied from the buildfiles to avoid installing the \
                interface multiple times
-set(datamanagement_SRC ${datamanagement_SRC} \
interfaces/resourcewatcherconnectioninterface.cpp \
                interfaces/resourcewatchermanagerinterface.cpp 
-interfaces/datamanagementinterface.cpp)
-
-# qt4_add_dbus_interface(datamanagement_SRC
-#   interfaces/org.kde.nepomuk.ResourceWatcherConnection.xml
-#   resourcewatcherconnectioninterface)
-# 
-# qt4_add_dbus_interface(datamanagement_SRC
-#   interfaces/org.kde.nepomuk.ResourceWatcher.xml
-#   resourcewatchermanagerinterface)
-# 
-# qt4_add_dbus_interface(datamanagement_SRC
-#   ${datamanagementservice_dbus_desc}
-#   datamanagementinterface)
+set(datamanagement_SRC ${datamanagement_SRC} \
interfaces/resourcewatcherconnectioninterface.cpp \
interfaces/resourcewatchermanagerinterface.cpp)  
 kde4_add_library(nepomukdatamanagement-copy SHARED
   ${datamanagement_SRC})
@@ -47,5 +31,5 @@ target_link_libraries(nepomukdatamanagement-copy
   ${NEPOMUK_LIBRARIES}
   ${KDE4_KDECORE_LIBS})
 
- install(TARGETS nepomukdatamanagement-copy
-   DESTINATION ${LIB_INSTALL_DIR})
+install(TARGETS nepomukdatamanagement-copy
+   DESTINATION ${LIB_INSTALL_DIR})
\ No newline at end of file
diff --git a/agents/nepomukfeeder/dms-copy/README \
b/agents/nepomukfeeder/dms-copy/README index 19c0701..c907f86 100644
--- a/agents/nepomukfeeder/dms-copy/README
+++ b/agents/nepomukfeeder/dms-copy/README
@@ -1,2 +1,2 @@
-Copy from kde-runtime revision 5bfc371e40b22b032b428e2d278738da62555e18.
-To be removed when the dms is moved to kdelibs (probably kde 4.8)
\ No newline at end of file
+Copy from kde-runtime revision c982c2326ba93c4380ad950ada8d93b5582e4e4f.
+To be removed when the dms is moved to kdelibs (probably kde 4.9)
\ No newline at end of file
diff --git a/agents/nepomukfeeder/dms-copy/abstracttimeoutdbusinterface.cpp \
b/agents/nepomukfeeder/dms-copy/abstracttimeoutdbusinterface.cpp new file mode 100644
index 0000000..cc060d3
--- /dev/null
+++ b/agents/nepomukfeeder/dms-copy/abstracttimeoutdbusinterface.cpp
@@ -0,0 +1,42 @@
+/*
+   This file is part of the Nepomuk KDE project.
+   Copyright (C) 2011 Sebastian Trueg <trueg@kde.org>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) version 3, or any
+   later version accepted by the membership of KDE e.V. (or its
+   successor approved by the membership of KDE e.V.), which shall
+   act as a proxy defined in Section 6 of version 3 of the license.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "abstracttimeoutdbusinterface.h"
+
+#include <QtDBus/QDBusPendingCall>
+
+AbstractTimeoutDBusInterface::AbstractTimeoutDBusInterface(const QString& service, \
const QString& path, const char* interface, const QDBusConnection& connection, \
QObject* parent) +    : QDBusAbstractInterface( service, path, interface, connection, \
parent ) +{
+}
+
+AbstractTimeoutDBusInterface::~AbstractTimeoutDBusInterface()
+{
+}
+
+QDBusPendingCall AbstractTimeoutDBusInterface::asyncCallWithArgumentList(const \
QString &method, const QList<QVariant> &args, int timeout) +{
+    QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), \
interface(), method); +    msg.setArguments(args);
+    return connection().asyncCall(msg, timeout);
+}
+
+#include "abstracttimeoutdbusinterface.moc"
diff --git a/agents/nepomukfeeder/dms-copy/abstracttimeoutdbusinterface.h \
b/agents/nepomukfeeder/dms-copy/abstracttimeoutdbusinterface.h new file mode 100644
index 0000000..3cd0f3f
--- /dev/null
+++ b/agents/nepomukfeeder/dms-copy/abstracttimeoutdbusinterface.h
@@ -0,0 +1,41 @@
+/*
+   This file is part of the Nepomuk KDE project.
+   Copyright (C) 2011 Sebastian Trueg <trueg@kde.org>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) version 3, or any
+   later version accepted by the membership of KDE e.V. (or its
+   successor approved by the membership of KDE e.V.), which shall
+   act as a proxy defined in Section 6 of version 3 of the license.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef ABSTRACTTIMEOUTDBUSINTERFACE_H
+#define ABSTRACTTIMEOUTDBUSINTERFACE_H
+
+#include <QDBusAbstractInterface>
+
+/**
+ * An extension of the abstract DBus interface which allows to set the timeout.
+ */
+class AbstractTimeoutDBusInterface : public QDBusAbstractInterface
+{
+    Q_OBJECT
+
+public:
+    AbstractTimeoutDBusInterface(const QString& service, const QString& path, const \
char* interface, const QDBusConnection& connection, QObject* parent = 0); +    \
~AbstractTimeoutDBusInterface(); +
+    QDBusPendingCall asyncCallWithArgumentList(const QString &method, const \
QList<QVariant> &args, int timeout); +};
+
+#endif // ABSTRACTTIMEOUTDBUSINTERFACE_H
diff --git a/agents/nepomukfeeder/dms-copy/createresourcejob.cpp \
b/agents/nepomukfeeder/dms-copy/createresourcejob.cpp index fb7880e..b0a1763 100644
--- a/agents/nepomukfeeder/dms-copy/createresourcejob.cpp
+++ b/agents/nepomukfeeder/dms-copy/createresourcejob.cpp
@@ -23,6 +23,7 @@
 #include "datamanagementinterface.h"
 #include "dbustypes.h"
 #include "genericdatamanagementjob_p.h"
+#include "kdbusconnectionpool.h"
 
 #include <QtDBus/QDBusConnection>
 #include <QtDBus/QDBusPendingReply>
@@ -50,7 +51,7 @@ Nepomuk::CreateResourceJob::CreateResourceJob(const QList<QUrl>& \
types,  {
     org::kde::nepomuk::DataManagement dms(QLatin1String(DMS_DBUS_SERVICE),
                                           QLatin1String("/datamanagement"),
-                                          QDBusConnection::sessionBus());
+                                          KDBusConnectionPool::threadConnection());
     QDBusPendingCallWatcher* dbusCallWatcher
             = new QDBusPendingCallWatcher(dms.createResource(Nepomuk::DBus::convertUriList(types),
  label,
diff --git a/agents/nepomukfeeder/dms-copy/createresourcejob.h \
b/agents/nepomukfeeder/dms-copy/createresourcejob.h index 3cc4d1c..190aba9 100644
--- a/agents/nepomukfeeder/dms-copy/createresourcejob.h
+++ b/agents/nepomukfeeder/dms-copy/createresourcejob.h
@@ -28,7 +28,6 @@
 #include <QtCore/QUrl>
 
 #include "nepomukdatamanagement_export.h"
-#include "datamanagement.h"
 
 class KComponentData;
 class QDBusPendingCallWatcher;
diff --git a/agents/nepomukfeeder/dms-copy/datamanagement.cpp \
b/agents/nepomukfeeder/dms-copy/datamanagement.cpp index 9c570b0..aedf54f 100644
--- a/agents/nepomukfeeder/dms-copy/datamanagement.cpp
+++ b/agents/nepomukfeeder/dms-copy/datamanagement.cpp
@@ -23,6 +23,7 @@
 #include "genericdatamanagementjob_p.h"
 #include "createresourcejob.h"
 #include "describeresourcesjob.h"
+#include "storeresourcesjob.h"
 #include "dbustypes.h"
 #include "simpleresourcegraph.h"
 
@@ -131,18 +132,15 @@ KJob* Nepomuk::mergeResources(const QUrl& resource1,
                                         Q_ARG(QString, component.componentName()));
 }
 
-KJob* Nepomuk::storeResources(const SimpleResourceGraph& resources,
-                              StoreIdentificationMode identificationMode,
-                              StoreResourcesFlags flags,
-                              const QHash<QUrl, QVariant>& additionalMetadata,
-                              const KComponentData& component)
+
+Nepomuk::StoreResourcesJob* Nepomuk::storeResources(const \
Nepomuk::SimpleResourceGraph& resources, +                                            \
Nepomuk::StoreIdentificationMode identificationMode, +                                \
Nepomuk::StoreResourcesFlags flags, +                                                 \
const QHash<QUrl, QVariant>& additionalMetadata, +                                    \
const KComponentData& component)  {
-    return new GenericDataManagementJob("storeResources",
-                                        Q_ARG(QList<Nepomuk::SimpleResource>, \
                resources.toList()),
-                                        Q_ARG(int, int(identificationMode)),
-                                        Q_ARG(int, int(flags)),
-                                        Q_ARG(Nepomuk::PropertyHash, \
                additionalMetadata),
-                                        Q_ARG(QString, component.componentName()));
+    return new StoreResourcesJob( resources, identificationMode, flags,
+                                  additionalMetadata, component );
 }
 
 KJob* Nepomuk::importResources(const KUrl& url,
@@ -163,7 +161,8 @@ KJob* Nepomuk::importResources(const KUrl& url,
 }
 
 Nepomuk::DescribeResourcesJob* Nepomuk::describeResources(const QList<QUrl>& \
                resources,
-                                                          bool includeSubResources)
+                                                          DescribeResourcesFlags \
flags, +                                                          const QList<QUrl>& \
targetParties )  {
-    return new DescribeResourcesJob(resources, includeSubResources);
+    return new DescribeResourcesJob(resources, flags, targetParties);
 }
diff --git a/agents/nepomukfeeder/dms-copy/datamanagement.h \
b/agents/nepomukfeeder/dms-copy/datamanagement.h index 97f0a9b..4c3cb90 100644
--- a/agents/nepomukfeeder/dms-copy/datamanagement.h
+++ b/agents/nepomukfeeder/dms-copy/datamanagement.h
@@ -47,6 +47,7 @@ class KUrl;
 
 namespace Nepomuk {
     class DescribeResourcesJob;
+    class StoreResourcesJob;
     class CreateResourceJob;
     class SimpleResourceGraph;
 
@@ -131,6 +132,41 @@ namespace Nepomuk {
      * syncing). But it can be queried at any time to be used for whatever purpose.
      *
      *
+     * \section nepomuk_dms_resource_identification Resource Identification
+     *
+     * Resource identification is an important issue in storeResources(). There are \
basically three ways to identify a resource: +     * -# The trivial way to identify a \
resource is to provide the exact resource URI. +     * -# The second, also rather \
trivial way to identify a resource is through its nie:url. This can be a local file \
URL or an +     * http URL or anything else as decribed in \ref \
nepomuk_dms_resource_uris. +     * -# The last, most interesting way to identify a \
resource is through its properties and relations. This is what +     * \
storeResources() does in Nepomuk::IdentifyNew mode. +     *
+     * In general all properties with a literal range are considered identifying. \
This includes properties like nao:prefLabel, +     * nie:title, nco:fullname, and so \
on. All properties with a non-literal range are considered non-identifying. However, \
+     * there are exceptions to this rule. Some properties with literal ranges are \
non-identifying since they express the state +     * of a resource or an opinion of a \
particular user. +     *
+     * Examples of properties like this include \c nao:numericRating, nie:comment, \
or nco:imStatus. On the other hand there are +     * properties with non-literal \
ranges which are in fact identifying. Typical examples include \c rdf:type, \c \
nfo:hasHash, +     * or \c nmm:performer.
+     *
+     * To this end we make use of \c nrl:IdentifyingProperty and \c \
nrl:FluxProperty. The former is used to mark specific properties +     * as being \
identifying while the latter states that a property can change over time without \
actually chaning the identity +     * of the resource.
+     *
+     * In storeResources() two resources are considered being equal if all of their \
identifying properties match and they have at +     * least one identifying propery \
in common. Matching identifying properties here means that there is no identifying \
property +     * with a different value in the other resource.
+     *
+     *
+     * \section nepomuk_dms_permissions Permissions in %Nepomuk
+     *
+     * FIXME: define exactly how permissions are handled. By default all is private. \
Questions remaining: +     * - Do we define permissions on the graph level?
+     * - What is the range of the permissions? \c nao:Party?
+     * - How do we define "public to all"?
+     *
+     *
      * \section nepomuk_dms_advanced Advanced Nepomuk Concepts
      *
      * This section described advanced concepts in Nepomuk such as the data layout \
used throughout the database. @@ -350,6 +386,23 @@ namespace Nepomuk {
     Q_DECLARE_FLAGS(StoreResourcesFlags, StoreResourcesFlag)
 
     /**
+     * \brief Flags to influence the result of describeResources().
+     *
+     * See the documentation of describeResources() for details.
+     */
+    enum DescribeResourcesFlag {
+        /// No flags - default behaviour
+        NoDescribeResourcesFlags = 0,
+
+        /// Exclude discardable data, ie. data which can be re-generated
+        ExcludeDiscardableData = 1,
+
+        /// Exclude related resources, only include literal properties
+        ExcludeRelatedResources = 2
+    };
+    Q_DECLARE_FLAGS(DescribeResourcesFlags, DescribeResourcesFlag)
+
+    /**
      * \brief Remove all information about resources from the database which
      * has been created by a specific application.
      *
@@ -410,8 +463,10 @@ namespace Nepomuk {
      * to state that the provided information can be recreated at any time. Only \
                built-in types
      * such as int, string, or url are supported.
      * \param component The calling component. Typically this is left to the \
default. +     *
+     * See \ref nepomuk_dms_resource_identification for details on how resources are \
                identified.
      */
-    NEPOMUK_DATA_MANAGEMENT_EXPORT KJob* storeResources(const \
Nepomuk::SimpleResourceGraph& resources, +    NEPOMUK_DATA_MANAGEMENT_EXPORT \
                StoreResourcesJob* storeResources(const Nepomuk::SimpleResourceGraph& \
                resources,
                                                         \
                Nepomuk::StoreIdentificationMode identificationMode = \
                Nepomuk::IdentifyNew,
                                                         Nepomuk::StoreResourcesFlags \
                flags = Nepomuk::NoStoreResourcesFlags,
                                                         const QHash<QUrl, QVariant>& \
additionalMetadata = QHash<QUrl, QVariant>(), @@ -439,6 +494,8 @@ namespace Nepomuk {
      * to state that the provided information can be recreated at any time. Only \
                built-in types
      * such as int, string, or url are supported.
      * \param component The calling component. Typically this is left to the \
default. +     *
+     * See \ref nepomuk_dms_resource_identification for details on how resources are \
                identified.
      */
     NEPOMUK_DATA_MANAGEMENT_EXPORT KJob* importResources(const KUrl& url,
                                                          Soprano::RdfSerialization \
serialization, @@ -451,16 +508,42 @@ namespace Nepomuk {
     /**
      * \brief Retrieve all information about a set of resources.
      *
+     * Different levels of detail are available when retrieving resources. These are \
modified through the +     * \p flags where the following values are supported:
+     *
+     * - \c ExcludeDiscardableData - If this flag is enabled no discardable data \
will be returned. This means +     * that any data that has been created through \
storeResources() using additional metadata including a graph +     * type \c \
nrl:DiscardableInstanceBase is ignored. This includes for example all information the \
file +     * indexer has created. Be aware that this might even mean that some of the \
requested \p resources are not +     * returned at all since they only contain \
discardable information. +     *
+     * - \c ExcludeRelatedResources - If this flag is enabled related resources are \
ignored, only properties with +     * a literal value will be returned. The only \
exception are sub-resources which are treated as part of the +     * resource itself. \
Typical examples of sub-resources are address details of a contact or the performer + \
* contact of a music track. +     *
+     * \b Related \b resources:
+     *
+     * If the \c ExcludeRelatedResources flag is not specified related resources are \
returned as well. Related +     * resoures are returned by including only their \
identifying properties. \ref nepomuk_dms_resource_identification +     * explains the \
usage of identifying properties in more detail. +     *
      * \param resources The resources to describe. See \ref \
                nepomuk_dms_resource_uris for details.
-     * \param includeSubResources If \p true sub resources will be included. See \
\ref nepomuk_dms_sub_resources for details. +     * \param flags Optional flags to \
modify the data which is returned. +     * \param targetParties This optional list \
can be used to specify the parties (nao:Party) which should +     * receive the \
returned data. This will result in a filtering of the result according to configured \
+     * permissions. Only data which is set as being public or readable by the \
specified parties is returned. +     * See \ref nepomuk_dms_permissions for details. \
                \b NOT \b IMPLEMENTED \b YET!
      */
     NEPOMUK_DATA_MANAGEMENT_EXPORT DescribeResourcesJob* describeResources(const \
                QList<QUrl>& resources,
-                                                                           bool \
includeSubResources); +                                                               \
DescribeResourcesFlags flags = NoDescribeResourcesFlags, +                            \
const QList<QUrl>& targetParties = QList<QUrl>() );  //@}
     //@}
 }
 
 Q_DECLARE_OPERATORS_FOR_FLAGS(Nepomuk::RemovalFlags)
 Q_DECLARE_OPERATORS_FOR_FLAGS(Nepomuk::StoreResourcesFlags)
+Q_DECLARE_OPERATORS_FOR_FLAGS(Nepomuk::DescribeResourcesFlags)
 
 #endif
diff --git a/agents/nepomukfeeder/dms-copy/interfaces/datamanagementinterface.cpp \
b/agents/nepomukfeeder/dms-copy/datamanagementinterface.cpp similarity index 78%
rename from agents/nepomukfeeder/dms-copy/interfaces/datamanagementinterface.cpp
rename to agents/nepomukfeeder/dms-copy/datamanagementinterface.cpp
index 39709f7..5019353 100644
--- a/agents/nepomukfeeder/dms-copy/interfaces/datamanagementinterface.cpp
+++ b/agents/nepomukfeeder/dms-copy/datamanagementinterface.cpp
@@ -1,6 +1,6 @@
 /*
  * This file was generated by qdbusxml2cpp version 0.7
- * Command line was: qdbusxml2cpp -m -i dbustypes.h -p datamanagementinterface \
/home/chrigi/devel/kde/kdepim-runtime/agents/nepomukfeeder/dms-copy/interfaces/org.kde.nepomuk.DataManagement.xml
 + * Command line was: qdbusxml2cpp -m -i dbustypes.h -p datamanagementinterface \
/home/trueg/kde/dev/kde/src/kde-runtime/nepomuk/interfaces/org.kde.nepomuk.DataManagement.xml
                
  *
  * qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
  *
@@ -16,7 +16,7 @@
  */
 
 OrgKdeNepomukDataManagementInterface::OrgKdeNepomukDataManagementInterface(const \
QString &service, const QString &path, const QDBusConnection &connection, QObject \
                *parent)
-    : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, \
parent) +    : AbstractTimeoutDBusInterface(service, path, staticInterfaceName(), \
connection, parent)  {
 }
 
diff --git a/agents/nepomukfeeder/dms-copy/interfaces/datamanagementinterface.h \
b/agents/nepomukfeeder/dms-copy/datamanagementinterface.h similarity index 84%
rename from agents/nepomukfeeder/dms-copy/interfaces/datamanagementinterface.h
rename to agents/nepomukfeeder/dms-copy/datamanagementinterface.h
index 8460796..6157770 100644
--- a/agents/nepomukfeeder/dms-copy/interfaces/datamanagementinterface.h
+++ b/agents/nepomukfeeder/dms-copy/datamanagementinterface.h
@@ -1,15 +1,16 @@
 /*
  * This file was generated by qdbusxml2cpp version 0.7
- * Command line was: qdbusxml2cpp -m -i dbustypes.h -p datamanagementinterface \
/home/chrigi/devel/kde/kdepim-runtime/agents/nepomukfeeder/dms-copy/interfaces/org.kde.nepomuk.DataManagement.xml
 + * Command line was: qdbusxml2cpp -m -i dbustypes.h -p datamanagementinterface \
/home/trueg/kde/dev/kde/src/kde-runtime/nepomuk/interfaces/org.kde.nepomuk.DataManagement.xml
                
  *
  * qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
  *
  * This is an auto-generated file.
- * Do not edit! All changes made to it will be lost.
+ *
+ * It contains one small change: it is derived from AbstractTimeoutDbusInterface \
                instead of QDBusAbstractInterface and uses a big timeout.
  */
 
-#ifndef DATAMANAGEMENTINTERFACE_H_1312387679
-#define DATAMANAGEMENTINTERFACE_H_1312387679
+#ifndef DATAMANAGEMENTINTERFACE_H_1308595912
+#define DATAMANAGEMENTINTERFACE_H_1308595912
 
 #include <QtCore/QObject>
 #include <QtCore/QByteArray>
@@ -21,12 +22,18 @@
 #include <QtDBus/QtDBus>
 #include "dbustypes.h"
 
+#include "abstracttimeoutdbusinterface.h"
+
 /*
  * Proxy class for interface org.kde.nepomuk.DataManagement
  */
-class OrgKdeNepomukDataManagementInterface: public QDBusAbstractInterface
+class OrgKdeNepomukDataManagementInterface: public AbstractTimeoutDBusInterface
 {
     Q_OBJECT
+
+    /// we use a big timeout (10 min) since commands are queued in the DMS
+    static const int s_defaultTimeout = 600000;
+
 public:
     static inline const char *staticInterfaceName()
     { return "org.kde.nepomuk.DataManagement"; }
@@ -41,133 +48,133 @@ public Q_SLOTS: // METHODS
     {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(resource) << qVariantFromValue(property) \
                << qVariantFromValue(value) << qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("addProperty"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("addProperty"), argumentList, \
s_defaultTimeout);  }
 
     inline QDBusPendingReply<> addProperty(const QStringList &resources, const \
QString &property, const QVariantList &values, const QString &app)  {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(resources) << qVariantFromValue(property) \
                << qVariantFromValue(values) << qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("addProperty"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("addProperty"), argumentList, \
s_defaultTimeout);  }
 
     inline QDBusPendingReply<QString> createResource(const QString &type, const \
QString &label, const QString &description, const QString &app)  {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(type) << qVariantFromValue(label) << \
                qVariantFromValue(description) << qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("createResource"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("createResource"), argumentList, \
s_defaultTimeout);  }
 
     inline QDBusPendingReply<QString> createResource(const QStringList &types, const \
QString &label, const QString &description, const QString &app)  {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(types) << qVariantFromValue(label) << \
                qVariantFromValue(description) << qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("createResource"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("createResource"), argumentList, \
s_defaultTimeout);  }
 
-    inline QDBusPendingReply<QList<Nepomuk::SimpleResource> > \
describeResources(const QStringList &resources, bool includeSubResources) +    inline \
QDBusPendingReply<QList<Nepomuk::SimpleResource> > describeResources(const \
QStringList &resources, int flags, const QStringList &targetParties)  {
         QList<QVariant> argumentList;
-        argumentList << qVariantFromValue(resources) << \
                qVariantFromValue(includeSubResources);
-        return asyncCallWithArgumentList(QLatin1String("describeResources"), \
argumentList); +        argumentList << qVariantFromValue(resources) << \
qVariantFromValue(flags) << qVariantFromValue(targetParties); +        return \
asyncCallWithArgumentList(QLatin1String("describeResources"), argumentList, \
s_defaultTimeout);  }
 
     inline QDBusPendingReply<> importResources(const QString &url, const QString \
&serialization, int identificationMode, int flags, const QString &app)  {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(url) << qVariantFromValue(serialization) \
<< qVariantFromValue(identificationMode) << qVariantFromValue(flags) << \
                qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("importResources"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("importResources"), argumentList, \
s_defaultTimeout);  }
 
     inline QDBusPendingReply<> importResources(const QString &url, const QString \
&serialization, int identificationMode, int flags, Nepomuk::PropertyHash \
additionalMetadata, const QString &app)  {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(url) << qVariantFromValue(serialization) \
<< qVariantFromValue(identificationMode) << qVariantFromValue(flags) << \
                qVariantFromValue(additionalMetadata) << qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("importResources"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("importResources"), argumentList, \
s_defaultTimeout);  }
 
     inline QDBusPendingReply<> mergeResources(const QString &resource1, const \
QString &resource2, const QString &app)  {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(resource1) << qVariantFromValue(resource2) \
                << qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("mergeResources"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("mergeResources"), argumentList, \
s_defaultTimeout);  }
 
     inline QDBusPendingReply<> removeDataByApplication(int flags, const QString \
&app)  {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(flags) << qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("removeDataByApplication"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("removeDataByApplication"), argumentList, \
s_defaultTimeout);  }
 
     inline QDBusPendingReply<> removeDataByApplication(const QStringList &resources, \
int flags, const QString &app)  {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(resources) << qVariantFromValue(flags) << \
                qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("removeDataByApplication"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("removeDataByApplication"), argumentList, \
s_defaultTimeout);  }
 
     inline QDBusPendingReply<> removeProperties(const QString &resource, const \
QString &property, const QString &app)  {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(resource) << qVariantFromValue(property) \
                << qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("removeProperties"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("removeProperties"), argumentList, \
s_defaultTimeout);  }
 
     inline QDBusPendingReply<> removeProperties(const QStringList &resources, const \
QStringList &properties, const QString &app)  {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(resources) << \
                qVariantFromValue(properties) << qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("removeProperties"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("removeProperties"), argumentList, \
s_defaultTimeout);  }
 
     inline QDBusPendingReply<> removeProperty(const QString &resource, const QString \
&property, const QDBusVariant &value, const QString &app)  {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(resource) << qVariantFromValue(property) \
                << qVariantFromValue(value) << qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("removeProperty"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("removeProperty"), argumentList, \
s_defaultTimeout);  }
 
     inline QDBusPendingReply<> removeProperty(const QStringList &resources, const \
QString &property, const QVariantList &values, const QString &app)  {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(resources) << qVariantFromValue(property) \
                << qVariantFromValue(values) << qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("removeProperty"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("removeProperty"), argumentList, \
s_defaultTimeout);  }
 
     inline QDBusPendingReply<> removeResources(const QString &resource, int flags, \
const QString &app)  {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(resource) << qVariantFromValue(flags) << \
                qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("removeResources"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("removeResources"), argumentList, \
s_defaultTimeout);  }
 
     inline QDBusPendingReply<> removeResources(const QStringList &resources, int \
flags, const QString &app)  {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(resources) << qVariantFromValue(flags) << \
                qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("removeResources"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("removeResources"), argumentList, \
s_defaultTimeout);  }
 
     inline QDBusPendingReply<> setProperty(const QString &resource, const QString \
&property, const QDBusVariant &value, const QString &app)  {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(resource) << qVariantFromValue(property) \
                << qVariantFromValue(value) << qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("setProperty"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("setProperty"), argumentList, \
s_defaultTimeout);  }
 
     inline QDBusPendingReply<> setProperty(const QStringList &resources, const \
QString &property, const QVariantList &values, const QString &app)  {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(resources) << qVariantFromValue(property) \
                << qVariantFromValue(values) << qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("setProperty"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("setProperty"), argumentList, \
s_defaultTimeout);  }
 
     inline QDBusPendingReply<> storeResources(const QList<Nepomuk::SimpleResource> \
&resources, int identificationMode, int flags, Nepomuk::PropertyHash \
additionalMetadata, const QString &app)  {
         QList<QVariant> argumentList;
         argumentList << qVariantFromValue(resources) << \
qVariantFromValue(identificationMode) << qVariantFromValue(flags) << \
                qVariantFromValue(additionalMetadata) << qVariantFromValue(app);
-        return asyncCallWithArgumentList(QLatin1String("storeResources"), \
argumentList); +        return \
asyncCallWithArgumentList(QLatin1String("storeResources"), argumentList, \
s_defaultTimeout);  }
 
 Q_SIGNALS: // SIGNALS
diff --git a/agents/nepomukfeeder/dms-copy/dbustypes.cpp \
b/agents/nepomukfeeder/dms-copy/dbustypes.cpp index 27fd0f4..09e5dde 100644
--- a/agents/nepomukfeeder/dms-copy/dbustypes.cpp
+++ b/agents/nepomukfeeder/dms-copy/dbustypes.cpp
@@ -122,6 +122,9 @@ void Nepomuk::DBus::registerDBusTypes()
 
     // required for the additional metadata in storeResources
     qDBusRegisterMetaType<Nepomuk::PropertyHash>();
+
+    // required for returning the mappings in storeResources
+    qDBusRegisterMetaType< QHash<QString, QString> >();
 }
 
 // We need the QUrl serialization to be able to pass URIs in variants
diff --git a/agents/nepomukfeeder/dms-copy/dbustypes.h \
b/agents/nepomukfeeder/dms-copy/dbustypes.h index 900e219..ce1e578 100644
--- a/agents/nepomukfeeder/dms-copy/dbustypes.h
+++ b/agents/nepomukfeeder/dms-copy/dbustypes.h
@@ -36,10 +36,14 @@ Q_DECLARE_METATYPE(Nepomuk::PropertyHash)
 Q_DECLARE_METATYPE(Nepomuk::SimpleResource)
 Q_DECLARE_METATYPE(QList<Nepomuk::SimpleResource>)
 
+//CAUTION: Q_DECLARE_METATYPE doesn't accept template arguments like QHash<T, T>
+typedef QHash<QString, QString> __nepomuk_QHashQStringQString;
+Q_DECLARE_METATYPE( __nepomuk_QHashQStringQString )
+
 namespace Nepomuk {
     namespace DBus {
-        QString convertUri(const QUrl& uri);
-        QStringList convertUriList(const QList<QUrl>& uris);
+        QString NEPOMUK_DATA_MANAGEMENT_EXPORT convertUri(const QUrl& uri);
+        QStringList NEPOMUK_DATA_MANAGEMENT_EXPORT convertUriList(const QList<QUrl>& \
uris);  
         /// Convert QDBusArguments variants into QUrl, QDate, QTime, and QDateTime \
                variants
         NEPOMUK_DATA_MANAGEMENT_EXPORT QVariant resolveDBusArguments(const QVariant& \
                v);
diff --git a/agents/nepomukfeeder/dms-copy/describeresourcesjob.cpp \
b/agents/nepomukfeeder/dms-copy/describeresourcesjob.cpp index b955ea1..60a4420 \
                100644
--- a/agents/nepomukfeeder/dms-copy/describeresourcesjob.cpp
+++ b/agents/nepomukfeeder/dms-copy/describeresourcesjob.cpp
@@ -24,6 +24,7 @@
 #include "simpleresourcegraph.h"
 #include "dbustypes.h"
 #include "genericdatamanagementjob_p.h"
+#include "kdbusconnectionpool.h"
 
 #include <QtDBus/QDBusConnection>
 #include <QtDBus/QDBusPendingReply>
@@ -43,7 +44,8 @@ public:
 };
 
 Nepomuk::DescribeResourcesJob::DescribeResourcesJob(const QList<QUrl>& resources,
-                                                    bool includeSubResources)
+                                                    DescribeResourcesFlags flags,
+                                                    const QList<QUrl>& targetGroups)
     : KJob(0),
       d(new Private)
 {
@@ -51,10 +53,11 @@ Nepomuk::DescribeResourcesJob::DescribeResourcesJob(const \
QList<QUrl>& resources  
     org::kde::nepomuk::DataManagement dms(QLatin1String(DMS_DBUS_SERVICE),
                                           QLatin1String("/datamanagement"),
-                                          QDBusConnection::sessionBus());
+                                          KDBusConnectionPool::threadConnection());
     QDBusPendingCallWatcher* dbusCallWatcher
             = new QDBusPendingCallWatcher(dms.describeResources(Nepomuk::DBus::convertUriList(resources),
                
-                                                                \
includeSubResources)); +                                                              \
int(flags), +                                                                \
Nepomuk::DBus::convertUriList(targetGroups)));  connect(dbusCallWatcher, \
SIGNAL(finished(QDBusPendingCallWatcher*)),  this, \
SLOT(slotDBusCallFinished(QDBusPendingCallWatcher*)));  }
diff --git a/agents/nepomukfeeder/dms-copy/describeresourcesjob.h \
b/agents/nepomukfeeder/dms-copy/describeresourcesjob.h index 643b413..c63c854 100644
--- a/agents/nepomukfeeder/dms-copy/describeresourcesjob.h
+++ b/agents/nepomukfeeder/dms-copy/describeresourcesjob.h
@@ -27,8 +27,8 @@
 #include <QtCore/QList>
 #include <QtCore/QUrl>
 
-#include "nepomukdatamanagement_export.h"
 #include "datamanagement.h"
+#include "nepomukdatamanagement_export.h"
 
 class QDBusPendingCallWatcher;
 
@@ -69,14 +69,16 @@ private Q_SLOTS:
 
 private:
     DescribeResourcesJob(const QList<QUrl>& resources,
-                         bool includeSubResources);
+                         DescribeResourcesFlags flags,
+                         const QList<QUrl>& targetGroups);
     void start();
 
     class Private;
     Private* const d;
 
     friend Nepomuk::DescribeResourcesJob* Nepomuk::describeResources(const \
                QList<QUrl>&,
-                                                                     bool);
+                                                                     \
Nepomuk::DescribeResourcesFlags, +                                                    \
const QList<QUrl>&);  };
 }
 
diff --git a/agents/nepomukfeeder/dms-copy/genericdatamanagementjob.cpp \
b/agents/nepomukfeeder/dms-copy/genericdatamanagementjob.cpp index 949dfc0..3d79b62 \
                100644
--- a/agents/nepomukfeeder/dms-copy/genericdatamanagementjob.cpp
+++ b/agents/nepomukfeeder/dms-copy/genericdatamanagementjob.cpp
@@ -22,6 +22,7 @@
 #include "genericdatamanagementjob_p.h"
 #include "datamanagementinterface.h"
 #include "dbustypes.h"
+#include "kdbusconnectionpool.h"
 
 #include <QtDBus/QDBusConnection>
 #include <QtDBus/QDBusPendingReply>
@@ -46,7 +47,7 @@ Nepomuk::GenericDataManagementJob::GenericDataManagementJob(const \
char *methodNa  
     org::kde::nepomuk::DataManagement dms(QLatin1String(DMS_DBUS_SERVICE),
                                           QLatin1String("/datamanagement"),
-                                          QDBusConnection::sessionBus());
+                                          KDBusConnectionPool::threadConnection());
     QDBusPendingReply<> reply;
     QMetaObject::invokeMethod(&dms,
                               methodName,
diff --git a/agents/nepomukfeeder/dms-copy/interfaces/CMakeLists.txt \
b/agents/nepomukfeeder/dms-copy/interfaces/CMakeLists.txt deleted file mode 100644
index 9490e99..0000000
--- a/agents/nepomukfeeder/dms-copy/interfaces/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-project(nepomuk_interfaces)
-
-#install(FILES
-#  org.kde.nepomuk.DataManagement.xml
-#  org.kde.nepomuk.ResourceWatcher.xml
-#  org.kde.nepomuk.ResourceWatcherConnection.xml
-#  DESTINATION ${DBUS_INTERFACES_INSTALL_DIR}
-#  )
diff --git a/agents/nepomukfeeder/dms-copy/interfaces/org.kde.nepomuk.DataManagement.xml \
b/agents/nepomukfeeder/dms-copy/interfaces/org.kde.nepomuk.DataManagement.xml deleted \
file mode 100644 index 0172373..0000000
--- a/agents/nepomukfeeder/dms-copy/interfaces/org.kde.nepomuk.DataManagement.xml
+++ /dev/null
@@ -1,121 +0,0 @@
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
-"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node>
-  <interface name="org.kde.nepomuk.DataManagement">
-    <method name="addProperty">
-      <arg name="resources" type="as" direction="in"/>
-      <arg name="property" type="s" direction="in"/>
-      <arg name="values" type="av" direction="in"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-    <method name="setProperty">
-      <arg name="resources" type="as" direction="in"/>
-      <arg name="property" type="s" direction="in"/>
-      <arg name="values" type="av" direction="in"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-    <method name="removeProperty">
-      <arg name="resources" type="as" direction="in"/>
-      <arg name="property" type="s" direction="in"/>
-      <arg name="values" type="av" direction="in"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-    <method name="removeProperties">
-      <arg name="resources" type="as" direction="in"/>
-      <arg name="properties" type="as" direction="in"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-    <method name="createResource">
-      <arg type="s" direction="out"/>
-      <arg name="types" type="as" direction="in"/>
-      <arg name="label" type="s" direction="in"/>
-      <arg name="description" type="s" direction="in"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-    <method name="removeResources">
-      <arg name="resources" type="as" direction="in"/>
-      <arg name="flags" type="i" direction="in"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-    <method name="removeDataByApplication">
-      <arg name="resources" type="as" direction="in"/>
-      <arg name="flags" type="i" direction="in"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-    <method name="removeDataByApplication">
-      <arg name="flags" type="i" direction="in"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-    <method name="storeResources">
-      <arg name="resources" type="a(sa{sv})" direction="in"/>
-      <annotation name="com.trolltech.QtDBus.QtTypeName.In0" \
                value="QList&lt;Nepomuk::SimpleResource&gt;"/>
-      <arg name="identificationMode" type="i" direction="in"/>
-      <arg name="flags" type="i" direction="in"/>
-      <arg name="additionalMetadata" type="a{sv}" direction="in"/>
-      <annotation name="com.trolltech.QtDBus.QtTypeName.In3" \
                value="Nepomuk::PropertyHash"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-    <method name="importResources">
-      <arg name="url" type="s" direction="in"/>
-      <arg name="serialization" type="s" direction="in"/>
-      <arg name="identificationMode" type="i" direction="in"/>
-      <arg name="flags" type="i" direction="in"/>
-      <arg name="additionalMetadata" type="a{sv}" direction="in"/>
-      <annotation name="com.trolltech.QtDBus.QtTypeName.In4" \
                value="Nepomuk::PropertyHash"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-    <method name="importResources">
-      <arg name="url" type="s" direction="in"/>
-      <arg name="serialization" type="s" direction="in"/>
-      <arg name="identificationMode" type="i" direction="in"/>
-      <arg name="flags" type="i" direction="in"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-    <method name="mergeResources">
-      <arg name="resource1" type="s" direction="in"/>
-      <arg name="resource2" type="s" direction="in"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-    <method name="describeResources">
-      <arg name="resources" type="as" direction="in"/>
-      <arg name="includeSubResources" type="b" direction="in"/>
-      <arg type="a(sa{sv})" direction="out"/>
-      <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" \
                value="QList&lt;Nepomuk::SimpleResource&gt;"/>
-    </method>
-    <method name="setProperty">
-      <arg name="resource" type="s" direction="in"/>
-      <arg name="property" type="s" direction="in"/>
-      <arg name="value" type="v" direction="in"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-    <method name="addProperty">
-      <arg name="resource" type="s" direction="in"/>
-      <arg name="property" type="s" direction="in"/>
-      <arg name="value" type="v" direction="in"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-    <method name="removeProperty">
-      <arg name="resource" type="s" direction="in"/>
-      <arg name="property" type="s" direction="in"/>
-      <arg name="value" type="v" direction="in"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-    <method name="removeProperties">
-      <arg name="resource" type="s" direction="in"/>
-      <arg name="property" type="s" direction="in"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-    <method name="createResource">
-      <arg type="s" direction="out"/>
-      <arg name="type" type="s" direction="in"/>
-      <arg name="label" type="s" direction="in"/>
-      <arg name="description" type="s" direction="in"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-    <method name="removeResources">
-      <arg name="resource" type="s" direction="in"/>
-      <arg name="flags" type="i" direction="in"/>
-      <arg name="app" type="s" direction="in"/>
-    </method>
-  </interface>
-</node>
diff --git a/agents/nepomukfeeder/dms-copy/kdbusconnectionpool.cpp \
b/agents/nepomukfeeder/dms-copy/kdbusconnectionpool.cpp new file mode 100644
index 0000000..43e1f5f
--- /dev/null
+++ b/agents/nepomukfeeder/dms-copy/kdbusconnectionpool.cpp
@@ -0,0 +1,68 @@
+/*
+ * This file is part of the Nepomuk KDE project.
+ * Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
+ * Copyright (C) 2010 David Faure <faure@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "kdbusconnectionpool.h"
+#include <QThreadStorage>
+
+namespace {
+QAtomicInt s_connectionCounter;
+
+class KDBusConnectionPoolPrivate
+{
+public:
+    KDBusConnectionPoolPrivate()
+        : m_connection( QDBusConnection::connectToBus(
+                            QDBusConnection::SessionBus,
+                            \
QString::fromLatin1("NepomukQueryServiceConnection%1").arg(newNumber()) ) ) +    {
+    }
+
+    ~KDBusConnectionPoolPrivate()
+    {
+        QDBusConnection::disconnectFromBus( m_connection.name() );
+    }
+
+    QDBusConnection connection() const
+    {
+        return m_connection;
+    }
+
+private:
+    static int newNumber()
+    {
+        return s_connectionCounter.fetchAndAddAcquire(1);
+    }
+
+    QDBusConnection m_connection;
+};
+} // namespace
+
+QThreadStorage<KDBusConnectionPoolPrivate *> s_perThreadConnection;
+
+QDBusConnection KDBusConnectionPool::threadConnection()
+{
+    if (!s_perThreadConnection.hasLocalData()) {
+        s_perThreadConnection.setLocalData(new KDBusConnectionPoolPrivate);
+    }
+
+    return s_perThreadConnection.localData()->connection();
+}
+
diff --git a/agents/nepomukfeeder/dms-copy/kdbusconnectionpool.h \
b/agents/nepomukfeeder/dms-copy/kdbusconnectionpool.h new file mode 100644
index 0000000..d4c7e9d
--- /dev/null
+++ b/agents/nepomukfeeder/dms-copy/kdbusconnectionpool.h
@@ -0,0 +1,39 @@
+/*
+ * This file is part of the Nepomuk KDE project.
+ * Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KDBUSCONNECTIONPOOL_H
+#define KDBUSCONNECTIONPOOL_H
+
+#include <QtDBus/QDBusConnection>
+
+namespace KDBusConnectionPool
+{
+/**
+ * The KDBusConnectionPool works around the problem
+ * of QDBusConnection not being thread-safe. As soon as that
+ * has been fixed (either directly in libdbus or with a work-
+ * around in Qt) this method can be dropped in favor of
+ * QDBusConnection::sessionBus().
+ */
+QDBusConnection threadConnection();
+}
+
+#endif
+
diff --git a/agents/nepomukfeeder/dms-copy/nepomuk-simpleresource-rcgen.py \
b/agents/nepomukfeeder/dms-copy/nepomuk-simpleresource-rcgen.py deleted file mode \
100644 index 304db56..0000000
--- a/agents/nepomukfeeder/dms-copy/nepomuk-simpleresource-rcgen.py
+++ /dev/null
@@ -1,395 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-## This file is part of the Nepomuk KDE project.
-## Copyright (C) 2011 Sebastian Trueg <trueg@kde.org>
-##
-## This library is free software; you can redistribute it and/or
-## modify it under the terms of the GNU Lesser General Public
-## License as published by the Free Software Foundation; either
-## version 2.1 of the License, or (at your option) version 3, or any
-## later version accepted by the membership of KDE e.V. (or its
-## successor approved by the membership of KDE e.V.), which shall
-## act as a proxy defined in Section 6 of version 3 of the license.
-##
-## This library is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public
-## License along with this library.  If not, see <http://www.gnu.org/licenses/>.
-
-
-import optparse
-import sys
-import os, errno
-from PyKDE4.soprano import Soprano
-from PyQt4 import QtCore
-
-output_path = os.getcwd()
-verbose = True
-
-def normalizeName(name):
-    "Normalize a class or property name to be used as a C++ entity."
-    name.replace('-', '_')
-    name.replace('.', '_')
-    return name
-
-def extractNameFromUri(uri):
-    "Extract the class or property name from an entity URI. This is the last section \
                of the URI"
-    name = uri.toString().mid(uri.toString().lastIndexOf(QtCore.QRegExp('[#/:]'))+1)
-    return normalizeName(name)
-
-def makeFancy(name, cardinality):
-    if cardinality != 1:
-        if name.endsWith('s'):
-            return name + 'es'
-        else:
-            return name + 's'
-    else:
-        return name
-
-def extractOntologyName(uri):
-    "The name of the ontology is typically the section before the name of the \
                entity"
-    return uri.toString().section(QtCore.QRegExp('[#/:]'), -2, -2)
-    
-def mkdir_p(path):
-    "Create a folder and all its missing parent folders"
-    try:
-        os.makedirs(path)
-    except OSError as exc: # Python >2.5
-        if exc.errno == errno.EEXIST:
-            pass
-        else: raise
-
-def typeString(rdfType, cardinality):
-    """
-    Construct the C++/Qt type to be used for the given type and cardinality.
-    Uses QUrl for all non-literal types
-    """
-    if (rdfType == Soprano.Vocabulary.XMLSchema.string() or rdfType == \
                Soprano.Vocabulary.RDFS.Literal()) and cardinality != 1:
-        return 'QStringList'
-
-    simpleType = ''
-    if rdfType == Soprano.Vocabulary.XMLSchema.integer(): simpleType = "qint64"
-    elif rdfType == Soprano.Vocabulary.XMLSchema.negativeInteger(): simpleType = \
                "qint64"
-    elif rdfType == Soprano.Vocabulary.XMLSchema.nonNegativeInteger(): simpleType = \
                "quint64"
-    elif rdfType == Soprano.Vocabulary.XMLSchema.xsdLong(): simpleType = "qint64"
-    elif rdfType == Soprano.Vocabulary.XMLSchema.unsignedLong(): simpleType = \
                "quint64"
-    elif rdfType == Soprano.Vocabulary.XMLSchema.xsdInt(): simpleType = "qint32"
-    elif rdfType == Soprano.Vocabulary.XMLSchema.unsignedInt(): simpleType = \
                "quint32"
-    elif rdfType == Soprano.Vocabulary.XMLSchema.xsdShort(): simpleType = "qint16"
-    elif rdfType == Soprano.Vocabulary.XMLSchema.unsignedShort(): simpleType = \
                "quint16"
-    elif rdfType == Soprano.Vocabulary.XMLSchema.xsdFloat(): simpleType = "double"
-    elif rdfType == Soprano.Vocabulary.XMLSchema.xsdDouble(): simpleType = "double"
-    elif rdfType == Soprano.Vocabulary.XMLSchema.boolean(): simpleType = "bool"
-    elif rdfType == Soprano.Vocabulary.XMLSchema.date(): simpleType = "QDate"
-    elif rdfType == Soprano.Vocabulary.XMLSchema.time(): simpleType = "QTime"
-    elif rdfType == Soprano.Vocabulary.XMLSchema.dateTime(): simpleType = \
                "QDateTime"
-    elif rdfType == Soprano.Vocabulary.XMLSchema.string(): simpleType = "QString"
-    elif rdfType == Soprano.Vocabulary.RDFS.Literal(): simpleType = "QString"
-    else: simpleType = 'QUrl'
-
-    if cardinality != 1:
-        return 'QList<%s>' % simpleType
-    else:
-        return simpleType
-
-
-class OntologyParser():
-    def __init__(self):
-        self.model = Soprano.createModel()
-
-    def parseFile(self, path):
-        parser = Soprano.PluginManager.instance().discoverParserForSerialization(Soprano.SerializationTrig)
                
-        if not parser:
-            return False
-        it = parser.parseFile(path, QtCore.QUrl("dummy"), Soprano.SerializationTrig)
-        while it.next():
-            self.model.addStatement(it.current())
-        if parser.lastError():
-            return False;
-
-        return True
-
-    def writeAll(self):
-        # add rdfs:Resource as domain for all properties without a domain
-        query = 'select ?p where { ?p a %s . OPTIONAL { ?p %s ?d . } . \
                FILTER(!BOUND(?d)) . }' \
-                 % (Soprano.Node.resourceToN3(Soprano.Vocabulary.RDF.Property()), \
-                         \
                Soprano.Node.resourceToN3(Soprano.Vocabulary.RDFS.domain()))
-        nodes = self.model.executeQuery(query, \
                Soprano.Query.QueryLanguageSparql).iterateBindings(0).allNodes()
-        for p in nodes:
-            self.model.addStatement(p, \
Soprano.Node(Soprano.Vocabulary.RDFS.domain()), \
                Soprano.Node(Soprano.Vocabulary.RDFS.Resource()))
-        
-        # cache a few values we need more than once
-        self.rdfsResourceProperties = \
                self.getPropertiesForClass(Soprano.Vocabulary.RDFS.Resource())
-
-        query = 'select distinct ?uri ?label ?comment where {{ ?uri a {0} . ?uri {1} \
                ?label . OPTIONAL {{ ?uri {2} ?comment . }} . }}' \
-            .format(Soprano.Node.resourceToN3(Soprano.Vocabulary.RDFS.Class()), \
-                         Soprano.Node.resourceToN3(Soprano.Vocabulary.RDFS.label()), \
                \
-                         \
                Soprano.Node.resourceToN3(Soprano.Vocabulary.RDFS.comment()))
-        it = self.model.executeQuery(query, Soprano.Query.QueryLanguageSparql)
-        
-        while it.next():
-            uri = it['uri'].uri()
-            ns = self.getNamespaceAbbreviationForUri(uri)
-            name = extractNameFromUri(uri)
-            self.writeHeader(uri, ns, name, it['label'].toString(), \
                it['comment'].toString())
-
-    def getNamespaceAbbreviationForUri(self, uri):
-        query = "select ?ns where { graph ?g { %s ?p ?o . } . ?g %s ?ns . } LIMIT 1" \
                \
-            % (Soprano.Node.resourceToN3(uri), \
-               Soprano.Node.resourceToN3(Soprano.Vocabulary.NAO.hasDefaultNamespaceAbbreviation()))
                
-        it = self.model.executeQuery(query, Soprano.Query.QueryLanguageSparql)
-        if it.next():
-            return it[0].toString().toLower()
-        else:
-            return extractOntologyName(uri)
-
-    def getParentClasses(self, uri):
-        # We only select parent classes that we actually generate
-        query = "select distinct ?uri where {{ {0} {1} ?uri . ?uri a {2} . }}" \
-             .format(Soprano.Node.resourceToN3(uri), \
-                          \
                Soprano.Node.resourceToN3(Soprano.Vocabulary.RDFS.subClassOf()), \
-                          \
                Soprano.Node.resourceToN3(Soprano.Vocabulary.RDFS.Class()))
-        it = self.model.executeQuery(query, Soprano.Query.QueryLanguageSparql)
-        classes = {}
-        while it.next():
-            puri = it['uri'].uri()
-            if puri != Soprano.Vocabulary.RDFS.Resource():
-                cd = {}
-                cd['ns'] = self.getNamespaceAbbreviationForUri(puri)
-                cd['name'] = extractNameFromUri(puri)
-                classes[puri] = cd
-        return classes
-
-    def getPropertiesForClass(self, uri):
-        #print "Getting properties for %s..." % uri.toString()
-        query = "select distinct ?p ?range ?comment ?c ?mc where { ?p a %s . ?p %s \
%s . ?p %s ?range . OPTIONAL { ?p %s ?comment . } . OPTIONAL { ?p %s ?c . } . \
                OPTIONAL { ?p %s ?mc . } . }" \
-            % (Soprano.Node.resourceToN3(Soprano.Vocabulary.RDF.Property()),
-               Soprano.Node.resourceToN3(Soprano.Vocabulary.RDFS.domain()),
-               Soprano.Node.resourceToN3(uri),
-               Soprano.Node.resourceToN3(Soprano.Vocabulary.RDFS.range()),
-               Soprano.Node.resourceToN3(Soprano.Vocabulary.RDFS.comment()),
-               Soprano.Node.resourceToN3(Soprano.Vocabulary.NRL.cardinality()),
-               Soprano.Node.resourceToN3(Soprano.Vocabulary.NRL.maxCardinality()))
-        it = self.model.executeQuery(query, Soprano.Query.QueryLanguageSparql)
-        #print "Property query done."
-        properties = {}
-        while it.next():
-            p = it['p'].uri()
-            r = it['range'].uri()
-            comment = it['comment'].toString()
-            c = 0
-            if it['c'].isValid():
-                c = it['c'].literal().toInt();
-            else:
-                c = it['mc'].literal().toInt();
-            properties[p] = dict([('range', r), ('cardinality', c), ('comment', \
                comment)])
-        #print "Done getting properties."
-        return properties
-
-    def writeComment(self, theFile, text, indent):
-        maxLine = 50;
-
-        theFile.write(' ' * indent*4)
-        theFile.write("/**\n")
-        theFile.write(' ' * (indent*4+1))
-        theFile.write("* ")
-
-        words = QtCore.QString(text).split( QtCore.QRegExp("\\s"), \
                QtCore.QString.SkipEmptyParts )
-        cnt = 0;
-        for i in range(words.count()):
-            if cnt >= maxLine:
-                theFile.write('\n')
-                theFile.write(' ' * (indent*4+1))
-                theFile.write("* ")
-                cnt = 0;
-            theFile.write(words[i])
-            theFile.write(' ')
-            cnt += words[i].length()
-
-        theFile.write('\n')
-        theFile.write(' ' * (indent*4+1))
-        theFile.write("*/\n")
-
-    def writeGetter(self, theFile, prop, name, propRange, cardinality):
-        theFile.write('    %s %s() const {\n' % (typeString(propRange, cardinality), \
                makeFancy(name, cardinality)))
-        theFile.write('        %s value;\n' % typeString(propRange, cardinality))
-        if cardinality == 1:
-            theFile.write('        if(m_res->contains(QUrl::fromEncoded("%s", \
                QUrl::StrictMode)))\n' % prop.toString())
-            theFile.write('            value = \
m_res->property(QUrl::fromEncoded("{0}", \
QUrl::StrictMode)).first().value<{1}>();\n'.format(prop.toString(), \
                typeString(propRange, 1)))
-        else:
-            theFile.write('        foreach(const QVariant& v, \
                m_res->property(QUrl::fromEncoded("%s", QUrl::StrictMode)))\n' % \
                prop.toString())
-            theFile.write('            value << \
                v.value<{0}>();\n'.format(typeString(propRange, 1)))
-        theFile.write('        return value;\n')
-        theFile.write('    }\n')
-
-    def writeSetter(self, theFile, prop, name, propRange, cardinality):
-        theFile.write('    void set%s%s(const %s& value) {\n' % (makeFancy(name, \
cardinality)[0].toUpper(), makeFancy(name, cardinality).mid(1), typeString(propRange, \
                cardinality)))
-        theFile.write('        m_res->addProperty(Soprano::Vocabulary::RDF::type(), \
                resourceType());\n')
-        theFile.write('        QVariantList values;\n')
-        if cardinality == 1:
-            theFile.write('        values << value;\n')
-        else:
-             theFile.write('        foreach(const %s& v, value)\n' % \
                typeString(propRange, 1))
-             theFile.write('            values << v;\n')
-        theFile.write('        m_res->setProperty(QUrl::fromEncoded("%s", \
                QUrl::StrictMode), values);\n' % prop.toString())
-        theFile.write('    }\n')
-
-    def writeAdder(self, theFile, prop, name, propRange, cardinality):
-        theFile.write('    void add%s%s(const %s& value) {\n' % (makeFancy(name, \
                1)[0].toUpper(), makeFancy(name, 1).mid(1), typeString(propRange, \
                1)))
-        theFile.write('        m_res->addProperty(Soprano::Vocabulary::RDF::type(), \
                resourceType());\n')
-        theFile.write('        m_res->addProperty(QUrl::fromEncoded("%s", \
                QUrl::StrictMode), value);\n' % prop.toString())
-        theFile.write('    }\n')
-
-    def writeHeader(self, uri, nsAbbr, className, label, comment):
-        # Construct paths
-        folder = output_path + '/' + nsAbbr
-        filePath = folder + '/' + className.toLower() + '.h'
-
-        if verbose:
-            print "Writing header file: %s" % filePath
-
-        # Create the containing folder
-        mkdir_p(QtCore.QFile.encodeName(folder).data())
-
-        # open the header file
-        header = open(filePath, 'w')
-
-        parentClasses = self.getParentClasses(uri)
-
-        # write protecting ifdefs
-        header_protect = '_%s_%s_H_' % (nsAbbr.toUpper(), className.toUpper())
-        header.write('#ifndef %s\n' % header_protect)
-        header.write('#define %s\n' % header_protect)
-        header.write('\n')
-        
-        # write default includes
-        header.write('#include <QtCore/QVariant>\n')
-        header.write('#include <QtCore/QStringList>\n')
-        header.write('#include <QtCore/QUrl>\n')
-        header.write('#include <QtCore/QDate>\n')
-        header.write('#include <QtCore/QTime>\n')
-        header.write('#include <QtCore/QDateTime>\n')
-        header.write('#include <Soprano/Vocabulary/RDF>\n')
-        header.write('\n')
-
-        # all classes need the SimpleResource include
-        header.write('#include <nepomuk/simpleresource.h>\n\n')
-
-        # write includes for the parent classes
-        parentClassNames = []
-        for parent in parentClasses.keys():
-             header.write('#include "%s/%s.h"\n' % (parentClasses[parent]['ns'], \
                parentClasses[parent]['name'].toLower()))
-             parentClassNames.append("%s::%s" \
                %(parentClasses[parent]['ns'].toUpper(), \
                parentClasses[parent]['name']))
-
-        # write the class namespace
-        header.write('namespace Nepomuk {\n')
-        header.write('namespace %s {\n' % nsAbbr.toUpper())
-
-        # write the class + parent classes
-        self.writeComment(header, comment, 0)
-        header.write('class %s' % className)
-        if len(parentClassNames) > 0:
-            header.write(' : ')
-        header.write(', '.join(['public %s' % (p) for p in parentClassNames]))
-        header.write('\n{\n')
-        header.write('public:\n')
-
-        # write the constructor
-        header.write('    %s(Nepomuk::SimpleResource* res)\n' % className)
-        header.write('      : ')
-        header.write(', '.join(['%s(res)' % p for p in parentClassNames]))
-        if len(parentClassNames) > 0:
-            header.write(', ')
-        header.write('m_res(res)\n    {}\n\n')
-
-        # write the destructor (necessary for the virtual resourceType() method
-        header.write('    virtual ~%s() {}\n\n' % className)
-
-        # Write getter and setter methods for all properties
-        # This includes the properties that have domain rdfs:Resource on base \
                classes, ie.
-        # those that are not derived from any other class. That way these properties \
                are
-        # accessible from all classes.
-        properties = self.getPropertiesForClass(uri)
-        if len(parentClassNames) == 0:
-            properties.update(self.rdfsResourceProperties)
-
-        # There could be properties with the same name - in that case we give the \
                methods a prefix
-        for p in properties.keys():
-            name = extractNameFromUri(p)
-            cnt = 0
-            # search for the same name again
-            for op in properties.keys():
-                if extractNameFromUri(op) == name:
-                    cnt+=1
-            if cnt > 1:
-                name = self.getNamespaceAbbreviationForUri(p).toLower() + \
                name[0].toUpper() + name.mid(1)
-            properties[p]['name'] = name;
-            
-        for p in properties.keys():
-            self.writeComment(header, 'Get property %s. %s' % (p.toString(), \
                properties[p]['comment']), 1)
-            self.writeGetter(header, p, properties[p]['name'], \
                properties[p]['range'], properties[p]['cardinality'])
-            header.write('\n')
-            self.writeComment(header, 'Set property %s. %s' % (p.toString(), \
                properties[p]['comment']), 1)
-            self.writeSetter(header, p, properties[p]['name'], \
                properties[p]['range'], properties[p]['cardinality'])
-            header.write('\n')
-            self.writeComment(header, 'Add value to property %s. %s' % \
                (p.toString(), properties[p]['comment']), 1)
-            self.writeAdder(header, p, properties[p]['name'], \
                properties[p]['range'], properties[p]['cardinality'])
-            header.write('\n')
-
-        # write the protected resource type access method
-        header.write('protected:\n')
-        header.write('    virtual QUrl resourceType() const { return \
                QUrl::fromEncoded("%s", QUrl::StrictMode); }\n' % uri.toString())
-        header.write('\n')
-
-        # write the private members
-        header.write('private:\n')
-        header.write('    Nepomuk::SimpleResource* m_res;\n')
-
-        # close the class
-        header.write('};\n')
-
-        # write the closing parenthesis for the namespaces
-        header.write('}\n}\n')
-
-        # write the closing preprocessor thingi
-        header.write('\n#endif\n')
-        
-
-def main():
-    global output_path
-    global verbose
-    
-    usage = "Usage: %prog [options] ontologyfile1 ontologyfile2 ..."
-    optparser = optparse.OptionParser(usage=usage, description="Nepomuk \
SimpleResource code generator. It will generate a hierarchy of simple wrapper classes \
around Nepomuk::SimpleResource which provide convinience methods to get and set \
properties of those classes. Each wrapper class will be defined in its own header \
file and be written to a subdirectory named as the default ontology prefix. Example: \
the header file for nao:Tag would be written to nao/tag.h and be defined in the \
                namespace Nepomuk::NAO.")
-    optparser.add_option('--output', '-o', metavar='PATH', dest='output', help='The \
                destination folder')
-    optparser.add_option('--quiet', '-q', action="store_false", dest="verbose", \
                default=True, help="don't print status messages to stdout")
-
-    (options, args) = optparser.parse_args()
-    if len(args) == 0:
-        optparser.error('No ontology file specified.')
-    if options.output and len(options.output) > 0:
-        output_path = options.output
-    verbose = options.verbose
-    
-    if verbose:
-        print 'Generating from ontology files %s' % ','.join(args)
-        print 'Writing files to %s.' % output_path
-
-    # Parse all ontology files
-    ontoParser = OntologyParser()
-    for f in args:
-        if verbose:
-            print "Reading ontology '%s'" % f
-        ontoParser.parseFile(f)
-    if verbose:
-        print "All ontologies read. Generating code..."
-
-    # Get all classes and handle them one by one
-    ontoParser.writeAll()
-
-if __name__ == "__main__":
-    main()
diff --git a/agents/nepomukfeeder/dms-copy/nepomukdatamanagement_export.h \
b/agents/nepomukfeeder/dms-copy/nepomukdatamanagement_export.h index bf97f4d..929a737 \
                100644
--- a/agents/nepomukfeeder/dms-copy/nepomukdatamanagement_export.h
+++ b/agents/nepomukfeeder/dms-copy/nepomukdatamanagement_export.h
@@ -24,7 +24,7 @@
 #include <kdemacros.h>
 
 #ifndef NEPOMUK_DATA_MANAGEMENT_EXPORT
-# if defined(MAKE_NEPOMUKDATAMANAGEMENT_COPY_LIB)
+# if defined(MAKE_NEPOMUKDATAMANAGEMENT_LIB)
    /* We are building this library */ 
 #  define NEPOMUK_DATA_MANAGEMENT_EXPORT KDE_EXPORT
 # else
diff --git a/agents/nepomukfeeder/dms-copy/resourcewatcher.cpp \
b/agents/nepomukfeeder/dms-copy/resourcewatcher.cpp index 0761aad..f6fc93c 100644
--- a/agents/nepomukfeeder/dms-copy/resourcewatcher.cpp
+++ b/agents/nepomukfeeder/dms-copy/resourcewatcher.cpp
@@ -118,7 +118,6 @@ bool Nepomuk::ResourceWatcher::start()
 void Nepomuk::ResourceWatcher::stop()
 {
     if (d->m_connectionInterface) {
-        d->m_connectionInterface->disconnect( this );
         d->m_connectionInterface->close();
         delete d->m_connectionInterface;
         d->m_connectionInterface = 0;
diff --git a/agents/nepomukfeeder/dms-copy/simpleresource.cpp \
b/agents/nepomukfeeder/dms-copy/simpleresource.cpp index dfd72af..5293961 100644
--- a/agents/nepomukfeeder/dms-copy/simpleresource.cpp
+++ b/agents/nepomukfeeder/dms-copy/simpleresource.cpp
@@ -81,7 +81,7 @@ Nepomuk::SimpleResource::~SimpleResource()
 {
 }
 
-Nepomuk::SimpleResource & Nepomuk::SimpleResource::operator =(const \
Nepomuk::SimpleResource &other) +Nepomuk::SimpleResource & \
Nepomuk::SimpleResource::operator=(const Nepomuk::SimpleResource &other)  {
     d = other.d;
     return *this;
@@ -147,7 +147,7 @@ bool Nepomuk::SimpleResource::isValid() const
     return true;
 }
 
-bool Nepomuk::SimpleResource::operator ==(const Nepomuk::SimpleResource &other) \
const +bool Nepomuk::SimpleResource::operator==(const Nepomuk::SimpleResource &other) \
const  {
     return d->m_uri == other.d->m_uri && d->m_properties == other.d->m_properties;
 }
@@ -224,16 +224,36 @@ void Nepomuk::SimpleResource::addPropertyNode(const QUrl \
&property, const Sopran  // else do nothing
 }
 
-void Nepomuk::SimpleResource::removeProperty(const QUrl &property, const QVariant \
&value) +void Nepomuk::SimpleResource::remove(const QUrl &property, const QVariant \
&value)  {
     d->m_properties.remove(property, value);
 }
 
-void Nepomuk::SimpleResource::removeProperty(const QUrl &property)
+void Nepomuk::SimpleResource::remove(const QUrl &property)
 {
     d->m_properties.remove(property);
 }
 
+void Nepomuk::SimpleResource::removeAll(const QUrl &property, const QVariant &value)
+{
+    if(property.isEmpty()) {
+        if(value.isValid()) {
+            foreach(const QUrl& prop, d->m_properties.keys(value)) {
+                d->m_properties.remove(prop, value);
+            }
+        }
+        else {
+            d->m_properties.clear();
+        }
+    }
+    else if(value.isValid()){
+        d->m_properties.remove(property, value);
+    }
+    else {
+        d->m_properties.remove(property);
+    }
+}
+
 void Nepomuk::SimpleResource::addType(const QUrl &type)
 {
     addProperty(Soprano::Vocabulary::RDF::type(), type);
diff --git a/agents/nepomukfeeder/dms-copy/simpleresource.h \
b/agents/nepomukfeeder/dms-copy/simpleresource.h index d2418ea..f5d7563 100644
--- a/agents/nepomukfeeder/dms-copy/simpleresource.h
+++ b/agents/nepomukfeeder/dms-copy/simpleresource.h
@@ -131,8 +131,14 @@ public:
      */
     void addPropertyNode(const QUrl& property, const Soprano::Node& value);
 
-    void removeProperty(const QUrl& property, const QVariant& value);
-    void removeProperty(const QUrl& property);
+    void remove(const QUrl& property, const QVariant& value);
+    void remove(const QUrl& property);
+
+    /**
+     * Remove all property/value pairs matchin the provided pattern. Both
+     * parameters can be set to empty values to act as wildcards.
+     */
+    void removeAll(const QUrl& property, const QVariant& value);
 
     /**
      * A convenience method which adds a property of type rdf:type.
diff --git a/agents/nepomukfeeder/dms-copy/simpleresourcegraph.cpp \
b/agents/nepomukfeeder/dms-copy/simpleresourcegraph.cpp index 3bab264..41c4ee5 100644
--- a/agents/nepomukfeeder/dms-copy/simpleresourcegraph.cpp
+++ b/agents/nepomukfeeder/dms-copy/simpleresourcegraph.cpp
@@ -22,6 +22,7 @@
 #include "simpleresourcegraph.h"
 #include "simpleresource.h"
 #include "datamanagement.h"
+#include "storeresourcesjob.h"
 
 #include <QtCore/QSharedData>
 #include <QtCore/QHash>
@@ -121,15 +122,23 @@ void Nepomuk::SimpleResourceGraph::remove(const QUrl &uri, \
const QUrl &property,  {
     QHash< QUrl, SimpleResource >::iterator it = d->resources.find( uri );
     if( it != d->resources.end() ) {
-        it.value().removeProperty(property, value);
+        it.value().remove(property, value);
     }
 }
 
-void Nepomuk::SimpleResourceGraph::removeAll(const QUrl &uri, const QUrl &property)
+void Nepomuk::SimpleResourceGraph::removeAll(const QUrl &uri, const QUrl &property, \
const QVariant &value)  {
-    QHash< QUrl, SimpleResource >::iterator it = d->resources.find( uri );
-    if( it != d->resources.end() ) {
-        it.value().removeProperty(property);
+    if(!uri.isEmpty()) {
+        QHash< QUrl, SimpleResource >::iterator it = d->resources.find( uri );
+        if( it != d->resources.end() ) {
+            it.value().removeAll(property, value);
+        }
+    }
+    else {
+        for(QHash<QUrl, SimpleResource>::iterator it = d->resources.begin();
+            it != d->resources.end(); ++it) {
+            it->removeAll(property, value);
+        }
     }
 }
 
@@ -171,6 +180,11 @@ QList<Nepomuk::SimpleResource> \
Nepomuk::SimpleResourceGraph::toList() const  return d->resources.values();
 }
 
+QList<QUrl> Nepomuk::SimpleResourceGraph::allResourceUris() const
+{
+    return d->resources.keys();
+}
+
 void Nepomuk::SimpleResourceGraph::clear()
 {
     d->resources.clear();
@@ -243,15 +257,19 @@ void Nepomuk::SimpleResourceGraph::addStatement(const \
Soprano::Node& subject, co  addStatement( Soprano::Statement( subject, predicate, \
object ) );  }
 
-
-KJob* Nepomuk::SimpleResourceGraph::save(const KComponentData& component) const
+Nepomuk::StoreResourcesJob* Nepomuk::SimpleResourceGraph::save(const KComponentData& \
component) const  {
     return Nepomuk::storeResources(*this, Nepomuk::IdentifyNew, \
Nepomuk::NoStoreResourcesFlags, QHash<QUrl, QVariant>(), component);  }
 
 QDebug Nepomuk::operator<<(QDebug dbg, const Nepomuk::SimpleResourceGraph& graph)
 {
-    return dbg << graph.toList();
+    dbg.nospace() << "SimpleResourceGraph(" << endl;
+    foreach(const SimpleResource& res, graph.toList()) {
+        dbg << res << endl;
+    }
+    dbg.nospace() << ")" << endl;
+    return dbg;
 }
 
 QDataStream & Nepomuk::operator<<(QDataStream & stream, const \
                Nepomuk::SimpleResourceGraph& graph)
diff --git a/agents/nepomukfeeder/dms-copy/simpleresourcegraph.h \
b/agents/nepomukfeeder/dms-copy/simpleresourcegraph.h index 386b8c1..d897d4e 100644
--- a/agents/nepomukfeeder/dms-copy/simpleresourcegraph.h
+++ b/agents/nepomukfeeder/dms-copy/simpleresourcegraph.h
@@ -27,6 +27,7 @@
 #include <QtCore/QSet>
 #include <QtCore/QUrl>
 #include <QtCore/QMetaType>
+#include <QtCore/QVariant>
 
 #include <KGlobal>
 
@@ -41,6 +42,7 @@ class Node;
 }
 namespace Nepomuk {
 class SimpleResource;
+class StoreResourcesJob;
 
 class NEPOMUK_DATA_MANAGEMENT_EXPORT SimpleResourceGraph
 {
@@ -68,7 +70,12 @@ public:
     void set(const QUrl& uri, const QUrl& property, const QVariant& value);
 
     void remove(const QUrl& uri, const QUrl& property, const QVariant& value);
-    void removeAll(const QUrl& uri, const QUrl& property);
+
+    /**
+     * Remove all properties matching the provided parameters. It is possible to
+     * provide empty values to act as wildcards.
+     */
+    void removeAll(const QUrl& uri, const QUrl& property, const QVariant& value = \
QVariant());  
     void clear();
 
@@ -82,12 +89,27 @@ public:
 
     SimpleResource operator[](const QUrl& uri) const;
 
+    /**
+     * Get a list of the URIs of all resources in this graph.
+     * The result is equivalent to:
+     *
+     * \code
+     * QList<QUrl> uris;
+     * foreach(const SimpleResource& res, toList())
+     *     uris << res.uri();
+     * \endcode
+     *
+     * \return A list of all resource URIs in this graph.
+     */
+    QList<QUrl> allResourceUris() const;
+
     QSet<SimpleResource> toSet() const;
     QList<SimpleResource> toList() const;
 
     void addStatement(const Soprano::Statement& statement);
-    void addStatement( const Soprano::Node & subject, const Soprano::Node & \
                predicate,
-                       const Soprano::Node & object );
+    void addStatement(const Soprano::Node & subject,
+                      const Soprano::Node & predicate,
+                      const Soprano::Node & object);
 
     SimpleResourceGraph& operator+=( const SimpleResourceGraph & graph );
 
@@ -102,7 +124,7 @@ public:
      *
      * \sa Nepomuk::storeResources()
      */
-    KJob* save(const KComponentData& component = KGlobal::mainComponent()) const;
+    StoreResourcesJob* save(const KComponentData& component = \
KGlobal::mainComponent()) const;  
     bool operator==( const SimpleResourceGraph & rhs) const;
     bool operator!=( const SimpleResourceGraph & rhs) const;
diff --git a/agents/nepomukfeeder/dms-copy/storeresourcesjob.cpp \
b/agents/nepomukfeeder/dms-copy/storeresourcesjob.cpp new file mode 100644
index 0000000..55f3637
--- /dev/null
+++ b/agents/nepomukfeeder/dms-copy/storeresourcesjob.cpp
@@ -0,0 +1,107 @@
+/*
+   This file is part of the Nepomuk KDE project.
+   Copyright (C) 2011 Vishesh Handa <handa.vish@gmail.com>
+   Copyright (C) 2011 Sebastian Trueg <trueg@kde.org>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) version 3, or any
+   later version accepted by the membership of KDE e.V. (or its
+   successor approved by the membership of KDE e.V.), which shall
+   act as a proxy defined in Section 6 of version 3 of the license.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "storeresourcesjob.h"
+#include "datamanagementinterface.h"
+#include "simpleresourcegraph.h"
+#include "dbustypes.h"
+#include "genericdatamanagementjob_p.h"
+
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusPendingReply>
+#include <QtDBus/QDBusPendingCallWatcher>
+
+#include <QtCore/QHash>
+#include <QtCore/QUrl>
+
+#include <KComponentData>
+#include <KUrl>
+#include <KDebug>
+
+class Nepomuk::StoreResourcesJob::Private {
+public:
+    Nepomuk::StoreResourcesJob *q;
+    QHash<QUrl, QUrl> m_mappings;
+
+    void _k_slotDBusCallFinished(QDBusPendingCallWatcher* watcher);
+};
+
+Nepomuk::StoreResourcesJob::StoreResourcesJob(const Nepomuk::SimpleResourceGraph& \
resources, +                                              \
Nepomuk::StoreIdentificationMode identificationMode, +                                \
Nepomuk::StoreResourcesFlags flags, +                                              \
const QHash< QUrl, QVariant >& additionalMetadata, +                                  \
const KComponentData& component) +    : KJob(),
+      d( new Nepomuk::StoreResourcesJob::Private )
+{
+    d->q = this;
+    DBus::registerDBusTypes();
+
+    org::kde::nepomuk::DataManagement dms(QLatin1String(DMS_DBUS_SERVICE),
+                                          QLatin1String("/datamanagement"),
+                                          QDBusConnection::sessionBus());
+    QDBusPendingCallWatcher* dbusCallWatcher
+    = new QDBusPendingCallWatcher(dms.storeResources( resources.toList(), \
identificationMode, +                                                      flags, \
additionalMetadata, +                                                      \
component.componentName() )); +
+    connect(dbusCallWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+            this, SLOT(_k_slotDBusCallFinished(QDBusPendingCallWatcher*)));
+}
+
+Nepomuk::StoreResourcesJob::~StoreResourcesJob()
+{
+    delete d;
+}
+
+void Nepomuk::StoreResourcesJob::start()
+{
+    // Nothing to do
+}
+
+QHash< QUrl, QUrl > Nepomuk::StoreResourcesJob::mappings() const
+{
+    return d->m_mappings;
+}
+
+void Nepomuk::StoreResourcesJob::Private::_k_slotDBusCallFinished(QDBusPendingCallWatcher* \
watcher) +{
+    QDBusPendingReply< QHash<QString,QString> > reply = *watcher;
+    if (reply.isError()) {
+        QDBusError error = reply.error();
+        q->setError(1);
+        q->setErrorText(error.message());
+    }
+    else {
+        m_mappings.clear();
+        QHash<QString, QString> mappings = reply.value();
+        QHash<QString, QString>::const_iterator it = mappings.constBegin();
+        for( ; it != mappings.constEnd(); it++ ) {
+            m_mappings.insert( KUrl( it.key() ), KUrl( it.value() ) );
+        }
+    }
+
+    watcher->deleteLater();
+    q->emitResult();
+}
+
+#include "storeresourcesjob.moc"
diff --git a/agents/nepomukfeeder/dms-copy/storeresourcesjob.h \
b/agents/nepomukfeeder/dms-copy/storeresourcesjob.h new file mode 100644
index 0000000..9043f3c
--- /dev/null
+++ b/agents/nepomukfeeder/dms-copy/storeresourcesjob.h
@@ -0,0 +1,63 @@
+/*
+   This file is part of the Nepomuk KDE project.
+   Copyright (C) 2011 Vishesh Handa <handa.vish@gmail.com>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) version 3, or any
+   later version accepted by the membership of KDE e.V. (or its
+   successor approved by the membership of KDE e.V.), which shall
+   act as a proxy defined in Section 6 of version 3 of the license.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef STORERESOURCEJOB_H
+#define STORERESOURCEJOB_H
+
+#include <KJob>
+#include "nepomukdatamanagement_export.h"
+#include "datamanagement.h"
+
+class QDBusPendingCallWatcher;
+
+namespace Nepomuk {
+
+    class NEPOMUK_DATA_MANAGEMENT_EXPORT StoreResourcesJob : public KJob
+    {
+        Q_OBJECT
+    public:
+        ~StoreResourcesJob();
+
+        QHash<QUrl, QUrl> mappings() const;
+
+    private:
+        StoreResourcesJob(const Nepomuk::SimpleResourceGraph& resources,
+                         Nepomuk::StoreIdentificationMode identificationMode,
+                         Nepomuk::StoreResourcesFlags flags,
+                         const QHash<QUrl, QVariant>& additionalMetadata,
+                         const KComponentData& component);
+        class Private;
+        Private *d;
+
+        void start();
+
+        Q_PRIVATE_SLOT( d, void _k_slotDBusCallFinished( QDBusPendingCallWatcher* ) \
) +
+        friend Nepomuk::StoreResourcesJob* storeResources(const \
SimpleResourceGraph&, +                                                         \
StoreIdentificationMode, +                                                         \
StoreResourcesFlags, +                                                         const \
QHash<QUrl, QVariant>&, +                                                         \
const KComponentData& ); +    };
+
+}
+#endif // STORERESOURCEJOB_H


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic