KDE 4.2 PyKDE API Reference

- KDE's Python API

# FilterModel Class Reference

`from PyKDE4.soprano import *`

Inherits: Soprano.Model → QObject
Subclasses: Soprano::Inference::InferenceModel, Soprano.RdfSchemaModel, Soprano::Server::DBusExportModel, Soprano::Util::AsyncModel, Soprano::Util::MutexModel, Soprano::Util::SignalCacheModel
Namespace: Soprano

## Detailed Description

\class FilterModel filtermodel.h Soprano/FilterModel

A FilterModel is a virtual model that wraps another Model.

FilterModels can be stacked to provide filtering on each of the Model's methods. A FilterModel has a parent model which is the data base for this filter. The parent can be an actual StorageModel or another FilterModel.

Error handling:

The FilterModel "inherits" its parent Model's errors, i.e. FilterModel.lastError() always equals FilterModel.parent()->lastError() (If the FilterModel implementations are called in subclasses).

Author:
  Sebastian Trueg <trueg@kde.org>

## Methods

| __init__ (self)
| __init__ (self, Soprano.Model parent)
Soprano.Error.ErrorCode | addStatement (self, Soprano.Statement statement)
Soprano.Error.ErrorCode | addStatement (self, Soprano.Node subject, Soprano.Node predicate, Soprano.Node object, Soprano.Node context=Soprano.Node())
bool | containsAnyStatement (self, Soprano.Statement statement)
bool | containsAnyStatement (self, Soprano.Node subject, Soprano.Node predicate, Soprano.Node object, Soprano.Node context=Soprano.Node())
bool | containsStatement (self, Soprano.Statement statement)
bool | containsStatement (self, Soprano.Node subject, Soprano.Node predicate, Soprano.Node object, Soprano.Node context=Soprano.Node())
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.StatementIterator | listStatements (self, Soprano.Node subject, Soprano.Node predicate, Soprano.Node object, Soprano.Node context=Soprano.Node())
Soprano.Model | parentModel (self)
| parentStatementAdded (self, Soprano.Statement a0)
| parentStatementRemoved (self, Soprano.Statement a0)
| parentStatementsAdded (self)
| parentStatementsRemoved (self)
Soprano.Error.ErrorCode | removeAllStatements (self, Soprano.Statement statement)
Soprano.Error.ErrorCode | removeAllStatements (self, Soprano.Node subject, Soprano.Node predicate, Soprano.Node object, Soprano.Node context=Soprano.Node())
Soprano.Error.ErrorCode | removeStatement (self, Soprano.Statement statement)
Soprano.Error.ErrorCode | removeStatement (self, Soprano.Node subject, Soprano.Node predicate, Soprano.Node object, Soprano.Node context=Soprano.Node())
| setParentModel (self, Soprano.Model model)
int | statementCount (self)
Soprano.Error.ErrorCode | write (self, QTextStream os)

## Method Documentation

__init__ | ( |  | self ) |

Create an empty filter model.

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

Create a new FilterModel which works on parent. Calls setParentModel.

Parameters:

  | parent | The parent Model.

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

Default implementation simply pipes the call through to the parent model.

Soprano.Error.ErrorCode addStatement | ( | self, |
|  | Soprano.Node | subject,
|  | Soprano.Node | predicate,
|  | Soprano.Node | object,
|  | Soprano.Node | context=Soprano.Node()
| ) |  |  |

Reimplemented for convenience. Calls Model.addStatement(const Node&,const Node&,const Node&,const Node&)

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

Default implementation simply pipes the call through to the parent model.

bool containsAnyStatement | ( | self, |
|  | Soprano.Node | subject,
|  | Soprano.Node | predicate,
|  | Soprano.Node | object,
|  | Soprano.Node | context=Soprano.Node()
| ) |  |  |

Reimplemented for convenience. Calls Model.containsAnyStatement(const Node&,const Node&,const Node&,const Node&)

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

Default implementation simply pipes the call through to the parent model.

bool containsStatement | ( | self, |
|  | Soprano.Node | subject,
|  | Soprano.Node | predicate,
|  | Soprano.Node | object,
|  | Soprano.Node | context=Soprano.Node()
| ) |  |  |

Reimplemented for convenience. Calls Model.containsStatement(const Node&,const Node&,const Node&,const Node&)

Soprano.Node createBlankNode | ( |  | self ) |

Default implementation simply pipes the call through to the parent model.

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

Default implementation simply pipes the call through to the parent model.

bool isEmpty | ( |  | self ) |

Default implementation simply pipes the call through to the parent model.

Soprano.NodeIterator listContexts | ( |  | self ) |

Default implementation simply pipes the call through to the parent model.

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

Default implementation simply pipes the call through to the parent model.

Soprano.StatementIterator listStatements | ( | self, |
|  | Soprano.Node | subject,
|  | Soprano.Node | predicate,
|  | Soprano.Node | object,
|  | Soprano.Node | context=Soprano.Node()
| ) |  |  |

Reimplemented for convenience. Calls Model.listStatements(const Node&,const Node&,const Node&,const Node&)

Soprano.Model parentModel | ( |  | self ) |

Get the parent model.

Returns:
  The parent Model or 0 if none has been set.

parentStatementAdded | ( | self, |
|  | Soprano.Statement | a0
| ) |  |  |

Handle a statementsAdded() signal from the parent Model.

The default implementation simply re-emits the signal.

parentStatementRemoved | ( | self, |
|  | Soprano.Statement | a0
| ) |  |  |

Handle a statementsRemoved() signal from the parent Model.

The default implementation simply re-emits the signal.

parentStatementsAdded | ( |  | self ) |

Handle a statementsAdded() signal from the parent Model.

The default implementation simply re-emits the signal.

parentStatementsRemoved | ( |  | self ) |

Handle a statementsRemoved() signal from the parent Model.

The default implementation simply re-emits the signal.

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

Default implementation simply pipes the call through to the parent model.

Soprano.Error.ErrorCode removeAllStatements | ( | self, |
|  | Soprano.Node | subject,
|  | Soprano.Node | predicate,
|  | Soprano.Node | object,
|  | Soprano.Node | context=Soprano.Node()
| ) |  |  |

Reimplemented for convenience. Calls Model.removeAllStatements(const Node&,const Node&,const Node&,const Node&)

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

Default implementation simply pipes the call through to the parent model.

Soprano.Error.ErrorCode removeStatement | ( | self, |
|  | Soprano.Node | subject,
|  | Soprano.Node | predicate,
|  | Soprano.Node | object,
|  | Soprano.Node | context=Soprano.Node()
| ) |  |  |

Reimplemented for convenience. Calls Model.removeStatement(const Node&,const Node&,const Node&,const Node&)

setParentModel | ( | self, |
|  | Soprano.Model | model
| ) |  |  |

Set the parent Model.

Parameters:

  | model | The Model that this filter will forward any commands to.

int statementCount | ( |  | self ) |

Default implementation simply pipes the call through to the parent model.

Soprano.Error.ErrorCode write | ( | self, |
|  | QTextStream | os
| ) |  |  |

Default implementation simply pipes the call through to the parent model.