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 () | |
Node | createBlankNode () |
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::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 |
bool | containsStatement (const Statement &statement) const |
bool | containsAnyStatement (const Statement &statement) const |
int | statementCount () const |
bool | isEmpty () 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 53 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".
Error::ErrorCode Soprano::Client::SparqlModel::addStatement | ( | const Statement & | statement | ) | [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.
Error::ErrorCode Soprano::Client::SparqlModel::removeStatement | ( | const Statement & | statement | ) | [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.
Error::ErrorCode Soprano::Client::SparqlModel::removeAllStatements | ( | const Statement & | statement | ) | [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.
Soprano::StatementIterator Soprano::Client::SparqlModel::listStatements | ( | const Statement & | partial | ) | const [virtual] |
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. |
Implements Soprano::Model.
Soprano::QueryResultIterator Soprano::Client::SparqlModel::executeQuery | ( | const QString & | query, | |
Query::QueryLanguage | language = Query::QueryLanguageSparql , |
|||
const QString & | userQueryLanguage = QString() | |||
) | const [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. |
NodeIterator Soprano::Client::SparqlModel::listContexts | ( | ) | const [virtual] |
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. |
Implements Soprano::Model.
bool Soprano::Client::SparqlModel::containsStatement | ( | const Statement & | statement | ) | const [virtual] |
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. |
Implements Soprano::Model.
bool Soprano::Client::SparqlModel::containsAnyStatement | ( | const Statement & | statement | ) | const [virtual] |
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. |
Implements Soprano::Model.
int Soprano::Client::SparqlModel::statementCount | ( | ) | const [virtual] |
Retrieving the number of statements is not supported by the SparqlModel.
Implements Soprano::Model.
bool Soprano::Client::SparqlModel::isEmpty | ( | ) | const [virtual] |
Node Soprano::Client::SparqlModel::createBlankNode | ( | ) | [virtual] |
Creation of blank nodes is not supported by the SparqlModel.
Implements Soprano::Model.