Soprano.Client.DBusModel

KDE 4.2 PyKDE API Reference

- KDE's Python API

# DBusModel Class Reference

`from PyKDE4.soprano import *`

Inherits: Soprano.StorageModel → Soprano.Model → QObject
Namespace: Soprano::Client

## Detailed Description

\class DBusModel dbusmodel.h Soprano/Client/DBusModel

Interface to a DBus server model.

The DBusModel provides a fully functional interface to a Model provided through a %Soprano DBus server. It can thus, be seen as the counterpart to Server.DBusExportModel.

Given the DBus service name and the object path of the Model in question it handles all DBus communication transparently.

Normally there is no need to use this class directly as DBusClient does create instances of it on request.

Warning:
  DBusModel is not thread-safe by default and has to be protected if is is to be used from different threads (This can be done via Soprano.Util.MutexModel in Soprano.Util.MutexModel.ReadWriteMultiThreading mode or via setting the model to async mode via setAsyncCalls()).

Author:
  Sebastian Trueg <trueg@kde.org>

\sa soprano_server_dbus

## Methods
| __init__ (self, QString serviceName, QString dbusObject, Soprano.Backend backend=0)
Soprano.Error.ErrorCode | addStatement (self, Soprano.Statement statement)
bool | asyncCalls (self)
bool | containsAnyStatement (self, Soprano.Statement statement)
bool | containsStatement (self, Soprano.Statement statement)
Soprano.Node | createBlankNode (self)
Soprano.QueryResultIterator | executeQuery (self, QString query, Soprano.Query.QueryLanguage language, QString userQueryLanguage=QString())
bool | isEmpty (self)
Soprano.NodeIterator | listContexts (self)
Soprano.StatementIterator | listStatements (self, Soprano.Statement partial)
Soprano.Error.ErrorCode | removeAllStatements (self, Soprano.Statement statement)
Soprano.Error.ErrorCode | removeStatement (self, Soprano.Statement statement)
| setAsyncCalls (self, bool b)
int | statementCount (self)

## Method Documentation

__init__ | ( | self, |
|  | QString | serviceName,
|  | QString | dbusObject,
|  | Soprano.Backend | backend=0
| ) |  |  |

Create a new DBus Model interface.

Parameters:

  | serviceName | The name of the DBus service that provides the Model.

Parameters:

  | dbusObject | The path to the Model object in the DBus service.

Parameters:

  | backend | The backend that created this model. Should always be set to 0.

Soprano.Error.ErrorCode addStatement | ( | self, |
|  | Soprano.Statement | statement
| ) |  |  |

bool asyncCalls | ( |  | self ) |

Returns:
  true if asyncronous calls are enabled.

bool containsAnyStatement | ( | self, |
|  | Soprano.Statement | statement
| ) |  |  |

bool containsStatement | ( | self, |
|  | Soprano.Statement | statement
| ) |  |  |

Soprano.Node createBlankNode | ( |  | self ) |

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

bool isEmpty | ( |  | self ) |

Soprano.NodeIterator listContexts | ( |  | self ) |

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

Soprano.Error.ErrorCode removeAllStatements | ( | self, |
|  | Soprano.Statement | statement
| ) |  |  |

Soprano.Error.ErrorCode removeStatement | ( | self, |
|  | Soprano.Statement | statement
| ) |  |  |

setAsyncCalls | ( | self, |
|  | bool | b
| ) |  |  |

Configure DBusModel to use asyncronous calls over DBus. With asyncronous calls DBusModel will enter local event loops while waiting for the reply. This way multiple calls can be performed interweaved. However, the application does not block, i.e. events (such as signals and slots) are handled which might not be wanted. If that is the case it is better to use Util.MutexModel instead.

Parameters:

  | b | If true asyncronous calls are enabled.

Per default asyncronous calls are disabled.

Warning:
  Asyncronous calls only work in combination with a QCoreApplication instance.

\sa QDBus.BlockWithGui

int statementCount | ( |  | self ) |