Soprano
2.7.6
|
00001 /* 00002 * This file is part of Soprano Project. 00003 * 00004 * Copyright (C) 2007 Sebastian Trueg <trueg@kde.org> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef _SOPRANO_FILTER_MODEL_H_ 00023 #define _SOPRANO_FILTER_MODEL_H_ 00024 00025 #include "model.h" 00026 #include "soprano_export.h" 00027 00028 00029 namespace Soprano { 00048 class SOPRANO_EXPORT FilterModel : public Model 00049 { 00050 Q_OBJECT 00051 00052 public: 00056 virtual ~FilterModel(); 00057 00059 00063 virtual void setParentModel( Model* model ); 00064 00069 virtual Model* parentModel() const; 00071 00073 00076 virtual Error::ErrorCode addStatement( const Statement &statement ); 00077 00081 Error::ErrorCode addStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ); 00083 00085 00088 virtual Error::ErrorCode removeStatement( const Statement &statement ); 00089 00093 Error::ErrorCode removeStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ); 00094 00098 virtual Error::ErrorCode removeAllStatements( const Statement &statement ); 00099 00103 Error::ErrorCode removeAllStatements( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ); 00105 00107 00110 virtual StatementIterator listStatements( const Statement &partial ) const; 00111 00115 StatementIterator listStatements( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const; 00116 00120 virtual NodeIterator listContexts() const; 00121 00125 // virtual QueryResultIterator executeQuery( const Query::Query& query ) const; 00126 00130 virtual QueryResultIterator executeQuery( const QString& query, Query::QueryLanguage language, const QString& userQueryLanguage = QString() ) const; 00132 00134 00137 virtual bool containsStatement( const Statement &statement ) const; 00138 00142 bool containsStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const; 00143 00147 virtual bool containsAnyStatement( const Statement &statement ) const; 00148 00152 bool containsAnyStatement( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const; 00154 00156 00159 virtual bool isEmpty() const; 00160 00164 virtual int statementCount() const; 00166 00168 00171 virtual Error::ErrorCode write( QTextStream &os ) const; 00173 00175 00178 virtual Node createBlankNode(); 00180 00181 using Model::addStatement; 00182 using Model::removeStatement; 00183 using Model::removeAllStatements; 00184 using Model::listStatements; 00185 using Model::containsStatement; 00186 using Model::containsAnyStatement; 00187 00188 protected: 00192 FilterModel(); 00193 00199 FilterModel( Model* parent ); 00200 00206 virtual void parentStatementsAdded(); 00207 00213 virtual void parentStatementsRemoved(); 00214 00220 virtual void parentStatementAdded( const Statement& ); 00221 00227 virtual void parentStatementRemoved( const Statement& ); 00228 00229 private Q_SLOTS: 00234 void slotStatementsAdded(); 00235 00240 void slotStatementsRemoved(); 00241 00246 void slotStatementAdded( const Soprano::Statement& ); 00247 00252 void slotStatementRemoved( const Soprano::Statement& ); 00253 00254 private: 00255 class Private; 00256 Private* const d; 00257 }; 00258 } 00259 00260 #endif