Nepomuk
resource.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _NEPOMUK_RESOURCE_H_
00022 #define _NEPOMUK_RESOURCE_H_
00023
00024 #include <QtCore/QHash>
00025 #include <QtCore/QStringList>
00026 #include <QtCore/QUrl>
00027
00028 #include "nepomuk_export.h"
00029
00030 namespace Nepomuk {
00031
00032 class ResourceManager;
00033 class ResourceData;
00034 class Variant;
00035 class Tag;
00036 class Thing;
00037
00038 enum ErrorCode {
00039 NoError = 0,
00040 CommunicationError,
00041 InvalidType,
00042 UnknownError
00043 };
00044
00048
00049 NEPOMUK_EXPORT QString errorString( ErrorCode code );
00050
00070 class NEPOMUK_EXPORT Resource
00071 {
00072 public:
00078 Resource();
00079
00090 Resource( ResourceManager* manager );
00091
00095 Resource( const Resource& );
00096
00134 Resource( const QString& pathOrIdentifier, const QUrl& type = QUrl() );
00135
00144 Resource( const QString& pathOrIdentifier, const QUrl& type, ResourceManager* manager );
00145
00149 KDE_DEPRECATED Resource( const QString& pathOrIdentifier, const QString& type );
00150
00163 Resource( const QUrl& uri, const QUrl& type = QUrl() );
00164
00173 Resource( const QUrl& uri, const QUrl& type, ResourceManager* manager );
00174
00178 Resource( ResourceData* );
00179
00183 virtual ~Resource();
00184
00188 Resource& operator=( const Resource& other );
00189
00193 Resource& operator=( const QUrl& uri );
00194
00200 ResourceManager* manager() const;
00201
00219 KDE_DEPRECATED QString uri() const;
00220
00233 QUrl resourceUri() const;
00234
00249 KDE_DEPRECATED QString type() const;
00250
00260 QUrl resourceType() const;
00261
00268 QList<QUrl> types() const;
00269
00275 void setTypes( const QList<QUrl>& types );
00276
00282 void addType( const QUrl& type );
00283
00288 bool hasType( const QUrl& typeUri ) const;
00289
00298 QString className() const;
00299
00303 KDE_DEPRECATED QHash<QString, Variant> allProperties() const;
00304
00308 QHash<QUrl, Variant> properties() const;
00309
00318 bool hasProperty( const QUrl& uri ) const;
00319
00323 KDE_DEPRECATED bool hasProperty( const QString& uri ) const;
00324
00331 Variant property( const QUrl& uri ) const;
00332
00336 KDE_DEPRECATED Variant property( const QString& uri ) const;
00337
00344 void setProperty( const QUrl& uri, const Variant& value );
00345
00354 void addProperty( const QUrl& uri, const Variant& value );
00355
00359 KDE_DEPRECATED void setProperty( const QString& uri, const Variant& value );
00360
00366 void removeProperty( const QUrl& uri );
00367
00376 void removeProperty( const QUrl& uri, const Variant& value );
00377
00381 KDE_DEPRECATED void removeProperty( const QString& uri );
00382
00388 void remove();
00389
00394 bool exists() const;
00395
00403 bool isValid() const;
00404
00412 QString genericLabel() const;
00413
00422 QString genericDescription() const;
00423
00429 QString genericIcon() const;
00430
00439 Thing pimoThing();
00440
00445 bool operator==( const Resource& ) const;
00446
00451 QString description() const;
00452
00457 void setDescription( const QString& value );
00458
00462 static QString descriptionUri();
00463
00467 QStringList identifiers() const;
00468
00472 void setIdentifiers( const QStringList& value );
00473
00477 void addIdentifier( const QString& value );
00478
00482 static QString identifierUri();
00483
00487 QStringList altLabels() const;
00488
00492 void setAltLabels( const QStringList& value );
00493
00497 void addAltLabel( const QString& value );
00498
00502 static QString altLabelUri();
00503
00507 QList<Resource> annotations() const;
00508
00512 void setAnnotations( const QList<Resource>& value );
00513
00517 void addAnnotation( const Resource& value );
00518
00522 static QString annotationUri();
00523
00528 QList<Tag> tags() const;
00529
00534 void setTags( const QList<Tag>& value );
00535
00541 void addTag( const Tag& value );
00542
00546 static QString tagUri();
00547
00551 QList<Resource> topics() const;
00552
00556 void setTopics( const QList<Resource>& value );
00557
00561 void addTopic( const Resource& value );
00562
00566 static QString topicUri();
00567
00571 QList<Resource> isTopicOfs() const;
00572
00576 void setIsTopicOfs( const QList<Resource>& value );
00577
00581 void addIsTopicOf( const Resource& value );
00582
00586 static QString isTopicOfUri();
00587
00591 QList<Resource> isRelateds() const;
00592
00596 void setIsRelateds( const QList<Resource>& value );
00597
00601 void addIsRelated( const Resource& value );
00602
00606 static QString isRelatedUri();
00607
00611 QString label() const;
00612
00616 void setLabel( const QString& value );
00617
00621 static QString labelUri();
00622
00626 quint32 rating() const;
00627
00631 void setRating( const quint32& value );
00632
00636 static QString ratingUri();
00637
00644 QStringList symbols() const;
00645
00652 void setSymbols( const QStringList& value );
00653
00660 void addSymbol( const QString& value );
00661
00665 static QString symbolUri();
00666
00671 QList<Resource> annotationOf() const;
00672
00677 QList<Resource> isRelatedOf() const;
00678
00688 static QList<Resource> allResources();
00689
00690 private:
00691 ResourceData* m_data;
00692
00693 class Private;
00694 Private* d;
00695
00696 friend class ResourceData;
00697 };
00698 }
00699
00700 #endif