KDE 4.4 PyKDE API Reference

- KDE's Python API

# ComparisonTerm Class Reference

`from PyKDE4.nepomuk import *`

Inherits: Nepomuk.Query.SimpleTerm → Nepomuk.Query.Term
Namespace: Nepomuk.Query.ComparisonTerm

## Detailed Description

\class ComparisonTerm comparisonterm.h Nepomuk/Query/ComparisonTerm

A term matching the value of a property.

The %ComparisonTerm is the most important term in the query API. It can be used to match the values of properties. As such it consists of a property(), a comparator() and a subTerm().

The latter can be any other term including AndTerm and OrTerm. The matching is done in one of two ways:

- A LiteralTerm as subTerm() is directly matched to the value of a literal
property (see also Nepomuk.Types.Property.literalRangeType()) or to the labels of related resources in case of a property that has a resource range.
- Any other term type will be used as a sort of subquery to match the
related resources. This means that the property() needs to have a resource range.

For more details see the Comparator enumeration.

Author:
  Sebastian Trueg <trueg@kde.org>

Since:
  4.4

## Enumerations
Comparator | { Contains, Regexp, Equal, Greater, Smaller, GreaterOrEqual, SmallerOrEqual }
## Methods
| __init__ (self)
| __init__ (self, Nepomuk.Query.ComparisonTerm term)
| __init__ (self, Nepomuk.Types.Property property, Nepomuk.Query.Term term, Nepomuk.Query.ComparisonTerm.Comparator comparator=Nepomuk.Query.ComparisonTerm.Comparator.Contains)
Nepomuk.Query.ComparisonTerm.Comparator | comparator (self)
Nepomuk.Types.Property | property (self)
| setComparator (self, Nepomuk.Query.ComparisonTerm.Comparator a0)
| setProperty (self, Nepomuk.Types.Property a0)

## Method Documentation

__init__ | ( |  | self ) |

Default constructor: creates an invalid comparison term.

__init__ | ( | self, |
|  | Nepomuk.Query.ComparisonTerm | term
| ) |  |  |

Copy constructor.

__init__ | ( | self, |
|  | Nepomuk.Types.Property | property,
|  | Nepomuk.Query.Term | term,
|  | Nepomuk.Query.ComparisonTerm.Comparator | comparator=Nepomuk.Query.ComparisonTerm.Comparator.Contains
| ) |  |  |

Default constructor.

Parameters:

  | property | The property that should be matched.

Parameters:

  | term | The sub term to match to.

Parameters:

  | comparator | The Comparator to use for comparison. Not all Comparators make sense with all sub term types.

Nepomuk.Query.ComparisonTerm.Comparator comparator | ( |  | self ) |

The Comparator used by ComparisonTerm Terms.

\sa setComparator

Nepomuk.Types.Property property | ( |  | self ) |

A property used for ComparisonTerm Terms.

\sa setProperty

setComparator | ( | self, |
|  | Nepomuk.Query.ComparisonTerm.Comparator | a0
| ) |  |  |

Set the comparator

setProperty | ( | self, |
|  | Nepomuk.Types.Property | a0
| ) |  |  |

Set the property for ComparisonTerm Terms.

\sa property

## Enumeration Documentation

Comparator

%ComparisonTerm supports different ways to compare values.

Enumerator:

  Contains |
  Regexp |
  Equal |
  Greater |
  Smaller |
  GreaterOrEqual |
  SmallerOrEqual |