KDE 4.9 PyKDE API Reference

- KDE's Python API

# Backend Class Reference

`from PyKDE4.soprano import *`

Inherits: Soprano.Plugin,Soprano.Error.ErrorCache
Namespace: Soprano

## Detailed Description

\class Backend backend.h Soprano/Backend

Soprano.Backend defines the interface for a Soprano backend plugin.

The Backend interface defines two important methods: createModel() and supportedFeatures(). It inherits from Error.ErrorCache for error handling and subclasses should use clearError() and setError() to report the status.

\sa soprano_writing_plugins

Author:
  Sebastian Trueg <trueg@kde.org>

## Methods

| __init__ (self, QString name)
Soprano.StorageModel | createModel (self, [Soprano.BackendSetting] settings=Soprano.BackendSettings())
bool | deleteModelData (self, [Soprano.BackendSetting] settings)
Soprano.BackendFeatures | supportedFeatures (self)
QStringList | supportedUserFeatures (self)
bool | supportsFeatures (self, Soprano.BackendFeatures feature, QStringList userFeatures=QStringList())

## Method Documentation

__init__ | ( | self, |
|  | QString | name
| ) |  |  |

Soprano.StorageModel createModel | ( | self, |
|  | [Soprano.BackendSetting] | settings=Soprano.BackendSettings()
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Creates a new RDF model with options. The caller takes ownership and has to care about deletion.

Parameters:

  | settings | The settings that should be used to create the Model. Backend implementations should never ignore settings but rather return 0 if an option is not supported. Backends can, however, define their own default settings. Invalid settings should result in an Error with value Error.ErrorInvalidArgument.

\sa BackendSetting

bool deleteModelData | ( | self, |
|  | [Soprano.BackendSetting] | settings
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Phyically delete all data for a specific model. For most backends this means deleting some files on the hard disk. With others it may mean to delete tables from an SQL database.

Parameters:

  | settings | The settings that were used to create the model which should be deleted. For most backends the Soprano.BackendOptionStorageDir setting is probably most important. If the settings do not provide enough information to uniquely identify the model to delete, the method should be terminated with an Error.ErrorInvalidArgument error.

Returns:
  true if the data was successfully removed, false otherwise. ErrorCache.lastError() may provide more detailed error information in the latter case.

Since:
  2.1

Soprano.BackendFeatures supportedFeatures | ( |  | self ) |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Each backend can support a set of features. Backends without any features do not make much sense. If the features include Soprano.BackendFeatureUser additional user features not defined in Backend.BackendFeature can be supported via supportedUserFeatures().

Returns:
  A combination of Soprano.BackendFeature values.

QStringList supportedUserFeatures | ( |  | self ) |

A Backend can support additional features that are not defined in Backend.BackendFeature. These user defined features have string identifiers. If a backend supports additional features it has to include Soprano.BackendFeatureUser in supportedFeatures().

The default implementation returns an empty list.

Returns:
  the list of supported user features.

bool supportsFeatures | ( | self, |
|  | Soprano.BackendFeatures | feature,
|  | QStringList | userFeatures=QStringList()
| ) |  |  |

Check if a backend supports certain features. If feature includes Soprano.BackendFeatureUser the list if userFeatures is also compared.

Returns:
  true if the backend does support the requested features, false otherwise.