Soprano.Util.MutexModel

KDE 4.2 PyKDE API Reference

- KDE's Python API

# MutexModel Class Reference

`from PyKDE4.soprano import *`

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

## Detailed Description

\class MutexModel mutexmodel.h Soprano/Util/MutexModel

Protect a Model for multiple calls in multi-threaded applications.

In most cases one does not need to use this FilterModel since Models created by Soprano.createModel and Soprano.Backend.createModel are thread-safe. It may, however, come in handy for custom models.

Author:
  Sebastian Trueg <trueg@kde.org>

## Enumerations
ProtectionMode | { PlainMultiThreading, ReadWriteMultiThreading, ReadWriteSingleThreading }
## Methods
| __init__ (self, Soprano.Util.MutexModel.ProtectionMode mode, Soprano.Model parent=0)
Soprano.Error.ErrorCode | addStatement (self, Soprano.Statement statement)
bool | containsAnyStatement (self, Soprano.Statement statement)
bool | containsStatement (self, Soprano.Statement statement)
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)
int | statementCount (self)

## Method Documentation

__init__ | ( | self, |
|  | Soprano.Util.MutexModel.ProtectionMode | mode,
|  | Soprano.Model | parent=0
| ) |  |  |

Create a new MutexModel.

Parameters:

  | mode | The mode to use.

Parameters:

  | parent | The parent Model to forward the actual calls to.

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

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

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

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
| ) |  |  |

int statementCount | ( |  | self ) |

## Enumeration Documentation

ProtectionMode

In PlainMultiThreading mode only one action can be performed at the same time. Calls block until the previous call is done.

Warning:
  In this mode nesting iterators will result in a deadlock.

Enumerator:

  PlainMultiThreading |
  ReadWriteMultiThreading |
  ReadWriteSingleThreading |