class Resource |
|
\class Resource resource.h Nepomuk/Resource
Resource is the central object type in Nepomuk. It represents a piece of information of any kind. Resources are identified by their unique URI (which correlates directly with the URI in the local NEPOMUK RDF storage. Resource objects with the same URI share their data. All methods in Resource are thread-safe. See hacking for details on how to use Resource. See also ResourceManager
Author Sebastian Trueg |
|
Creates an empty invalid Resource. An invalid resource will become valid (i.e. get a new random URI) once setProperty is called. |
|
|
Creates a new Resource object.
The actual resource data is loaded on demand. Thus, it is possible to work with Resources as if they were in memory all the time. uriOrIdentifier - The unique URI or an arbitrary identifier of the resource. If it exists as a resource URI in the RDF store it is used to load the related properties. If not the passed string is treated as an identifier. If a resource exists in the store which has this identifier set this resource's properties are loaded. Otherwise the resource is created in the store with a new random URI which can be accessed through uri after the resource has been synced. The resource can later again be found through the same identifier. In Nepomuk there are two ways of identifying a resource uniquely: type - The URI identifying the type of the resource. If it is empty Resource falls back to http://www.w3.org/2000/01/rdf-schema\#Resource or in case the resource already exists the type will be read from the store. (This is a QString instead of a QUrl for historical reasons) Example: The best way to understand the URI and identifier system is through file resources. When a Resource object is created with the local path of the file as an identifier:
Resource myfile( "/tmp/testfile.txt" ); Now the URI of the resource in the store representing metadata for the file /tmp/testfile.txt is referred to by myfile.uri() which differs from the path of the file. However, the path of the file is saved as a hasIdentifier relation which means that it can be used to easily find the related resource. |
|
Deprecated use Resource( const QString&, const QUrl& ) |
|
Creates a new Resource object.
url - The URI of the resource. If no resource with this URI exists, a new one is created. type - The URI identifying the type of the resource. If it is empty Resource falls back to http://www.w3.org/2000/01/rdf-schema\#Resource or in case the resource already exists the type will be read from the store. |
|
Constructor used internally. |
|
Add a value to property 'altLabel'. |
|
Add a value to property 'annotation'. |
|
Add a value to property 'identifier'. |
|
Add a value to property 'isRelated'. |
|
Add a value to property 'isTopicOf'. |
|
Add a value to property 'Symbol'. Each resource can have a symbol assigned. For now this is a simple string which can either be the patch to an actual pixmap file or just the name of an icon as defined by the freedesktop.org standard. |
|
Add a value to property 'Tag'. Each Resource can be tagged with an arbitrary number of Tags. This allows a simple grouping of resources. |
|
Add a value to property 'Topic'. |
|
Deprecated Use properties() |
|
Retrieve a list of all available Resource resources. This list consists of all resource of type Resource that are stored in the local Nepomuk meta data storage and any changes made locally. Be aware that in some cases this list can get very big. Then it might be better to use libKNep directly. |
|
Returns The URI of the property 'altLabel'. |
|
Get property 'altLabel'. |
|
Get all resources that have this resource set as property 'annotation'.
See also ResourceManager.allResourcesWithProperty |
|
Returns The URI of the property 'annotation'. |
|
Get property 'annotation'. |
|
The name of the class this Resource represents an object of.
The classname is derived from the type URI (see Resource.uri).
For a translated user readable name of the resource see
Ontology.typeName.
See also type() |
|
Get property 'description'. Everything can be annotated with a simple string comment. |
|
Returns The URI of the property 'description'. |
|
Returns true if this resource (i.e. the uri of this resource) exists in the local NEPOMUK RDF store. |
|
Tries very hard to find a suitable human-readable description of the resource.
This description is supposed to be longer than text() and includes such properties
as nao:description, xesam:comment, rdfs:comment
Returns A human readable description of the resource or an empty string if none could be found. |
|
Tries very hard to find an icon suitable for this resource.
Returns An icon name to be used with KIcon or an empty string if none was found. |
|
Tries very hard to find a suitable human-readable label for this resource.
It looks for properties such as nao:prefLabel, rdfs:label, or nao:identifier,
or even the fileName of File resources.
Returns A human readable label or if all fails the URI of the resource. |
|
Check if property identified by uri is defined
for this resource.
uri - The URI identifying the property. Returns true if property uri has a value set. |
|
Deprecated use hasProperty( const QUrl& ) const |
|
Check if the resource is of a certain type. The type hierarchy is checked including subclass relations. |
|
Returns The URI of the property 'identifier'. |
|
Get property 'identifier'. |
|
Get all resources that have this resource set as property 'isRelated'.
See also ResourceManager.allResourcesWithProperty |
|
Returns The URI of the property 'isRelated'. |
|
Get property 'isRelated'. |
|
Returns The URI of the property 'isTopicOf'. |
|
Get property 'isTopicOf'. |
|
Returns true if this Resource object is valid, i.e. has a proper URI and type and
can be synced with the local NEPOMUK RDF store.
An invalid resource will become valid (i.e. get a new random URI) once setProperty is called. |
|
Get property 'label'. |
|
Returns The URI of the property 'label'. |
|
Operator to compare two Resource objects. Normally one does not need this. It is mainly intended for testing and debugging purposes. |
|
Returns A list of all defined properties |
|
Retrieve the value of property uri. If the property is not defined for
this resource an invalid, empty Variant object is returned.
uri - The URI identifying the property. |
|
Deprecated use property( const QUrl& ) const |
|
Get property 'Rating'. |
|
Returns The URI of the property 'Rating'. |
|
Remove this resource completely. CAUTION: After calling this method the resource will have been removed from the store without any trace. |
|
Remove property uri from this resource object.
uri - The URI identifying the property. |
|
Deprecated use removeProperty( const QUrl& ) |
|
The main type of the resource. Nepomuk tries hard to make this
the type furthest down the hierarchy. In case the resource has only
one type, this is no problem. However, if the resource has multiple
types from different type hierarchies, there is no guarantee which
one will be used here.
See also name(), hasType(), types() |
|
The URI of the resource, uniquely identifying it. This URI in most
cases is a virtual one which has been created from a generic base
namespace and some identifier.
the most important thing to remember is that the URI of for example a file does not necessarily have a relation to its local path. (Although Nepomuk tries to keep the URI of file resources in sync with the file URL for convinience.) See also uri, getIdentifiers |
|
Set property 'altLabel'. |
|
Set property 'annotation'. |
|
Set property 'description'. Everything can be annotated with a simple string comment. |
|
Set property 'identifier'. |
|
Set property 'isRelated'. |
|
Set property 'isTopicOf'. |
|
Set property 'label'. |
|
Set a property of the resource.
uri - The URI identifying the property. value - The value of the property (i.e. the object of the RDF triple(s)) |
|
Deprecated use setProperty( const QUrl& ) |
|
Set property 'Rating'. |
|
Set property 'Symbol'. Each resource can have a symbol assigned. For now this is a simple string which can either be the patch to an actual pixmap file or just the name of an icon as defined by the freedesktop.org standard. |
|
Set property 'Tag'. Each Resource can be tagged with an arbitrary number of Tags. This allows a simple grouping of resources. |
|
Set property 'Topic'. |
|
Returns The URI of the property 'Symbol'. |
|
Get property 'Symbol'. Each resource can have a symbol assigned. For now this is a simple string which can either be the patch to an actual pixmap file or just the name of an icon as defined by the freedesktop.org standard. |
|
Returns The URI of the property 'Tag'. |
|
Get property 'Tag'. Each Resource can be tagged with an arbitrary number of Tags. This allows a simple grouping of resources. |
|
Returns The URI of the property 'Topic'. |
|
Get property 'Topic'. |
|
The main type of the resource. Nepomuk tries hard to make this
the type furthest down the hierarchy. In case the resource has only
one type, this is no problem. However, if the resource has multiple
types from different type hierarchies, there is no guarantee which
one will be used here.
For historical reasons the method does return a URI as QString instead of QUrl. The value equals resourceType().toString(). See also name(), hasType(), types() Deprecated use resourceType instead |
|
Returns The list of all stored types for this resource. This may
also include types that lie in the same hierachy.
See also type(), hasType() |
|
The URI of the resource, uniquely identifying it. This URI in most
cases is a virtual one which has been created from a generic base
namespace and some identifier.
the most important thing to remember is that the URI of for example a file does not necessarily have a relation to its local path. (Although Nepomuk tries to keep the URI of file resources in sync with the file URL for convinience.) For historical reasons the method does return a URI as QString instead of QUrl. The value equals resourceUri().toString(). See also resourceUri, getIdentifiers Deprecated use resourceUri instead |