[Nepomuk] Problem with nepomuksearch

Sebastian Trueg trueg at kde.org
Fri Dec 4 16:18:32 CET 2009

Alessandro Sivieri wrote:
> If I can expand this thread, always about nepomuksearch and the query
> library...
> First question: I have some code like the following:
> Query::ComparisonTerm
> cterm(Types::Property(Soprano::Vocabulary::RDF::type()), Query::ResourceTerm(Nepomuk::Resource(Nepomuk::Vocabulary::NFO::FileDataObject())), Query::ComparisonTerm::Equal);
> Query::ComparisonTerm
> fterm(Types::Property(Soprano::Vocabulary::RDF::type()),
> Query::ResourceTerm(Nepomuk::Resource(Nepomuk::Vocabulary::NFO::Folder())), Query::ComparisonTerm::Equal);

just for readability I would omit the "Types::Property". The compiler
will add that for you. The same is true for "Nepomuk::Resource".

> then I add the first and the negation of the second term to an AndTerm,
> then to a file query with an include folder, and the final result is the
> following:
> select distinct ?r  where { { ?r
> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
> <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject>
> . OPTIONAL { ?v2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
> <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Folder> .  .
> FILTER(?v2=?r) . } . FILTER(!BOUND(?v2)) . } .  ?r
> <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url> ?v1 .
>  FILTER(REGEX(STR(?v1), "^file:///home/alex/nepomuk-kde/misc/")) .  }
> which does not find any file, even if I think it should find some,
> because the ones in the misc/ subdirectory are correctly indexed by
> strigi, and I can find them individually...

Funnily enough the only problem is the duplicate dot. I fixed that and
will commit soon.

> And the second question, about the API itself: shouldn't be reasonable
> to add a NotEqual value to the ComparisonTerm comparators? I know that
> there exists the NegationTerm (which I am using above), but there are
> all the comparators but the NotEqual already in the enum, so I think it
> may make sense to add it, too.

hm. not sure. Then we would have two ways to do not-equal. But then
again we also have two ways to do >=:
  NegationTerm( ComparisonTerm::Smaller )

How about TypeTerm:

        class NEPOMUKQUERY_EXPORT TypeTerm : public Term
            TypeTerm( const Term& term );
            TypeTerm( const Nepomuk::Types::Class& type );
            TypeTerm& operator=( const TypeTerm& term );
            Nepomuk::Types::Class type() const;
            void setType( const Nepomuk::Types::Class& type );
Idea for a better name?


More information about the Nepomuk mailing list