2
This file is part of the Nepomuk KDE project.
3
Copyright (C) 2010 Vishesh Handa <handa.vish@gmail.com>
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.
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.
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/>.
23
#ifndef NEPOMUK_RESOURCEMERGER_H
24
#define NEPOMUK_RESOURCEMERGER_H
26
#include <QtCore/QList>
27
#include <QtCore/QHash>
31
#include "nepomuksync_export.h"
42
class ResourceManager;
51
* \class ResourceMerger resourcemerger.h
53
* This class can be used to push resources into repository after identification.
54
* It's default behavior is to create all the resources that have not been
57
* By default, it pushes all the statements with a nrl:InstanceBase graph. If a
58
* statement already exists in the repository then it is NOT overwritten.
60
* \author Vishesh Handa <handa.vish@gmail.com>
62
class NEPOMUKSYNC_EXPORT ResourceMerger
65
ResourceMerger( ResourceManager * rm = 0 );
66
virtual ~ResourceMerger();
68
ResourceManager * resourceManager() const;
69
void setResourceManager( ResourceManager * rm );
71
Soprano::Model * model() const;
74
* Pushes all the statements in \p graph into the model. If the statement
75
* already exists then resolveDuplicate() is called.
77
* If any of the statements contains a graph, then that graph is used. Otherwise
78
* a newly generated graph is used.
80
* \sa setGraphType graphType
82
virtual void merge( const Soprano::Graph & graph, const QHash<KUrl, Resource> & mappings );
85
* The graph type by default is nrl:InstanceBase. If \p type is not a subclass of
86
* nrl:Graph then it is ignored.
88
bool setGraphType( const Types::Class & type );
90
Types::Class graphType() const;
95
* Called when trying to merge a statement which contains a Resource that
96
* has not been identified.
98
* The default implementation of this creates the resource in the main model.
100
virtual Resource resolveUnidentifiedResource( const KUrl & uri );
103
* Creates a new graph of type graphType()
105
virtual KUrl createGraph();
108
* Push the statement into the Nepomuk repository if it doesn't already exist!
110
void push( const Soprano::Statement & st );
118
#endif // NEPOMUK_RESOURCEMERGER_H