• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

Nepomuk

  • Nepomuk
  • ResourceManager
Signals | Public Member Functions | Static Public Member Functions

Nepomuk::ResourceManager Class Reference

The ResourceManager is the central Nepomuk configuration point. More...

#include <Nepomuk/ResourceManager>

Inheritance diagram for Nepomuk::ResourceManager:
Inheritance graph
[legend]

List of all members.

Signals

void error (const QString &uri, int errorCode)
void nepomukSystemStarted ()
void nepomukSystemStopped ()
void resourceModified (const QString &uri)

Public Member Functions

QList< Resource > allResources ()
QList< Resource > allResourcesOfType (const QUrl &type)
QList< Resource > allResourcesOfType (const QString &type)
QList< Resource > allResourcesWithProperty (const QUrl &uri, const Variant &v)
QList< Resource > allResourcesWithProperty (const QString &uri, const Variant &v)
void clearCache ()
Resource createResourceFromUri (const QString &uri)
void deleteInstance ()
QUrl generateUniqueUri (const QString &label)
QString generateUniqueUri ()
int init ()
bool initialized () const
Soprano::Model * mainModel ()
void notifyError (const QString &uri, int errorCode)
void removeResource (const QString &uri)
void setOverrideMainModel (Soprano::Model *model)

Static Public Member Functions

static ResourceManager * createManagerForModel (Soprano::Model *model)
static ResourceManager * instance ()

Detailed Description

The ResourceManager is the central Nepomuk configuration point.

Use the initialized() method to check the availabity of the Nepomuk system. Signals nepomukSystemStarted() and nepomukSystemStopped() can be used to enable or disable Nepomuk-specific GUI elements.

Author:
Sebastian Trueg <trueg@kde.org>

Definition at line 51 of file resourcemanager.h.


Member Function Documentation

QList<Resource> Nepomuk::ResourceManager::allResources ( )

Retrieve a list of all resource managed by this manager.

Warning:
This list will be very big. Usage of this method is discouraged. Use Query::QueryServiceClient in combination with an empty Query::Query instead.
Since:
4.3
QList<Resource> Nepomuk::ResourceManager::allResourcesOfType ( const QUrl &  type)

Retrieve a list of all resources of the specified type.

This includes Resources that are not synced yet so it might not represent exactly the state as in the RDF store.

Warning:
This list can be very big. Usage of this method is discouraged. Use Query::QueryServiceClient in combination with a Query::Query containing one Query::ResourceTypeTerm instead.
QList<Resource> Nepomuk::ResourceManager::allResourcesOfType ( const QString &  type)
Deprecated:
Use allResourcesOfType( const QString& type )
QList<Resource> Nepomuk::ResourceManager::allResourcesWithProperty ( const QUrl &  uri,
const Variant &  v 
)

Retrieve a list of all resources that have property uri defined with a value of v.

This includes Resources that are not synced yet so it might not represent exactly the state as in the RDF store.

Parameters:
uriThe URI identifying the property. If this URI does not include a namespace the default namespace is prepended.
vThe value all returned resources should have set as properts uri.
Warning:
This list can be very big. Usage of this method is discouraged. Use Query::QueryServiceClient in combination with a Query::Query containing one Query::ComparisonTerm instead.
QList<Resource> Nepomuk::ResourceManager::allResourcesWithProperty ( const QString &  uri,
const Variant &  v 
)
Deprecated:
Use allResourcesWithProperty( const QString& type )
void Nepomuk::ResourceManager::clearCache ( )

ResourceManager caches resource locally so subsequent access is faster.

This method clears this cache, deleting any Resource that is not used.

Since:
4.4
static ResourceManager* Nepomuk::ResourceManager::createManagerForModel ( Soprano::Model *  model) [static]

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:
modelThe model to read and write data from and to.
Since:
4.3
Resource Nepomuk::ResourceManager::createResourceFromUri ( const 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.
void Nepomuk::ResourceManager::deleteInstance ( )

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
void Nepomuk::ResourceManager::error ( const QString &  uri,
int  errorCode 
) [signal]

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

Parameters:
uriThe resource related to the error.
errorCodeThe type of the error (Resource::ErrorCode)
QUrl Nepomuk::ResourceManager::generateUniqueUri ( const 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:
labelA 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
QString Nepomuk::ResourceManager::generateUniqueUri ( )
Deprecated:
Use generateUniqueUri(const QString&)

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

int Nepomuk::ResourceManager::init ( )

Initialize the Nepomuk framework.

This method will initialize the communication with the local Nepomuk-KDE services, ie. the data repository. It will trigger a reconnect to the Nepomuk database.

There is normally no reason to call this method manually except when using multiple threads. In that case it is highly recommended to call this method in the main thread before doing anything else.

Returns:
0 if all necessary components could be found and -1 otherwise.
bool Nepomuk::ResourceManager::initialized ( ) const
Returns:
true if init() has been called successfully, ie. the KMetaData system is connected to the local RDF repository service and ready to work.
static ResourceManager* Nepomuk::ResourceManager::instance ( ) [static]
Soprano::Model* Nepomuk::ResourceManager::mainModel ( )

Retrieve the main data storage model.

void Nepomuk::ResourceManager::nepomukSystemStarted ( ) [signal]

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
void Nepomuk::ResourceManager::nepomukSystemStopped ( ) [signal]

Emitted once the Nepomuk system goes down.

Since:
4.4
void Nepomuk::ResourceManager::notifyError ( const QString &  uri,
int  errorCode 
)

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

void Nepomuk::ResourceManager::removeResource ( const QString &  uri)

Remove the resource denoted by uri completely.

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

void Nepomuk::ResourceManager::resourceModified ( const QString &  uri) [signal]

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:
uriThe URI of the modified resource.

NOT IMPLEMENTED YET

void Nepomuk::ResourceManager::setOverrideMainModel ( Soprano::Model *  model)

Override the main model used for all storage.

By default the main model used is the Nepomuk server main model.

Parameters:
modelThe model to use instead of the Nepomuk server or 0 to reset.
Since:
4.1

The documentation for this class was generated from the following file:
  • resourcemanager.h

Nepomuk

Skip menu "Nepomuk"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal