Soprano 2.9.4
graph.h
Go to the documentation of this file.
1/*
2 * This file is part of Soprano Project.
3 *
4 * Copyright (C) 2009 Sebastian Trueg <trueg@kde.org>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 */
21
22#ifndef SOPRANO_GRAPH_H
23#define SOPRANO_GRAPH_H
24
25#include <QtCore/QList>
26#include <QtCore/QSharedDataPointer>
27#include <QtCore/QDebug>
28
29#include "soprano_export.h"
30#include "error.h"
31#include "sopranotypes.h"
32#include "node.h"
33#include "statement.h"
34
35
36namespace Soprano
37{
39 class NodeIterator;
40
61 {
62 public:
67
71 Graph( const Graph& );
72
79
84
86
91 void addStatement( const Statement& statement );
92
96 void addStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() );
97
101 void addStatements( const QList<Statement>& statements );
103
105
113 void removeStatement( const Statement& statement );
114
118 void removeStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() );
119
127 void removeAllStatements( const Statement& statement = Statement() );
128
137 void removeAllStatements( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() );
138
142 void removeStatements( const QList<Statement>& statements );
143
147 void removeContext( const Node& );
149
150
152
161
172 StatementIterator listStatements( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
173
180
188
189
191
200 bool containsAnyStatement( const Statement& statement ) const;
201
210 bool containsAnyStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
211
222 bool containsStatement( const Statement& statement ) const;
223
227 bool containsStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
228
232 bool containsContext( const Node& context ) const;
233
237 bool isEmpty() const;
238
243 int statementCount() const;
245
247
252
254
259
264
267 Graph& operator=( const Graph& g );
268
272 Graph& operator=( const QList<Statement>& statements );
273
277 Graph operator+( const Graph& g ) const;
278
282 Graph operator+( const Statement& s ) const;
283
288 Graph& operator+=( const Graph& g );
289
295
300 Graph operator-( const Graph& ) const;
301
306 Graph operator-( const Statement& s ) const;
307
312 Graph& operator-=( const Graph& g );
313
319
324
329
336 bool operator==( const Graph& g ) const;
337
344 bool operator!=( const Graph& g ) const;
346
347 private:
348 class Private;
350 };
351
352 SOPRANO_EXPORT QDebug operator<<(QDebug dbg, const Graph& graph);
353}
354
355#endif
A simple collection of statements.
Definition graph.h:61
Graph(const Graph &)
Graph(const QList< Statement > &)
bool isEmpty() const
Graph & operator<<(const Graph &)
QSet< Statement > toSet() const
bool containsContext(const Node &context) const
Graph operator-(const Statement &s) const
void removeAllStatements(const Statement &statement=Statement())
void removeAllStatements(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
void addStatements(const QList< Statement > &statements)
void removeStatements(const QList< Statement > &statements)
Graph operator+(const Statement &s) const
Graph operator-(const Graph &) const
void removeStatement(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
void addStatement(const Statement &statement)
Graph & operator=(const QList< Statement > &statements)
StatementIterator listStatements(const Statement &partial=Statement()) const
bool containsStatement(const Statement &statement) const
Graph operator+(const Graph &g) const
Graph & operator-=(const Statement &s)
void removeStatement(const Statement &statement)
Graph & operator-=(const Graph &g)
bool containsAnyStatement(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
Graph & operator=(const Graph &g)
StatementIterator listStatementsInContext(const Node &context) const
StatementIterator listStatements(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
int statementCount() const
NodeIterator listContexts() const
bool containsAnyStatement(const Statement &statement) const
bool operator!=(const Graph &g) const
Graph & operator<<(const Statement &)
Graph & operator+=(const Graph &g)
void removeContext(const Node &)
QList< Statement > toList() const
bool containsStatement(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
bool operator==(const Graph &g) const
void addStatement(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
Graph & operator+=(const Statement &s)
An iterator that provides a stream of Nodes.
A Node represents one RDF resource.
Definition node.h:54
An iterator that provides a stream of Statements.
A Statement instance represents one RDF quadruple.
Definition statement.h:48
SOPRANO_EXPORT QDebug operator<<(QDebug dbg, const Graph &graph)
#define SOPRANO_EXPORT