1/*
2 * This file is part of Soprano Project.
3 *
4 * Copyright (C) 2007 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_DUMMY_MODEL_H
23#define SOPRANO_DUMMY_MODEL_H
24
25#include "soprano_export.h"
26#include "model.h"
27
28
29namespace Soprano {
30 namespace Util {
31 /**
32 * \class DummyModel dummymodel.h Soprano/Util/DummyModel
33 *
34 * \brief A dummy model. All its methods do nothing and always
35 * fail with a default error.
36 *
37 * A dummy model might be useful in situations where a null pointer
38 * could lead to crashes if creating a real model fails.
39 *
40 * \author Sebastian Trueg <trueg@kde.org>
41 */
42 class SOPRANO_EXPORT DummyModel : public Model
43 {
44 Q_OBJECT
45
46 public:
47 /**
48 * Create a new dummy model.
49 */
50 DummyModel();
51
52 /**
53 * destructor
54 */
55 ~DummyModel();
56
57 //@{
58 Error::ErrorCode addStatement( const Statement &statement );
59 Error::ErrorCode addStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() );
60 Error::ErrorCode addStatements( const QList<Statement> &statements );
61 //@}
62
63 //@{
64 Error::ErrorCode removeStatement( const Statement &statement );
65 Error::ErrorCode removeStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() );
66 Error::ErrorCode removeAllStatements( const Statement &statement );
67 Error::ErrorCode removeStatements( const QList<Statement> &statements );
68 Error::ErrorCode removeContext( const Node& );
69 Error::ErrorCode removeAllStatements();
70 //@}
71
72 //@{
73 StatementIterator listStatements( const Statement &partial ) const;
74 StatementIterator listStatements( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
75 StatementIterator listStatements() const;
76 StatementIterator listStatementsInContext( const Node &context ) const;
77 NodeIterator listContexts() const;
78// QueryResultIterator executeQuery( const Query::Query& query ) const;
79 QueryResultIterator executeQuery( const QString& query, Query::QueryLanguage language, const QString& userQueryLanguage = QString() ) const;
80 //@}
81
82 //@{
83 bool containsAnyStatement( const Statement &statement ) const;
84 bool containsAnyStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
85 bool containsStatement( const Statement &statement ) const;
86 bool containsStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
87 bool containsContext( const Node &context ) const;
88 bool isEmpty() const;
89 int statementCount() const;
90 //@}
91
92 //@{
93 Error::ErrorCode write( QTextStream &os ) const;
94 //@}
95
96 //@{
97 Node createBlankNode();
98 //@}
99
100 private:
101 class Private;
102 Private* const d;
103 };
104 }
105}
106
107#endif
108