• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Nepomuk-Core

  • Nepomuk2
  • Query
  • Result
Public Member Functions | List of all members
Nepomuk2::Query::Result Class Reference

#include <Nepomuk2/Query/Result>

Public Member Functions

 Result ()
 
 Result (const Nepomuk2::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 Nepomuk2::Resource and an optional score.

Additional bindings (variable values) as requested via ComparisonTerm::setVariableName() can be retrieved using additionalBinding().

Author
Sebastian Trueg trueg.nosp@m.@kde.nosp@m..org
Since
4.4

Definition at line 57 of file result.h.

Constructor & Destructor Documentation

Nepomuk2::Query::Result::Result ( )

Create an empty result.

Definition at line 43 of file result.cpp.

Nepomuk2::Query::Result::Result ( const Nepomuk2::Resource &  resource,
double  score = 0.0 
)

Create a new result.

Parameters
resourceThe result resource.
scoreThe optional result score.

Definition at line 49 of file result.cpp.

Nepomuk2::Query::Result::Result ( const Result &  other)

Copy constructor.

Definition at line 57 of file result.cpp.

Nepomuk2::Query::Result::~Result ( )

Destructor.

Definition at line 63 of file result.cpp.

Member Function Documentation

Nepomuk2::Variant Nepomuk2::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:

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

Definition at line 135 of file result.cpp.

Soprano::BindingSet Nepomuk2::Query::Result::additionalBindings ( ) const

Retrieve the set of additional bindings as set via setAdditionalBindings().

Normally one would use additionalBinding() instead.

Since
4.5

Definition at line 129 of file result.cpp.

void Nepomuk2::Query::Result::addRequestProperty ( const Types::Property &  property,
const Soprano::Node &  value 
)

Add the value of a request property.

See also
Query::RequestProperty

Definition at line 93 of file result.cpp.

QString Nepomuk2::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

Definition at line 147 of file result.cpp.

Nepomuk2::Query::Result & Nepomuk2::Query::Result::operator= ( const Result &  other)

Assignment operator.

Definition at line 68 of file result.cpp.

bool Nepomuk2::Query::Result::operator== ( const Result &  other) const

Comparison operator.

Definition at line 153 of file result.cpp.

Soprano::Node Nepomuk2::Query::Result::operator[] ( const Types::Property &  property) const

Retrieve value of request property property.

See also
requestProperties, addRequestProperty

Definition at line 99 of file result.cpp.

QHash< Nepomuk2::Types::Property, Soprano::Node > Nepomuk2::Query::Result::requestProperties ( ) const

Retrieve the values of the request properties.

See also
Query::RequestProperty

Definition at line 117 of file result.cpp.

Soprano::Node Nepomuk2::Query::Result::requestProperty ( const Types::Property &  property) const

Retrieve value of request property property.

See also
additionalBinding, requestProperties, addRequestProperty

Definition at line 105 of file result.cpp.

Nepomuk2::Resource Nepomuk2::Query::Result::resource ( ) const

The result resource.

Definition at line 81 of file result.cpp.

double Nepomuk2::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

Definition at line 75 of file result.cpp.

void Nepomuk2::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

Definition at line 123 of file result.cpp.

void Nepomuk2::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

Definition at line 141 of file result.cpp.

void Nepomuk2::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

Definition at line 87 of file result.cpp.


The documentation for this class was generated from the following files:
  • result.h
  • result.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:09 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk-Core

Skip menu "Nepomuk-Core"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal