• 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
resourcemerger.h
Go to the documentation of this file.
1 /*
2  <one line to give the library's name and an idea of what it does.>
3  Copyright (C) 2011 Vishesh Handa <handa.vish@gmail.com>
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) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 
20 
21 #ifndef NEPOMUK_DATAMANAGEMENT_RESOURCEMERGER_H
22 #define NEPOMUK_DATAMANAGEMENT_RESOURCEMERGER_H
23 
24 #include <QtCore/QHash>
25 #include <QtCore/QVariant>
26 #include <QtCore/QUrl>
27 #include <QtCore/QSet>
28 
29 #include <KUrl>
30 
31 #include "datamanagement.h"
32 #include "resourceidentifier.h"
33 #include "syncresource.h"
34 
35 namespace Soprano {
36  class Node;
37  class Statement;
38  class Graph;
39 }
40 
41 namespace Nepomuk2 {
42  class DataManagementModel;
43  class ResourceWatcherManager;
44 
45  class ResourceMerger
46  {
47  public:
48  ResourceMerger( Nepomuk2::DataManagementModel * model, const QString & app,
49  const StoreResourcesFlags& flags, bool discardable );
50  ~ResourceMerger();
51 
52  void setMappings( const QHash<QUrl, QUrl> & mappings );
53  QHash<QUrl, QUrl> mappings() const;
54 
55  bool merge(const Sync::ResourceHash& resHash);
56 
57  //
58  // We do not just derive from Soprano::Error::ErrorCache cause it
59  // implements per thread error handling. We do not need that since
60  // each thread has its own ResourceMerger
61  //
62  Soprano::Error::Error lastError();
63  void clearError();
64  void setError(const Soprano::Error::Error& error);
65  void setError(const QString& errorMessage, int code);
66 
67  private:
75  bool hasValidData( const QHash<KUrl, Sync::SyncResource>& resHash, Sync::SyncResource& res );
76 
77  bool push( const QUrl& graph, const Nepomuk2::Sync::ResourceHash& resHash );
78 
79  //
80  // Resolution
81  //
82  Soprano::Node resolveBlankNode( const Soprano::Node& node );
83  Soprano::Node resolveMappedNode( const Soprano::Node& node );
84 
85  Sync::ResourceHash resolveBlankNodes( const Sync::ResourceHash& resHash );
86 
88  QSet<QUrl> m_newUris;
89 
90  QHash<QUrl, QUrl> m_mappings;
91 
93  Sync::ResourceHash m_resRemoveHash;
94 
103  QHash<QUrl, QUrl> m_graphHash;
104 
105  bool m_discardbale;
106 
107  QString m_app;
108  QUrl m_appUri;
109  QUrl m_graph;
110 
111  StoreResourcesFlags m_flags;
112  Nepomuk2::DataManagementModel * m_model;
113 
119  bool isOfType( const Soprano::Node& node, const QUrl& type, const QList<QUrl>& newTypes = QList<QUrl>() ) const;
120 
121  QSet<QUrl> metadataProperties;
122  ResourceWatcherManager *m_rvm;
123 
124  Soprano::Error::Error m_error;
125  };
126 
127 }
128 
129 #endif // NEPOMUK_DATAMANAGEMENT_RESOURCEMERGER_H
Nepomuk2::ResourceMerger
Definition: resourcemerger.h:45
resourceidentifier.h
Nepomuk2::ResourceMerger::ResourceMerger
ResourceMerger(Nepomuk2::DataManagementModel *model, const QString &app, const StoreResourcesFlags &flags, bool discardable)
Definition: resourcemerger.cpp:90
QHash
Nepomuk2::ResourceMerger::~ResourceMerger
~ResourceMerger()
Definition: resourcemerger.cpp:109
Nepomuk2::ResourceMerger::mappings
QHash< QUrl, QUrl > mappings() const
Definition: resourcemerger.cpp:118
Nepomuk2::ResourceWatcherManager
Definition: resourcewatchermanager.h:38
datamanagement.h
Nepomuk2::ResourceMerger::setError
void setError(const Soprano::Error::Error &error)
Definition: resourcemerger.cpp:620
Nepomuk2::ResourceMerger::setMappings
void setMappings(const QHash< QUrl, QUrl > &mappings)
Definition: resourcemerger.cpp:113
Nepomuk2::ResourceMerger::lastError
Soprano::Error::Error lastError()
Definition: resourcemerger.cpp:615
Nepomuk2::ResourceMerger::clearError
void clearError()
Definition: resourcemerger.cpp:610
Nepomuk2::ResourceMerger::merge
bool merge(const Sync::ResourceHash &resHash)
Definition: resourcemerger.cpp:303
syncresource.h
Nepomuk2::Sync::SyncResource
A SyncResource is a convenient way of storing a set of properties and objects for a common subject...
Definition: syncresource.h:53
Nepomuk2::DataManagementModel
Definition: datamanagementmodel.h:39
Nepomuk2::Sync::ResourceHash
A SyncResource is a convenient way of representing a list of Soprano::Statements or a Soprano::Graph...
Definition: syncresource.h:109
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