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

Nepomuk-Core

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk-core
  • libnepomukcore
  • query
comparisonterm.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the Nepomuk KDE project.
3  Copyright (C) 2009-2010 Sebastian Trueg <trueg@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) version 3, or any
9  later version accepted by the membership of KDE e.V. (or its
10  successor approved by the membership of KDE e.V.), which shall
11  act as a proxy defined in Section 6 of version 3 of the license.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #include "comparisonterm.h"
23 #include "comparisonterm_p.h"
24 #include "querybuilderdata_p.h"
25 #include "literalterm.h"
26 #include "literalterm_p.h"
27 #include "resourceterm.h"
28 #include "resource.h"
29 #include "query_p.h"
30 
31 #include <Soprano/LiteralValue>
32 #include <Soprano/Node>
33 #include <Soprano/Vocabulary/RDFS>
34 
35 #include "literal.h"
36 #include "class.h"
37 
38 #include <kdebug.h>
39 
40 
41 namespace {
42 
43  QString varInAggregateFunction( Nepomuk2::Query::ComparisonTerm::AggregateFunction f, const QString& varName )
44  {
45  switch( f ) {
46  case Nepomuk2::Query::ComparisonTerm::Count:
47  return QString::fromLatin1("count(%1)").arg(varName);
48  case Nepomuk2::Query::ComparisonTerm::DistinctCount:
49  return QString::fromLatin1("count(distinct %1)").arg(varName);
50  case Nepomuk2::Query::ComparisonTerm::Max:
51  return QString::fromLatin1("max(%1)").arg(varName);
52  case Nepomuk2::Query::ComparisonTerm::Min:
53  return QString::fromLatin1("min(%1)").arg(varName);
54  case Nepomuk2::Query::ComparisonTerm::Sum:
55  return QString::fromLatin1("sum(%1)").arg(varName);
56  case Nepomuk2::Query::ComparisonTerm::DistinctSum:
57  return QString::fromLatin1("sum(distinct %1)").arg(varName);
58  case Nepomuk2::Query::ComparisonTerm::Average:
59  return QString::fromLatin1("avg(%1)").arg(varName);
60  case Nepomuk2::Query::ComparisonTerm::DistinctAverage:
61  return QString::fromLatin1("avg(distinct %1)").arg(varName);
62  default:
63  return QString();
64  }
65  }
66 }
67 
68 QString Nepomuk2::Query::comparatorToString( Nepomuk2::Query::ComparisonTerm::Comparator c )
69 {
70  switch( c ) {
71  case Nepomuk2::Query::ComparisonTerm::Contains:
72  return QChar( ':' );
73  case Nepomuk2::Query::ComparisonTerm::Equal:
74  return QChar( '=' );
75  case Nepomuk2::Query::ComparisonTerm::Regexp:
76  return QLatin1String( "regex" );
77  case Nepomuk2::Query::ComparisonTerm::Greater:
78  return QChar( '>' );
79  case Nepomuk2::Query::ComparisonTerm::Smaller:
80  return QChar( '<' );
81  case Nepomuk2::Query::ComparisonTerm::GreaterOrEqual:
82  return QLatin1String( ">=" );
83  case Nepomuk2::Query::ComparisonTerm::SmallerOrEqual:
84  return QLatin1String( "<=" );
85  default:
86  return QString();
87  }
88 }
89 
90 
91 Nepomuk2::Query::ComparisonTerm::Comparator Nepomuk2::Query::stringToComparator( const QStringRef& c )
92 {
93  if( c == QChar( '=' ) )
94  return Nepomuk2::Query::ComparisonTerm::Equal;
95  else if( c == QLatin1String( "regex" ) )
96  return Nepomuk2::Query::ComparisonTerm::Regexp;
97  else if( c == QChar( '>' ) )
98  return Nepomuk2::Query::ComparisonTerm::Greater;
99  else if( c == QChar( '<' ) )
100  return Nepomuk2::Query::ComparisonTerm::Smaller;
101  else if( c == QLatin1String( ">=" ) )
102  return Nepomuk2::Query::ComparisonTerm::GreaterOrEqual;
103  else if( c == QLatin1String( "<=" ) )
104  return Nepomuk2::Query::ComparisonTerm::SmallerOrEqual;
105  else
106  return Nepomuk2::Query::ComparisonTerm::Contains;
107 }
108 
109 QString Nepomuk2::Query::ComparisonTermPrivate::toSparqlGraphPattern( const QString& resourceVarName, const TermPrivate* parentTerm, const QString &additionalFilters, QueryBuilderData *qbd ) const
110 {
111  Q_UNUSED(parentTerm);
112 
113  //
114  // 1. property range: literal
115  // 1.1. operator =
116  // use a single pattern like: ?r <prop> "value"
117  // 1.2. operator :
118  // use two patterns: ?r <prop> ?v . ?v bif:contains "'value'"
119  // 1.3. operator <,>,<=,>=
120  // use two patterns: ?r <prop> ?v . FILTER(?v < value)
121  // fail if subterm is not a literal term
122  //
123  // 2. property range is class
124  // 2.1. operator =
125  // 2.1.1. literal subterm
126  // use two patterns like: ?r <prop> ?v . ?v rdfs:label "value"
127  // 2.1.2. resource subterm
128  // use one pattern: ?r <prop> <res>
129  // 2.1.3. subterm type and, or, comparision
130  // use one pattern and the subpattern: ?r <prop> ?v . subpattern(?v)
131  // 2.2. operator :
132  // 2.2.1. literal subterm
133  // use 3 pattern: ?r <prop> ?v . ?v rdfs:label ?l . ?l bif:contains "'value'"
134  // 2.2.2. resource subterm
135  // same as =
136  // 2.2.3. subterm type and, or, comparision
137  // same as =
138  // 2.3. operator <,>,<=,>=
139  // fail!
140  //
141 
142  if ( !m_subTerm.isValid() ) {
143  QString finalPattern;
144  QString prop = propertyToString( qbd );
145  bool firstUse = false;
146  QString ov = getMainVariableName( qbd, &firstUse );
147  if( m_inverted )
148  finalPattern = QString::fromLatin1( "%1 %2 %3 . " )
149  .arg( ov, prop, resourceVarName );
150  else if( firstUse )
151  finalPattern = QString::fromLatin1( "%1 %2 %3 . " )
152  .arg( resourceVarName, prop, ov );
153  else
154  return QString();
155 
156  return finalPattern + additionalFilters;
157  }
158 
159  // when using Regexp comparator with a resource range property we match the resource URI to the regular expression
160  else if ( m_property.literalRangeType().isValid() || m_comparator == ComparisonTerm::Regexp ) {
161  QString finalPattern;
162 
163  if( !m_subTerm.isLiteralTerm() )
164  kDebug() << "Incompatible subterm type:" << m_subTerm.type();
165  if ( m_comparator == ComparisonTerm::Equal ) {
166  finalPattern = QString::fromLatin1( "%1 %2 %3 . " )
167  .arg( resourceVarName,
168  propertyToString( qbd ),
169  Soprano::Node::literalToN3( m_subTerm.toLiteralTerm().value() ) );
170  }
171  else if ( m_comparator == ComparisonTerm::Contains ) {
172  bool firstUse = false;
173  const QString v = getMainVariableName(qbd, &firstUse);
174  finalPattern = LiteralTermPrivate::createContainsPattern( v, m_subTerm.toLiteralTerm().value().toString(), qbd );
175  if(firstUse) {
176  finalPattern.prepend(QString::fromLatin1( "%1 %2 %3 . " )
177  .arg( resourceVarName,
178  propertyToString( qbd ),
179  v ));
180  }
181  }
182  else if ( m_comparator == ComparisonTerm::Regexp ) {
183  bool firstUse = false;
184  const QString v = getMainVariableName(qbd, &firstUse);
185  finalPattern = QString::fromLatin1( "FILTER(REGEX(STR(%1), '%2', 'i')) . " )
186  .arg( v, m_subTerm.toLiteralTerm().value().toString() );
187  if( firstUse ) {
188  finalPattern.prepend(QString::fromLatin1( "%1 %2 %3 . " )
189  .arg( resourceVarName,
190  propertyToString( qbd ),
191  v ));
192  }
193  }
194  else {
195  bool firstUse = false;
196  const QString v = getMainVariableName(qbd, &firstUse);
197  finalPattern = QString::fromLatin1( "FILTER(%1%2%3) . " )
198  .arg( v,
199  comparatorToString( m_comparator ),
200  Soprano::Node::literalToN3(m_subTerm.toLiteralTerm().value()) );
201  if( firstUse ) {
202  finalPattern.prepend( QString::fromLatin1( "%1 %2 %3 . " )
203  .arg( resourceVarName,
204  propertyToString( qbd ),
205  v ) );
206  }
207  }
208 
209  return finalPattern + additionalFilters;
210  }
211 
212  else { // resource range
213  if( !(m_comparator == ComparisonTerm::Equal ||
214  m_comparator == ComparisonTerm::Contains ||
215  m_comparator == ComparisonTerm::Regexp )) {
216  kDebug() << "Incompatible property range:" << m_property.range().uri();
217  }
218 
219  //
220  // The core pattern is always the same: we match to resources that have a certain
221  // property defined. The value of that property is filled in below.
222  //
223  QString corePattern;
224  QString subject;
225  QString object;
226  if( m_inverted && !m_subTerm.isLiteralTerm() ) {
227  subject = QLatin1String("%1"); // funny way to have a resulting string which takes only one arg
228  object = resourceVarName;
229  }
230  else {
231  subject = resourceVarName;
232  object = QLatin1String("%1");
233  }
234  if( qbd->flags() & Query::HandleInverseProperties &&
235  m_property.inverseProperty().isValid() ) {
236  corePattern = QString::fromLatin1("{ %1 %2 %3 . %5} UNION { %3 %4 %1 . %5} . ")
237  .arg( subject,
238  propertyToString( qbd ),
239  object,
240  Soprano::Node::resourceToN3( m_property.inverseProperty().uri() ),
241  additionalFilters );
242  }
243  else {
244  corePattern = QString::fromLatin1("%1 %2 %3 . %4")
245  .arg( subject,
246  propertyToString( qbd ),
247  object,
248  additionalFilters );
249  }
250 
251  if ( m_subTerm.isLiteralTerm() ) {
252  //
253  // the base of the pattern is always the same: match to resources related to X
254  // which has a label that we compare somehow. This label's value will be filled below
255  //
256  bool firstUse = true;
257  QString v1 = getMainVariableName(qbd, &firstUse);
258  QString pattern = QString::fromLatin1( "%1%2 %4 %3 . " )
259  .arg( firstUse ? corePattern.arg(v1) : QString(),
260  v1,
261  QLatin1String("%1"), // funny way to have a resulting string which takes only one arg
262 // FIXME: Change back to rdfs:label when virtuoso inferencing bug is fixed
263 // BUG: 3591024 - https://sourceforge.net/tracker/?func=detail&aid=3591024&group_id=161622&atid=820574
264  qbd->uniqueVarName() ); // Soprano::Node::resourceToN3( Soprano::Vocabulary::RDFS::label() ) );
265 
266  if ( m_comparator == ComparisonTerm::Equal ) {
267  return pattern.arg( Soprano::Node::literalToN3( m_subTerm.toLiteralTerm().value() ) );
268  }
269  else if ( m_comparator == ComparisonTerm::Contains ) {
270  QString v3 = qbd->uniqueVarName();
271  // since this is not a "real" full text search but rather a match on resource "names" we do not call QueryBuilderData::addFullTextSearchTerm
272  return pattern.arg(v3)
273  + LiteralTermPrivate::createContainsPattern( v3,
274  m_subTerm.toLiteralTerm().value().toString(),
275  qbd );
276  }
277  else if ( m_comparator == ComparisonTerm::Regexp ) {
278  QString v3 = qbd->uniqueVarName();
279  return QString::fromLatin1( "%1FILTER(REGEX(STR(%2)), '%3', 'i') . " )
280  .arg( pattern.arg(v3),
281  v3,
282  m_subTerm.toLiteralTerm().value().toString() );
283  }
284  else {
285  kDebug() << QString( "Invalid Term: comparator %1 cannot be used for matching to a resource!" ).arg( comparatorToString( m_comparator ) );
286  return QString();
287  }
288  }
289  else if ( m_subTerm.isResourceTerm() ) {
290  // ?r <prop> <res>
291  return corePattern.arg( Soprano::Node::resourceToN3(m_subTerm.toResourceTerm().resource().uri()) );
292  }
293  else {
294  // ?r <prop> ?v1 . ?v1 ...
295  bool firstUse = true;
296  QString v = getMainVariableName(qbd, &firstUse);
297  qbd->increaseDepth();
298  QString subTermSparql = m_subTerm.d_ptr->toSparqlGraphPattern( v, this, QString(), qbd );
299  qbd->decreaseDepth();
300  if( firstUse )
301  return corePattern.arg(v) + subTermSparql;
302  else
303  return subTermSparql;
304  }
305  }
306 }
307 
308 
309 
310 bool Nepomuk2::Query::ComparisonTermPrivate::equals( const TermPrivate* other ) const
311 {
312  if ( other->m_type == m_type ) {
313  const ComparisonTermPrivate* ctp = static_cast<const ComparisonTermPrivate*>( other );
314  return( ctp->m_property == m_property &&
315  ctp->m_comparator == m_comparator &&
316  ctp->m_subTerm == m_subTerm &&
317  ctp->m_inverted == m_inverted &&
318  ctp->m_sortOrder == m_sortOrder &&
319  ctp->m_sortWeight == m_sortWeight &&
320  ctp->m_variableName == m_variableName );
321  }
322  else {
323  return false;
324  }
325 }
326 
327 
328 bool Nepomuk2::Query::ComparisonTermPrivate::isValid() const
329 {
330  // an invalid property will simply match all properties
331  // and an invalid subterm is a wildcard, too
332  // Thus, a ComparisonTerm is always valid
333  return true;
334 }
335 
336 
337 //
338 // Determines the main variable name, i.e. the variable representing the compared value, i.e. the one
339 // that can be set vie setVariableName.
340 //
341 // Thus, the basic scheme is: if a variable name has been set via setVariableName, return that name,
342 // otherwise create a random new one.
343 //
344 // But this method also handles AggregateFunction and sorting. The latter is a bit hacky.
345 //
346 // There a quite a few cases that are handled:
347 //
348 // 1. No variable name set
349 // 1.1 no aggregate function set
350 // 1.1.1 no sorting weight set
351 // -> return a new random variable
352 // 1.1.2 sorting weight set
353 // -> determine a new random variable, use it as sorting var (via QueryBuilderData::addOrderVariable),
354 // and return it
355 // 1.2 an aggregate function has been set
356 // 1.2.1 sorting weight set (no sorting weight is useless and behaves exactly as if no aggregate function was set)
357 // -> embed a new random variable in the aggregate expression, add that as sort variable, and
358 // return the new variable
359 // 2. A variable name has been set
360 // 2.1 no aggregate function set
361 // 2.1.1 no sorting weight set
362 // -> add the variable name as custom variable via QueryBuilderData::addCustomVariable and return the variable name
363 // 2.1.2 sorting weight set
364 // -> add the variable name as sort car via QueryBuilderData::addOrderVariable and return it
365 // 2.2 an aggregate function has been set
366 // 2.2.1 no sorting weight set
367 // -> Create a new random variable, embed it in the aggregate expression with the set variable name,
368 // use that expression as custom variable (this is the hacky part), and return the random one
369 // 2.2.2 sorting weight set
370 // -> Do the same as above only also add the set variable name as sort variable via QueryBuilderData::addOrderVariable
371 //
372 QString Nepomuk2::Query::ComparisonTermPrivate::getMainVariableName( QueryBuilderData* qbd, bool* firstUse ) const
373 {
374  QString v;
375  QString sortVar;
376  if( !m_variableName.isEmpty() ) {
377  qbd->registerVarName( m_property, QLatin1String("?") + m_variableName );
378  *firstUse = true;
379 
380  sortVar = QLatin1String("?") + m_variableName;
381  if( m_aggregateFunction == ComparisonTerm::NoAggregateFunction ) {
382  v = sortVar;
383  qbd->addCustomVariable( v );
384  }
385  else {
386  // this is a bit hacky as far as the method naming in QueryBuilderData is concerned.
387  // we add a select statement as a variable name.
388  v = qbd->uniqueVarName();
389  QString selectVar = QString::fromLatin1( "%1 as ?%2")
390  .arg(varInAggregateFunction(m_aggregateFunction, v),
391  m_variableName );
392  qbd->addCustomVariable( selectVar );
393  }
394  }
395  else {
396  //
397  // for inverted terms we do not perform variable sharing as described in QueryBuilderData::uniqueVarName
398  // since we would have to check inverse properties and their cardinality and the former is rarely defined.
399  //
400  v = qbd->uniqueVarName( m_inverted ? Types::Property() : m_property, firstUse );
401  if( m_aggregateFunction == ComparisonTerm::NoAggregateFunction )
402  sortVar = v;
403  else
404  sortVar = varInAggregateFunction(m_aggregateFunction, v);
405  }
406  if( m_sortWeight != 0 ) {
407  qbd->addOrderVariable( sortVar, m_sortWeight, m_sortOrder );
408 
409  // trueg: there seems to be a bug in Virtuoso which gives wrong search order if the sort variable is not in the select list.
410  if( m_aggregateFunction == ComparisonTerm::NoAggregateFunction )
411  qbd->addCustomVariable( sortVar );
412  }
413  return v;
414 }
415 
416 
417 QString Nepomuk2::Query::ComparisonTermPrivate::propertyToString( QueryBuilderData* qbd ) const
418 {
419  if( m_property.isValid() )
420  return Soprano::Node::resourceToN3( m_property.uri() );
421  else
422  return qbd->uniqueVarName();
423 }
424 
425 
426 Nepomuk2::Query::ComparisonTerm::ComparisonTerm()
427  : SimpleTerm( new ComparisonTermPrivate() )
428 {
429 }
430 
431 
432 Nepomuk2::Query::ComparisonTerm::ComparisonTerm( const ComparisonTerm& term )
433  : SimpleTerm( term )
434 {
435 }
436 
437 
438 Nepomuk2::Query::ComparisonTerm::ComparisonTerm( const Types::Property& property, const Term& term, Comparator comparator )
439  : SimpleTerm( new ComparisonTermPrivate() )
440 {
441  N_D( ComparisonTerm );
442  d->m_property = property;
443  d->m_subTerm = term;
444  d->m_comparator = comparator;
445 }
446 
447 
448 Nepomuk2::Query::ComparisonTerm::~ComparisonTerm()
449 {
450 }
451 
452 
453 Nepomuk2::Query::ComparisonTerm& Nepomuk2::Query::ComparisonTerm::operator=( const ComparisonTerm& term )
454 {
455  d_ptr = term.d_ptr;
456  return *this;
457 }
458 
459 
460 Nepomuk2::Query::ComparisonTerm::Comparator Nepomuk2::Query::ComparisonTerm::comparator() const
461 {
462  N_D_CONST( ComparisonTerm );
463  return d->m_comparator;
464 }
465 
466 
467 Nepomuk2::Types::Property Nepomuk2::Query::ComparisonTerm::property() const
468 {
469  N_D_CONST( ComparisonTerm );
470  return d->m_property;
471 }
472 
473 
474 void Nepomuk2::Query::ComparisonTerm::setComparator( Comparator comparator )
475 {
476  N_D( ComparisonTerm );
477  d->m_comparator = comparator;
478 }
479 
480 
481 void Nepomuk2::Query::ComparisonTerm::setProperty( const Types::Property& property )
482 {
483  N_D( ComparisonTerm );
484  d->m_property = property;
485 }
486 
487 
488 void Nepomuk2::Query::ComparisonTerm::setVariableName( const QString& name )
489 {
490  N_D( ComparisonTerm );
491  d->m_variableName = name;
492 }
493 
494 
495 QString Nepomuk2::Query::ComparisonTerm::variableName() const
496 {
497  N_D_CONST( ComparisonTerm );
498  return d->m_variableName;
499 }
500 
501 
502 void Nepomuk2::Query::ComparisonTerm::setAggregateFunction( AggregateFunction function )
503 {
504  N_D( ComparisonTerm );
505  d->m_aggregateFunction = function;
506 }
507 
508 
509 Nepomuk2::Query::ComparisonTerm::AggregateFunction Nepomuk2::Query::ComparisonTerm::aggregateFunction() const
510 {
511  N_D_CONST( ComparisonTerm );
512  return d->m_aggregateFunction;
513 }
514 
515 
516 void Nepomuk2::Query::ComparisonTerm::setSortWeight( int weight, Qt::SortOrder sortOrder )
517 {
518  N_D( ComparisonTerm );
519  d->m_sortWeight = weight;
520  d->m_sortOrder = sortOrder;
521 }
522 
523 
524 int Nepomuk2::Query::ComparisonTerm::sortWeight() const
525 {
526  N_D_CONST( ComparisonTerm );
527  return d->m_sortWeight;
528 }
529 
530 
531 Qt::SortOrder Nepomuk2::Query::ComparisonTerm::sortOrder() const
532 {
533  N_D_CONST( ComparisonTerm );
534  return d->m_sortOrder;
535 }
536 
537 
538 bool Nepomuk2::Query::ComparisonTerm::isInverted() const
539 {
540  N_D_CONST( ComparisonTerm );
541  return d->m_inverted;
542 }
543 
544 
545 void Nepomuk2::Query::ComparisonTerm::setInverted( bool invert )
546 {
547  N_D( ComparisonTerm );
548  d->m_inverted = invert;
549 }
550 
551 
552 Nepomuk2::Query::ComparisonTerm Nepomuk2::Query::ComparisonTerm::inverted() const
553 {
554  ComparisonTerm ct( *this );
555  ct.setInverted( !isInverted() );
556  return ct;
557 }
Nepomuk2::Query::ComparisonTerm::setComparator
void setComparator(Comparator)
Set the comparator.
Definition: comparisonterm.cpp:474
Nepomuk2::Query::ComparisonTerm::Smaller
A LiteralTerm sub-term is matched to smaller literal values.
Definition: comparisonterm.h:104
class.h
Nepomuk2::Query::ComparisonTerm::setProperty
void setProperty(const Types::Property &)
Set the property for ComparisonTerm Terms.
Definition: comparisonterm.cpp:481
Nepomuk2::Query::ComparisonTerm::Average
Return the average value of all results instead of the results themselves.
Definition: comparisonterm.h:177
resourceterm.h
Nepomuk2::Query::ComparisonTerm::setAggregateFunction
void setAggregateFunction(AggregateFunction function)
Set an aggregate function which changes the result.
Definition: comparisonterm.cpp:502
Nepomuk2::Query::ComparisonTerm::Greater
A LiteralTerm sub-term is matched to greater literal values.
Definition: comparisonterm.h:99
Nepomuk2::Query::Term
The base class for all term types.
Definition: term.h:64
Nepomuk2::Query::ComparisonTerm::variableName
QString variableName() const
The variable name set in setVariableName() or an empty string if none has been set.
Definition: comparisonterm.cpp:495
Nepomuk2::Query::ComparisonTerm::GreaterOrEqual
A LiteralTerm sub-term is matched to greater or equal literal values.
Definition: comparisonterm.h:109
Nepomuk2::Query::ComparisonTerm::inverted
ComparisonTerm inverted() const
Create an inverted copy of this ComparisonTerm.
Definition: comparisonterm.cpp:552
Nepomuk2::Query::ComparisonTerm::~ComparisonTerm
~ComparisonTerm()
Destructor.
Definition: comparisonterm.cpp:448
Nepomuk2::Query::ComparisonTerm::setSortWeight
void setSortWeight(int weight, Qt::SortOrder sortOrder=Qt::AscendingOrder)
Set the sort weight of this property.
Definition: comparisonterm.cpp:516
Nepomuk2::Query::ComparisonTerm::AggregateFunction
AggregateFunction
Aggregate functions which can be applied to a comparison term to influence the value they return...
Definition: comparisonterm.h:125
Nepomuk2::Query::ComparisonTerm::Equal
A sub-term is matched one-to-one.
Definition: comparisonterm.h:94
Nepomuk2::Query::ComparisonTerm::aggregateFunction
AggregateFunction aggregateFunction() const
The aggregate function to be used with the additional binding set in setVariableName().
Definition: comparisonterm.cpp:509
Nepomuk2::Query::ComparisonTerm::ComparisonTerm
ComparisonTerm()
Default constructor: creates a comparison term that matches all properties.
Definition: comparisonterm.cpp:426
Nepomuk2::Query::ComparisonTerm::Regexp
A LiteralTerm sub-term is matched against a string literal value using the literal term's value as a ...
Definition: comparisonterm.h:89
Nepomuk2::Query::ComparisonTerm::Max
Return the maximum value of all results instead of the results themselves.
Definition: comparisonterm.h:150
Nepomuk2::Query::ComparisonTerm::DistinctAverage
The same as Average except that no two similar results are counted twice.
Definition: comparisonterm.h:183
Nepomuk2::Query::ComparisonTerm::SmallerOrEqual
A LiteralTerm sub-term is matched to smaller or equal literal values.
Definition: comparisonterm.h:114
Nepomuk2::Query::ComparisonTerm
A term matching the value of a property.
Definition: comparisonterm.h:70
resource.h
Nepomuk2::Query::ComparisonTerm::Comparator
Comparator
ComparisonTerm supports different ways to compare values.
Definition: comparisonterm.h:76
Nepomuk2::Types::Property
A property is a resource of type rdf:Property which relates a domain with a range.
Definition: libnepomukcore/types/property.h:52
Nepomuk2::Query::ComparisonTerm::DistinctCount
The same as Count except that no two similar results are counted twice.
Definition: comparisonterm.h:143
Nepomuk2::Query::SimpleTerm
Abstract base class for NegationTerm and ComparisonTerm which maintains one sub-term.
Definition: simpleterm.h:41
Nepomuk2::Query::ComparisonTerm::Min
Return the minimum value of all results instead of the results themselves.
Definition: comparisonterm.h:157
Nepomuk2::Query::ComparisonTerm::sortOrder
Qt::SortOrder sortOrder() const
Definition: comparisonterm.cpp:531
Nepomuk2::Query::ComparisonTerm::comparator
Comparator comparator() const
The Comparator used by ComparisonTerm Terms.
Definition: comparisonterm.cpp:460
comparisonterm.h
literalterm.h
Nepomuk2::Query::ComparisonTerm::Sum
Return the sum of all result values instead of the results themselves.
Definition: comparisonterm.h:164
Nepomuk2::Query::ComparisonTerm::sortWeight
int sortWeight() const
Definition: comparisonterm.cpp:524
Nepomuk2::Query::ComparisonTerm::Contains
A LiteralTerm sub-term is matched against string literal values.
Definition: comparisonterm.h:81
Nepomuk2::Query::ComparisonTerm::setVariableName
void setVariableName(const QString &name)
Set the variable name that is to be used for the variable to match to.
Definition: comparisonterm.cpp:488
literal.h
Nepomuk2::Query::ComparisonTerm::DistinctSum
The same as Sum except that no two similar results are added twice.
Definition: comparisonterm.h:170
Nepomuk2::Query::ComparisonTerm::isInverted
bool isInverted() const
Definition: comparisonterm.cpp:538
Nepomuk2::Query::ComparisonTerm::operator=
ComparisonTerm & operator=(const ComparisonTerm &term)
Assignment operator.
Definition: comparisonterm.cpp:453
Nepomuk2::Query::ComparisonTerm::property
Types::Property property() const
A property used for ComparisonTerm Terms.
Definition: comparisonterm.cpp:467
Nepomuk2::Query::ComparisonTerm::Count
Count the number of matching results instead of returning the results themselves. ...
Definition: comparisonterm.h:137
Nepomuk2::Query::ComparisonTerm::setInverted
void setInverted(bool invert)
Invert the comparison, i.e.
Definition: comparisonterm.cpp:545
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:08 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