Soprano  2.9.4
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 
180 
181  using Model::addStatement;
184  using Model::listStatements;
187 
188  protected:
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
A FilterModel is a virtual model that wraps another Model.
Definition: filtermodel.h:49
virtual Node createBlankNode()
virtual void setParentModel(Model *model)
virtual Error::ErrorCode addStatement(const Statement &statement)
virtual void parentStatementRemoved(const Statement &)
virtual bool isEmpty() const
StatementIterator listStatements(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
virtual StatementIterator listStatements(const Statement &partial) const
virtual Error::ErrorCode write(QTextStream &os) const
virtual void parentStatementsAdded()
bool containsStatement(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
Error::ErrorCode addStatement(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
bool containsAnyStatement(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
virtual Model * parentModel() const
Error::ErrorCode removeAllStatements(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
virtual void parentStatementsRemoved()
virtual bool containsStatement(const Statement &statement) const
FilterModel(Model *parent)
virtual Error::ErrorCode removeAllStatements(const Statement &statement)
virtual NodeIterator listContexts() const
virtual void parentStatementAdded(const Statement &)
virtual int statementCount() const
virtual bool containsAnyStatement(const Statement &statement) const
Error::ErrorCode removeStatement(const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
virtual Error::ErrorCode removeStatement(const Statement &statement)
virtual QueryResultIterator executeQuery(const QString &query, Query::QueryLanguage language, const QString &userQueryLanguage=QString()) const
A Model is the central class in Soprano. It is a queryable collection of RDF quadruples,...
Definition: model.h:95
virtual bool containsStatement(const Statement &statement) const =0
virtual bool containsAnyStatement(const Statement &statement) const =0
StatementIterator listStatements() const
Error::ErrorCode removeAllStatements()
virtual Error::ErrorCode removeStatement(const Statement &statement)=0
virtual Error::ErrorCode addStatement(const Statement &statement)=0
An iterator that provides a stream of Nodes.
Definition: nodeiterator.h:73
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
SOPRANO_EXPORT QUrl predicate()
SOPRANO_EXPORT QUrl subject()
SOPRANO_EXPORT QUrl context()
SOPRANO_EXPORT QUrl language()
#define SOPRANO_EXPORT