LiteralTerm Class Reference
from PyKDE4.nepomuk import *
Inherits: Nepomuk.Query.Term
Namespace: Nepomuk.Query
Detailed Description
\class LiteralTerm literalterm.h Nepomuk/Query/LiteralTerm
Match literal properties via full text.
Other than the rest of the terms LiteralTerm has two uses:
Usage in ComparisonTerm
%LiteralTerm can be used in a ComparisonTerm with both properties with a literal range and a resource range. The former case is the simple one: the value() of the %LiteralTerm will simply be compared to the value of the ComparisonTerm.property(). In the latter case value() will be matched to rdfs:label of any resource. So in essence the following two examples are equal:
ComparisonTerm( Vocabulary.NAO.hasTag(), LiteralTerm("nepomuk") ); ComparisonTerm( Vocabulary.NAO.hasTag(), ComparisonTerm( Vocabulary.RDFS.label(), LiteralTerm("nepomuk") ) );
Usage as "stand-alone" term
As a term by itself %LiteralTerm will act like a traditional full text query and match all resources that contain the string value in some property.
LiteralTerm( "nepomuk" );
The example above will match all resources that have a property with a value containing the string "nepomuk".
Examples
<pre>LiteralTerm("nepomuk")</pre> searches for the term "nepomuk".
<pre>LiteralTerm("'nepomuk*'")</pre> searches for the terms starting with "nepomuk".
<pre>LiteralTerm("'nepomuk kde'")</pre> searches for the term "nepomuk kde".
<pre>LiteralTerm("'nepomuk* kde'")</pre> searches for terms matching "nepomuk* kde".
%LiteralTerm always tries to normalize the query terms as best as possible. This includes automatically adding quotes as needed.
- Warning:
- Be aware that the examples above apply to using %LiteralTerm as a stand-alone term or in a ComparisonTerm.Contains term. When using ComparisonTerm.Regexp the test as specified will be used as-is to create the regular expression.
- Since:
- 4.4
Methods | |
__init__ (self, Nepomuk.Query.LiteralTerm term) | |
__init__ (self, Soprano.LiteralValue value=Soprano.LiteralValue()) | |
setValue (self, Soprano.LiteralValue value) | |
Soprano.LiteralValue | value (self) |
Method Documentation
__init__ | ( | self, | ||
Nepomuk.Query.LiteralTerm | term | |||
) |
Copy constructor.
__init__ | ( | self, | ||
Soprano.LiteralValue | value=Soprano.LiteralValue() | |||
) |
Default constructor
- Parameters:
-
value The value this %LiteralTerm should match to.
setValue | ( | self, | ||
Soprano.LiteralValue | value | |||
) |
Set the value this %LiteralTerm should match to.
\sa value()
Soprano.LiteralValue value | ( | self ) |
The value this %LiteralTerm should match to.
\sa setValue()