KDE 4.9 PyKDE API Reference

- KDE's Python API

# AsyncModel Class Reference

`from PyKDE4.soprano import *`

Inherits: Soprano.FilterModel → Soprano.Model → QObject
Namespace: Soprano.Util

## Detailed Description

\class AsyncModel asyncmodel.h Soprano/Server/AsyncModel

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@kde.org>

Since:
  2.1

## Enumerations

AsyncModelMode | { SingleThreaded, MultiThreaded }

## Methods

| __init__ (self, Soprano.Model parent=0)
Soprano.Util.AsyncResult | addStatementAsync (self, Soprano.Statement statement)
Soprano.Util.AsyncResult | addStatementAsync (self, Soprano.Node subject, Soprano.Node predicate, Soprano.Node object, Soprano.Node context=Soprano.Node())
Soprano.Util.AsyncResult | addStatementsAsync (self, [Soprano.Statement] statements)
Soprano.Util.AsyncResult | containsAnyStatementAsync (self, Soprano.Statement statement)
Soprano.Util.AsyncResult | containsAnyStatementAsync (self, Soprano.Node subject, Soprano.Node predicate, Soprano.Node object, Soprano.Node context=Soprano.Node())
Soprano.Util.AsyncResult | containsStatementAsync (self, Soprano.Statement statement)
Soprano.Util.AsyncResult | containsStatementAsync (self, Soprano.Node subject, Soprano.Node predicate, Soprano.Node object, Soprano.Node context=Soprano.Node())
Soprano.Util.AsyncResult | createBlankNodeAsync (self)
Soprano.QueryResultIterator | executeQuery (self, QString query, Soprano.Query.QueryLanguage language, QString userQueryLanguage=QString())
Soprano.Util.AsyncResult | executeQueryAsync (self, QString query, Soprano.Query.QueryLanguage language, QString userQueryLanguage=QString())
Soprano.Util.AsyncResult | isEmptyAsync (self)
Soprano.NodeIterator | listContexts (self)
Soprano.Util.AsyncResult | listContextsAsync (self)
Soprano.StatementIterator | listStatements (self, Soprano.Statement partial)
Soprano.Util.AsyncResult | listStatementsAsync (self, Soprano.Statement statement)
Soprano.Util.AsyncResult | listStatementsAsync (self, Soprano.Node subject, Soprano.Node predicate, Soprano.Node object, Soprano.Node context=Soprano.Node())
Soprano.Util.AsyncResult | listStatementsAsync (self)
Soprano.Util.AsyncModel.AsyncModelMode | mode (self)
Soprano.Util.AsyncResult | removeAllStatementsAsync (self, Soprano.Statement statement)
Soprano.Util.AsyncResult | removeAllStatementsAsync (self, Soprano.Node subject, Soprano.Node predicate, Soprano.Node object, Soprano.Node context=Soprano.Node())
Soprano.Util.AsyncResult | removeStatementAsync (self, Soprano.Statement statement)
Soprano.Util.AsyncResult | removeStatementAsync (self, Soprano.Node subject, Soprano.Node predicate, Soprano.Node object, Soprano.Node context=Soprano.Node())
Soprano.Util.AsyncResult | removeStatementsAsync (self, [Soprano.Statement] statements)
| setMode (self, Soprano.Util.AsyncModel.AsyncModelMode mode)
Soprano.Util.AsyncResult | statementCountAsync (self)

## Method Documentation

__init__ | ( | self, |
|  | Soprano.Model | parent=0
| ) |  |  |

Create a new Model.

Parameters:

  | parent | The parent model to forward the operations to.

Soprano.Util.AsyncResult addStatementAsync | ( | self, |
|  | Soprano.Statement | statement
| ) |  |  |

Since:
  2.2

Soprano.Util.AsyncResult addStatementAsync | ( | self, |
|  | Soprano.Node | subject,
|  | Soprano.Node | predicate,
|  | Soprano.Node | object,
|  | Soprano.Node | context=Soprano.Node()
| ) |  |  |

Since:
  2.2

Soprano.Util.AsyncResult addStatementsAsync | ( | self, |
|  | [Soprano.Statement] | statements
| ) |  |  |

Since:
  2.2

Soprano.Util.AsyncResult containsAnyStatementAsync | ( | self, |
|  | Soprano.Statement | statement
| ) |  |  |

Since:
  2.2

Soprano.Util.AsyncResult containsAnyStatementAsync | ( | self, |
|  | Soprano.Node | subject,
|  | Soprano.Node | predicate,
|  | Soprano.Node | object,
|  | Soprano.Node | context=Soprano.Node()
| ) |  |  |

