The QSparqlQuery class provides a means of executing and manipulating SPARQL statements. More...
Public Types |
|
enum | StatementType { SelectStatement, AskStatement, ConstructStatement, DescribeStatement, InsertStatement, DeleteStatement } |
Public Member Functions |
|
QSparqlQuery (const QString &query=QString(), StatementType type=SelectStatement) | |
QSparqlQuery (const QSparqlQuery &other) | |
QSparqlQuery & | operator= (const QSparqlQuery &other) |
~QSparqlQuery () | |
StatementType | type () const |
void | setType (StatementType type) |
QString | query () const |
void | setQuery (const QString &query) |
void | bindValue (const QString &placeholder, const QVariant &val) |
void | bindValue (const QSparqlBinding &binding) |
void | bindValues (const QSparqlResultRow &bindings) |
QVariant | boundValue (const QString &placeholder) const |
QMap< QString, QSparqlBinding > | boundValues () const |
void | unbindValues () |
QString | preparedQueryText () const |
The QSparqlQuery class provides a means of executing and manipulating SPARQL statements.
QSparqlQuery encapsulates the functionality involved in creating SPARQL queries which are executed on a QSparqlConnection.
It can also be used to execute commands specific to an RDF store which are not standard SPARQL.
To execute the QSparqlQuery, pass it to QSparqlConnection::exec().
QSparqlQuery supports binding of parameter values to placeholders; ?: and $: are used as placeholder markers.
You can retrieve the values of all the fields in a single variable (a map) using boundValues().
QSparqlQuery supports replacing placeholders (marked with ?: or $:) with strings.
QSparqlQuery nameQuery("select ?ng ?nf " "{ ?:contact_uri nco:nameGiven ?ng ; nco:nameFamily ?nf . } "); nameQuery.bindValue("contact_uri", QUrl(uri));
When replacing strings, the quotes surrounding strings are inserted automatically. Quotes (" and ') inside the strings are escaped.
This enum contains a list of SPARQL statement (or clause) types the driver can create.
QSparqlQuery::QSparqlQuery | ( | const QString & | query = QString() , |
|
StatementType | type = SelectStatement |
|||
) | [explicit] |
Constructs a QSparqlQuery object which uses the QSparqlResult result to communicate with a database.
QSparqlQuery::QSparqlQuery | ( | const QSparqlQuery & | other | ) |
Constructs a copy of other.
QSparqlQuery::~QSparqlQuery | ( | ) |
Destroys the object and frees any allocated resources.
Set the placeholder placeholder to be bound to value val in the query. Note that the placeholder mark (?: or $
:) must not be included when specifying the placeholder name.
void QSparqlQuery::bindValue | ( | const QSparqlBinding & | binding | ) |
Set the placeholder binding.name() to be bound to value binding.value() in the query. Note that the placeholder mark (?: or $
:) must not be included when specifying the placeholder name.
void QSparqlQuery::bindValues | ( | const QSparqlResultRow & | bindings | ) |
Iterates through the variable name - value pairs from the bindings and adds them as bindings.
Returns the value for the placeholder.
QMap< QString, QSparqlBinding > QSparqlQuery::boundValues | ( | ) | const |
Returns a map of the bound values.
QSparqlQuery & QSparqlQuery::operator= | ( | const QSparqlQuery & | other | ) |
Assigns other to this object.
QString QSparqlQuery::preparedQueryText | ( | ) | const |
Replaces the placeholders with the bound values and returns the resulting query.
QString QSparqlQuery::query | ( | ) | const |
Returns the query text without replacements.
void QSparqlQuery::setQuery | ( | const QString & | query | ) |
Sets the query text to query. The bound placeholders are not affected.
void QSparqlQuery::setType | ( | StatementType | type | ) |
Sets the statement type to type.
QSparqlQuery::StatementType QSparqlQuery::type | ( | ) | const |
Returns the statement type.
void QSparqlQuery::unbindValues | ( | ) |
Clears all bound values.
Copyright (C) 2010-2011 Nokia Corporation and/or its subsidiary(-ies). Commercial Qt/LGPL 2.1 with Nokia exception/GPL 3.0 |
MeeGo 1.2 Harmattan API
|