Soprano
2.7.6
|
00001 /* 00002 * This file is part of Soprano Project. 00003 * 00004 * Copyright (C) 2008 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_ASYNC_MODEL_H_ 00023 #define _SOPRANO_ASYNC_MODEL_H_ 00024 00025 #include "filtermodel.h" 00026 #include "asyncresult.h" // backwards comp when AsyncResult was defined in this header 00027 00028 #include "soprano_export.h" 00029 00030 00031 namespace Soprano { 00032 00033 class Statement; 00034 class StatementIterator; 00035 class Node; 00036 class NodeIterator; 00037 class QueryResultIterator; 00038 00039 namespace Util { 00040 00041 class AsyncModelPrivate; 00042 00067 class SOPRANO_EXPORT AsyncModel : public FilterModel 00068 { 00069 Q_OBJECT 00070 00071 public: 00077 AsyncModel( Model* parent = 0 ); 00078 00082 ~AsyncModel(); 00083 00089 enum AsyncModelMode { 00095 SingleThreaded, 00096 00102 MultiThreaded 00103 }; 00104 00113 void setMode( AsyncModelMode mode ); 00114 00122 AsyncModelMode mode() const; 00123 00134 AsyncResult* addStatementAsync( const Statement& statement ); 00135 00141 AsyncResult* addStatementAsync( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ); 00142 00148 AsyncResult* addStatementsAsync( const QList<Statement>& statements ); 00149 00162 AsyncResult* removeStatementAsync( const Statement& statement ); 00163 00169 AsyncResult* removeStatementAsync( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ); 00170 00176 AsyncResult* removeStatementsAsync( const QList<Statement>& statements ); 00177 00190 AsyncResult* removeAllStatementsAsync( const Statement& statement ); 00191 00197 AsyncResult* removeAllStatementsAsync( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ); 00198 00207 AsyncResult* isEmptyAsync() const; 00208 00217 AsyncResult* statementCountAsync() const; 00218 00230 AsyncResult* listStatementsAsync( const Statement& statement ) const; 00231 00237 AsyncResult* listStatementsAsync( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const; 00238 00246 AsyncResult* listStatementsAsync() const; 00247 00256 AsyncResult* listContextsAsync() const; 00257 00276 AsyncResult* executeQueryAsync( const QString& query, 00277 Query::QueryLanguage language, 00278 const QString& userQueryLanguage = QString() ) const; 00279 00292 AsyncResult* containsStatementAsync( const Statement& statement ) const; 00293 00299 AsyncResult* containsStatementAsync( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const; 00300 00312 AsyncResult* containsAnyStatementAsync( const Statement& statement ) const; 00313 00319 AsyncResult* containsAnyStatementAsync( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const; 00320 00329 AsyncResult* createBlankNodeAsync(); 00330 00339 StatementIterator listStatements( const Statement& partial ) const; 00340 00349 NodeIterator listContexts() const; 00350 00359 QueryResultIterator executeQuery( const QString& query, Query::QueryLanguage language, const QString& userQueryLanguage = QString() ) const; 00360 00361 using FilterModel::addStatement; 00362 using FilterModel::removeStatement; 00363 using FilterModel::removeAllStatements; 00364 using FilterModel::listStatements; 00365 using FilterModel::containsStatement; 00366 using FilterModel::containsAnyStatement; 00367 00368 private: 00369 AsyncModelPrivate* const d; 00370 00371 Q_PRIVATE_SLOT( d, void _s_executeNextCommand() ) 00372 }; 00373 } 00374 } 00375 00376 #endif