Since:
  2.2

Soprano.Util.AsyncResult containsStatementAsync | ( | self, |
|  | Soprano.Statement | statement
| ) |  |  |

Since:
  2.2

Soprano.Util.AsyncResult containsStatementAsync | ( | self, |
|  | Soprano.Node | subject,
|  | Soprano.Node | predicate,
|  | Soprano.Node | object,
|  | Soprano.Node | context=Soprano.Node()
| ) |  |  |

Since:
  2.2

Soprano.Util.AsyncResult createBlankNodeAsync | ( |  | self ) |

Asyncroneously create a new blank node with a unique identifier.

\sa createBlankNode

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

Soprano.QueryResultIterator executeQuery | ( | self, |
|  | QString | query,
|  | Soprano.Query.QueryLanguage | language,
|  | QString | userQueryLanguage=QString()
| ) |  |  |

\reimplemented

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

Soprano.Util.AsyncResult executeQueryAsync | ( | self, |
|  | QString | query,
|  | Soprano.Query.QueryLanguage | language,
|  | QString | userQueryLanguage=QString()
| ) |  |  |

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:

  | query | The query to evaluate.

Parameters:

  | language | The %query language used to encode query.

Parameters:

  | userQueryLanguage | If language equals Query.QueryLanguageUser userQueryLanguage defines the language to use.

\sa executeQuery

Returns:
  an AsyncResult with result type QueryResultIterator object which will signal when the result is ready.

Soprano.Util.AsyncResult isEmptyAsync | ( |  | self ) |

Asyncroneously check if the Model does contain any Statement.

\sa isEmpty

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

Soprano.NodeIterator listContexts | ( |  | self ) |

\reimplemented

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

Soprano.Util.AsyncResult listContextsAsync | ( |  | self ) |

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

\sa listContexts

Returns:
  an AsyncResult with result type NodeIterator object which will signal when the result is ready.

Soprano.StatementIterator listStatements | ( | self, |
|  | Soprano.Statement | partial
| ) |  |  |

\reimplemented

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

Soprano.Util.AsyncResult listStatementsAsync | ( | self, |
|  | Soprano.Statement | statement
| ) |  |  |

Lists all statements in the Model asyncroneously.

Since:
  2.2

Soprano.Util.AsyncResult listStatementsAsync | ( | self, |
|  | Soprano.Node | subject,
|  | Soprano.Node | predicate,
|  | Soprano.Node | object,
|  | Soprano.Node | context=Soprano.Node()
| ) |  |  |

Lists all statements in the Model asyncroneously.

Since:
  2.2

Soprano.Util.AsyncResult listStatementsAsync | ( |  | self ) |

Lists all statements in the Model asyncroneously.

Since:
  2.2

Soprano.Util.AsyncModel.AsyncModelMode mode | ( |  | self ) |

The mode used by this model.

\sa setMode

Since:
  2.2

Soprano.Util.AsyncResult removeAllStatementsAsync | ( | self, |
|  | Soprano.Statement | statement
| ) |  |  |

Since:
  2.2

Soprano.Util.AsyncResult removeAllStatementsAsync | ( | self, |
|  | Soprano.Node | subject,
|  | Soprano.Node | predicate,
|  | Soprano.Node | object,
|  | Soprano.Node | context=Soprano.Node()
| ) |  |  |

Since:
  2.2

Soprano.Util.AsyncResult removeStatementAsync | ( | self, |
|  | Soprano.Statement | statement
| ) |  |  |

Since:
  2.2

Soprano.Util.AsyncResult removeStatementAsync | ( | self, |
|  | Soprano.Node | subject,
|  | Soprano.Node | predicate,
|  | Soprano.Node | object,
|  | Soprano.Node | context=Soprano.Node()
| ) |  |  |

Since:
  2.2

Soprano.Util.AsyncResult removeStatementsAsync | ( | self, |
|  | [Soprano.Statement] | statements
| ) |  |  |

Since:
  2.2

setMode | ( | self, |
|  | Soprano.Util.AsyncModel.AsyncModelMode | mode
| ) |  |  |

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

\sa mode

Since:
  2.2

Soprano.Util.AsyncResult statementCountAsync | ( |  | self ) |

Asyncroneously determine the number of statements stored in this Model.

\sa statementCount

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

## Enumeration Documentation

AsyncModelMode

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

Since:
  2.2

Enumerator:

  SingleThreaded |
  MultiThreaded |