Nepomuk
#include <Nepomuk/Query/Result>
Public Member Functions | |
| Result () | |
| Result (const Nepomuk::Resource &resource, double score=0.0) | |
| Result (const Result &) | |
| ~Result () | |
| Variant | additionalBinding (const QString &name) const |
| Soprano::BindingSet | additionalBindings () const |
| void | addRequestProperty (const Types::Property &property, const Soprano::Node &value) |
| QString | excerpt () const |
| Result & | operator= (const Result &) |
| bool | operator== (const Result &) const |
| Soprano::Node | operator[] (const Types::Property &property) const |
| QHash< Types::Property, Soprano::Node > | requestProperties () const |
| Soprano::Node | requestProperty (const Types::Property &property) const |
| Resource | resource () const |
| double | score () const |
| void | setAdditionalBindings (const Soprano::BindingSet &bindings) |
| void | setExcerpt (const QString &text) |
| void | setScore (double score) |
Detailed Description
A single search result.
A search via QueryServiceClient returns a set of Result object. A result consists of a Nepomuk::Resource and an optional score.
Additional bindings (variable values) as requested via ComparisonTerm::setVariableName() can be retrieved using additionalBinding().
- Since
- 4.4
Constructor & Destructor Documentation
◆ Result() [1/3]
| Nepomuk::Query::Result::Result | ( | ) |
Create an empty result.
◆ Result() [2/3]
| Nepomuk::Query::Result::Result | ( | const Nepomuk::Resource & | resource, |
| double | score = 0.0 ) |
◆ Result() [3/3]
| Nepomuk::Query::Result::Result | ( | const Result & | ) |
Copy constructor.
◆ ~Result()
| Nepomuk::Query::Result::~Result | ( | ) |
Destructor.
Member Function Documentation
◆ additionalBinding()
| Variant Nepomuk::Query::Result::additionalBinding | ( | const QString & | name | ) | const |
Retrieve an additional binding as returned by the query.
Typically these bindings are created via ComparisonTerm::setVariableName(). But they could also stem from custom SPARQL queries. A simple example would be:
Here ?r would be used as the result's resource while ?rating could be accessed via
If for some reason one needs the plain binding values one could use additionalBinding().
- Since
- 4.5
◆ additionalBindings()
| Soprano::BindingSet Nepomuk::Query::Result::additionalBindings | ( | ) | const |
Retrieve the set of additional bindings as set via setAdditionalBindings().
Normally one would use additionalBinding() instead.
- Since
- 4.5
◆ addRequestProperty()
| void Nepomuk::Query::Result::addRequestProperty | ( | const Types::Property & | property, |
| const Soprano::Node & | value ) |
Add the value of a request property.
- See also
- Query::RequestProperty
◆ excerpt()
| QString Nepomuk::Query::Result::excerpt | ( | ) | const |
An excerpt of the matched text with highlighted search words in case the query contained a full text matching.
- Returns
- A rich-text snippet highlighting the search words or and empty string if the query did not contain any full text search terms.
- See also
- LiteralTerm
- Since
- 4.6
◆ operator=()
◆ operator==()
| bool Nepomuk::Query::Result::operator== | ( | const Result & | ) | const |
Comparison operator.
◆ operator[]()
| Soprano::Node Nepomuk::Query::Result::operator[] | ( | const Types::Property & | property | ) | const |
Retrieve value of request property property.
- See also
- requestProperties, addRequestProperty
◆ requestProperties()
| QHash< Types::Property, Soprano::Node > Nepomuk::Query::Result::requestProperties | ( | ) | const |
Retrieve the values of the request properties.
- See also
- Query::RequestProperty
◆ requestProperty()
| Soprano::Node Nepomuk::Query::Result::requestProperty | ( | const Types::Property & | property | ) | const |
Retrieve value of request property property.
◆ resource()
| Resource Nepomuk::Query::Result::resource | ( | ) | const |
The result resource.
◆ score()
| double Nepomuk::Query::Result::score | ( | ) | const |
The score of the result.
By default the value is 0.0 which means no score.
Be aware that scoring needs to be enabled via Query::setFullTextScoringEnabled() in order for this value to be filled.
- See also
- setScore
◆ setAdditionalBindings()
| void Nepomuk::Query::Result::setAdditionalBindings | ( | const Soprano::BindingSet & | bindings | ) |
Set the additional bindings a query returned besides the result itself and the request properties.
Normally there is no need to call this method as the query service does set the bindings.
- Since
- 4.5
◆ setExcerpt()
| void Nepomuk::Query::Result::setExcerpt | ( | const QString & | text | ) |
Set the excerpt from the query.
Normally there is no need to call this method as the query service does set the excerpt.
- Since
- 4.6
◆ setScore()
| void Nepomuk::Query::Result::setScore | ( | double | score | ) |
Set the score of the result.
Normally there is no need to call this method as the query service does set the bindings.
- See also
- score
The documentation for this class was generated from the following file:
Documentation copyright © 1996-2026 The KDE developers.
Generated on by doxygen 1.16.1 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.