Dataquay 0.8
Connection.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_CONNECTION_H
35#define DATAQUAY_CONNECTION_H
36
37#include "Store.h"
38
39namespace Dataquay
40{
41
42class TransactionalStore;
43class Transaction;
44
74class Connection : public QObject, public Store
75{
76 Q_OBJECT
77
78public:
85
92
93 // Store interface
94 bool add(Triple t);
95 bool remove(Triple t);
96 void change(ChangeSet changes);
97 void revert(ChangeSet changes);
98 bool contains(Triple t) const;
100 ResultSet query(QString sparql) const;
103 Node queryOnce(QString sparql, QString bindingName) const;
104 Uri getUniqueUri(QString prefix) const;
106 Uri expand(QString uri) const;
107 void save(QString filename) const;
108 void import(QUrl url, ImportDuplicatesMode idm, QString format = "");
109 void importString(QString encodedRdf, Uri uri,
110 ImportDuplicatesMode idm, QString format = "");
112
113public slots:
117 void commit();
118
124
130 void rollback();
131
132signals:
135
138
139private:
140 class D;
141 D *m_d;
142};
143
144}
145
146#endif
Connection provides a connection interface to TransactionalStore, allowing it to be used in a conveni...
Definition Connection.h:75
Features getSupportedFeatures() const
Retrieve the set of optional features supported by this Store implementation.
Uri getUniqueUri(QString prefix) const
Get a new URI, starting with the given prefix (e.g.
bool contains(Triple t) const
Return true if the store contains the given triple, false otherwise.
bool add(Triple t)
Add a triple to the store.
void save(QString filename) const
Export the store to an RDF/TTL file with the given filename.
bool remove(Triple t)
Remove a triple from the store.
Connection(TransactionalStore *ts)
Construct a Connection to the given TransactionalStore, through which a series of transactions may be...
~Connection()
Destroy the Connection, first committing any outstanding transaction.
Node complete(Triple t) const
Given a triple in which any two nodes are specified and the other is a wildcard node of type Nothing,...
Uri expand(QString uri) const
Expand the given URI (which may use local namespaces) and prefix-expand it, returning the result as a...
void importString(QString encodedRdf, Uri uri, ImportDuplicatesMode idm, QString format="")
Import the RDF document encoded in the given string into the current store (in addition to its existi...
Triples match(Triple t) const
Return all triples matching the given wildcard triple.
void transactionCommitted()
Forwarded from TransactionalStore.
Node queryOnce(QString sparql, QString bindingName) const
Run a SPARQL query against the store and return the node of the first result for the given query bind...
Triple matchOnce(Triple t) const
Return a triple from the store that matches the given wildcard triple, or the empty triple if none ma...
void rollback()
Roll back the outstanding Transaction, if any, and prepare to begin a new Transaction the next time a...
ChangeSet commitAndObtain()
Commit the outstanding Transaction, if any, and return the changes committed.
void commit()
Commit the outstanding Transaction, if any.
void revert(ChangeSet changes)
Atomically apply the sequence of add/remove changes described in the given ChangeSet,...
Node addBlankNode()
Create and return a new blank node.
ResultSet query(QString sparql) const
Run a SPARQL query against the store and return its results.
void change(ChangeSet changes)
Atomically apply the sequence of add/remove changes described in the given ChangeSet.
void transactionCommitted(const ChangeSet &)
Forwarded from TransactionalStore.
Node represents a single RDF node, with conversions to and from variant types.
Definition Node.h:65
Store is an abstract interface for Dataquay RDF data stores.
Definition Store.h:72
QSet< Feature > Features
Definition Store.h:290
ImportDuplicatesMode
ImportDuplicatesMode determines the outcome when an import operation encounters a triple in the impor...
Definition Store.h:222
TransactionalStore is an RDF data store implementing the Store interface, providing transaction suppo...
Triple represents an RDF statement made up of three Node objects.
Definition Triple.h:48
A list of RDF triples.
Definition Triple.h:111
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
QList< Dictionary > ResultSet
A list of Dictionary types, used to contain a sequence of query results.
Definition Store.h:52