Result Class Reference
from PyKDE4.nepomuk import *
Namespace: Nepomuk.Query
Detailed Description
\class Result result.h Nepomuk/Query/Result
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
Methods | |
__init__ (self) | |
__init__ (self, Nepomuk.Resource resource, float score=0.0) | |
__init__ (self, Nepomuk.Query.Result a0) | |
addRequestProperty (self, Nepomuk.Types.Property property, Soprano.Node value) | |
Nepomuk.Variant | additionalBinding (self, QString name) |
Soprano.BindingSet | additionalBindings (self) |
QString | excerpt (self) |
bool | operator == (self, Nepomuk.Query.Result a0) |
Soprano.Node | operator [] (self, Nepomuk.Types.Property property) |
{Nepomuk.Types.Property:Soprano.Node} | requestProperties (self) |
Soprano.Node | requestProperty (self, Nepomuk.Types.Property property) |
Nepomuk.Resource | resource (self) |
float | score (self) |
setAdditionalBindings (self, Soprano.BindingSet bindings) | |
setExcerpt (self, QString text) | |
setScore (self, float score) |
Method Documentation
__init__ | ( | self ) |
Copy constructor.
__init__ | ( | self, | ||
Nepomuk.Resource | resource, | |||
float | score=0.0 | |||
) |
Create a new result.
- Parameters:
-
resource The result resource.
- Parameters:
-
score The optional result score.
__init__ | ( | self, | ||
Nepomuk.Query.Result | a0 | |||
) |
Copy constructor.
addRequestProperty | ( | self, | ||
Nepomuk.Types.Property | property, | |||
Soprano.Node | value | |||
) |
Add the value of a request property.
\sa Query.RequestProperty
Nepomuk.Variant additionalBinding | ( | self, | ||
QString | name | |||
) |
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:
select ?r ?rating where { ?r nao:numericRating ?rating . }
Here ?r would be used as the result's resource while ?rating could be accessed via
additionalBinding( QLatin1String("rating") );
If for some reason one needs the plain binding values one could use additionalBinding().
- Since:
- 4.5
Soprano.BindingSet additionalBindings | ( | self ) |
Retrieve the set of additional bindings as set via setAdditionalBindings(). Normally one would use additionalBinding() instead.
- Since:
- 4.5
QString excerpt | ( | self ) |
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.
\sa LiteralTerm
- Since:
- 4.6
bool operator == | ( | self, | ||
Nepomuk.Query.Result | a0 | |||
) |
Comparison operator
Soprano.Node operator [] | ( | self, | ||
Nepomuk.Types.Property | property | |||
) |
Retrieve value of request property property.
\sa requestProperties, addRequestProperty
{Nepomuk.Types.Property:Soprano.Node} requestProperties | ( | self ) |
Retrieve the values of the request properties.
\sa Query.RequestProperty
Soprano.Node requestProperty | ( | self, | ||
Nepomuk.Types.Property | property | |||
) |
Retrieve value of request property property.
\sa additionalBinding, requestProperties, addRequestProperty
Nepomuk.Resource resource | ( | self ) |
The result resource.
float score | ( | self ) |
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.
\sa setScore
setAdditionalBindings | ( | self, | ||
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 | ( | self, | ||
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 | ( | self, | ||
float | score | |||
) |
Set the score of the result.
Normally there is no need to call this method as the query service does set the bindings.
\sa score