# class DBusModel

###

Module | soprano
Namespace | Soprano::Client
Class | DBusModel
Inherits | Soprano::StorageModel

\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.

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>

See also soprano_server_dbus

### methods

- DBusModel (serviceName, dbusObject, backend)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  serviceName | QString |
  dbusObject | QString |
  backend | Soprano.Backend | 0

  Create a new DBus Model interface.

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

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

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

- addStatement (statement)

  returns Soprano.Error.ErrorCode

  Argument | Type | Default
  --- | --- | ---
  statement | Soprano.Statement |

- asyncCalls ( )

  returns bool

  Returns true if asyncronous calls are enabled.

- containsAnyStatement (statement)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  statement | Soprano.Statement |

- containsStatement (statement)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  statement | Soprano.Statement |

- createBlankNode ( )

  returns Soprano.Node

- executeQuery (query, language, userQueryLanguage)

  returns Soprano.QueryResultIterator

  Argument | Type | Default
  --- | --- | ---
  query | QString |
  language | Soprano.Query.QueryLanguage |
  userQueryLanguage | QString | QString()

- isEmpty ( )

  returns bool

- listContexts ( )

  returns Soprano.NodeIterator

- listStatements (partial)

  returns Soprano.StatementIterator

  Argument | Type | Default
  --- | --- | ---
  partial | Soprano.Statement |

- removeAllStatements (statement)

  returns Soprano.Error.ErrorCode

  Argument | Type | Default
  --- | --- | ---
  statement | Soprano.Statement |

- removeStatement (statement)

  returns Soprano.Error.ErrorCode

  Argument | Type | Default
  --- | --- | ---
  statement | Soprano.Statement |

- setAsyncCalls (b)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  b | bool |

  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.

  b - If true asyncronous calls are enabled.

  Per default asyncronous calls are disabled.

  Asyncronous calls only work in combination with a QCoreApplication instance.

  See also QDBus.BlockWithGui

- statementCount ( )

  returns int