Dataquay 0.8
TypeMapping.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_TYPE_MAPPING_H
35#define DATAQUAY_TYPE_MAPPING_H
36
37#include "../Uri.h"
38
39#include <QString>
40
41namespace Dataquay
42{
43
77{
78public:
83
87
95
100
107 void setPropertyPrefix(Uri prefix);
108
113
120
125
129 void addTypeMapping(QString className, Uri uri);
130
136 bool getTypeUriForClass(QString className, Uri &uri) const;
137
144 bool getClassForTypeUri(Uri uri, QString &className) const;
145
160 Uri synthesiseTypeUriForClass(QString className) const;
161
180 QString synthesiseClassForTypeUri(Uri uri) const;
181
206 void addTypeUriPrefixMapping(QString className, Uri prefix);
207
213 bool getUriPrefixForClass(QString className, Uri &prefix) const;
214
225 void addPropertyMapping(QString className, QString propertyName, Uri uri);
226
232 bool getPropertyUri(QString className, QString propertyName, Uri &uri) const;
233
240 bool getPropertyName(QString className, Uri propertyUri, QString &propertyName) const;
241
244
245private:
246 class D;
247 D *m_d;
248};
249
250}
251
252#endif
TypeMapping describes a set of relationships between RDF entity and property URIs,...
Definition TypeMapping.h:77
void setObjectTypePrefix(Uri prefix)
Set the prefix for synthetic type URIs.
TypeMapping(const TypeMapping &)
void setRelationshipPrefix(Uri prefix)
Set the prefix for ObjectMapper-specific property URIs.
TypeMapping()
Construct a TypeMapping using default URIs throughout.
Uri getObjectTypePrefix() const
Retrieve the prefix for synthetic type URIs.
bool getClassForTypeUri(Uri uri, QString &className) const
Retrieve the C++ class name that has been set for the given entity URI using addTypeMapping,...
bool getTypeUriForClass(QString className, Uri &uri) const
Retrieve the URI that has been set for the given class name using addTypeMapping, returning it in uri...
Uri getRelationshipPrefix() const
Retrieve the prefix for ObjectMapper-specific property URIs.
bool getPropertyName(QString className, Uri propertyUri, QString &propertyName) const
Retrieve the name of the property for which the given URI has been set in the given class using addPr...
void addTypeMapping(QString className, Uri uri)
Add a specific mapping from class name to entity URI.
Uri synthesiseTypeUriForClass(QString className) const
Return a URI for the RDF entity type corresponding to the given C++ class.
void addPropertyMapping(QString className, QString propertyName, Uri uri)
Add a specific mapping for the given QObject property in the given C++ class, to an RDF property URI.
bool getPropertyUri(QString className, QString propertyName, Uri &uri) const
Retrieve the URI that has been set for the given property in the given class using addPropertyMapping...
bool getUriPrefixForClass(QString className, Uri &prefix) const
Retrieve the URI prefix set for the given className using addTypeUriPrefixMapping,...
QString synthesiseClassForTypeUri(Uri uri) const
Return a C++ class name corresponding to the given RDF entity type URI.
void addTypeUriPrefixMapping(QString className, Uri prefix)
Add a mapping between class name and the common parts of any URIs that are automatically generated wh...
void setPropertyPrefix(Uri prefix)
Set the prefix for synthetic property URIs.
TypeMapping & operator=(const TypeMapping &)
Uri getPropertyPrefix() const
Retrieve the prefix for synthetic property URIs.
Uri represents a single URI.
Definition Uri.h:77