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

Nepomuk

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk
  • core
resource.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Nepomuk KDE project.
3  * Copyright (C) 2006-2009 Sebastian Trueg <trueg@kde.org>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef _NEPOMUK_RESOURCE_H_
22 #define _NEPOMUK_RESOURCE_H_
23 
24 #include <QtCore/QHash>
25 #include <QtCore/QStringList>
26 
27 #include <kurl.h>
28 
29 #include "class.h"
30 
31 #include "nepomuk_export.h"
32 
33 namespace Nepomuk {
34 
35  class ResourceManager;
36  class ResourceData;
37  class Variant;
38  class Tag;
39  class Thing;
40  class File;
41  namespace Types {
42  class Property;
43  }
44 
45  enum ErrorCode {
46  NoError = 0,
47  CommunicationError,
48  InvalidType,
49  UnknownError
50  };
51 
55  // FIXME: add the uri of the resource as parameter
56  NEPOMUK_EXPORT QString errorString( ErrorCode code );
57 
94  class NEPOMUK_EXPORT Resource
95  {
96  public:
102  Resource();
103 
114  Resource( ResourceManager* manager );
115 
119  Resource( const Resource& );
120 
154  Resource( const QString& pathOrIdentifier, const QUrl& type = QUrl() );
155 
164  Resource( const QString& pathOrIdentifier, const QUrl& type, ResourceManager* manager );
165 
169 #ifndef KDE_NO_DEPRECATED
170  KDE_DEPRECATED Resource( const QString& pathOrIdentifier, const QString& type );
171 #endif
172 
187  Resource( const QUrl& uri, const QUrl& type = QUrl() );
188 
197  Resource( const QUrl& uri, const QUrl& type, ResourceManager* manager );
198 
202  Resource( ResourceData* );
203 
207  virtual ~Resource();
208 
212  Resource& operator=( const Resource& other );
213 
217  Resource& operator=( const QUrl& uri );
218 
224  ResourceManager* manager() const;
225 
243 #ifndef KDE_NO_DEPRECATED
244  KDE_DEPRECATED QString uri() const;
245 #endif
246 
260  QUrl resourceUri() const;
261 
276 #ifndef KDE_NO_DEPRECATED
277  KDE_DEPRECATED QString type() const;
278 #endif
279 
289  QUrl resourceType() const;
290 
297  QList<QUrl> types() const;
298 
304  void setTypes( const QList<QUrl>& types );
305 
311  void addType( const QUrl& type );
312 
317  bool hasType( const QUrl& typeUri ) const;
318 
327  QString className() const;
328 
332 #ifndef KDE_NO_DEPRECATED
333  KDE_DEPRECATED QHash<QString, Variant> allProperties() const;
334 #endif
335 
339  QHash<QUrl, Variant> properties() const;
340 
349  bool hasProperty( const QUrl& uri ) const;
350 
356  bool hasProperty( const Types::Property& p, const Variant& v ) const;
357 
361 #ifndef KDE_NO_DEPRECATED
362  KDE_DEPRECATED bool hasProperty( const QString& uri ) const;
363 #endif
364 
371  Variant property( const QUrl& uri ) const;
372 
376 #ifndef KDE_NO_DEPRECATED
377  KDE_DEPRECATED Variant property( const QString& uri ) const;
378 #endif
379 
386  void setProperty( const QUrl& uri, const Variant& value );
387 
396  void addProperty( const QUrl& uri, const Variant& value );
397 
401 #ifndef KDE_NO_DEPRECATED
402  KDE_DEPRECATED void setProperty( const QString& uri, const Variant& value );
403 #endif
404 
410  void removeProperty( const QUrl& uri );
411 
420  void removeProperty( const QUrl& uri, const Variant& value );
421 
425 #ifndef KDE_NO_DEPRECATED
426  KDE_DEPRECATED void removeProperty( const QString& uri );
427 #endif
428 
434  void remove();
435 
440  bool exists() const;
441 
449  bool isValid() const;
450 
458  QString genericLabel() const;
459 
468  QString genericDescription() const;
469 
475  QString genericIcon() const;
476 
485  Thing pimoThing();
486 
490  bool operator==( const Resource& ) const;
491 
497  bool operator!=( const Resource& ) const;
498 
503  QString description() const;
504 
509  void setDescription( const QString& value );
510 
514  static QString descriptionUri();
515 
519  QStringList identifiers() const;
520 
524  void setIdentifiers( const QStringList& value );
525 
529  void addIdentifier( const QString& value );
530 
534  static QString identifierUri();
535 
539  QStringList altLabels() const;
540 
544  void setAltLabels( const QStringList& value );
545 
549  void addAltLabel( const QString& value );
550 
554  static QString altLabelUri();
555 
559  QList<Resource> annotations() const;
560 
564  void setAnnotations( const QList<Resource>& value );
565 
569  void addAnnotation( const Resource& value );
570 
574  static QString annotationUri();
575 
580  QList<Tag> tags() const;
581 
586  void setTags( const QList<Tag>& value );
587 
593  void addTag( const Tag& value );
594 
598  static QString tagUri();
599 
603  QList<Resource> topics() const;
604 
608  void setTopics( const QList<Resource>& value );
609 
613  void addTopic( const Resource& value );
614 
618  static QString topicUri();
619 
623  QList<Resource> isTopicOfs() const;
624 
628  void setIsTopicOfs( const QList<Resource>& value );
629 
633  void addIsTopicOf( const Resource& value );
634 
638  static QString isTopicOfUri();
639 
643  QList<Resource> isRelateds() const;
644 
648  void setIsRelateds( const QList<Resource>& value );
649 
653  void addIsRelated( const Resource& value );
654 
658  static QString isRelatedUri();
659 
663  QString label() const;
664 
668  void setLabel( const QString& value );
669 
673  static QString labelUri();
674 
678  quint32 rating() const;
679 
683  void setRating( const quint32& value );
684 
688  static QString ratingUri();
689 
696  QStringList symbols() const;
697 
704  void setSymbols( const QStringList& value );
705 
712  void addSymbol( const QString& value );
713 
717  static QString symbolUri();
718 
723  QList<Resource> annotationOf() const;
724 
729  QList<Resource> isRelatedOf() const;
730 
744  static QList<Resource> allResources();
745 
753  int usageCount() const;
754 
761  void increaseUsageCount();
762 
770  bool isFile() const;
771 
778  File toFile() const;
779 
788  static Resource fromResourceUri( const KUrl& uri, const Nepomuk::Types::Class& type = Nepomuk::Types::Class(), ResourceManager* manager = 0 );
789 
790  private:
797  void determineFinalResourceData() const;
798 
799  ResourceData* m_data;
800 
801  class Private;
802  Private* d; // unused
803 
804  friend class ResourceData;
805  };
806 
807  NEPOMUK_EXPORT uint qHash( const Resource& res );
808 }
809 
810 #endif
class.h
Nepomuk::InvalidType
Definition: resource.h:48
Nepomuk::Resource
Resource is the central object type in Nepomuk.
Definition: resource.h:94
Nepomuk::Tag
A Tag can be assigned to any Thing.
Definition: tag.h:38
Nepomuk::ResourceManager
The ResourceManager is the central Nepomuk configuration point.
Definition: resourcemanager.h:55
Nepomuk::qHash
uint qHash(const Resource &res)
Nepomuk::ErrorCode
ErrorCode
Definition: resource.h:45
Nepomuk::Types::Property
A property is a resource of type rdf:Property which relates a domain with a range.
Definition: property.h:52
Nepomuk::errorString
QString errorString(ErrorCode code)
Nepomuk::CommunicationError
A communication error, i.e.
Definition: resource.h:47
Nepomuk::Thing
A Nepomuk PIMO Thing resource.
Definition: thing.h:57
Nepomuk::NoError
Definition: resource.h:46
Nepomuk::Variant
The Nepomuk Variant extends over QVariant by introducing direct support for Resource embedding...
Definition: variant.h:65
Nepomuk::File
A Nepomuk resource representing a file.
Definition: file.h:41
Nepomuk::Types::Class
A Class is a resource of type rdf:Class.
Definition: class.h:49
Nepomuk::UnknownError
Definition: resource.h:49
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal