• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Nepomuk-Core

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk-core
  • services
  • storage
datamanagementmodel.h
Go to the documentation of this file.
1 /*
2  This file is part of the Nepomuk KDE project.
3  Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) version 3, or any
9  later version accepted by the membership of KDE e.V. (or its
10  successor approved by the membership of KDE e.V.), which shall
11  act as a proxy defined in Section 6 of version 3 of the license.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #ifndef DATAMANAGEMENTMODEL_H
23 #define DATAMANAGEMENTMODEL_H
24 
25 #include "datamanagement.h"
26 
27 #include <Soprano/FilterModel>
28 
29 #include <QtCore/QDateTime>
30 
31 namespace Nepomuk2 {
32 
33 class ClassAndPropertyTree;
34 class ResourceMerger;
35 class SimpleResourceGraph;
36 class ResourceWatcherManager;
37 class TypeCache;
38 
39 class DataManagementModel : public Soprano::FilterModel
40 {
41  Q_OBJECT
42 
43 public:
44  DataManagementModel(ClassAndPropertyTree* tree, Soprano::Model* model, QObject *parent = 0);
45  ~DataManagementModel();
46 
48  ResourceWatcherManager* resourceWatcherManager() const;
49 
50 public Q_SLOTS:
60  void addProperty(const QList<QUrl>& resources,
61  const QUrl& property,
62  const QVariantList& values,
63  const QString& app);
64 
70  void setProperty(const QList<QUrl>& resources,
71  const QUrl& property,
72  const QVariantList& values,
73  const QString& app);
74 
79  void removeProperty(const QList<QUrl>& resources,
80  const QUrl& property,
81  const QVariantList& values,
82  const QString& app);
83 
88  void removeProperties(const QList<QUrl>& resources,
89  const QList<QUrl>& properties,
90  const QString& app);
91 
95  QUrl createResource(const QList<QUrl>& types,
96  const QString& label,
97  const QString& description,
98  const QString& app);
99 
108  void removeResources(const QList<QUrl>& resources,
109  Nepomuk2::RemovalFlags flags,
110  const QString& app);
112 
126  void removeDataByApplication(const QList<QUrl>& resources,
127  RemovalFlags flags,
128  const QString& app);
129 
138  void removeDataByApplication(RemovalFlags flags,
139  const QString& app);
140 
159  QHash<QUrl,QUrl> storeResources(const SimpleResourceGraph& resources,
160  const QString& app,
161  Nepomuk2::StoreIdentificationMode identificationMode = Nepomuk2::IdentifyNew,
162  Nepomuk2::StoreResourcesFlags flags = Nepomuk2::NoStoreResourcesFlags,
163  const QHash<QUrl, QVariant>& additionalMetadata = (QHash<QUrl, QVariant>()) );
164 
177  QHash<QUrl,QUrl> storeResources(const SimpleResourceGraph& resources,
178  const QString& app,
179  bool discardable,
180  Nepomuk2::StoreIdentificationMode identificationMode = Nepomuk2::IdentifyNew,
181  Nepomuk2::StoreResourcesFlags flags = Nepomuk2::NoStoreResourcesFlags);
187  void mergeResources(const QList<QUrl>& resources, const QString& app);
188 
208  void importResources(const QUrl& url, const QString& app,
209  Soprano::RdfSerialization serialization,
210  const QString& userSerialization = QString(),
211  Nepomuk2::StoreIdentificationMode identificationMode = Nepomuk2::IdentifyNew,
212  Nepomuk2::StoreResourcesFlags flags = Nepomuk2::NoStoreResourcesFlags,
213  const QHash<QUrl, QVariant>& additionalMetadata = (QHash<QUrl, QVariant>()) );
214 
223  SimpleResourceGraph describeResources(const QList<QUrl>& resources,
224  DescribeResourcesFlags flags = NoDescribeResourcesFlags,
225  const QList<QUrl>& targetParties = QList<QUrl>() );
226 
242  QString exportResources(const QList<QUrl>& resources,
243  Soprano::RdfSerialization serialization,
244  const QString& userSerialization = QString(),
245  DescribeResourcesFlags flags = NoDescribeResourcesFlags,
246  const QList<QUrl>& targetParties = QList<QUrl>() );
248 
252  void clearCache();
253 
254  TypeCache* typeCache();
255 
256  QUrl nepomukGraph();
257 private:
258  QUrl createNepomukGraph();
259  QUrl createGraph(const QString& app, const QMultiHash<QUrl, Soprano::Node>& additionalMetadata);
260  QUrl fetchGraph(const QString& app, bool discardable = false);
261 
262  QUrl findApplicationResource(const QString& app, bool create = true);
263 
268  Soprano::Error::ErrorCode updateModificationDate( const QUrl& resource,
269  const QDateTime& date = QDateTime::currentDateTime() );
270 
275  Soprano::Error::ErrorCode updateModificationDate( const QSet<QUrl>& resources,
276  const QDateTime& date = QDateTime::currentDateTime() );
277 
289  QHash<QUrl, QList<Soprano::Node> > addProperty(const QList<QUrl>& resources, const QUrl& property,
290  const QList<Soprano::Node>& nodes, const QString& app,
291  bool signalPropertyChanged = false);
292 
298  void removeAllResources(const QSet<QUrl>& resourceUris, RemovalFlags flags);
299 
304  bool doesResourceExist(const QUrl& res, const QUrl& graph = QUrl()) const;
305 
313  QUrl resolveUrl(const QUrl& url, bool statLocalFiles = false);
314 
322  QList<QUrl> resolveUrls(const QList< QUrl >& urls, const QString& app, bool statLocalFiles = true);
323 
329  QList<Soprano::Node> resolveNodes(const QSet<Soprano::Node>& nodes, const QString& app);
330 
331  QList<QUrl> createFileResources(const QList<QUrl>& nieUrls, const QUrl& graph);
332 
342  bool updateNieUrlOnLocalFile(const QUrl& resource, const QUrl& nieUrl);
343 
344  ClassAndPropertyTree * classAndPropertyTree();
345 
346  enum UriType {
347  GraphUri,
348  ResourceUri
349  };
350  QUrl createUri(UriType type);
351 
352  bool isProtectedProperty(const QUrl& prop) const;
353 
354  class Private;
355  Private* const d;
356 
357  friend class ResourceMerger;
358 };
359 }
360 
361 #endif
Nepomuk2::StoreIdentificationMode
StoreIdentificationMode
The identification mode used by storeResources().
Definition: datamanagement.h:349
QMultiHash
Nepomuk2::ErrorCode
ErrorCode
Definition: resource.h:44
Nepomuk2::ResourceMerger
Definition: resourcemerger.h:45
Nepomuk2::TypeCache
Definition: typecache.h:34
Nepomuk2::DataManagementModel::storeResources
QHash< QUrl, QUrl > storeResources(const SimpleResourceGraph &resources, const QString &app, Nepomuk2::StoreIdentificationMode identificationMode=Nepomuk2::IdentifyNew, Nepomuk2::StoreResourcesFlags flags=Nepomuk2::NoStoreResourcesFlags, const QHash< QUrl, QVariant > &additionalMetadata=(QHash< QUrl, QVariant >()))
Definition: datamanagementmodel.cpp:1285
Nepomuk2::DataManagementModel::removeResources
void removeResources(const QList< QUrl > &resources, Nepomuk2::RemovalFlags flags, const QString &app)
Remove resources from the database.
Definition: datamanagementmodel.cpp:907
Nepomuk2::DataManagementModel::mergeResources
void mergeResources(const QList< QUrl > &resources, const QString &app)
Merges all the resources into one.
Definition: datamanagementmodel.cpp:1608
Nepomuk2::DataManagementModel::~DataManagementModel
~DataManagementModel()
Definition: datamanagementmodel.cpp:268
Nepomuk2::DataManagementModel::removeProperty
void removeProperty(const QList< QUrl > &resources, const QUrl &property, const QVariantList &values, const QString &app)
Remove the property property with values from each resource in resources.
Definition: datamanagementmodel.cpp:617
QHash
QObject
Nepomuk2::DataManagementModel::setProperty
void setProperty(const QList< QUrl > &resources, const QUrl &property, const QVariantList &values, const QString &app)
Set, ie.
Definition: datamanagementmodel.cpp:465
Nepomuk2::DataManagementModel::exportResources
QString exportResources(const QList< QUrl > &resources, Soprano::RdfSerialization serialization, const QString &userSerialization=QString(), DescribeResourcesFlags flags=NoDescribeResourcesFlags, const QList< QUrl > &targetParties=QList< QUrl >())
Export a set of resources, i.e.
Definition: datamanagementmodel.cpp:1925
Nepomuk2::ClassAndPropertyTree
Definition: classandpropertytree.h:45
Nepomuk2::SimpleResourceGraph
Definition: simpleresourcegraph.h:48
Nepomuk2::DataManagementModel::createResource
QUrl createResource(const QList< QUrl > &types, const QString &label, const QString &description, const QString &app)
Create a new resource with several types.
Definition: datamanagementmodel.cpp:814
Nepomuk2::DataManagementModel::describeResources
SimpleResourceGraph describeResources(const QList< QUrl > &resources, DescribeResourcesFlags flags=NoDescribeResourcesFlags, const QList< QUrl > &targetParties=QList< QUrl >())
Describe a set of resources, i.e.
Definition: datamanagementmodel.cpp:1711
Nepomuk2::DataManagementModel::addProperty
void addProperty(const QList< QUrl > &resources, const QUrl &property, const QVariantList &values, const QString &app)
Add property with values to each resource from resources.
Definition: datamanagementmodel.cpp:321
Nepomuk2::DataManagementModel::importResources
void importResources(const QUrl &url, const QString &app, Soprano::RdfSerialization serialization, const QString &userSerialization=QString(), Nepomuk2::StoreIdentificationMode identificationMode=Nepomuk2::IdentifyNew, Nepomuk2::StoreResourcesFlags flags=Nepomuk2::NoStoreResourcesFlags, const QHash< QUrl, QVariant > &additionalMetadata=(QHash< QUrl, QVariant >()))
Import an RDF graph from a URL.
Definition: datamanagementmodel.cpp:1558
Nepomuk2::DataManagementModel::DataManagementModel
DataManagementModel(ClassAndPropertyTree *tree, Soprano::Model *model, QObject *parent=0)
Definition: datamanagementmodel.cpp:211
Nepomuk2::DataManagementModel::removeDataByApplication
void removeDataByApplication(const QList< QUrl > &resources, RemovalFlags flags, const QString &app)
Remove all information about resources from the database which have been created by a specific applic...
Definition: datamanagementmodel.cpp:948
Nepomuk2::DataManagementModel::clearCache
void clearCache()
Clear the internal cache present in the model.
Definition: datamanagementmodel.cpp:247
Nepomuk2::ResourceWatcherManager
Definition: resourcewatchermanager.h:38
Nepomuk2::IdentifyNew
This is the default mode.
Definition: datamanagement.h:352
Nepomuk2::DataManagementModel::nepomukGraph
QUrl nepomukGraph()
Definition: datamanagementmodel.cpp:2608
datamanagement.h
Nepomuk2::DataManagementModel::resourceWatcherManager
ResourceWatcherManager * resourceWatcherManager() const
used by the unit tests
Definition: datamanagementmodel.cpp:2598
Nepomuk2::DataManagementModel::removeProperties
void removeProperties(const QList< QUrl > &resources, const QList< QUrl > &properties, const QString &app)
Remove all statements involving any proerty from properties from all resources in resources...
Definition: datamanagementmodel.cpp:713
Nepomuk2::NoStoreResourcesFlags
No flags - default behaviour.
Definition: datamanagement.h:364
Nepomuk2::NoDescribeResourcesFlags
No flags - default behaviour.
Definition: datamanagement.h:396
Nepomuk2::DataManagementModel::typeCache
TypeCache * typeCache()
Definition: datamanagementmodel.cpp:2603
Nepomuk2::DataManagementModel
Definition: datamanagementmodel.h:39
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk-Core

Skip menu "Nepomuk-Core"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal