Soprano  2.9.0
asyncmodel.h
Go to the documentation of this file.
1 /*
2  * This file is part of Soprano Project.
3  *
4  * Copyright (C) 2008 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_ASYNC_MODEL_H_
23 #define _SOPRANO_ASYNC_MODEL_H_
24 
25 #include "filtermodel.h"
26 #include "asyncresult.h" // backwards comp when AsyncResult was defined in this header
27 
28 #include "soprano_export.h"
29 
30 
31 namespace Soprano {
32 
33  class Statement;
34  class StatementIterator;
35  class Node;
36  class NodeIterator;
37  class QueryResultIterator;
38 
39  namespace Util {
40 
41  class AsyncModelPrivate;
42 
68  {
69  Q_OBJECT
70 
71  public:
77  AsyncModel( Model* parent = 0 );
78 
82  ~AsyncModel();
83 
96 
102  MultiThreaded
103  };
104 
113  void setMode( AsyncModelMode mode );
114 
122  AsyncModelMode mode() const;
123 
134  AsyncResult* addStatementAsync( const Statement& statement );
135 
141  AsyncResult* addStatementAsync( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() );
142 
148  AsyncResult* addStatementsAsync( const QList<Statement>& statements );
149 
162  AsyncResult* removeStatementAsync( const Statement& statement );
163 
169  AsyncResult* removeStatementAsync( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() );
170 
176  AsyncResult* removeStatementsAsync( const QList<Statement>& statements );
177 
190  AsyncResult* removeAllStatementsAsync( const Statement& statement );
191 
197  AsyncResult* removeAllStatementsAsync( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() );
198 
207  AsyncResult* isEmptyAsync() const;
208 
217  AsyncResult* statementCountAsync() const;
218 
230  AsyncResult* listStatementsAsync( const Statement& statement ) const;
231 
237  AsyncResult* listStatementsAsync( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
238 
246  AsyncResult* listStatementsAsync() const;
247 
256  AsyncResult* listContextsAsync() const;
257 
276  AsyncResult* executeQueryAsync( const QString& query,
278  const QString& userQueryLanguage = QString() ) const;
279 
292  AsyncResult* containsStatementAsync( const Statement& statement ) const;
293 
299  AsyncResult* containsStatementAsync( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
300 
312  AsyncResult* containsAnyStatementAsync( const Statement& statement ) const;
313 
319  AsyncResult* containsAnyStatementAsync( const Node& subject, const Node& predicate, const Node& object, const Node& context = Node() ) const;
320 
329  AsyncResult* createBlankNodeAsync();
330 
339  StatementIterator listStatements( const Statement& partial ) const;
340 
349  NodeIterator listContexts() const;
350 
359  QueryResultIterator executeQuery( const QString& query, Query::QueryLanguage language, const QString& userQueryLanguage = QString() ) const;
360 
367 
368  private:
369  AsyncModelPrivate* const d;
370 
371  Q_PRIVATE_SLOT( d, void _s_executeNextCommand() )
372  };
373  }
374 }
375 
376 #endif