2
* This file is part of the Nepomuk KDE project.
3
* Copyright (C) 2008-2011 Sebastian Trueg <trueg@kde.org>
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.
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.
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.
21
#ifndef _NEPOMUK_THING_H_
22
#define _NEPOMUK_THING_H_
25
#include "nepomuk_export.h"
27
// FIXME: (Would it even make sense to check in Nepomuk2::Resource if a resource is a pimo:Thing and if so,
28
// use the PIMO context? Or should we handle that through the Nepomuk2::PimoThing class?)
32
* \class Thing thing.h Nepomuk2/Thing
34
* \brief A Nepomuk PIMO Thing resource.
36
* A Thing represents a unique abstract concept/idea or real-world
37
* entity which can have multiple representations or occurrences.
39
* A typical example for a Thing is a unique person resource
40
* which identifies the person itself, not any representation
41
* such as an addressbook entry.
43
* Things are typically grounded via application resources,
44
* i.e. those resources that are created or handled by applications.
45
* Again the typical example is the addressbook entry.
47
* In general it is recommended to alway use the Thing instead of the
48
* grounding resource to annotate, i.e. to add tags, or relate to other
49
* resources. The advantage is its uniqueness. While there can be many
50
* occurrences of one concept there is only one Thing, identifying
53
* \author Sebastian Trueg <trueg@kde.org>
57
class NEPOMUK_EXPORT Thing : public Resource
61
* Create a Thing object with URI \p uri. If the Thing does not
62
* exist in the Nepomuk storage yet, it will be created once
63
* a writing method is called (such as Resource::setProperty).
65
* \param uri The URI of the Thing. If empty, a new random one
67
* \param pimoType The type of this Thing. Needs to be a subtype
68
* of pimo:Thing. If empty defaults to pimo:Thing.
70
Thing( const QUrl& uri = QUrl(), const QUrl& pimoType = QUrl() );
73
* Create a new Thing with label or URI \p uriOrName
75
* \param uriOrName The URI or the label of the Thing. The constructor
76
* tries hard to find the Thing associated. If it is not found, a new
77
* Thing will be created.
78
* \param pimoType The type of this Thing. Needs to be a subtype
79
* of pimo:Thing. If empty defaults to pimo:Thing.
81
* Be aware that using the other constructor is always faster in case
82
* the URI of the Thing is known.
84
Thing( const QString& uriOrName, const QUrl& pimoType = QUrl() );
89
Thing( const Thing& other );
94
* \param other the resoruce to construct the Thing from.
96
Thing( const Resource& other );
99
* Constructor used internally.
101
Thing( ResourceData* );
109
* Assignment operator.
111
Thing& operator=( const Thing& res );
114
* Assignment operator.
116
Thing& operator=( const Resource& res );
119
* Assignment operator.
121
Thing& operator=( const QUrl& res );
124
* Get the grounding occurrences for this Thing.
125
* Grounding resources are physical representations
128
* An example is an mp3 file which represents an audio track
129
* or a website which represents a company or a person. Or the
130
* addressbook entry for an abstract person thing.
132
* \sa pimo:groundingResource
134
QList<Resource> groundingOccurrences() const;
136
QList<Resource> referencingOccurrences() const;
138
QList<Resource> occurrences() const;
141
* Add a grounding occurrence for this Thing.
142
* Grounding resources are physical representations
145
* An example is an mp3 file which represents an audio track
146
* or a website which represents a company or a person. Or the
147
* addressbook entry for an abstract person thing.
149
* \sa pimo:groundingResource
151
void addGroundingOccurrence( const Resource &res );
154
* Merges two Things that represent the same real-world
157
* \param other The Thing that should be merged into this
160
* All properties of \p other will be merged into this
161
* Thing and all references to \p other will be replaced
162
* with references to this Thing.
164
// void merge( Thing other );