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
Soprano::FilterModel::parentStatementAdded
virtual void parentStatementAdded(const Statement &)
Soprano::FilterModel::statementCount
virtual int statementCount() const
soprano_export.h
Soprano::Model::listStatements
StatementIterator listStatements() const
Soprano::Vocabulary::RDF::subject
SOPRANO_EXPORT QUrl subject()
model.h
Soprano::FilterModel::FilterModel
FilterModel()
Soprano::FilterModel::createBlankNode
virtual Node createBlankNode()
Soprano::Model::addStatement
virtual Error::ErrorCode addStatement(const Statement &statement)=0
Soprano::Query::QueryLanguage
QueryLanguage
Definition: sopranotypes.h:129
Soprano::Vocabulary::RDF::predicate
SOPRANO_EXPORT QUrl predicate()
SOPRANO_EXPORT
#define SOPRANO_EXPORT
Definition: soprano_export.h:37
Soprano::FilterModel
A FilterModel is a virtual model that wraps another Model.
Definition: filtermodel.h:49
Soprano::Statement
A Statement instance represents one RDF quadruple.
Definition: statement.h:48
QTextStream
Soprano::Model::removeStatement
virtual Error::ErrorCode removeStatement(const Statement &statement)=0
Soprano::QueryResultIterator
An iterator for query results.
Definition: queryresultiterator.h:109
Soprano::FilterModel::listContexts
virtual NodeIterator listContexts() const
Soprano::FilterModel::FilterModel
FilterModel(Model *parent)
Soprano::Model::removeAllStatements
Error::ErrorCode removeAllStatements()
Soprano::Model
A Model is the central class in Soprano. It is a queryable collection of RDF quadruples,...
Definition: model.h:95
Soprano::StatementIterator
An iterator that provides a stream of Statements.
Definition: statementiterator.h:76
Soprano::FilterModel::executeQuery
virtual QueryResultIterator executeQuery(const QString &query, Query::QueryLanguage language, const QString &userQueryLanguage=QString()) const
Soprano
Definition: backend.h:36
Soprano::FilterModel::parentStatementsAdded
virtual void parentStatementsAdded()
Soprano::Model::containsStatement
virtual bool containsStatement(const Statement &statement) const =0
Soprano::Model::containsAnyStatement
virtual bool containsAnyStatement(const Statement &statement) const =0
Soprano::FilterModel::parentStatementsRemoved
virtual void parentStatementsRemoved()
Soprano::FilterModel::write
virtual Error::ErrorCode write(QTextStream &os) const
Soprano::FilterModel::~FilterModel
virtual ~FilterModel()
Soprano::NodeIterator
An iterator that provides a stream of Nodes.
Definition: nodeiterator.h:73
Soprano::FilterModel::isEmpty
virtual bool isEmpty() const
Soprano::FilterModel::parentModel
virtual Model * parentModel() const
Soprano::FilterModel::parentStatementRemoved
virtual void parentStatementRemoved(const Statement &)
Soprano::FilterModel::setParentModel
virtual void setParentModel(Model *model)
Soprano::Node
A Node represents one RDF resource.
Definition: node.h:54
Soprano::Error::ErrorCode
ErrorCode
Definition: error.h:40
QString
Soprano::Vocabulary::Xesam::language
SOPRANO_EXPORT QUrl language()
Soprano::Vocabulary::SIL::context
SOPRANO_EXPORT QUrl context()