Soprano 2.9.4
|
Remote client Model for Http SPARQL end points. More...
#include <Soprano/Client/SparqlModel>
Public Member Functions | |
SparqlModel (const QString &host=QString(), quint16 port=80, const QString &user=QString(), const QString &password=QString()) | |
~SparqlModel () | |
void | setHost (const QString &host, quint16 port=80) |
void | setUser (const QString &user, const QString &password=QString()) |
void | setPath (const QString &path) |
Error::ErrorCode | addStatement (const Statement &statement) |
Error::ErrorCode | removeStatement (const Statement &statement) |
Error::ErrorCode | removeAllStatements (const Statement &statement) |
Soprano::StatementIterator | listStatements (const Statement &partial) const |
Soprano::Util::AsyncResult * | listStatementsAsync (const Statement &statement) const |
Soprano::QueryResultIterator | executeQuery (const QString &query, Query::QueryLanguage language=Query::QueryLanguageSparql, const QString &userQueryLanguage=QString()) const |
Soprano::Util::AsyncResult * | executeQueryAsync (const QString &query, Query::QueryLanguage language=Query::QueryLanguageSparql, const QString &userQueryLanguage=QString()) const |
NodeIterator | listContexts () const |
Soprano::Util::AsyncResult * | listContextsAsync () const |
bool | containsStatement (const Statement &statement) const |
bool | containsAnyStatement (const Statement &statement) const |
int | statementCount () const |
bool | isEmpty () const |
Node | createBlankNode () |
Error::ErrorCode | addStatement (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) |
Error::ErrorCode | removeStatement (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) |
Error::ErrorCode | removeAllStatements (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) |
Error::ErrorCode | removeAllStatements () |
StatementIterator | listStatements (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const |
StatementIterator | listStatements () const |
bool | containsStatement (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const |
bool | containsAnyStatement (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const |
Public Member Functions inherited from Soprano::Model | |
virtual | ~Model () |
Error::ErrorCode | addStatement (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) |
Error::ErrorCode | addStatements (const QList< Statement > &statements) |
Error::ErrorCode | removeStatement (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) |
Error::ErrorCode | removeAllStatements (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) |
Error::ErrorCode | removeStatements (const QList< Statement > &statements) |
Error::ErrorCode | removeContext (const Node &) |
Error::ErrorCode | removeAllStatements () |
StatementIterator | listStatements (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const |
StatementIterator | listStatements () const |
StatementIterator | listStatementsInContext (const Node &context) const |
bool | containsAnyStatement (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const |
bool | containsStatement (const Node &subject, const Node &predicate, const Node &object, const Node &context=Node()) const |
bool | containsContext (const Node &context) const |
virtual Error::ErrorCode | write (QTextStream &os) const |
Public Member Functions inherited from QObject | |
QObject (QObject *parent=0) | |
blockSignals (bool block) | |
childEvent (QChildEvent *event) | |
children () | |
connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type=Qt::AutoCompatConnection) | |
connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type=Qt::AutoCompatConnection) | |
connectNotify (const char *signal) | |
customEvent (QEvent *event) | |
deleteLater () | |
destroyed (QObject *obj=0) | |
disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) | |
disconnect (const char *signal=0, const QObject *receiver=0, const char *method=0) | |
disconnect (const QObject *receiver, const char *method=0) | |
disconnectNotify (const char *signal) | |
dumpObjectInfo () | |
dumpObjectTree () | |
dynamicPropertyNames () | |
event (QEvent *e) | |
eventFilter (QObject *watched, QEvent *event) | |
findChild (const QString &name=QString() | |
findChildren (const QString &name=QString() | |
findChildren (const QRegExp ®Exp) | |
inherits (const char *className) | |
installEventFilter (QObject *filterObj) | |
isWidgetType () | |
killTimer (int id) | |
metaObject () | |
moveToThread (QThread *targetThread) | |
parent () | |
property (const char *name) | |
receivers (const char *signal) | |
removeEventFilter (QObject *obj) | |
sender () | |
setParent (QObject *parent) | |
setProperty (const char *name, const QVariant &value) | |
signalsBlocked () | |
startTimer (int interval) | |
thread () | |
timerEvent (QTimerEvent *event) | |
tr (const char *sourceText, const char *comment=0, int n=-1) | |
trUtf8 (const char *sourceText, const char *comment=0, int n=-1) | |
staticMetaObject | |
QObject (QObject *parent, const char *name) | |
checkConnectArgs (const char *signal, const QObject *object, const char *method) | |
child (const char *objName, const char *inheritsClass=0, bool recursiveSearch=true) | |
className () | |
insertChild (QObject *object) | |
isA (const char *className) | |
name () | |
name (const char *defaultName) | |
normalizeSignalSlot (const char *signalSlot) | |
removeChild (QObject *object) | |
setName (const char *name) | |
Public Member Functions inherited from Soprano::Error::ErrorCache | |
virtual | ~ErrorCache () |
virtual Error | lastError () const |
Additional Inherited Members | |
Signals inherited from Soprano::Model | |
void | statementsAdded () |
void | statementsRemoved () |
void | statementAdded (const Soprano::Statement &statement) |
void | statementRemoved (const Soprano::Statement &statement) |
Protected Member Functions inherited from Soprano::Model | |
Model () | |
Protected Member Functions inherited from Soprano::Error::ErrorCache | |
ErrorCache () | |
void | clearError () const |
void | setError (const Error &) const |
void | setError (const QString &errorMessage, int code=ErrorUnknown) const |
Remote client Model for Http SPARQL end points.
The SparqlModel provides a very simple way of accessing remote SPARQL (SPARQL Protocol and RDF Query Language) web services via Http.
Its usage is simple: set hostname and optionally user credentials, then call the well known Model methods like Model::executeQuery to work with the remote repository.
Definition at line 50 of file sparqlmodel.h.
Soprano::Client::SparqlModel::SparqlModel | ( | const QString & | host = QString(), |
quint16 | port = 80, | ||
const QString & | user = QString(), | ||
const QString & | password = QString() ) |
Create a new SparqlModel instance.
host | The host to connect to (example: dbpedia.org) |
port | The port on which to connect the host (most Http services run on port 80. |
user | The userName in case the host does not allow anonymous access. |
password | The password for user in case the host does not allow anonymous access. |
Soprano::Client::SparqlModel::~SparqlModel | ( | ) |
Destructor.
void Soprano::Client::SparqlModel::setHost | ( | const QString & | host, |
quint16 | port = 80 ) |
Set the host to connect to.
host | The host to connect to (example: dbpedia.org) |
port | The port on which to connect the host (most Http services run on port 80. |
void Soprano::Client::SparqlModel::setUser | ( | const QString & | user, |
const QString & | password = QString() ) |
Set the user name and password to access the host.
user | The userName in case the host does not allow anonymous access. |
password | The password for user in case the host |
void Soprano::Client::SparqlModel::setPath | ( | const QString & | path | ) |
Set the path to where the SPARQL endpoint is exposed on the server.
For historical reasons the default path is set to "/sparql".
|
virtual |
Add a statement to the remote model.
This method is realized using the SPARQL/Update language extension. Thus, it will only work on services supporting this extension.
statement | The Statement to add. |
Implements Soprano::Model.
|
virtual |
Removed a statement from the remote model.
This method is realized using the SPARQL/Update language extension. Thus, it will only work on services supporting this extension.
statement | The Statement to remove. |
Implements Soprano::Model.
|
virtual |
Remove all statements that match the partial statement. For removing one specific statement see removeStatement().
This method is realized using the SPARQL/Update language extension. Thus, it will only work on services supporting this extension.
statement | A possible partially defined statement that serves as a filter for all statements that should be removed. |
Implements Soprano::Model.
|
virtual |
\reimpl
Implements Soprano::Model.
Soprano::Util::AsyncResult * Soprano::Client::SparqlModel::listStatementsAsync | ( | const Statement & | statement | ) | const |
Asyncroneously list statements.
statement | The partial Statement to match. |
|
virtual |
Execute a query on the SPARQL endpoint.
query | The query to evaluate. |
language | The query language used to encode query . Be aware that the SparqlModel does only support one query language: Query::QueryLanguageSparql. |
userQueryLanguage | unused since language needs to be set to Query::QueryLanguageSparql. |
Implements Soprano::Model.
Soprano::Util::AsyncResult * Soprano::Client::SparqlModel::executeQueryAsync | ( | const QString & | query, |
Query::QueryLanguage | language = Query::QueryLanguageSparql, | ||
const QString & | userQueryLanguage = QString() ) const |
Asyncroneously execute the given query over the Model.
query | The query to evaluate. |
language | The query language used to encode query . |
userQueryLanguage | If language equals Query::QueryLanguageUser userQueryLanguage defines the language to use. |
|
virtual |
\reimpl
Implements Soprano::Model.
Soprano::Util::AsyncResult * Soprano::Client::SparqlModel::listContextsAsync | ( | ) | const |
Asyncroneously list all contexts.
statement | The partial Statement to match. |
|
virtual |
\reimpl
Implements Soprano::Model.
|
virtual |
\reimpl
Implements Soprano::Model.
|
virtual |
Retrieving the number of statements is not supported by the SparqlModel.
Implements Soprano::Model.
|
virtual |
|
virtual |
Creation of blank nodes is not supported by the SparqlModel.
Implements Soprano::Model.
Error::ErrorCode Soprano::Model::addStatement | ( | const Node & | subject, |
const Node & | predicate, | ||
const Node & | object, | ||
const Node & | context = Node() ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Error::ErrorCode Soprano::Model::removeStatement | ( | const Node & | subject, |
const Node & | predicate, | ||
const Node & | object, | ||
const Node & | context = Node() ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Error::ErrorCode Soprano::Model::removeAllStatements | ( | const Node & | subject, |
const Node & | predicate, | ||
const Node & | object, | ||
const Node & | context = Node() ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
subject | The subject node to match. Can be empty as a wildcard. |
predicate | The predicate node to match. Can be empty as a wildcard. |
object | The object node to match. Can be empty as a wildcard. |
context | The context node to match. Can be empty as a wildcard. |
Error::ErrorCode Soprano::Model::removeAllStatements | ( | ) |
Convenience method that clear the Model of all statements
StatementIterator Soprano::Model::listStatements | ( | const Node & | subject, |
const Node & | predicate, | ||
const Node & | object, | ||
const Node & | context = Node() ) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
subject | The subject node to match. Can be empty as a wildcard. |
predicate | The predicate node to match. Can be empty as a wildcard. |
object | The object node to match. Can be empty as a wildcard. |
context | The context node to match. Can be empty as a wildcard. |
StatementIterator Soprano::Model::listStatements | ( | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool Soprano::Model::containsStatement | ( | const Node & | subject, |
const Node & | predicate, | ||
const Node & | object, | ||
const Node & | context = Node() ) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool Soprano::Model::containsAnyStatement | ( | const Node & | subject, |
const Node & | predicate, | ||
const Node & | object, | ||
const Node & | context = Node() ) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
subject | The subject node to match. Can be empty as a wildcard. |
predicate | The predicate node to match. Can be empty as a wildcard. |
object | The object node to match. Can be empty as a wildcard. |
context | The context node to match. Can be empty as a wildcard. |