~ubuntu-branches/ubuntu/utopic/nepomuk-core/utopic

« back to all changes in this revision

Viewing changes to libnepomukcore/resource/thing.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-07-26 22:43:09 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20120726224309-pf2v1e78ee7uljjp
Tags: 4:4.9.0a-0ubuntu1
* Use direct build-depends versions rather than kde-sc-dev-latest
* New upstream release
* New symbols, rename libnepomukcore4 to libnepomukcore4abi and enable Debian ABI manager

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * This file is part of the Nepomuk KDE project.
3
 
 * Copyright (C) 2008-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 _NEPOMUK_THING_H_
22
 
#define _NEPOMUK_THING_H_
23
 
 
24
 
#include "resource.h"
25
 
#include "nepomuk_export.h"
26
 
 
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?)
29
 
 
30
 
namespace Nepomuk2 {
31
 
    /**
32
 
     * \class Thing thing.h Nepomuk2/Thing
33
 
     *
34
 
     * \brief A Nepomuk PIMO Thing resource.
35
 
     *
36
 
     * A Thing represents a unique abstract concept/idea or real-world
37
 
     * entity which can have multiple representations or occurrences.
38
 
     *
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.
42
 
     *
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.
46
 
     *
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
51
 
     * uniquely.
52
 
     *
53
 
     * \author Sebastian Trueg <trueg@kde.org>
54
 
     *
55
 
     * \since 4.2
56
 
     */
57
 
    class NEPOMUK_EXPORT Thing : public Resource
58
 
    {
59
 
    public:
60
 
        /**
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).
64
 
         *
65
 
         * \param uri The URI of the Thing. If empty, a new random one
66
 
         * will be created.
67
 
         * \param pimoType The type of this Thing. Needs to be a subtype
68
 
         * of pimo:Thing. If empty defaults to pimo:Thing.
69
 
         */
70
 
        Thing( const QUrl& uri = QUrl(), const QUrl& pimoType = QUrl() );
71
 
 
72
 
        /**
73
 
         * Create a new Thing with label or URI \p uriOrName
74
 
         *
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.
80
 
         *
81
 
         * Be aware that using the other constructor is always faster in case
82
 
         * the URI of the Thing is known.
83
 
         */
84
 
        Thing( const QString& uriOrName, const QUrl& pimoType = QUrl() );
85
 
 
86
 
        /**
87
 
         * Copy constructor.
88
 
         */
89
 
        Thing( const Thing& other );
90
 
 
91
 
        /**
92
 
         * Copy constructor.
93
 
         *
94
 
         * \param other the resoruce to construct the Thing from.
95
 
         */
96
 
        Thing( const Resource& other );
97
 
 
98
 
        /**
99
 
         * Constructor used internally.
100
 
         */
101
 
        Thing( ResourceData* );
102
 
 
103
 
        /**
104
 
         * Desctructor
105
 
         */
106
 
        ~Thing();
107
 
 
108
 
        /**
109
 
         * Assignment operator.
110
 
         */
111
 
        Thing& operator=( const Thing& res );
112
 
 
113
 
        /**
114
 
         * Assignment operator.
115
 
         */
116
 
        Thing& operator=( const Resource& res );
117
 
 
118
 
        /**
119
 
         * Assignment operator.
120
 
         */
121
 
        Thing& operator=( const QUrl& res );
122
 
 
123
 
        /**
124
 
         * Get the grounding occurrences for this Thing.
125
 
         * Grounding resources are physical representations
126
 
         * of the Thing.
127
 
         *
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.
131
 
         *
132
 
         * \sa pimo:groundingResource
133
 
         */
134
 
        QList<Resource> groundingOccurrences() const;
135
 
 
136
 
        QList<Resource> referencingOccurrences() const;
137
 
 
138
 
        QList<Resource> occurrences() const;
139
 
 
140
 
        /**
141
 
         * Add a grounding occurrence for this Thing.
142
 
         * Grounding resources are physical representations
143
 
         * of the Thing.
144
 
         *
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.
148
 
         *
149
 
         * \sa pimo:groundingResource
150
 
         */
151
 
        void addGroundingOccurrence( const Resource &res );
152
 
 
153
 
        /**
154
 
         * Merges two Things that represent the same real-world
155
 
         * entity.
156
 
         *
157
 
         * \param other The Thing that should be merged into this
158
 
         * Thing.
159
 
         *
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.
163
 
         */
164
 
//        void merge( Thing other );
165
 
    };
166
 
}
167
 
 
168
 
#endif