Nepomuk
#include <resourcewatcher.h>
|
void | propertyAdded (const Nepomuk::Resource &resource, const Nepomuk::Types::Property &property, const QVariant &value) |
|
void | propertyChanged (const Nepomuk::Resource &resource, const Nepomuk::Types::Property &property, const QVariantList &oldValue, const QVariantList &newValue) |
|
void | propertyRemoved (const Nepomuk::Resource &resource, const Nepomuk::Types::Property &property, const QVariant &value) |
|
void | resourceCreated (const Nepomuk::Resource &resource, const QList< QUrl > &types) |
|
void | resourceRemoved (const QUrl &uri, const QList< QUrl > &types) |
|
void | resourceTypeAdded (const Nepomuk::Resource &res, const Types::Class &type) |
|
void | resourceTypeRemoved (const Nepomuk::Resource &res, const Types::Class &type) |
|
Selectively monitor the nepomuk repository for changes.
Resources may be monitored on the basis of types, properties, and uris.
Changes may be monitored in one of the following ways:
- By resources - Specify the exact resources that should be watched. Any changes made to the specified resources (Excluding nepomuk_dms_metadata) will be notified through the propertyAdded() and propertyRemoved() signals. Notifications will also be sent if any of the watched resources is deleted.
- By resources and properties - Specify the exact resources and their properties. Any changes made to the specified resources which touch one of the specified properties will be notified through the propertyAdded() and propertyRemoved() signals.
- By types - Specific types may be specified via add/setType. If types are set, then notifications will be sent for all new resources of that type. This includes property changes and resource creation and removal. TODO: add flags that allow to only watch for resource creation and removal.
- By types and properties - Both the types and properties may be specified. Notifications will be sent for property changes in resource with the specified types.
Resource Watcher Usage Example
The following code creates a new ResourceWatcher, configures it to listen to changes on the nmm:performer
property on one specific resource res
.
this, SLOT(slotPropertyChanged()));
this, SLOT(slotPropertyChanged()));
rwatcher->start();
- Author
- Vishesh Handa handa.nosp@m..vis.nosp@m.h@gma.nosp@m.il.c.nosp@m.om, Sebastian Trueg trueg.nosp@m.@kde.nosp@m..org
Definition at line 78 of file resourcewatcher.h.
◆ ResourceWatcher()
Nepomuk::ResourceWatcher::ResourceWatcher |
( |
QObject * |
parent = 0 | ) |
|
Create a new ResourceWatcher instance.
This instance will not emit any signals before it has been configured and started.
◆ ~ResourceWatcher()
virtual Nepomuk::ResourceWatcher::~ResourceWatcher |
( |
| ) |
|
|
virtual |
◆ addProperty
void Nepomuk::ResourceWatcher::addProperty |
( |
const Types::Property & |
property | ) |
|
|
slot |
Add a property to be watched.
Every change to a value of this property will be signalled, depending on the configured resources() or types().
- See also
- setProperties()
◆ addResource
Add a resource to be watched.
Every change to this resource will be signalled, depending on the configured properties().
- See also
- setResources()
◆ addType
void Nepomuk::ResourceWatcher::addType |
( |
const Types::Class & |
type | ) |
|
|
slot |
Add a type to be watched.
Every resource of this type will be watched for changes.
- See also
- setTypes()
◆ properties
◆ propertyAdded
This signal is emitted when a property value is added.
- Parameters
-
resource | The changed resource. |
property | The property which has a new value. |
value | The newly added property value. |
◆ propertyChanged
This signal is emitted when a property value is changed.
This signal cannot be emitted for all changes. It doesn't work if a property is first removed and then set, cause the Data Mangement Service does not maintain an internal cache for the purpose of emitting the propertyChanged signal.
Specially, since one could theoretically take forever between the removal and the setting of the property.
- Parameters
-
resource | The changed resource. |
property | The property which was changed. |
oldValue | The removed property value. |
◆ propertyCount
int Nepomuk::ResourceWatcher::propertyCount |
( |
| ) |
const |
|
slot |
◆ propertyRemoved
This signal is emitted when a property value is removed.
- Parameters
-
resource | The changed resource. |
property | The property which was changed. |
value | The removed property value. |
◆ removeProperty
void Nepomuk::ResourceWatcher::removeProperty |
( |
const Types::Property & |
property | ) |
|
|
slot |
Remove a property to be watched.
Every change to a value of this property will be signalled, depending on the configured resources() or types().
- See also
- setProperties()
◆ removeResource
Remove a resource to be watched.
Every change to this resource will be signalled, depending on the configured properties().
- See also
- setResources()
◆ removeType
void Nepomuk::ResourceWatcher::removeType |
( |
const Types::Class & |
type | ) |
|
|
slot |
Remove a type to be watched.
Every resource of this type will be watched for changes.
- See also
- setTypes()
◆ resourceCount
int Nepomuk::ResourceWatcher::resourceCount |
( |
| ) |
const |
|
slot |
◆ resourceCreated
void Nepomuk::ResourceWatcher::resourceCreated |
( |
const Nepomuk::Resource & |
resource, |
|
|
const QList< QUrl > & |
types |
|
) |
| |
|
signal |
This signal is emitted when a new resource is created.
- Parameters
-
resource | The newly created resource. |
types | The types the new resource has. If types() have been configured this list will always contain one of the configured types. |
◆ resourceRemoved
void Nepomuk::ResourceWatcher::resourceRemoved |
( |
const QUrl & |
uri, |
|
|
const QList< QUrl > & |
types |
|
) |
| |
|
signal |
This signal is emitted when a resource is deleted.
- Parameters
-
uri | The resource URI of the removed resource. |
types | The types the removed resource had. If types() have been configured this list will always contain one of the configured types. |
◆ resources
◆ resourceTypeAdded
This signal is emitted when a type has been added to a resource.
This does not include creation which is signalled via resourceCreated(). It only applies to changes in a resource's types.
- Parameters
-
res | The changed resource. |
type | The newly added type. If types() have been configured it will be one of them. |
◆ resourceTypeRemoved
This signal is emitted when a type has been removed from a resource.
This does not include removal of entire resources which is signalled via resourceRemoved(). It only applies to changes in a resource's types.
- Parameters
-
res | The changed resource. |
type | The removed type. If types() have been configured it will be one of them. |
◆ setProperties
void Nepomuk::ResourceWatcher::setProperties |
( |
const QList< Types::Property > & |
properties_ | ) |
|
|
slot |
Set the properties to be watched.
Every change to a value of any of these properties will be signalled, depending on the configured resources() or types().
- See also
- addProperty()
◆ setResources
void Nepomuk::ResourceWatcher::setResources |
( |
const QList< Nepomuk::Resource > & |
resources_ | ) |
|
|
slot |
Set the resources to be watched.
Every change to one of these resources will be signalled, depending on the configured properties().
- See also
- addResource()
◆ setTypes
void Nepomuk::ResourceWatcher::setTypes |
( |
const QList< Types::Class > & |
types_ | ) |
|
|
slot |
Set the types to be watched.
Every resource having one of these types will be watched for changes.
- See also
- addType()
◆ start
bool Nepomuk::ResourceWatcher::start |
( |
| ) |
|
|
slot |
Start the signalling of changes.
Before calling this method no signal will be emitted. In combination with stop() this allows to suspend the watching. Calling start() multiple times has no effect.
◆ stop
void Nepomuk::ResourceWatcher::stop |
( |
| ) |
|
|
slot |
Stop the signalling of changes.
Allows to stop the watcher which has been started via start(). Calling stop() multiple times has no effect.
◆ typeCount
int Nepomuk::ResourceWatcher::typeCount |
( |
| ) |
const |
|
slot |
Return the number of types that are being watched.
This method is slightly faster than called types().count()
- See also
- types addType setType
◆ types
QList<Types::Class> Nepomuk::ResourceWatcher::types |
( |
| ) |
const |
|
slot |
The types that have been configured via addType() and setTypes().
Every resource having one of these types will be watched for changes.
The documentation for this class was generated from the following file:
Resource is the central object type in Nepomuk. It represents a piece of information of any kind.
void propertyRemoved(const Nepomuk::Resource &resource, const Nepomuk::Types::Property &property, const QVariant &value)
This signal is emitted when a property value is removed.
void addResource(const Nepomuk::Resource &res)
Add a resource to be watched.
void propertyAdded(const Nepomuk::Resource &resource, const Nepomuk::Types::Property &property, const QVariant &value)
This signal is emitted when a property value is added.
void addProperty(const Types::Property &property)
Add a property to be watched.
A property is a resource of type rdf:Property which relates a domain with a range....
Selectively monitor the nepomuk repository for changes.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Jan 30 2020 00:00:00 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.