Soprano  2.8.0
Public Types | Public Member Functions
Soprano::Util::AsyncModel Class Reference

Filter model that allows to perform operations asyncroneously. More...

#include <Soprano/Server/AsyncModel>

+ Inheritance diagram for Soprano::Util::AsyncModel:

List of all members.

Public Types

enum  AsyncModelMode { SingleThreaded, MultiThreaded }

Public Member Functions

 AsyncModel (Model *parent=0)
 ~AsyncModel ()
void setMode (AsyncModelMode mode)
AsyncModelMode mode () const
AsyncResultaddStatementAsync (const Statement &statement)
AsyncResultaddStatementAsync (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
AsyncResultaddStatementsAsync (const QList< Statement > &statements)
AsyncResultremoveStatementAsync (const Statement &statement)
AsyncResultremoveStatementAsync (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
AsyncResultremoveStatementsAsync (const QList< Statement > &statements)
AsyncResultremoveAllStatementsAsync (const Statement &statement)
AsyncResultremoveAllStatementsAsync (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node())
AsyncResultisEmptyAsync () const
AsyncResultstatementCountAsync () const
AsyncResultlistStatementsAsync (const Statement &statement) const
AsyncResultlistStatementsAsync (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
AsyncResultlistStatementsAsync () const
AsyncResultlistContextsAsync () const
AsyncResultexecuteQueryAsync (const QString &query, Query::QueryLanguage language, const QString &userQueryLanguage=QString()) const
AsyncResultcontainsStatementAsync (const Statement &statement) const
AsyncResultcontainsStatementAsync (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
AsyncResultcontainsAnyStatementAsync (const Statement &statement) const
AsyncResultcontainsAnyStatementAsync (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const
AsyncResultcreateBlankNodeAsync ()
StatementIterator listStatements (const Statement &partial) const
NodeIterator listContexts () const
QueryResultIterator executeQuery (const QString &query, Query::QueryLanguage language, const QString &userQueryLanguage=QString()) const

Detailed Description

Filter model that allows to perform operations asyncroneously.

AsyncModel has two modes: AsyncModel::SingleThreaded and AsyncModel::MultiThreaded. The main purpose of the AsyncModel::SingleThreaded mode is to protect a Model against deadlocks in a single threaded situation.

AsyncModel::MultiThreaded mode provides real asyncroneous execution of Model commands.

Usage:

 AsyncResult* result = model->listStatementsAsync( s );
 connect( result, SIGNAL(resultReady(AsyncResult*)),
          this, SLOT(slotResultReady(AsyncResult*)) );
Author:
Sebastian Trueg trueg.nosp@m.@kde.nosp@m..org
Since:
2.1

Definition at line 67 of file asyncmodel.h.


Member Enumeration Documentation

The mode of the model, single vs. multi threaded execution.

Since:
2.2
Enumerator:
SingleThreaded 

The model uses a single thread. Thus, commands are executed in the same thread but no two commands will ever block each other. This is the default mode for historical reasons.

MultiThreaded 

The model uses multiple threads through QThreadPool. Commands are executed in parallel. Be aware that the parent model needs to be thread-safe.

Definition at line 89 of file asyncmodel.h.


Constructor & Destructor Documentation

Create a new Model.

Parameters:
parentThe parent model to forward the operations to.

Destructor.


Member Function Documentation

Set the mode to be used. For historical reasons the default mode is SingleThreaded.

See also:
mode
Since:
2.2

The mode used by this model.

See also:
setMode
Since:
2.2

Asyncroneously add the Statement to the Model.

Parameters:
statementThe Statement to add.
See also:
addStatement
Returns:
an AsyncResult with result type Error::ErrorCode object which will signal when the result is ready.
AsyncResult* Soprano::Util::AsyncModel::addStatementAsync ( const Node subject,
const Node predicate,
const Node object,
const Node context = Node() 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since:
2.2

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since:
2.2

Asyncroneously remove one statement. For removing statements with wildward matching see removeAllStatementsAsync().

Parameters:
statementThe statement that should be removed. This has to be a valid statement.
See also:
removeStatement
Returns:
an AsyncResult with result type Error::ErrorCode object which will signal when the result is ready.
AsyncResult* Soprano::Util::AsyncModel::removeStatementAsync ( const Node subject,
const Node predicate,
const Node object,
const Node context = Node() 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since:
2.2

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since:
2.2

Asyncroneously remove all statements that match the partial statement. For removing one specific statement see removeStatement().

Parameters:
statementA possible partially defined statement that serves as a filter for all statements that should be removed.
See also:
removeAllStatements
Returns:
an AsyncResult with result type Error::ErrorCode object which will signal when the result is ready.
AsyncResult* Soprano::Util::AsyncModel::removeAllStatementsAsync ( const Node subject,
const Node predicate,
const Node object,
const Node context = Node() 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since:
2.2

Asyncroneously check if the Model does contain any Statement.

See also:
isEmpty
Returns:
an AsyncResult with result type bool object which will signal when the result is ready.

Asyncroneously determine the number of statements stored in this Model.

See also:
statementCount
Returns:
an AsyncResult with result type int object which will signal when the result is ready.

Asyncroneously return an iterator over Model Statements that "partial" match the input Statement.

Parameters:
statementThe partial Statement to match.
See also:
listStatements
Returns:
an AsyncResult with result type StatementIterator object which will signal when the result is ready.
AsyncResult* Soprano::Util::AsyncModel::listStatementsAsync ( const Node subject,
const Node predicate,
const Node object,
const Node context = Node() 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since:
2.2

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Lists all statements in the Model asyncroneously.

Since:
2.2

Asyncroneously list all contexts in the model, i.e. all named graphs.

See also:
listContexts
Returns:
an AsyncResult with result type NodeIterator object which will signal when the result is ready.
AsyncResult* Soprano::Util::AsyncModel::executeQueryAsync ( const QString query,
Query::QueryLanguage  language,
const QString userQueryLanguage = QString() 
) const

Asyncroneously execute the given query over the Model.

This is a const read-only method. As such Model implementations should not support SPARQL extensions such as INSERT or UPDATE through this method. A future version of Soprano will provide an additional API for queries that change the Model.

Parameters:
queryThe query to evaluate.
languageThe query language used to encode query.
userQueryLanguageIf language equals Query::QueryLanguageUser userQueryLanguage defines the language to use.
See also:
executeQuery
Returns:
an AsyncResult with result type QueryResultIterator object which will signal when the result is ready.

AsyncResult check if the model contains a statements.

Parameters:
statementThe statement in question. This has to be a valid statement, i.e. subject, predicate, and object need to be defined. If the context node is empty the default graph is searched.
See also:
containsStatement
Returns:
an AsyncResult with result type bool object which will signal when the result is ready.
AsyncResult* Soprano::Util::AsyncModel::containsStatementAsync ( const Node subject,
const Node predicate,
const Node object,
const Node context = Node() 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since:
2.2

Asyncroneously check if the model contains certain statements.

Parameters:
statementA partially defined statement that serves as a pattern.
See also:
containsAnyStatement
Returns:
an AsyncResult with result type bool object which will signal when the result is ready.
AsyncResult* Soprano::Util::AsyncModel::containsAnyStatementAsync ( const Node subject,
const Node predicate,
const Node object,
const Node context = Node() 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since:
2.2

Asyncroneously create a new blank node with a unique identifier.

See also:
createBlankNode
Returns:
an AsyncResult with result type Node object which will signal when the result is ready.

The call is directly delivered to the parent model. However, the iterator is counted so that interweaving asyncroneous and non-asyncroneous calls does not result in unwanted behaviour.

Since:
2.4

Reimplemented from Soprano::FilterModel.

The call is directly delivered to the parent model. However, the iterator is counted so that interweaving asyncroneous and non-asyncroneous calls does not result in unwanted behaviour.

Since:
2.4

Reimplemented from Soprano::FilterModel.

QueryResultIterator Soprano::Util::AsyncModel::executeQuery ( const QString query,
Query::QueryLanguage  language,
const QString userQueryLanguage = QString() 
) const [virtual]

The call is directly delivered to the parent model. However, the iterator is counted so that interweaving asyncroneous and non-asyncroneous calls does not result in unwanted behaviour.

Since:
2.4

Reimplemented from Soprano::FilterModel.


The documentation for this class was generated from the following file: