• 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
  • libnepomukcore
  • datamanagement
simpleresource.h
Go to the documentation of this file.
1 /*
2  This file is part of the Nepomuk KDE project.
3  Copyright (C) 2010-2011 Sebastian Trueg <trueg@kde.org>
4  Copyright (C) 2010-2011 Vishesh Handa <handa.vish@gmail.com>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) version 3, or any
10  later version accepted by the membership of KDE e.V. (or its
11  successor approved by the membership of KDE e.V.), which shall
12  act as a proxy defined in Section 6 of version 3 of the license.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #ifndef SIMPLERESOURCE_H
24 #define SIMPLERESOURCE_H
25 
26 #include <QtCore/QUrl>
27 #include <QtCore/QMultiHash>
28 #include <QtCore/QList>
29 #include <QtCore/QSharedDataPointer>
30 
31 #include <Soprano/Statement>
32 
33 #include "nepomuk_export.h"
34 
35 namespace Nepomuk2 {
36 
37 typedef QMultiHash<QUrl, QVariant> PropertyHash;
38 
46 class NEPOMUK_EXPORT SimpleResource
47 {
48 public:
49  explicit SimpleResource(const QUrl& uri = QUrl());
50  SimpleResource(const PropertyHash& properties);
51  SimpleResource(const SimpleResource& other);
52  virtual ~SimpleResource();
53 
54  SimpleResource& operator=(const SimpleResource& other);
55 
56  bool operator==(const SimpleResource& other) const;
57 
58  QUrl uri() const;
59 
64  void setUri( const QUrl & uri );
65 
66  bool contains(const QUrl& property) const;
67  bool contains(const QUrl& property, const QVariant& value) const;
68  bool containsNode(const QUrl& property, const Soprano::Node& value) const;
69 
73  void clear();
74 
78  void setProperties(const PropertyHash& properties);
79 
83  void addProperties(const PropertyHash& properties);
84 
90  void setProperty(const QUrl& property, const QVariant& value);
91 
97  void setProperty(const QUrl& property, const QVariantList& values);
98 
104  void setProperty(const QUrl& property, const SimpleResource& res);
105 
111  void setPropertyNode(const QUrl& property, const Soprano::Node& value);
112 
118  void addProperty(const QUrl& property, const QVariant& value);
119 
125  void addProperty(const QUrl& property, const SimpleResource& res);
126 
132  void addPropertyNode(const QUrl& property, const Soprano::Node& value);
133 
134  void remove(const QUrl& property, const QVariant& value);
135  void remove(const QUrl& property);
136 
141  void removeAll(const QUrl& property, const QVariant& value);
142 
147  void addType(const QUrl& type);
148 
153  void setTypes(const QList<QUrl>& types);
154 
158  QVariantList property(const QUrl& property) const;
159 
163  PropertyHash properties() const;
164 
169  QList<Soprano::Statement> toStatementList() const;
170 
175  bool isValid() const;
176 
177 
178 private:
179  class Private;
180  QSharedDataPointer<Private> d;
181 };
182 
183 NEPOMUK_EXPORT QDataStream & operator<<(QDataStream &, const Nepomuk2::SimpleResource& );
184 NEPOMUK_EXPORT QDataStream & operator>>(QDataStream &, Nepomuk2::SimpleResource& );
185 NEPOMUK_EXPORT QDebug operator<<(QDebug dbg, const Nepomuk2::SimpleResource& res);
186 NEPOMUK_EXPORT QDataStream & operator<<(QDataStream &, const Nepomuk2::SimpleResource& );
187 NEPOMUK_EXPORT QDataStream & operator>>(QDataStream &, Nepomuk2::SimpleResource& );
188 
189 NEPOMUK_EXPORT uint qHash(const SimpleResource& res);
190 }
191 
192 Q_DECLARE_TYPEINFO(Nepomuk2::SimpleResource, Q_MOVABLE_TYPE);
193 
194 #endif
QMultiHash
Nepomuk2::operator>>
QDataStream & operator>>(QDataStream &, Nepomuk2::SimpleResource &)
Definition: simpleresource.cpp:313
Nepomuk2::addProperty
KJob * addProperty(const QList< QUrl > &resources, const QUrl &property, const QVariantList &values, const KComponentData &component=KGlobal::mainComponent())
Add one or more property values to one or more resources.
Definition: datamanagement.cpp:36
Nepomuk2::SimpleResource
Represents a snapshot of one Nepomuk resource.
Definition: simpleresource.h:46
Nepomuk2::operator<<
QDataStream & operator<<(QDataStream &, const Nepomuk2::SimpleResource &)
Definition: simpleresource.cpp:307
Nepomuk2::PropertyHash
QMultiHash< QUrl, QVariant > PropertyHash
Definition: simpleresource.h:37
Nepomuk2::qHash
uint qHash(const SimpleResource &res)
Definition: simpleresource.cpp:297
Nepomuk2::setProperty
KJob * setProperty(const QList< QUrl > &resources, const QUrl &property, const QVariantList &values, const KComponentData &component=KGlobal::mainComponent())
Set the values of a property for one or more resources.
Definition: datamanagement.cpp:48
Q_DECLARE_TYPEINFO
Q_DECLARE_TYPEINFO(Nepomuk2::SimpleResource, Q_MOVABLE_TYPE)
nepomuk_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:09 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