/usr/include/dataquay/Connection.h is in libdataquay-dev 0.9-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
Dataquay
A C++/Qt library for simple RDF datastore management.
Copyright 2009-2012 Chris Cannam.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Chris Cannam
shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization.
*/
#ifndef _DATAQUAY_CONNECTION_H_
#define _DATAQUAY_CONNECTION_H_
#include "Store.h"
namespace Dataquay
{
class TransactionalStore;
class Transaction;
/**
* \class Connection Connection.h <dataquay/Connection.h>
*
* Connection provides a connection interface to TransactionalStore,
* allowing it to be used in a convenient manner familiar to
* programmers working with SQL databases.
*
* Each processing thread may construct a Connection to a central
* TransactionalStore. The Connection will start a new Transaction on
* the store when the first modifying function (add, remove, change or
* revert) is called and will continue to use this Transaction for all
* accesses to the store until either commit() or rollback() is called
* on the Connection.
*
* Any read-only functions called on this class between a commit() or
* rollback() and the next modifying function will be passed directly
* to the store without any transaction. Read-only functions called
* while a transaction is in progress will be passed through the
* current transaction, and so will read the effective state of the
* store with the partial transaction in force.
*
* The Connection commits any active Transaction when it is deleted.
* To avoid this, call rollback() before deletion. No other
* auto-commit functionality is provided -- if you want auto-commit,
* use the TransactionalStore's own interface in AutoTransaction mode.
*
* Each Connection should be used in a single processing thread only.
* Connection is not thread-safe.
*/
class Connection : public QObject, public Store
{
Q_OBJECT
public:
/**
* Construct a Connection to the given TransactionalStore, through
* which a series of transactions may be made in a single
* processing thread.
*/
Connection(TransactionalStore *ts);
/**
* Destroy the Connection, first committing any outstanding
* transaction. If you do not want any outstanding transaction to
* be committed, call rollback() first.
*/
~Connection();
// Store interface
bool add(Triple t);
bool remove(Triple t);
void change(ChangeSet changes);
void revert(ChangeSet changes);
bool contains(Triple t) const;
Triples match(Triple t) const;
ResultSet query(QString sparql) const;
Node complete(Triple t) const;
Triple matchOnce(Triple t) const;
Node queryOnce(QString sparql, QString bindingName) const;
Uri getUniqueUri(QString prefix) const;
Node addBlankNode();
Uri expand(QString uri) const;
void save(QString filename) const;
void import(QUrl url, ImportDuplicatesMode idm, QString format = "");
Features getSupportedFeatures() const;
public slots:
/**
* Commit the outstanding Transaction, if any.
*/
void commit();
/**
* Commit the outstanding Transaction, if any, and return the
* changes committed.
*/
ChangeSet commitAndObtain();
/**
* Roll back the outstanding Transaction, if any, and prepare to
* begin a new Transaction the next time a modifying function is
* called.
*/
void rollback();
signals:
/// Forwarded from TransactionalStore
void transactionCommitted(const ChangeSet &);
/// Forwarded from TransactionalStore
void transactionCommitted();
private:
class D;
D *m_d;
};
}
#endif
|