Soprano  2.7.56
Public Member Functions
Soprano::Client::SparqlModel Class Reference

Remote client Model for Http SPARQL end points. More...

#include <Soprano/Client/SparqlModel>

+ Inheritance diagram for Soprano::Client::SparqlModel:

List of all members.

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::Util::AsyncResultlistStatementsAsync (const Statement &statement) const
Soprano::QueryResultIterator executeQuery (const QString &query, Query::QueryLanguage language=Query::QueryLanguageSparql, const QString &userQueryLanguage=QString()) const
Soprano::Util::AsyncResultexecuteQueryAsync (const QString &query, Query::QueryLanguage language=Query::QueryLanguageSparql, const QString &userQueryLanguage=QString()) const
NodeIterator listContexts () const
Soprano::Util::AsyncResultlistContextsAsync () const
bool containsStatement (const Statement &statement) const
bool containsAnyStatement (const Statement &statement) const
int statementCount () const
bool isEmpty () const

Detailed Description

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.

Author:
Rajeev J Sebastian rajee.nosp@m.v.se.nosp@m.basti.nosp@m.an@g.nosp@m.mail..nosp@m.com
Sebastian Trueg trueg.nosp@m.@kde.nosp@m..org
Since:
2.2

Definition at line 50 of file sparqlmodel.h.


Constructor & Destructor Documentation

Soprano::Client::SparqlModel::SparqlModel ( const QString host = QString(),
quint16  port = 80,
const QString user = QString(),
const QString password = QString() 
)

Create a new SparqlModel instance.

Parameters:
hostThe host to connect to (example: dbpedia.org)
portThe port on which to connect the host (most Http services run on port 80.
userThe userName in case the host does not allow anonymous access.
passwordThe password for user in case the host does not allow anonymous access.

Destructor.


Member Function Documentation

void Soprano::Client::SparqlModel::setHost ( const QString host,
quint16  port = 80 
)

Set the host to connect to.

Parameters:
hostThe host to connect to (example: dbpedia.org)
portThe 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.

Parameters:
userThe userName in case the host does not allow anonymous access.
passwordThe password for user in case the host

Set the path to where the SPARQL endpoint is exposed on the server.

For historical reasons the default path is set to "/sparql".

Since:
2.2.1

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.

Parameters:
statementThe Statement to add.
Returns:
Error::ErrorNone on success and an error code if statement was invalid or an error occured. Check Error::ErrorCache::lastError for detailed error information.

Implements Soprano::Model.

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.

Parameters:
statementThe Statement to remove.
Returns:
Error::ErrorNone on success and an error code if statement was invalid or an error occured. Check Error::ErrorCache::lastError for detailed error information.

Implements Soprano::Model.

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.

Parameters:
statementA possible partially defined statement that serves as a filter for all statements that should be removed.
Returns:
Error::ErrorNone on success and an error code if statement was invalid or an error occured. Check Error::ErrorCache::lastError for detailed error information.

Implements Soprano::Model.

Implements Soprano::Model.

Asyncroneously list statements.

Parameters:
statementThe partial Statement to match.
Returns:
an AsyncResult with result type StatementIterator object which will signal when the result is ready.
Since:
2.4
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.

Parameters:
queryThe query to evaluate.
languageThe query language used to encode query. Be aware that the SparqlModel does only support one query language: Query::QueryLanguageSparql.
userQueryLanguageunused since language needs to be set to Query::QueryLanguageSparql.
Returns:
An iterator over all results matching the query, on error an invalid iterator is returned.

Implements Soprano::Model.

Asyncroneously execute the given query over the Model.

Parameters:
queryThe query to evaluate.
languageThe query language used to encode query.
userQueryLanguageIf language equals Query::QueryLanguageUser userQueryLanguage defines the language to use.
See also:
executeQuery
Returns:
an AsyncResult with result type QueryResultIterator object which will signal when the result is ready.

Implements Soprano::Model.

Asyncroneously list all contexts.

Parameters:
statementThe partial Statement to match.
Returns:
an AsyncResult with result type NodeIterator object which will signal when the result is ready.
Since:
2.4
bool Soprano::Client::SparqlModel::containsStatement ( const Statement statement) const [virtual]

Implements Soprano::Model.

bool Soprano::Client::SparqlModel::containsAnyStatement ( const Statement statement) const [virtual]

Implements Soprano::Model.

Retrieving the number of statements is not supported by the SparqlModel.

Returns:
-1

Implements Soprano::Model.

bool Soprano::Client::SparqlModel::isEmpty ( ) const [virtual]

Not supported by the SparqlModel.

Returns:
false

Implements Soprano::Model.

Creation of blank nodes is not supported by the SparqlModel.

Returns:
an invalid Node

Implements Soprano::Model.


The documentation for this class was generated from the following file: