Public Member Functions

QSparqlBinding Class Reference

The QSparqlBinding class handles a binding between a SPARQL query variable name and the value of the RDF node. More...

List of all members.

Public Member Functions

 QSparqlBinding (const QString &name=QString())
 QSparqlBinding (const QString &name, const QVariant &value)
 QSparqlBinding (const QSparqlBinding &other)
QSparqlBindingoperator= (const QSparqlBinding &other)
bool operator== (const QSparqlBinding &other) const
bool operator!= (const QSparqlBinding &other) const
 ~QSparqlBinding ()
void setValue (const QString &value, const QUrl &dataTypeUri)
void setValue (const QVariant &value)
void setBlankNodeLabel (const QString &label)
QVariant value () const
void setName (const QString &name)
QString name () const
bool isUri () const
bool isLiteral () const
bool isBlank () const
void clear ()
QUrl dataTypeUri () const
QString toString () const
void setDataTypeUri (const QUrl &datatype)
void setLanguageTag (const QString &lang)
QString languageTag () const
bool isValid () const

Detailed Description

The QSparqlBinding class handles a binding between a SPARQL query variable name and the value of the RDF node.

QSparqlBinding represents the characteristics of a single RDF node in a query result, such as the data type and variable name. A binding also contains the value of the variable, which can be viewed or changed.

Binding data values are stored as QVariants.

QSparqlBinding objects are rarely created explicitly in application code. They are usually accessed indirectly through QSparqlResultRow that already contain a list of bindings.

A QSparqlBinding object can provide some meta-data about the binding, for example, its name(), variant type(), languageTag(), and dataTypeUri(). The RDF node type is given with the isUri(), isLiteral() and isBlank() methods. The binding's data can be checked to see if it isValid(), and its value() retrieved, or a string representation toString(). When editing the data can be set with setValue() or set to an invalid type with clear().

See also:
QSparqlResultRow

Constructor & Destructor Documentation

QSparqlBinding::QSparqlBinding ( const QString &  name = QString()  ) 

Constructs an empty binding called name of variant type type.

See also:
setDataTypeUri() setLanguageTag() setBlankNodeLabel()
QSparqlBinding::QSparqlBinding ( const QString &  name,
const QVariant &  value 
)

Constructs a binding called name with the value value.

See also:
setDataTypeUri() setLanguageTag() setBlankNodeLabel()
QSparqlBinding::QSparqlBinding ( const QSparqlBinding other  ) 

Constructs a copy of other.

QSparqlBinding::~QSparqlBinding (  ) 

Destroys the object and frees any allocated resources.


Member Function Documentation

void QSparqlBinding::clear (  ) 

Clears the value of the binding and sets it to NULL. If the field is read-only, nothing happens.

See also:
setValue() isReadOnly()
QUrl QSparqlBinding::dataTypeUri (  )  const

If the binding is a literal, returns the data type Uri of the RDF type

See also:
setDataTypeUri()
bool QSparqlBinding::isBlank (  )  const

Returns true if the value is a blank node.

See also:
setBlankNodeLabel()
bool QSparqlBinding::isLiteral (  )  const

Returns true if the value is a literal node.

See also:
setValue()
bool QSparqlBinding::isUri (  )  const

Returns true if the value is a Uri representing an RDF resource node.

See also:
setValue()
bool QSparqlBinding::isValid (  )  const

Returns true if the field's variant type is valid; otherwise returns false.

QString QSparqlBinding::languageTag (  )  const

Returns the binding's languageTag.

See also:
setLanguageTag() dataTypeUri()
QString QSparqlBinding::name (  )  const

Returns the name of the binding's variable name.

See also:
setName()
bool QSparqlBinding::operator!= ( const QSparqlBinding other  )  const [inline]

Returns true if the binding is unequal to other; otherwise returns false.

QSparqlBinding & QSparqlBinding::operator= ( const QSparqlBinding other  ) 

Sets the binding equal to other.

bool QSparqlBinding::operator== ( const QSparqlBinding other  )  const

Returns true if the binding is equal to other; otherwise returns false.

void QSparqlBinding::setBlankNodeLabel ( const QString &  id  ) 

Sets the label name and RDF type of a blank node, and isBlank() will return true.

See also:
isBlank() toString()
void QSparqlBinding::setDataTypeUri ( const QUrl &  dataType  ) 

Sets the binding's data type URI.

See also:
dataTypeUri()
void QSparqlBinding::setLanguageTag ( const QString &  languageTag  ) 

Sets the binding's languageTag.

See also:
languageTag() setDataTypeUri()
void QSparqlBinding::setName ( const QString &  name  ) 

Sets the name of the binding variable to name.

See also:
name()
void QSparqlBinding::setValue ( const QVariant &  value  ) 

Sets the value of the binding to value..

If the data type of value differs from the binding's current data type, an attempt is made to cast it to the proper type. This preserves the data type of the field in the case of assignment, e.g. a QString to an integer data type.

To set the value to isInvalid(), use clear().

See also:
value() isReadOnly() defaultValue()
void QSparqlBinding::setValue ( const QString &  value,
const QUrl &  dataTypeUri 
)

Sets the binding's value and the URI of its data type

See also:
dataTypeUri() setDataTypeUri()
QString QSparqlBinding::toString (  )  const

Returns a string representation of the node in a form suitable for using in a SPARQL query.

QVariant QSparqlBinding::value (  )  const [inline]

Returns the value of the binding as a QVariant.

Use isValid() to check if the binding's value has been set.

See also:
setValue()

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Enumerations Enumerator