[Nepomuk] Problem with nepomuksearch

Sebastian Trueg trueg at kde.org
Fri Dec 4 07:54:53 CET 2009


Peter Penz wrote:
> On Thursday, 3. December 2009 22:04:11 Sebastian Trueg wrote:
> [...]
>>> I build the comparison term this way:
>>>
>>> Nepomuk::Query::ComparisonTerm term(prop, literal, comp);
>>>
>>> In my testcase the values are:
>>> - prop:
>>> QUrl("http://www.semanticdesktop.org/ontologies/2007/08/15/nao#lastModifi
>>> ed") - literal:
>>> [Literal "2009-01-01"^^<http://www.w3.org/2001/XMLSchema#date>]
>> This is already incorrect as the range is QDateTime. Maybe I could add
>> conversion support to libnepomukquery...
> 
> I've adjusted it to use QDateTime and the result looks like this now:
> 
> [Literal "2008-12-31T23:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>]
> 
> [...]
>>> This looks OK. Afterwards I'm doing something like this:
>>>
>>> Nepomuk::Query::Query query;
>>> query.setTerm(term);
>>> KUrl url = query.toSearchUrl();
>>>
>>> and url will be:
>>> KUrl("nepomuksearch:/?sparql=select distinct ?r  where { ?r
>>> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#lastModified>
>>> "2009-01-01"^^<http://www.w3.org/2001/XMLSchema#date> .    }")
>> This is a bug which I did not look into yet either. But I know of it. :P
> 
> I've manually adjusted the search to:
> nepomuksearch:/?sparql=select distinct ?r  where { ?r 
> <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#lastModified> >= 
> "2008-12-31T23:00:00Z"^^<http://www.w3.org/2001/XMLSchema%23dateTime> . }
> 
> but get no result... Is this query correct?

no, it is not. This is the correct one (using namespace abbreviations):

select distinct ?r where {
  ?r nie:lastModified ?d .
  FILTER(?d >= "2008-12-31T23:00:00Z"^^xsd:dateTime).
}


>>> So it seems that the >= operator has been removed... I tried to add it
>>> manually, but also get no results... Since my update to Virtuoso also
>>> "hand made queries" like:
>>>
>>> nepomuksearch:/tag:TestTag1
>>>
>>> don't give a result, although there is a tagged file with this tag (see
>>> http://enzosworld.gmxhome.de/temp/search1.png and
>>> http://enzosworld.gmxhome.de/temp/search2.png). At least just listing the
>>> tag works: http://enzosworld.gmxhome.de/temp/search3.png
>> That is because "tag" matches way too many properties which results in
>> amazingly long queries. Using "hastag" works though.
> 
> This was a good hint, thanks :-) I've adjusted the Dolphin code now and at 
> least searching for tags works very nice again.
> 
>> I am not sure on how to improve that situation other than maybe only
>> selecting used properties. But the problem with that is negated terms.
>> There you also want unused properties I suppose...
> 
> I've deactivated the "!=" operator for tags for Dolphin at least in KDE SC 
> 4.4.0 (I've left in the string so that I could reactivate it later during KDE 
> SC 4.4.x). So from a Dolphin point of view there is no need to have a solution 
> before KDE SC 4.4.0...
> 
> But for sure it would be nice having negated terms including unused 
> properties... I agree here with Alessandro: having a != enum to the 
> ComparisonTerm operators would be great, but I guess there was a reason why 
> you did not add it there yet ;-)

Yes, there is NegationTerm which I intended to be used like:

NegationTerm::negateTerm( ComparisonTerm( nao:hasTag, ResourceTerm(myTag)));


More information about the Nepomuk mailing list