Soprano 2.9.4
model.h
Go to the documentation of this file.
1/*
2 * This file is part of Soprano Project.
3 *
4 * Copyright (C) 2006 Daniele Galdi <daniele.galdi@gmail.com>
5 * Copyright (C) 2007 Sebastian Trueg <trueg@kde.org>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 */
22
23#ifndef SOPRANO_MODEL_H
24#define SOPRANO_MODEL_H
25
26#include <QtCore/QObject>
27#include <QtCore/QList>
28
29#include "soprano_export.h"
30#include "error.h"
31#include "sopranotypes.h"
32#include "node.h"
33
34class QTextStream;
35
36namespace Soprano
37{
38 class QueryLegacy;
40 class Statement;
42 class NodeIterator;
43 namespace Query {
44 class Query;
45 }
46
95 {
96 Q_OBJECT
97
98 public:
99 virtual ~Model();
100
102
107 virtual Error::ErrorCode addStatement( const Statement &statement ) = 0;
108
112 Error::ErrorCode addStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() );
113
119
121
129 virtual Error::ErrorCode removeStatement( const Statement &statement ) = 0;
130
134 Error::ErrorCode removeStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() );
135
143 virtual Error::ErrorCode removeAllStatements( const Statement &statement ) = 0;
144
153 Error::ErrorCode removeAllStatements( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() );
154
159
164
170
171
173
181 virtual StatementIterator listStatements( const Statement &partial ) const = 0;
182
193 StatementIterator listStatements( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
194
201
208
214 virtual NodeIterator listContexts() const = 0;
215
217
228// virtual QueryResultIterator executeQuery( const Query::Query& query ) const = 0;
229
231
248 virtual QueryResultIterator executeQuery( const QString& query, Query::QueryLanguage language, const QString& userQueryLanguage = QString() ) const = 0;
250
251
253
262 virtual bool containsAnyStatement( const Statement &statement ) const = 0;
263
272 bool containsAnyStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
273
284 virtual bool containsStatement( const Statement &statement ) const = 0;
285
289 bool containsStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
290
294 bool containsContext( const Node &context ) const;
295
299 virtual bool isEmpty() const = 0;
300
305 virtual int statementCount() const = 0;
307
308
310
315 virtual Error::ErrorCode write( QTextStream &os ) const;
317
318
320
325 virtual Node createBlankNode() = 0;
327
328 Q_SIGNALS:
335
342
347 void statementAdded( const Soprano::Statement& statement );
348
358 void statementRemoved( const Soprano::Statement& statement );
359
360 protected:
362
363 private:
367 Model( const Model& );
368 Model& operator=( const Model& );
369
370 class Private;
371 Private* const d;
372 };
373}
374
375#endif
Core class of Soprano's exception system.
Definition error.h:235
virtual bool containsStatement(const Statement &statement) const =0
bool containsContext(const Node &context) const
Error::ErrorCode removeAllStatements(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
virtual Error::ErrorCode write(QTextStream &os) const
void statementAdded(const Soprano::Statement &statement)
bool containsStatement(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
Error::ErrorCode removeStatement(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
Error::ErrorCode addStatements(const QList< Statement > &statements)
virtual QueryResultIterator executeQuery(const QString &query, Query::QueryLanguage language, const QString &userQueryLanguage=QString()) const =0
bool containsAnyStatement(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
StatementIterator listStatements(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
StatementIterator listStatementsInContext(const Node &context) const
void statementsAdded()
Error::ErrorCode removeContext(const Node &)
Error::ErrorCode addStatement(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
virtual StatementIterator listStatements(const Statement &partial) const =0
virtual Node createBlankNode()=0
virtual int statementCount() const =0
void statementRemoved(const Soprano::Statement &statement)
virtual bool isEmpty() const =0
Error::ErrorCode removeStatements(const QList< Statement > &statements)
virtual bool containsAnyStatement(const Statement &statement) const =0
virtual ~Model()
StatementIterator listStatements() const
Error::ErrorCode removeAllStatements()
virtual NodeIterator listContexts() const =0
virtual Error::ErrorCode removeStatement(const Statement &statement)=0
void statementsRemoved()
virtual Error::ErrorCode addStatement(const Statement &statement)=0
virtual Error::ErrorCode removeAllStatements(const Statement &statement)=0
An iterator that provides a stream of Nodes.
A Node represents one RDF resource.
Definition node.h:54
An iterator for query results.
An iterator that provides a stream of Statements.
A Statement instance represents one RDF quadruple.
Definition statement.h:48
QObject(QObject *parent=0)
#define SOPRANO_EXPORT