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_SIMPLERESOURCEH_H
24
#define NEPOMUK_SIMPLERESOURCEH_H
28
#include <QtCore/QList>
29
#include <QtCore/QHash>
30
#include <QtCore/QSharedDataPointer>
32
#include "nepomuksync_export.h"
44
* \class SimpleResource simpleresource.h
46
* A SimpleResource is a convenient way of storing a set of properties and objects for
47
* a common subject. This class does not represent an actual resource present in the
48
* repository. It's just a collection of in-memory statements.
50
* Interally it uses a multi-hash to store the properties and objects.
52
* \author Vishesh Handa <handa.vish@gmail.com>
54
class NEPOMUKSYNC_EXPORT SimpleResource : public QMultiHash<KUrl, Soprano::Node>
58
SimpleResource( const SimpleResource & rhs );
59
virtual ~SimpleResource();
62
* It uses the the first element's subject as the uri and ignores all further subjects.
63
* Please make sure all the subjects are the same cause no kind of checks are made.
65
static SimpleResource fromStatementList(const QList<Soprano::Statement> & list);
67
QList<Soprano::Statement> toStatementList() const;
69
bool isFileDataObject() const;
70
bool isFolder() const;
74
void setUri( const KUrl & newUri );
77
QList<Soprano::Node> property( const KUrl & url ) const;
80
* Removes all the statements whose object is \p uri
82
void removeObject( const KUrl & uri );
84
SimpleResource& operator=( const SimpleResource & rhs );
85
bool operator==( const SimpleResource & res );
88
QSharedDataPointer<Private> d;
92
* \class ResourceHash simpleresource.h
94
* A SimpleResource is a convenient way of representing a list of Soprano::Statements
95
* or a Soprano::Graph.
96
* It provides easy lookup of resources.
98
* \author Vishesh Handa <handa.vish@gmail.com>
100
class NEPOMUKSYNC_EXPORT ResourceHash : public QHash<KUrl, SimpleResource> {
102
static ResourceHash fromStatementList( const QList<Soprano::Statement> & list );
103
static ResourceHash fromGraph( const Soprano::Graph & graph );
105
QList<Soprano::Statement> toStatementList() const;
110
#endif // NEPOMUK_SIMPLERESOURCEH_H