Dataquay 0.8
ObjectMapper.h
Go to the documentation of this file.
1/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3/*
4 Dataquay
5
6 A C++/Qt library for simple RDF datastore management.
7 Copyright 2009-2012 Chris Cannam.
8
9 Permission is hereby granted, free of charge, to any person
10 obtaining a copy of this software and associated documentation
11 files (the "Software"), to deal in the Software without
12 restriction, including without limitation the rights to use, copy,
13 modify, merge, publish, distribute, sublicense, and/or sell copies
14 of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be
18 included in all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
24 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
25 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
28 Except as contained in this notice, the name of Chris Cannam
29 shall not be used in advertising or otherwise to promote the sale,
30 use or other dealings in this Software without prior written
31 authorization.
32*/
33
34#ifndef DATAQUAY_OBJECT_MAPPER_H
35#define DATAQUAY_OBJECT_MAPPER_H
36
37#include "../Node.h"
38#include "../Store.h"
39
40#include "ObjectMapperDefs.h"
41
42#include <QObject>
43
44namespace Dataquay
45{
46
47class TransactionalStore;
48class TypeMapping;
49
104class ObjectMapper : public QObject
105{
106 Q_OBJECT
107
108public:
121
127
136
142
149
155
161 Node getNodeForObject(QObject *o) const;
162
168 QObject *getObjectByNode(Node n) const;
169
171 QObject *load(Node node);
172
174 QObjectList loadType(Uri type);
175
176
177signals:
178 void committed();
179
180public slots:
192 void add(QObject *);
193
205 void add(QObjectList);
206
221 void manage(QObject *);
222
240 void manage(QObjectList);
241
245 void unmanage(QObject *);
246
250 void unmanage(QObjectList);
251
259 void commit();
260
270
277 void objectModified(QObject *);
278
285 void objectDestroyed(QObject *);
286
287private slots:
288 void transactionCommitted(const ChangeSet &cs);
289
290private:
291 ObjectMapper(const ObjectMapper &);
292 ObjectMapper &operator=(const ObjectMapper &);
293
294 class D;
295 D *m_d;
296};
297
298}
299
300#endif
Node represents a single RDF node, with conversions to and from variant types.
Definition Node.h:65
ObjectMapper manages a set of objects, maintaining a consistent record of their state in a Transactio...
void commit()
Commit to the store any changes that have happened to the currently managed objects since the last co...
void manage(QObject *)
Tell ObjectMapper to start managing an object.
ObjectMapper(TransactionalStore *ts)
Construct an object mapper backed by the given store.
QObject * getObjectByNode(Node n) const
Obtain the QObject which has been mapped to the given node, or NULL if the node is not one that has b...
void manage(QObjectList)
Tell ObjectMapper to start managing a list of objects.
void add(QObjectList)
Add a list of new objects to the store.
BlankNodePolicy getBlankNodePolicy() const
Retrieve the current policy used to determine whether to give an object a URI or use a blank node for...
QObjectList loadType(Uri type)
!!doc
void setBlankNodePolicy(BlankNodePolicy policy)
Set the policy used to determine whether to give an object a URI or use a blank node for it.
void unmanage(QObjectList)
Tell ObjectMapper to stop managing the given objects.
ChangeSet commitAndObtain()
Commit to the store any changes that have happened to the currently managed objects since the last co...
Node getNodeForObject(QObject *o) const
Obtain the RDF node to which the given object has been mapped, or a null Node if the object has not y...
const TypeMapping & getTypeMapping() const
Obtain the TypeMapping previously set using setTypeMapping, or the default (empty) TypeMapping if non...
QObject * load(Node node)
!!doc
void setTypeMapping(const TypeMapping &)
Supply a TypeMapping object describing the RDF URIs that should be used to encode each object's prope...
void objectDestroyed(QObject *)
Notify ObjectMapper that the given object is being destroyed.
TransactionalStore * getStore()
Obtain the TransactionalStore that was passed to the constructor.
void unmanage(QObject *)
Tell ObjectMapper to stop managing the given object.
void objectModified(QObject *)
Notify ObjectMapper that the given object has changed.
void add(QObject *)
Add a new object to the store.
TransactionalStore is an RDF data store implementing the Store interface, providing transaction suppo...
TypeMapping describes a set of relationships between RDF entity and property URIs,...
Definition TypeMapping.h:77
Uri represents a single URI.
Definition Uri.h:77
QList< Change > ChangeSet
A sequence of add/remove operations such as may be enacted by a transaction.
Definition Store.h:63