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

Nepomuk-Core

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk-core
  • libnepomukcore
  • resource
resource.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Nepomuk KDE project.
3  * Copyright (C) 2006-2011 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 _NEPOMUK2_RESOURCE_H_
22 #define _NEPOMUK2_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 Nepomuk2 {
34 
35  class ResourceData;
36  class ResourceManager;
37  class Variant;
38  class Tag;
39  class File;
40  namespace Types {
41  class Property;
42  }
43 
44  enum ErrorCode {
45  NoError = 0,
46  CommunicationError,
47  InvalidType,
48  UnknownError
49  };
50 
54  // FIXME: add the uri of the resource as parameter
55  NEPOMUK_EXPORT QString errorString( ErrorCode code );
56 
93  class NEPOMUK_EXPORT Resource
94  {
95  public:
101  Resource();
102 
106  Resource( const Resource& );
107 
141  Resource( const QString& pathOrIdentifier, const QUrl& type = QUrl() );
142 
157  Resource( const QUrl& uri, const QUrl& type = QUrl() );
158 
162  Resource( ResourceData* );
163 
167  virtual ~Resource();
168 
172  Resource& operator=( const Resource& other );
173 
177  Resource& operator=( const QUrl& uri );
178 
192  QUrl uri() const;
193 
203  QUrl type() const;
204 
211  QList<QUrl> types() const;
212 
218  void setTypes( const QList<QUrl>& types );
219 
225  void addType( const QUrl& type );
226 
231  bool hasType( const QUrl& typeUri ) const;
232 
236  QHash<QUrl, Variant> properties() const;
237 
246  bool hasProperty( const QUrl& uri ) const;
247 
253  bool hasProperty( const Types::Property& p, const Variant& v ) const;
254 
261  Variant property( const QUrl& uri ) const;
262 
269  void setProperty( const QUrl& uri, const Variant& value );
270 
279  void addProperty( const QUrl& uri, const Variant& value );
280 
286  void removeProperty( const QUrl& uri );
287 
296  void removeProperty( const QUrl& uri, const Variant& value );
297 
303  void remove();
304 
309  bool exists() const;
310 
318  bool isValid() const;
319 
327  QString genericLabel() const;
328 
337  QString genericDescription() const;
338 
344  QString genericIcon() const;
345 
349  bool operator==( const Resource& ) const;
350 
356  bool operator!=( const Resource& ) const;
357 
362  QString description() const;
363 
368  void setDescription( const QString& value );
369 
373  QStringList identifiers() const;
374 
378  void setIdentifiers( const QStringList& value );
379 
383  void addIdentifier( const QString& value );
384 
389  QList<Tag> tags() const;
390 
395  void setTags( const QList<Tag>& value );
396 
402  void addTag( const Tag& value );
403 
407  QList<Resource> isRelateds() const;
408 
412  void setIsRelateds( const QList<Resource>& value );
413 
417  void addIsRelated( const Resource& value );
418 
422  QString label() const;
423 
427  void setLabel( const QString& value );
428 
432  quint32 rating() const;
433 
437  void setRating( const quint32& value );
438 
447  QStringList symbols() const;
448 
457  void setSymbols( const QStringList& value );
458 
467  void addSymbol( const QString& value );
468 
473  QList<Resource> isRelatedOf() const;
474 
482  int usageCount() const;
483 
490  void increaseUsageCount();
491 
499  bool isFile() const;
500 
507  File toFile() const;
508 
517  static Resource fromResourceUri( const KUrl& uri, const Nepomuk2::Types::Class& type = Nepomuk2::Types::Class() );
518 
523  void setWatchEnabled( bool status );
524 
529  bool watchEnabled();
530 
531  private:
538  void determineFinalResourceData() const;
539 
540  ResourceData* m_data;
541 
542  class Private;
543  Private* d; // unused
544 
545  friend class ResourceData;
546  friend class ResourceManager;
547  };
548 
549  NEPOMUK_EXPORT uint qHash( const Resource& res );
550 }
551 
552 #endif
Nepomuk2::ErrorCode
ErrorCode
Definition: resource.h:44
class.h
Nepomuk2::addProperty
KJob * addProperty(const QList< QUrl > &resources, const QUrl &property, const QVariantList &values, const KComponentData &component=KGlobal::mainComponent())
Add one or more property values to one or more resources.
Definition: datamanagement.cpp:36
Nepomuk2::removeProperty
KJob * removeProperty(const QList< QUrl > &resources, const QUrl &property, const QVariantList &values, const KComponentData &component=KGlobal::mainComponent())
Remove values of a property from one or more resources.
Definition: datamanagement.cpp:61
QHash
Nepomuk2::NoError
Definition: resource.h:45
Nepomuk2::Tag
A Tag can be assigned to any Thing.
Definition: tag.h:38
Nepomuk2::InvalidType
Definition: resource.h:47
Nepomuk2::errorString
QString errorString(ErrorCode code)
Definition: resource.cpp:489
Nepomuk2::Variant
The Nepomuk Variant extends over QVariant by introducing direct support for Resource embedding...
Definition: variant.h:65
Nepomuk2::UnknownError
Definition: resource.h:48
Nepomuk2::Types::Class
A Class is a resource of type rdf:Class.
Definition: class.h:49
Nepomuk2::Types::Property
A property is a resource of type rdf:Property which relates a domain with a range.
Definition: libnepomukcore/types/property.h:52
Nepomuk2::CommunicationError
A communication error, i.e.
Definition: resource.h:46
Nepomuk2::ResourceManager
The ResourceManager is the central Nepomuk configuration point.
Definition: resourcemanager.h:55
Property
Represents the property of a resource.
Definition: rcgen/property.h:29
Nepomuk2::qHash
uint qHash(const SimpleResource &res)
Definition: simpleresource.cpp:297
Nepomuk2::File
A Nepomuk resource representing a file.
Definition: file.h:41
Nepomuk2::setProperty
KJob * setProperty(const QList< QUrl > &resources, const QUrl &property, const QVariantList &values, const KComponentData &component=KGlobal::mainComponent())
Set the values of a property for one or more resources.
Definition: datamanagement.cpp:48
Nepomuk2::Resource
Resource is the central object type in Nepomuk.
Definition: resource.h:93
nepomuk_export.h
Nepomuk2::ResourceData
Definition: resourcedata.h:42
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk-Core

Skip menu "Nepomuk-Core"
  • 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