• 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
simpleresourcegraph.h
Go to the documentation of this file.
1 /*
2  This file is part of the Nepomuk KDE project.
3  Copyright (C) 2011 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 SIMPLERESOURCEGRAPH_H
23 #define SIMPLERESOURCEGRAPH_H
24 
25 #include <QtCore/QSharedDataPointer>
26 #include <QtCore/QList>
27 #include <QtCore/QSet>
28 #include <QtCore/QUrl>
29 #include <QtCore/QMetaType>
30 #include <QtCore/QVariant>
31 
32 #include <KGlobal>
33 
34 #include "nepomuk_export.h"
35 
36 class QDataStream;
37 
38 class KJob;
39 namespace Soprano {
40 class Statement;
41 class Node;
42 class Graph;
43 }
44 namespace Nepomuk2 {
45 class SimpleResource;
46 class StoreResourcesJob;
47 
48 class NEPOMUK_EXPORT SimpleResourceGraph
49 {
50 public:
51  SimpleResourceGraph();
52  SimpleResourceGraph(const SimpleResource& resource);
53  SimpleResourceGraph(const QList<SimpleResource>& resources);
54  SimpleResourceGraph(const QSet<SimpleResource>& resources);
55  SimpleResourceGraph(const SimpleResourceGraph& other);
56  ~SimpleResourceGraph();
57 
58  SimpleResourceGraph& operator=(const SimpleResourceGraph& other);
59 
64  void insert(const SimpleResource& res);
65  SimpleResourceGraph& operator<<(const SimpleResource& res);
66 
67  void remove(const QUrl& uri);
68  void remove(const SimpleResource& res);
69 
70  void add(const QUrl& uri, const QUrl& property, const QVariant& value);
71  void set(const QUrl& uri, const QUrl& property, const QVariant& value);
72 
73  void remove(const QUrl& uri, const QUrl& property, const QVariant& value);
74 
79  void removeAll(const QUrl& uri, const QUrl& property, const QVariant& value = QVariant());
80 
81  void clear();
82 
83  int count() const;
84  int size() const { return count(); }
85  bool isEmpty() const;
86 
87  bool contains(const SimpleResource& res) const;
88  bool contains(const QUrl& res) const;
89  bool containsAny(const QUrl& res, const QUrl& property) const;
90 
91  SimpleResource operator[](const QUrl& uri) const;
92 
93  SimpleResource& operator[](const QUrl& uri);
94 
107  QList<QUrl> allResourceUris() const;
108 
109  QSet<SimpleResource> toSet() const;
110  QList<SimpleResource> toList() const;
111 
112  void addStatement(const Soprano::Statement& statement);
113  void addStatement(const Soprano::Node & subject,
114  const Soprano::Node & predicate,
115  const Soprano::Node & object);
116 
117  Soprano::Graph toStatementGraph() const;
118 
119  SimpleResourceGraph& operator+=( const SimpleResourceGraph & graph );
120 
132  StoreResourcesJob* save(const KComponentData& component = KGlobal::mainComponent()) const;
133 
134  bool operator==( const SimpleResourceGraph & rhs) const;
135  bool operator!=( const SimpleResourceGraph & rhs) const;
136 
137 private:
138  class Private;
139  QSharedDataPointer<Private> d;
140 };
141 
142 
143 NEPOMUK_EXPORT QDataStream & operator<<(QDataStream &, const Nepomuk2::SimpleResourceGraph& graph);
144 NEPOMUK_EXPORT QDataStream & operator>>(QDataStream &, Nepomuk2::SimpleResourceGraph& graph);
145 NEPOMUK_EXPORT QDebug operator<<(QDebug dbg, const Nepomuk2::SimpleResourceGraph& graph);
146 NEPOMUK_EXPORT QDataStream & operator<<(QDataStream &, const Nepomuk2::SimpleResourceGraph& graph);
147 NEPOMUK_EXPORT QDataStream & operator>>(QDataStream &, Nepomuk2::SimpleResourceGraph& graph);
148 }
149 
150 Q_DECLARE_TYPEINFO(Nepomuk2::SimpleResourceGraph, Q_MOVABLE_TYPE);
151 
152 #endif
Nepomuk2::operator>>
QDataStream & operator>>(QDataStream &, Nepomuk2::SimpleResource &)
Definition: simpleresource.cpp:313
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::SimpleResourceGraph
Definition: simpleresourcegraph.h:48
Nepomuk2::SimpleResourceGraph::size
int size() const
Definition: simpleresourcegraph.h:84
Nepomuk2::StoreResourcesJob
Definition: storeresourcesjob.h:34
Q_DECLARE_TYPEINFO
Q_DECLARE_TYPEINFO(Nepomuk2::SimpleResourceGraph, Q_MOVABLE_TYPE)
KJob
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