KDE 4.4 PyKDE API Reference
  • KDE's Python API
  • Overview
  • PyKDE Home
  • Sitemap
  • Contact Us
 

ResourceManager Class Reference

from PyKDE4.nepomuk import *

Inherits: QObject
Namespace: Nepomuk.ResourceManager

Detailed Description

\class ResourceManager resourcemanager.h Nepomuk/ResourceManager

The ResourceManager is the central %KMetaData configuration point.

Author:
Sebastian Trueg <trueg@kde.org>


Signals

 error (, QString uri, int errorCode)
 nepomukSystemStarted ()
 nepomukSystemStopped ()
 resourceModified (, QString uri)

Methods

 __init__ (self)
[Nepomuk.Resource] allResourcesOfType (self, QUrl type)
[Nepomuk.Resource] allResourcesOfType (self, QString type)
[Nepomuk.Resource] allResourcesWithProperty (self, QUrl uri, Nepomuk.Variant v)
[Nepomuk.Resource] allResourcesWithProperty (self, QString uri, Nepomuk.Variant v)
 clearCache (self)
Nepomuk.ResourceManager createManagerForModel (self, Soprano.Model model)
Nepomuk.Resource createResourceFromUri (self, QString uri)
 deleteInstance (self)
 error (self, QString uri, int errorCode)
QString generateUniqueUri (self)
QUrl generateUniqueUri (self, QString label)
int init (self)
bool initialized (self)
Nepomuk.ResourceManager instance (self)
Soprano.Model mainModel (self)
 nepomukSystemStarted (self)
 nepomukSystemStopped (self)
 notifyError (self, QString uri, int errorCode)
 removeResource (self, QString uri)
 resourceModified (self, QString uri)
 setOverrideMainModel (self, Soprano.Model model)

Method Documentation

__init__ (   self )
[Nepomuk.Resource] allResourcesOfType (  self,
QUrl  type
)

Deprecated:
Use allResourcesOfType( const QString& type )

[Nepomuk.Resource] allResourcesOfType (  self,
QString  type
)

Deprecated:
Use allResourcesOfType( const QString& type )

[Nepomuk.Resource] allResourcesWithProperty (  self,
QUrl  uri,
Nepomuk.Variant  v
)

Deprecated:
Use allResourcesWithProperty( const QString& type )

[Nepomuk.Resource] allResourcesWithProperty (  self,
QString  uri,
Nepomuk.Variant  v
)

Deprecated:
Use allResourcesWithProperty( const QString& type )

clearCache (   self )

%ResourceManager caches resource locally so subsequent access is faster. This method clears this cache, deleting any Resource that is not used.

Since:
4.4

Nepomuk.ResourceManager createManagerForModel (  self,
Soprano.Model  model
)

Create a new ResourceManager instance which uses model as its override model. This allows to use multiple instances of ResourceManager at the same time. Normally one does not need this method as the singleton accessed via instance() should be enough.

Parameters:
model  The model to read and write data from and to.

Since:
4.3

Nepomuk.Resource createResourceFromUri (  self,
QString  uri
)

Deprecated:
Use the Resource constructor directly.

Creates a Resource object representing the data referenced by uri. The result is the same as from using the Resource.Resource( const QString&, const QString& ) constructor with an empty type.

Returns:
The Resource representing the data at uri or an invalid Resource object if the local NEPOMUK RDF store does not contain an object with URI uri.

deleteInstance (   self )

In KDE 4.3 support for multiple ResourceManager instances has been introduced. To keep binary compatibility both the constructor's and destructor's access visibility could not be changed. Thus, instead of deleting a custom ResourceManager instance the standard way, one has to call this method or use QObject.deleteLater.

Since:
4.3

error (  self,
QString  uri,
int  errorCode
)

Whenever a problem occurs (like for example failed resource syncing) this signal is emitted.

Parameters:
uri  The resource related to the error.

Parameters:
errorCode  The type of the error (Resource.ErrorCode)

Signal syntax:
QObject.connect(source, SIGNAL("error(const QString&, int)"), target_slot)
QString generateUniqueUri (   self )

Generates a unique URI that is not used in the store yet. This method can be used to generate URIs for virtual types such as Tag.

Parameters:
label  A label that the algorithm should use to try to create a more readable URI.

Returns:
A new unique URI which can be used to define a new resource.

Since:
4.2

QUrl generateUniqueUri (  self,
QString  label
)

Generates a unique URI that is not used in the store yet. This method can be used to generate URIs for virtual types such as Tag.

Parameters:
label  A label that the algorithm should use to try to create a more readable URI.

Returns:
A new unique URI which can be used to define a new resource.

Since:
4.2

int init (   self )

Initialize the Nepomuk framework. This method will initialize the communication with the local Nepomuk-KDE services, ie. the data repository.

When using multiple threads make sure to call this method in the main thread before doing anything else.

Returns:
0 if all necessary components could be found and -1 otherwise.

FIXME: introduce error codes and human readable translated error messages.

bool initialized (   self )

Returns:
true if init() has been called successfully, ie. the KMetaData system is connected to the local RDF repository service and ready to work.

Nepomuk.ResourceManager instance (   self )
Soprano.Model mainModel (   self )

Retrieve the main data storage model.

nepomukSystemStarted (   self )

Emitted once the Nepomuk system is up and can be used.

Warning:
This signal will not be emitted if the Nepomuk system is running when the ResourceManager is created. Use initialized() to check the status.

Since:
4.4

Signal syntax:
QObject.connect(source, SIGNAL("nepomukSystemStarted()"), target_slot)
nepomukSystemStopped (   self )

Emitted once the Nepomuk system goes down.

Since:
4.4

Signal syntax:
QObject.connect(source, SIGNAL("nepomukSystemStopped()"), target_slot)
notifyError (  self,
QString  uri,
int  errorCode
)

Internal:
Non-public API. Used by Resource to signalize errors.

removeResource (  self,
QString  uri
)

Remove the resource denoted by uri completely.

This method is just a wrapper around Resource.remove. The result is the same.

resourceModified (  self,
QString  uri
)

This signal gets emitted whenever a Resource changes due to a sync procedure. Be aware that modifying resources locally via the Resource.setProperty method does not result in a resourceModified signal being emitted.

Parameters:
uri  The URI of the modified resource.

NOT IMPLEMENTED YET

Signal syntax:
QObject.connect(source, SIGNAL("resourceModified(const QString&)"), target_slot)
setOverrideMainModel (  self,
Soprano.Model  model
)

Override the main model used for all storage. By default the main model used is the Nepomuk server main model.

Parameters:
model  The model to use instead of the Nepomuk server or 0 to reset.

Since:
4.1

  • Full Index

Modules

  • akonadi
  • dnssd
  • kdecore
  • kdeui
  • khtml
  • kio
  • knewstuff
  • kparts
  • kutils
  • nepomuk
  • phonon
  • plasma
  • polkitqt
  • solid
  • soprano
This documentation is maintained by Simon Edwards.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal