Soprano  2.8.0
filtermodel.h
Go to the documentation of this file.
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_FILTER_MODEL_H_
23 #define _SOPRANO_FILTER_MODEL_H_
24 
25 #include "model.h"
26 #include "soprano_export.h"
27 
28 
29 namespace Soprano {
49  {
50  Q_OBJECT
51 
52  public:
56  virtual ~FilterModel();
57 
59 
63  virtual void setParentModel( Model* model );
64 
69  virtual Model* parentModel() const;
71 
73 
76  virtual Error::ErrorCode addStatement( const Statement &statement );
77 
81  Error::ErrorCode addStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() );
83 
85 
88  virtual Error::ErrorCode removeStatement( const Statement &statement );
89 
93  Error::ErrorCode removeStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() );
94 
98  virtual Error::ErrorCode removeAllStatements( const Statement &statement );
99 
103  Error::ErrorCode removeAllStatements( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() );
105 
107 
110  virtual StatementIterator listStatements( const Statement &partial ) const;
111 
115  StatementIterator listStatements( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
116 
120  virtual NodeIterator listContexts() const;
121 
125 // virtual QueryResultIterator executeQuery( const Query::Query& query ) const;
126 
130  virtual QueryResultIterator executeQuery( const QString& query, Query::QueryLanguage language, const QString& userQueryLanguage = QString() ) const;
132 
134 
137  virtual bool containsStatement( const Statement &statement ) const;
138 
142  bool containsStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
143 
147  virtual bool containsAnyStatement( const Statement &statement ) const;
148 
152  bool containsAnyStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
154 
156 
159  virtual bool isEmpty() const;
160 
164  virtual int statementCount() const;
166 
168 
171  virtual Error::ErrorCode write( QTextStream &os ) const;
173 
175 
178  virtual Node createBlankNode();
180 
181  using Model::addStatement;
184  using Model::listStatements;
187 
188  protected:
192  FilterModel();
193 
199  FilterModel( Model* parent );
200 
206  virtual void parentStatementsAdded();
207 
213  virtual void parentStatementsRemoved();
214 
220  virtual void parentStatementAdded( const Statement& );
221 
227  virtual void parentStatementRemoved( const Statement& );
228 
229  private Q_SLOTS:
234  void slotStatementsAdded();
235 
240  void slotStatementsRemoved();
241 
246  void slotStatementAdded( const Soprano::Statement& );
247 
252  void slotStatementRemoved( const Soprano::Statement& );
253 
254  private:
255  class Private;
256  Private* const d;
257  };
258 }
259 
260 #endif