Term Class Reference
from PyKDE4.nepomuk import *
Namespace: Nepomuk.Query
Detailed Description
\class Term term.h Nepomuk/Query/Term
The base class for all term types.
Queries are build from Term instances. A Term can have one of multiple types and subterms. See Term.Type for details on the different Term types.
- Since:
- 4.4
Method Documentation
| __init__ | ( | self ) |
\cond protected_term_members
| __init__ | ( | self, | ||
| Nepomuk.Query.Term | other | |||
| ) |
Copy constructor.
| bool isAndTerm | ( | self ) |
- Returns:
- true if this term is an AndTerm.
| bool isComparisonTerm | ( | self ) |
- Returns:
- true if this term is a ComparisonTerm.
| bool isLiteralTerm | ( | self ) |
- Returns:
- true if this term is a LiteralTerm.
| bool isNegationTerm | ( | self ) |
- Returns:
- true if this term is a NegationTerm.
| bool isOptionalTerm | ( | self ) |
- Returns:
- true if this term is a OptionalTerm.
- Since:
- 4.5
| bool isOrTerm | ( | self ) |
- Returns:
- true if this term is an OrTerm.
| bool isResourceTerm | ( | self ) |
- Returns:
- true if this term is a ResourceTerm.
| bool isResourceTypeTerm | ( | self ) |
- Returns:
- true if this term is a ResourceTypeTerm.
| bool isValid | ( | self ) |
- Returns:
- true if the term is valid. A valid term can be used to construct a Query.
| bool operator != | ( | self, | ||
| Nepomuk.Query.Term | term | |||
| ) |
Comparison operator.
- Returns:
- true if this term differs from term.
- Since:
- 4.6
| bool operator == | ( | self, | ||
| Nepomuk.Query.Term | term | |||
| ) |
Comparison operator.
- Returns:
- true if this term is equal to term.
| Nepomuk.Query.Term optimized | ( | self ) |
Optimizes the term without changing its meaning. This removes redundant terms such as NegationTerm and OptionalTerm nestings and flattens AndTerm and OrTerm hierarchies.
- Returns:
- An optimized version of this term.
- Since:
- 4.6
\sa Query.optimized()
| Nepomuk.Query.AndTerm toAndTerm | ( | self ) |
Convert this term into a AndTerm. If type is not And it will be changed and the result is a new AndTerm.
- Returns:
- A reference to this term as a AndTerm.
| Nepomuk.Query.ComparisonTerm toComparisonTerm | ( | self ) |
Convert this term into a ComparisonTerm. If type is not Comparison it will be changed and the result is a new ComparisonTerm.
- Returns:
- A reference to this term as a ComparisonTerm.
| Nepomuk.Query.LiteralTerm toLiteralTerm | ( | self ) |
Convert this term into a LiteralTerm. If type is not Literal it will be changed and the result is a new LiteralTerm.
- Returns:
- A reference to this term as a LiteralTerm.
| Nepomuk.Query.NegationTerm toNegationTerm | ( | self ) |
Convert this term into a NegationTerm. If type is not Negation it will be changed and the result is a new NegationTerm.
- Returns:
- A reference to this term as a NegationTerm.
| Nepomuk.Query.OptionalTerm toOptionalTerm | ( | self ) |
Convert this term into a OptionalTerm. If type is not Optional it will be changed and the result is a new OptionalTerm.
- Returns:
- A reference to this term as a OptionalTerm.
- Since:
- 4.5
| Nepomuk.Query.OrTerm toOrTerm | ( | self ) |
Convert this term into a OrTerm. If type is not Or it will be changed and the result is a new OrTerm.
- Returns:
- A reference to this term as a OrTerm.
| Nepomuk.Query.ResourceTerm toResourceTerm | ( | self ) |
Convert this term into a ResourceTerm. If type is not Resource it will be changed and the result is a new ResourceTerm.
- Returns:
- A reference to this term as a ResourceTerm.
| Nepomuk.Query.ResourceTypeTerm toResourceTypeTerm | ( | self ) |
Convert this term into a ResourceTypeTerm. If type is not ClassType it will be changed and the result is a new ResourceTypeTerm.
- Returns:
- A reference to this term as a ResourceTypeTerm.
| QString toString | ( | self ) |
Encode the Term in a string. Be aware that this does NOT create a SPARQL query. The returned string can be used to serialize terms that can later be read via fromString().
\sa fromString()
- Since:
- 4.5
| Nepomuk.Query.Term.Type type | ( | self ) |
- Returns:
- the Term type.
Static Method Documentation
| Nepomuk.Query.Term fromProperty | ( | Nepomuk.Types.Property | property, | |
| Nepomuk.Variant | variant | |||
| ) |
Create a term using a Types.Property and a Variant. Sadly this cannot be modelled as an operator since it would clash with Entity.operator==().
- Parameters:
-
property The property to be used in the ComparisonTerm.
- Parameters:
-
variant The value to be compared to. Either ResourceTerm or LiteralTerm is used. List variants (Variant.isList()) are handled via an AndTerm meaning all values need to match.
- Since:
- 4.6
| Nepomuk.Query.Term fromString | ( | QString | s | |
| ) |
Parse a Term that has been encoded as a string via toString().
- Warning:
- This method can NOT parse SPARQL syntax.
\sa toString()
- Since:
- 4.5
| Nepomuk.Query.Term fromVariant | ( | Nepomuk.Variant | variant | |
| ) |
Construct a Term from a Variant value. This is a convenience method that simplifies handling Nepomuk values. However, list variants are not supported and will result in an invalid Term.
- Returns:
- A ResourceTerm in case variant is a resource, a LiteralTerm if variant is a supported literal value, or an invalid Term if \p variant is invalid or a list.
- Since:
- 4.6
Enumeration Documentation
| Type |
The type of a term identifying its meaning.
\sa type()
- Enumerator:
-
Invalid Literal Resource And Or Comparison ResourceType Negation Optional
KDE 4.7 PyKDE API Reference